Saturday, July 24, 2010

Finally the new laptop arrives

I just did the first boot on my new laptop this morning, and I'm checking out the corporate supplied hardware/software. The hardware was everything I expected but it has two hard drives installed and the optical drive in an external bay.

The drives are a 320G 7200 rpm with W7 Enterprise 64 bit, and the 500G 7200 rpm is completely empty. It's like they knew what I wanted to do with it :)  I'll pull the 320 completely out and put it in a USB enclosure so I can boot it if I'm completely forced to (and I can put it back in when I ship it back in two years.) I'll move the 500 from the side bay to the internal slot, then move the optical drive to the side bay. 

As long as it's booted I'm taking down display driver info, wireless chip details, display settings, etc. Once I get Debian running I'll need to work through any of these loose ends. Speaking of Debian, I'd hoped by the time I got this PC 6.0 would have been released, but it's not quite there yet... If you remember way back to this post I talked briefly about the Debian release cycle. I've been running "stable" "Lenny" or "5.x" since I started this blog. If 6.0 had been released I could just repeat the installation instructions from before and my default install of "stable" would have been the new version. This is an easy way to get accustomed to Debian.

Since I want to go into "testing" "Squeeze" or "6.0" I'll need to know this link http://www.debian.org/releases/testing/ and use it to find open bugs, pre-release versions of the OS, etc. Who knows maybe I'll even get to find a bug and contribute something to the process. Last thing I need to know before I download my new installation media is that my architecture has changed. Since I want to make full use of my new hardware I need to fetch amd64 instead of i386. This is confusing to some since my CPU is actually made by Intel, but this should clear that up: Debian says Intel EM46T is a supported hardware for the architecture called amd64. Then Intel provides all info of what they classify as EM64T on their webiste

Long story short, I'm going to the download page and finding amd64 businesscard CD under the "daily built images" section and getting a fresh version of Debian to try out!

Tuesday, June 29, 2010

New laptop coming

So with everything running so smooth the last few months I haven't had anything to post, but now my little technology snow globe is getting shaken up!

My trusty Lenovo T60p is due to be retired and I've got a T510 on the way. Now I need to look at what I'm doing and figure out how to best configure my new box to meet my upcoming needs.

I know it has 8Gb of ram and an i5-M540 CPU so I'll need to go 64 bit to make use of it. Also I have some virtual appliances I need to run in VMware Workstation and not my beloved vbox. 

I think it's time to try out Squeeze 64 bit and see how that goes. Needless to say I'll have something new to post about shortly!

Sunday, May 2, 2010

xscreensaver, claws-mail, iceweasel, and backups

It's been nearly a month since I've converted back to full time debian and it's been going very well. Ubuntu has released 10.04 and they seem very happy about it, it's exactly what I feared it would be and I'm very glad to be back in control of my own OS. Over the last month I've made three significant changes I'll quickly go over now.

Locking the desktop

Where I work it's required that the desktop is locked or the PC is logged out anytime you aren't in your office. After the first couple hours of closing all programs and logging out of my machine I got pretty tired of reopening all my apps over and over. I searched the internet and easily found exactly what I was looking for.

I did a "aptitude install xscreensaver"and added this to my menu

[exec] (Lock Screen) {xscreensaver-command -lock}

And I found myself back in compliance again.

Email Client

OK I'd planned to use Opera and webmail to get by, but I played with Claws Mail again and got suckered in. I've put my main email account on it and setup my address book.  Normal drill "aptitude install claws-mail" and an add to my menu:

 [exec] (Claws Mail) {/usr/bin/claws-mail} <>

I've got one last thing to figure out regarding masking all addresses when sending to groups, but that will give me something to work on later today.

Another browser

I really love Opera, but I have a few websites that fail on it including my bank. The best choice for me was to just load iceweasel and open it only when I need to. It's another one already in the repos "aptitude install iceweasel" and a menu item:

 [exec] (Iceweasel) {/usr/bin/iceweasel} <> 

If anyone hasn't heard the history of iceweasel/firefox you can start your search for info on the wiki.

Backups!

Since this is just like any other production PC, I booted clean, logged in as root, mounted an external USB drive, and did a copy of my entire /home to that drive in a dated folder. Whatever OS you run, do your backups!

That pretty much wraps up the last month, everything is smooth sailing so I guess it's time to load up squeeze in a vbox and start evaluating that upgrade option.

Tuesday, April 6, 2010

Loose ends

I had a few gotchas after my conversion, here is what I found and my on-the-fly work arounds.

Audacity

I do some sound editing and I forgot to load audacity, in the repos and an easy fix:

# aptitude install audacity

and for the menu:

 [exec] (Audacity) {/usr/bin/audacity} <> 

Bookmarks

I was using Firefox 3 in Ubuntu as my primary browser, but when I tried to import the bookmarks into Opera it failed. Turns out as of FF3 they handle the bookmarks differently and back them up as json files. I ended up having to put my old HD in an external USB case and boot it so I could do a manual backup of the bookmarks. Once I had the html version they imported correctly.

Passwords

My old password manager was PWManager and I could not import my password database into keepassx. While I was booted via USB back to Ubuntu I did a unencrypted .csv export of my entire database. I'm going to use this opportunity to go out and change every password I had on file to a unique/complex password or delete old unused accounts.

I had a little tweaking to do on my W7 vbox to reconnect shared folders to my home directory, but it was an otherwise very smooth conversion.

Sunday, April 4, 2010

Virtualbox part 2

OK, I'm almost done with my checklist for the weekend, but I've got a few more biggies to go.

Virtualbox
You know I love testing out distro's in vbox, now I've gotta get it install on Lenny. A little trip out to virtualbox.org gives me a link for my sources.list
deb http://download.virtualbox.org/virtualbox/debian lenny non-free

And a simple "aptitude install virtualbox-3.1" gets the job done.

Toss a item on the fluxbox menu like this:
[exec] (Virtualbox) {/usr/bin/VirtualBox} <>

Launch that and agree to the EULA and vbox is done!

Alsa, aterm, and easy shutdown

Alsa + vlc
First thing lets fire up some sound, to do that we could use a nice guide on the subject;
http://newbiedoc.berlios.de/wiki/Sound_in_Debian_GNU/Linux
Since I know I'll need some of alsa-utils to do what I need, I'm just gonna get that and let it resolve it's own dependency on alsa-base.
# aptitude install alsa-utils

We haven't talked about dependencies much, notice aptitude says "The following NEW packages will be installed: alsa-base alsa-utils linux-sound-base" So if we know what we want we can let Debian figure out what we need to get there.

Once the packages were installed I ran "alsaconf" and followed the defaults as they all made sense to my hardware. I'm impatient so next I ran "speaker-test" and modified my volume control on my keyboard. Once that is sounding right I Ctrl+Z to end that and open up "alsa-mixer" to look at the volumes it set and to make sure things are muted that I want to playback.

Now to really test out my sound system I need to play something back, but I don't have codecs or a player for anything common so I'm gonna grab a nice lightweight player for audio and video:
# aptitude install vlc
And toss it on my menu
[exec] (Vlc) {/usr/bin/vlc} <>

When I toss a CD in my drive and open VLC I just File -> Open Disc, choose Audio CD and there comes the sound through my speakers! Audio setup and media player, check. On to the next thing.

Aterm
Next I want to setup a good looking console. I like aterm and I typically setup a bunch of stuff in my .Xdefaults file for it's behavior, but this time around I'm just going to put a few switches in my ~/.fluxbox/menu to do it quick and easy. Here is my modified line to make it transparent, put the scrollbar on the right, and increase the scroll lines way past the default 64:
[exec] (Aterm) {aterm -tr -sr -sl 2000} <>

Maybe I'll circle back on the .Xdefaults, but this will give you a taste of what you can do with it and enough info to search the internet for other tutorials and examples.

Shutdown
I don't mind doing an exit from fluxbox, then su to root, then a shutdown -h now, but if I can just toss a line in my fluxbox menu to take care of it I'm gonna do that. I know what I'm gonna do so I'll go ahead and take care of the menu, I'm also going to add a seperator for my own brain and comment that "Exit" is now just going to leave fluxbox:
[separator]
[exit] (Exit Fluxbox)
[exec] (Shutdown) {sudo /sbin/shutdown -h now} <>
[end]

Now I just need to make that work, sudo will be our friend.
# aptitude install sudo

Now we need to edit our sudoers file, but we shouldn't use geany, su and do this:
# visudo

Once sudoers is open I'll make it look like so:
# Cmnd alias specification
Cmnd_Alias SHUTDOWN = /sbin/shutdown

# User privilege specification
root ALL=(ALL) ALL
thom ALL = SHUTDOWN
thom ALL = NOPASSWD: SHUTDOWN

All other sections of the file are unchanged INCLUDING the bottom line. Don't open up all of sudo to no password! Don't mess with anything else. Ctrl+X to leave, choose Y to save, then let it use the .tmp. If there are any errors hit "e" to find and correct.

Now I'm doing a last reboot of my entire box, bring it up clean, login as my normal user, then click Shutdown on my new menu item, and down my system goes. Nice and clean. 

And the finished product:




Saturday, April 3, 2010

Networking with wicd

OK I'm done with Ubuntu and now I need to fixup my laptop for wired/wireless on Debian so I can go to work on Monday. Debian is pretty forgiving if you are just going to plug in a wire or use the same wireless SSID you used during your netinstall, but if you need more than that you'll need a network manager to make it quick and easy.

"Network Manager" is actually a very popular network manager, but you know I like lightweight options. I'm gonna try wicd again (wireless interface connection daemon) even though I've had a few buggy issues come up with it in the past. Worst case we can wipe it and put in Network Manager in it's place later.

Since I'm running Lenny, wicd isn't in my repos it's actually in backports. A little Google takes me to this page.  So a quick scrape of the page and a find/replace on my stuff yields this:
1) update repos with backports:
# geany /etc/apt/souces.list
2) Add this line to it:
deb http://www.backports.org/debian lenny-backports main contrib non-free
3) update
# aptitude update
4) this will throw an error, but since I'm gonna remove it from my repo list as soon as I get wicd I'm going to continue without installing their key.
5) get wicd
# aptitude -t lenny-backports install wicd
(added my user to the netdev group during install when prompted)
6) add wicd to my fluxbox menu
[exec] (Wicd) {/usr/bin/wicd-client -n} <>

That does it, now I've got a network manager. On to the next task.

Full time Debian

I've mentioned before that Ubuntu is my full time desktop OS, I've been running it since 5.10 came out of beta. There have been some great releases, and there has been some frustrating ones too. I've been running the beta of 10.04 for a little while now and I really don't like it.

Given the state of things in the Ubuntu camp I've decided to move forward with Debian as my new desktop OS.  I've converted my T60p to Lenny, using nothing so far but the instructions from my first blog posts.

My previous blog posts left out some pretty big things; network manager, sound, codecs, and virtualization are the biggies I can see right off the top. Expect a flurry of small posts to fill the gaps coming soon. Since this laptop earns my paycheck I've gotta get these things sorted out fast!

Sunday, March 14, 2010

KeePassX

The next few posts I'd planned to do are best suited for a hardware install, but my old lappy is off running windows server for a few weeks on a work project. We'll just skip those for now and focus on another gap in functionality we currently have, a password manager.

I'm a firm believer in:
making every username unique
making every password unique and complex
never storing an electronic copy of either unencrypted

So if you have several dozen or a few hundred usernames to keep track of, and lots of crazy passwords keeping an electronic copy is a double edged sword, but for me it's unavoidable. My password manager can generate custom passwords and open encrypted password files. I've run PwManager on linux for years, and keepass on windows, but now in Lenny we have keepassx in the repo! Let's grab it:
debian:/home/thom# aptitude install keepassx

Then add it to your fluxbox menu via geany:
[exec] (KeePassX) {/usr/bin/keepassx} <>

Then we can go ahead and launch it from the menu. (and begin the screenshot slideshow...)

K there is nothing there, we need to create a new password database.

First thing we get asked for a Master Key, whatever you type in here will be the only way into the password file. You'll need to enter it again to confirm it.

OK now we have created a database with a master key, but there is nothing in it. Next I right click in the Groups section and add a new group.

I will create a group for all the logins to different websites, you can break these groups down anyway you like.

I will do one for routers and servers, one for email and im accounts, and one for use inside of web browsers. Next I will highlight a group I want to put an entry in and click the little Add Entry icon my mouse is hovering on here.

Go ahead and fill in all the info you want to store in the database. If I type in a password I can click the eye to see what I typed, or if I want to generate a password I can click Gen.

I love using password generators, they let me pick my mix of characters and I can customize what I generate for any given site by it's minimum password requirements. I will pick my options and click Generate.

Whenever I generate a password I review it and usually change out a few characters before clicking OK. I remove any character that looks too much like another (capital I's and lower case L's can be difficult depending on font) and any special character that isn't easily recognizable.

Now we have our first entry, we must save the update to our database. Do Not make important accounts with impossible passwords then forget to save them!

You can name it something tricky too.

Once it's saved, close out of the program and launch it again. Now all you need to do is enter the master key once and you can see all your other passwords.

Notice we've got our entry and when we open the program it doesn't show us the password. If someone is sitting behind us they can't see the master key or the passwords in the file.

Now lets do something fun. This is the most exciting part for me in being able to switch to keepassx. Let's copy the password database to a windows box. We can install Keepass for windows and it will recognize the file type.

When we double click it we can enter the same master key we used when we first created the database in

Here we can see our entry. Pretty cool huh? Cross platform password manager.

But wait, go to Portable Apps website and you can install Portable Apps and Keepass on a USB thumb drive, then save your password files on the drive and put it in your pocket. This is really helpful when you're a linux guy and you have to work at the console of a bunch of Windows servers with lots of passwords but a no-install policy.

I hope seeing how easy these steps are will encourage anyone using poor security practices to step up their password strength and storage practices.

Monday, March 1, 2010

Conky

I like knowing how much CPU and RAM I have in use as well as some other runtime system info, and I use conky to put that seemlessly into my desktop. First thing we'll need to do is get it:
debian:/home/thom# aptitude install conky

Then we can open up a console and launch it from the command line to see what defaults we have. Let's see what we have here; seperate window, bunch of stuff I don't care about, missing some stuff I want to know... It's something but not what I want. Since this build is all about getting everything exactly the way you want it, lets create a custom configuration file so we can tweak the settings. I just need to create a .conkyrc file in my home directory and paste in something like this:
# my .conkyrc file
own_window yes
own_window_hints undecorated,below,skip_taskbar
background no
double_buffer yes
use_spacer yes
use_xft yes
update_interval 5.0
minimum_size 400 5
draw_shades yes
draw_outline no # amplifies text if yes
draw_borders no
uppercase no # set to yes if you want all text to be in uppercase
stippled_borders 8
border_margin 4
border_width 1
default_color white
default_shade_color black
default_outline_color white
own_window_colour brown
own_window_transparent yes
alignment top_right
gap_x 10
gap_y 30
override_utf8_locale no
xftfont Terminus:size=8
xftalpha 0.8
TEXT
${offset 300}${color }CPU ${color } $cpu%
${offset 300}${color light grey}${cpugraph 13,100}
${offset 300}${color }RAM ${color } $memperc%
${offset 300}${color light grey}${memgraph mem 13,100}
--- EOF

*Important, anything below TEXT will display, even comments starting with a #. Move all your comments or currently unused lines ABOVE the TEXT line! From here on out I'll just be showing from TEXT down, everything above is unchanged but present. The --- EOF is the first line that doesn't exist in my .conkyrc. Let's go ahead and open a console and launch conky again.

OK when we realize that it's not what we want, we'll need to Ctrl+z in our console to kill conky when it's running in the desktop instead of a window, then type exit a few times to close out the terminal. What I currently see in my screen is my stats overlapping on my screen and the bottom bar is cutoff. Next I'll try a little spacing to the file, remember whatever is below TEXT goes on the screen:
${offset 300}${color }CPU ${color } $cpu%
${offset 300}${color light grey}${cpugraph 13,100}

${offset 300}${color }RAM ${color } $memperc%
${offset 300}${color light grey}${memgraph mem 13,100}


---EOF

OK that's much better, but just a fraction of what I normally display on my desktop. What you can do with conky will blow your mind, the best way to tweak it out is to search for conky screenshots you like, then look at the config files. An invaluable resource is the conky variables webpage, notice the new link at the top of the blog. Let me kick this up one more notch with my actual config file:
TEXT
${offset 300}${time %l:%M %p} ${alignr}${time %A - %b %e, %Y}
${offset 300}${hr}

${offset 300}CPU @ ${freq}Mhz ${alignr}$cpu%
${offset 300}${cpugraph 20,200}

${offset 300}RAM @ ${memmax} ${alignr}$memperc%
${offset 300}${memgraph 20,200}

${offset 300}${alignc}Eth0 Up ${alignr}Down
${offset 300}${upspeedgraph eth0 20,95} ${alignr}${downspeedgraph eth0 20,95}

${offset 300}${alignc}Eth2 Up ${alignr}Down
${offset 300}${upspeedgraph eth2 20,95} ${alignr}${downspeedgraph eth2 20,95}

${offset 300}${hr}
${offset 300}TOP CPU ${alignr}PID CPU %
${offset 300}${top name 1} ${alignr}${top pid 1} ${top cpu 1}
${offset 300}${top name 2} ${alignr}${top pid 2} ${top cpu 2}
${offset 300}${top name 3} ${alignr}${top pid 3} ${top cpu 3}
${offset 300}${top name 4} ${alignr}${top pid 4} ${top cpu 4}
${offset 300}${top name 5} ${alignr}${top pid 5} ${top cpu 5}

${offset 300}${hr}
${offset 300}TOP MEM ${alignr}PID MEM %
${offset 300}${top_mem name 1} ${alignr}${top_mem pid 1} ${top_mem mem 1}
${offset 300}${top_mem name 2} ${alignr}${top_mem pid 2} ${top_mem mem 2}
${offset 300}${top_mem name 3} ${alignr}${top_mem pid 3} ${top_mem mem 3}
${offset 300}${top_mem name 4} ${alignr}${top_mem pid 4} ${top_mem mem 4}
${offset 300}${top_mem name 5} ${alignr}${top_mem pid 5} ${top_mem mem 5}

${offset 300}${hr}
${offset 300}Eth0 IP Add ${alignr}${addr eth0}
${offset 300}Eth2 IP Add ${alignr}${addr eth2}
${offset 300}Kernel Ver${alignr}${kernel}
${offset 300}AC State ${alignr}${acpiacadapter}
${offset 300}Battery ${alignr}${battery_percent BAT0}%
${offset 300}Temp ${alignr}${acpitemp}


---EOF

Now relaunch conky. Yeah, that's what I like to see! Now I'll tweak the width of my toolbar to fit how I like and remove the clock from the bar and just run it on conky. Open up .fluxbox/init and look for the line "session.screen0.toolbar.tools:" and see what it says. I'll copy that line and paste one line below, then remark out the original with a #. Now I'm going to make my new one look like this:
session.screen0.toolbar.tools: workspacename, prevworkspace, nextworkspace, iconbar

Because that's all I need. Keep whatever you like, add some more, take other stuff off, do what you like. OK, wouldn't it be neat if we could get this to start everytime we go into fluxbox? Here's the answer for that, open up that startup file inside .fluxbox and add a conky kicker above your exec fluxbox line like this:
exec conky &
exec /usr/bin/fluxbox

Once you've got that saved exit fluxbox and logout, then log back in. When fluxbox restarts you should have conky up and running in the corner!

Sunday, February 28, 2010

Fluxbox toolbar and menu

So now that we have apps to run, lets work on the usability of the system. First two things that seen really unhelpful to me are the defaults for the fluxbox toolbar and menus.

Toolbar
I'm going to put my toolbar top center of my screen with a total width of 80%. This means even with windows "full screen" I'll have 10% of my screen width both at the top left and right where I can bring up my fluxbox menu without minimizing every window first. If you've been playing with apps running with maximized windows you'll know what I'm talking about. You can setup the toolbar like so:
  1. Right click the desktop for fluxbox menu, click Configuration, click Toolbar, click Placement, then choose Top Center.
  2. Right click the desktop for fluxbox menu, click Configuration, click Toolbar, HOVER over Toolbar width percent
  • If you want to reduce the % of the screen, LEFT click
  • If you want to increase then RIGHT click
Cool huh? Since we know everything in fluxbox is driven by configuration files, we could have easily made these changed by browsing into the ~/.fluxbox directory and modifying the correct file. In this case you'll find these settings in the "init" file, we'll be modifying it for some other reasons sometime soon.

Menu
I hate the default menu that fluxbox offers me, I want everything at most two levels deep so I can launch my app with quickness.

Let's look at ~/.fluxbox/menu and see what the default menu config looks like:
[begin] (fluxbox)
[include] (/etc/X11/fluxbox/fluxbox-menu)
[end]
Seems pretty straight forward, it's just calling back to some system generated menu in /etc to paint our menu. So EVERYTHING in our menu right now is coming directly out of fluxbox.

OK, then let's mess with it! First thing I'm going to paste my own menu items between the begin and include lines, making it look like so:
[begin] (fluxbox)
[submenu] (Accessories) {}
[exec] (Aterm) {aterm -geometry 70x35} <>
[exec] (Galculator) {/usr/bin/galculator} <>
[exec] (Geany) {/usr/bin/geany} <>
[exec] (PCmanFM) {/usr/bin/pcmanfm} <>
[end]
[submenu] (Internet) {}
[exec] (Gftp) {/usr/bin/gftp-gtk} <>
[exec] (Opera) {opera} <>
[exec] (Pidgin) {/usr/bin/pidgin} <>
[exec] (Putty) {/usr/bin/putty} <>
[exec] (TS Client) {/usr/bin/tsclient -f} <>
[end]
[submenu] (Office) {}
[exec] (Abiword) {/usr/bin/abiword} <>
[exec] (Gnumeric) {/usr/bin/gnumeric} <>
[exec] (Xpdf) {/usr/bin/xpdf} <>
[end]
[submenu] (System) {}
[exec] (Root Xterm) {/usr/bin/su-to-root -X -c xterm} <>
[end]
[exit] (Exit)
[include] (/etc/X11/fluxbox/fluxbox-menu)
[end]
So now I have all my menu items above the fluxbox generated ones. Very cool, everything is two layers deep and where I want them (mostly) but I still have that ugly crap menu below everything else.

Instead of removing the "include" line, let's just remark it out incase we want to quickly turn it back on later for some reason. New menu looks like this:
[begin] (fluxbox)
[submenu] (Accessories) {}
[exec] (Aterm) {aterm -geometry 70x35} <>
[exec] (Galculator) {/usr/bin/galculator} <>
[exec] (Geany) {/usr/bin/geany} <>
[exec] (PCmanFM) {/usr/bin/pcmanfm} <>
[end]
[submenu] (Internet) {}
[exec] (Gftp) {/usr/bin/gftp-gtk} <>
[exec] (Opera) {opera} <>
[exec] (Pidgin) {/usr/bin/pidgin} <>
[exec] (Putty) {/usr/bin/putty} <>
[exec] (TS Client) {/usr/bin/tsclient -f} <>
[end]
[submenu] (Office) {}
[exec] (Abiword) {/usr/bin/abiword} <>
[exec] (Gnumeric) {/usr/bin/gnumeric} <>
[exec] (Xpdf) {/usr/bin/xpdf} <>
[end]
[submenu] (System) {}
[exec] (Root Xterm) {/usr/bin/su-to-root -X -c xterm} <>
[end]
[exit] (Exit)
# [include] (/etc/X11/fluxbox/fluxbox-menu)
[end]
That takes care of the ugly menus, and we can just stop here. If we add any apps we can add them to our menu, if it gives us any trouble we can always launch them from a terminal, and absolute worst case we can enable the fluxbox menu anytime we want by removing that # from our config.

Now getting all sorts of practical, I only have about a dozen apps I've installed that I'll be using, maybe I don't need two layers of menus, here is an option:
[begin] (fluxbox)
[exec] (Abiword) {/usr/bin/abiword} <>
[exec] (Aterm) {aterm -geometry 70x35} <>
[exec] (Galculator) {/usr/bin/galculator} <>
[exec] (Geany) {/usr/bin/geany} <>
[exec] (Gftp) {/usr/bin/gftp-gtk} <>
[exec] (Gnumeric) {/usr/bin/gnumeric} <>
[exec] (Opera) {opera} <>
[exec] (PCmanFM) {/usr/bin/pcmanfm} <>
[exec] (Pidgin) {/usr/bin/pidgin} <>
[exec] (Putty) {/usr/bin/putty} <>
[exec] (TS Client) {/usr/bin/tsclient -f} <>
[exec] (Xpdf) {/usr/bin/xpdf} <>
[exec] (Xterm) {/usr/bin/su-to-root -X -c xterm} <>
[exit] (Exit)
# [include] (/etc/X11/fluxbox/fluxbox-menu)
[end]
So this is the menu I'm going to run with, I'll leave a few items in there unexplained so you can go find out what some of those elements are for on your own.

One last scenario, what if someone doesn't know what all those crazy linux apps name mean? How would you know geany was a text editor? You could make this menu really friendly for non-linux users:
[begin] (fluxbox)
[exec] (Calculator) {/usr/bin/galculator} <>
[exec] (Chat Client) {/usr/bin/pidgin} <>
[exec] (Linux Console) {aterm -geometry 70x35} <>
[exec] (File Manager) {/usr/bin/pcmanfm} <>
[exec] (FTP Client) {/usr/bin/gftp-gtk} <>
[exec] (PDF Viewer) {/usr/bin/xpdf} <>
[exec] (Remote Desktop) {/usr/bin/tsclient -f} <>
[exec] (Root Terminal) {/usr/bin/su-to-root -X -c xterm} <>
[exec] (Spreadsheet) {/usr/bin/gnumeric} <>
[exec] (SSH Client) {/usr/bin/putty} <>
[exec] (Text Editor) {/usr/bin/geany} <>
[exec] (Web Browser) {opera} <>
[exec] (Word Processor) {/usr/bin/abiword} <>
[exit] (Exit)
# [include] (/etc/X11/fluxbox/fluxbox-menu)
[end]
I'm not going this route, but you can if you like. This is the greatest strength of linux, you can have it exactly your way!

Let's add one more line to whatever menu we decide on:

 [exec] (Screenshot) {import -pause 3 -window root ~/screenshot.jpeg} <>

*** I had to update to remove a space between the hyphen and w on window. Copy/paste failed me.

This will use part of imagemagick to wait 3 seconds then take a screenshot of the entire desktop and save it as "screenshot.jpeg" in our home directory. Remember to go rename it or save it off somewhere else before trying to snap more. By waiting 3 seconds it will let you pull up your fluxbox menu or put your mouse over something before it snaps.

I think that's enough about the toolbar and the menu for today. I'll circle back on my promise for doing the aterm configuration later, this post is already long enough!

Saturday, February 20, 2010

Adding some apps

So things are looking better on the desktop now and we still have a lean stable linux box. Our new problem is that we still can't really use it like a computer. Some might argue that all we need these days is a browser, but I think we should load up a few apps incase we need to do some work without a cloud connection. I've lined up some general PC uses below and the program I've selected to install on my box to do the job.

Accessories
There are a few things you just need in whatever OS you are running, we already have our file manager and text editor, but here are a few more apps to round us out:
  • Calculator: Sure we can do math in our spreadsheet program, from the cli with bc, or in any programming language, but I think every OS should have a handy calc. I haven't found my perfect calculator yet, but galculator has worked great for me for a long time so I'll stick with that.
  • Terminal: I know you are thinking we already have two; xterm and eterm. Yeah we do, but if we install aterm we get eye candy. Xterm will always be there if I need it, and I only load eterm to get my background image loaded with fbsetbg, but aterm is my main console all day everyday. We'll just install it for now and slick it up later.
  • Screenshot: it's cool to create our perfect desktop environment, but how do we collect our bragging rights? You might want to take a screenshot, or you may really need to document something you see on your screen at any given time. For this I use imagemagick with some cool foo in my FB menu, but I'll save that for later.
Office Productivity
You can pick from a few office suites to load like Open Office or Koffice, but if you want to go with a "best of breed" approach, you can pick the individual applications you want to build your own office suite with. I do run full OO on my Ubuntu box so I can afford to go lightweight on my Debian install.
  • Word Processor: So in MS world you've got Word, for basic/free built in you have Wordpad (which when working on a Windows server, I'm actually quite fond of.) In linux land we usually see people running Open Office Word Processor, and it's a fine choice with the ability to use LOTS of document format. Abiword has been around for a long, long time, oh and it's pure awesome so I'm going to install it.
  • Spreadsheet: Again Open Office Spreadsheet gives us a full feature alternative to Excel, but I'm going to go light and I'm choosing Gnumeric for this.
  • PDF viewer: So you can create PDF's in linux pretty easily, but to view them you need to load another app. I've only used Xpdf for any long amount of time so it's the only one I can recommend.
Internet Apps
I have some applications I use all of the time, they are particular to my job and the way I use my computers and servers so you may not need them. Since I'm installing them on my box, I'll document them here for completeness. We already have Opera so the most important internet app is already running on the system, now we just need to add whatever we'll be using on this box.
  • Email: If you wanna go big and install a dedicated email program, here is where I'd put in sylpheed-claws, but I'm happy not to have it so I'm personally skipping. I can use webmail with any of my accounts, or just keep the imap connection going in Opera.
  • FTP Client: I move lots of files for personal use and for work, they are often large archives of log files, etc. Since I work with people running Windows, Mac, and linux it's really handy to keep a dedicated FTP server out on the internet where I can create accounts and isolate directories for everyone I'm working with. Since I spend so much time using FTP I actually run a thick app for it, gftp. It's absolutely wonderful and I can't imagine life without it.
  • IM Client: Since I work with people using AOL, MSN, Google, and Yahoo IM accounts, a multi-protocol IM client is a must. I've used Pidgin since it was released and I've never found anything lighter that works better. Recently I installed Meebo on one of my PC's and my wifes Droid, it seems to work pretty well but I'm gonna stick with what I know, it'll be easier for me to import contact lists if I don't change right now.
  • Telnet/SSH client: Just PuTTY.
  • Remote Desktop: I spend most days working on a variety of linux and Windows servers, and after web consoles and ilo every other connection method short of walking to the keyboard requires a special client to be installed rather than a browser. VNC is installed on some servers because Terminal Services is not supported, most of the rest are Windows and use RDP only. TSclient is a very full featured front end that keeps a connection history and gives you easy options for mapping your drive across or modifying display settings per connection. VERY nice app. I once had an issue getting protocols put into tsclient so now I install them first then install the gui frontend in a second step. I'm sure there is a better answer but I haven't bothered searching for it.
OK so how hard is it to install all of the applications we need in our OS? You can put them all in on one line, but I'm gonna split them up for blog formatting:
debian:/home/thom# aptitude install galculator aterm imagemagick
debian:/home/thom# aptitude install abiword gnumeric xpdf
debian:/home/thom# aptitude install gftp pidgin putty
debian:/home/thom# aptitude install vncviewer rdesktop
debian:/home/thom# aptitude install tsclient

OK, about 75Mb later we've got a pretty good set of apps we can run! Now all you have to do is search out all the menus and try to find what we've installed. If you can't find it you can launch any of them from the console.

Next time we'll dress up that Aterm config, strip down our fluxbox menu, setup imagemagick for some screenshots, and kick our eye candy up another notch.

Sunday, February 7, 2010

Fluxbox beautification

Ok I've been talking about cleaning up our gui for a while, today let's make some progress. We've been logging in as our user and typing "startx" to launch fluxbox every time we boot up. Seems ridiculous, computers are good at doing things over and over. First thing lets tell Debian it can launch fluxbox upon successful authentication of our normal user. This is a simple two step process.

First, there is a hidden file in our home directory called .profile, this is basically a bunch of commands that will run everytime you log in. Why not put just put "startx" at the bottom of that file? Well there is one good reason, what if you are remotely connecting to the box over ssh? Here is another, what if you really botch up your startup or fluxbox config and you need to log into it from another terminal session without launching another instance of the same problem? So the best plan would be to tell Debian that if we are logging into an initial session directly from the attached keyboard and monitor to automatically lauch the gui, but ONLY for the initial local login. Here are the bottom 3 lines from my .profile that does that:
if [ $(tty) == /dev/tty1 ]; then
startx
fi

Second, now what happens if we have other window managers installed, which one do we start? How do we tell linux which window manager to choose? Just like logging into our account triggers .profile to be read, doing a startx will make linux check for a file in the users home directory called .xinitrc to see if you have any preferences you'd like setup when going into graphical mode. Fluxbox has some peculiarities we'll be touching on shortly, but the important thing is that we use the command "startfluxbox" in our .xinitrc to launch it. Here is the LAST LINE in my .xinitrc:
startfluxbox

It's entirely possible that you don't see an .xinitrc file in your home directory yet. If you are in PCManFM and showing hidden files and it's not there, just right click and Create New -> Text File, then change the filename to exactly ".xinitrc".

IMPORTANT - making these types of changes can break lots of stuff, so here is what I'd do if you are worried about recovering to what you currently have. Open up your home directory in PCManFM and copy any file you plan to change and save them back into the same directory with a "-OLD" at the end. Now we can make changes to the config files and IF we have any trouble we can login as root, go to the users home directory, delete the bad/active config files with the rm command, then copy the -OLD files back to the original names with the cp command. We'll be back to square 1 with our normal user account and able to try again. I won't be talking about backing out configs and commands much, but you should always work with a safety net. I do.

OK once we have our original config files backed up as -OLD files, we ca update the active files them with Geany without doing a su to root because they are in our user accounts home directory. We already have full control of these files. It's a good time to break the habbit of switching to root when not really neccessary. We'll need to exit fluxbox and logout of our user account to test this. Once we log back into linux we should go straight to our fluxbox desktop. OK, I just tried it and it worked perfectly. One final note, I like logging in at the cli and having it kick off fluxbox, it's the very leanest way to get the job done. If you search around you'll see a brazillian posts about gdm, xdm, etc. those are all gui front ends for the login process. I think they just slow down boot times and waste system resources. If you're into bloat maybe you should be reading somebody's blog about fluxbuntu or something.

OK, with all the baby crap out of the way, let's actually do something with fluxbox. You've seen we can do all this configuration and customization of fluxbox from the fluxbox menus inside of fluxbox. This is basically there for noobs. All of fluxbox is driven off of configuration files. Let's get a new theme on here. First thing go into the .fluxbox directory and you'll see a styles directory. Open that up and create a new empty file in there, name it whatever you want and open it with geany, then paste in the follow and save it:
# Thom's style
toolbar: flat crossdiagonal gradient
toolbar.color: grey20
toolbar.colorTo: grey10
toolbar.button: parentrelative
toolbar.button.picColor: grey85
toolbar.button.pressed: flat crossdiagonal gradient
toolbar.button.pressed.color: grey50
toolbar.button.pressed.colorTo: grey80
toolbar.label: parentrelative
toolbar.label.textColor: grey85
toolbar.windowLabel: parentrelative
toolbar.windowLabel.textColor: grey85
toolbar.clock: parentrelative
toolbar.clock.textColor: grey85
toolbar.justify: right
toolbar.font: lucidasans-10

menu.title: flat crossdiagonal gradient
menu.title.color: grey50
menu.title.colorTo: grey10
menu.title.textColor: white
menu.title.font: lucidasans-10
menu.title.justify: right

menu.frame: flat crossdiagonal gradient
menu.frame.color: grey50
menu.frame.colorTo: grey80
menu.frame.textColor: grey20
menu.frame.disableColor: grey40
menu.frame.font: lucidasans-10
menu.frame.justify: left

menu.bullet.position: right
menu.bullet: triangle

menu.hilite: flat crossdiagonal gradient
menu.hilite.color: grey50
menu.hilite.colorTo: grey10
menu.hilite.textColor: white

window.title.focus: flat crossdiagonal gradient
window.title.focus.color: grey50
window.title.focus.colorTo: grey10
window.title.unfocus: flat diagonal gradient
window.title.unfocus.color: grey50
window.title.unfocus.colorTo: grey20

window.label.focus: parentrelative
window.label.focus.textColor: white
window.label.unfocus: parentrelative
window.label.unfocus.textColor: grey60

window.button.focus: parentrelative
window.button.focus.picColor: grey85
window.button.unfocus: parentrelative
window.button.unfocus.picColor: grey60
window.button.pressed: flat crossdiagonal gradient
window.button.pressed.color: grey50
window.button.pressed.colorTo: grey80

window.handle.focus: flat crossdiagonal gradient
window.handle.focus.color: grey50
window.handle.focus.colorTo: grey10
window.handle.unfocus: flat diagonal gradient
window.handle.unfocus.color: grey50
window.handle.unfocus.colorTo: grey20

window.grip.focus: parentrelative
window.grip.unfocus: parentrelative

window.frame.focusColor: grey10
window.frame.unfocusColor: grey50

window.font: lucidasans-10
window.justify: right

borderColor: grey20

bevelWidth: 1
borderWidth: 1
handleWidth: 4

*textColor: grey85
*Font: lucidasans-10

rootCommand: fbsetroot -gradient flatcrossdiagonalgradient -from rgb:4/6/8 -to rgb:3/48/6

bbpager.desktop.focus: flat interlaced crossdiagonal gradient
bbpager.desktop.focus.color: grey50
bbpager.desktop.focus.colorTo: grey10
# END

Once that is saved and closed, right click your desktop to pull up your fluxbox menu and go to styles, you should now see your new style there so go ahead and click it. OK there we've got a nice black and dark gray theme. All of the other styles on the menu are all built in and reside elsewhere in the system. Whatever styles you put into your styles directory are only there for you to use. The most important thing to understand is that the fluxbox themes are completely file driven and customizable. Go search around for fluxbox screenshots and see what people have come up with, often you'll find their config files on the same page as their screenshots.

OK, let's put one more peice of happiness on here before we call it a day. Open up Opera and go find a nice jpg or png you'd like for a background image and save it into ~/.fluxbox/backgrounds.

Now open a terminal and su to root so you can run aptitude:
debian:/home/thom# aptitude install eterm

Eterm has a component that fluxbox will need to setup wallpaper. Next we can open up /.fluxbox/startup with geany. Let's look for a line:
/usr/bin/fbsetroot -solid black

and we'll remark that line out like so:
# /usr/bin/fbsetroot -solid black

Now find this line:
# fbsetbg -C /usr/share/fluxbox/splash.jpg

And we'll remove the # and change the path to our personal background directory:
fbsetbg -C ~/.fluxbox/backgrounds/wallpaper.jpg

Now we can exit fluxbox, log out of Debian, and log back into Debian as our normal username. We should have fluxbox auto start, to our slick theme, and display our wallpaper. Little things you can take for granted huh?


Saturday, February 6, 2010

Installing a decent web browser

OK, w3m and links aren't gonna cut it now that we have our graphical environment up and running so we need to fetch a better browser.

You can choose from a bunch via aptitude, if you want to stick with a free and supported option I'd say go with iceweasel. Iceweasel will install into a Mozilla directory, supports extensions, and has an icon that looks a bit like Firefox... Hmmm whats going on here? Basically Debian has requirements for all packages that they put into the APT repositories, and although Firefox is considered by the world to be free there are components it holds rights to like icons and logos. The compromise is this: someone can take all the code that is firefox, call it something else, and release it under a free license. The name they choose to call it is iceweasel. If my 10,000' view summary isn't enough for you google will take you all back through this history. Toss Ubuntu into that search to find the deeper interesting dirt. For those of you just needing a browser that is familiar to what you already use, here you go:
debian:/home/thom# aptitude install iceweasel
Boom, done, you can skip the rest of this post.

OK for the real cowboys ready to step up their game a bit, I think Firefox is too bloated and slow. 99% of the time I don't need all that it can offer and I just want something light and fast. I know everyone is thinking Chrome is all awesome, but I still prefer Opera for these reasons:
- small install size
- light memory usage
- FAST web browser
- built in email client with imap support
- built in IRC chat client
- bag of chips

OK so by installing this I can skip installing any other browser, email client, or IRC chat client? Yes it is so. Now I'm not going to say it's the best at any of them, but for me it's the perfect balance of what you get vs what you pay. So why wouldn't you want to use Opera? Here is the list of cons:
- it is proprietary software
- it's not in the APT repos
- you can't use Firefox or Chrome extensions with it

If I have to choose between Google and Opera for my non-free fast browser, I'll take Opera thank you. Let's figure out how to get this installed so you can check it out! First thing we'll need to do a web search to find some good info like this
http://wiki.debian.org/Opera
(this isn't optional reading if you are about to install Opera on Debian, please go read it now.)

Now that we know what we're up to let's get into a console and su to root. First step listed is to modify our sources.list, this is NOT a step to be taken lightly. Once we allow trusting to the Opera repository it opens up a security hole that could be exploited. Assuming that's not stopping you:
debian:/home/thom# geany /etc/apt/sources.list

That will open up Geany as root, then we can add these lines:
# This is just a comment, put whatever you want in here.
deb http://deb.opera.com/opera lenny non-free

We can click save in Geany and close it. Now just because we added that line to the sources.list file doesn't mean it's active yet, let's alert our OS to the change:
debian:/home/thom# aptitude update

Notice we get the same error as the example on the wiki link for their apt-update. Either way we need to add a gpg key to trust this source before we can use it.
debian:/home/thom# gpg --keyserver subkeys.pgp.net --recv-key 9D1A0061

We should see we have imported 1 key, we can take a look at it:
debian:/home/thom# gpg --fingerprint 9D1A0061

We can see it's from Opera and has some time before it expires. OK Now we actually need to establish the trust:
debian:/home/thom# gpg --armor --export 9D1A0061 | apt-key add -

And we see a little "OK" to be the only sign that we've now opened ourselves up to getting poisoned packages from Opera, but if you've made it this far you must know what you're doing right ;)

OK let's try that aptitude update again:
debian:/home/thom# aptitude update
Yeah that should be much happier now.

Now look at the next line in the wiki, "apt-get install opera" so remember that post about pick one package manager and use it exclusively? Well if we go all copy/paste happy here and install Opera via apt-get there will be no log of it or dependencies met in aptitude. So do the right thing:
debian:/home/thom# aptitude install opera

Now a couple exits will close out our su session and our xterm window, then we can pull up a menu and Applications -> Network -> Web Browsing -> Opera. If you accept the agreement click that and behold your new fast as hell browser! I'm not gonna get all application oriented but there are a few things you should do with Opera the first time you see it:
Speed Dial
  1. close the tab that welcomes you to Opera
  2. what you see now is the "speed dial" it's 9 websites you can pre configure
  3. right click on all of the ones that are set and clear them
  4. right click on one of them and choose edit
  5. type in thomslinuxblog.blogspot.com and click OK, it will prefetch the page
  6. since I only do about one post a week, right click set the reload to never (or whatever you want)

Widgets:
  1. once you are settled into the speed dial, click the menu Widget and then Add Widget
  2. you will see all of the Opera widgets, I don't use any widgets but if it's your thing you can knock yourself out

Email:
  1. click tools and choose email and chat
  2. choose OK to setup an account, choose email
  3. run through the wizard to setup your email, personally I only use imap
  4. see your email! If you have a large inbox or slow mail server it may take a little time to pull down headers

IRC:
  1. click tools and choose email and chat
  2. choose add to setup an account, choose chat
  3. run through your setup wizard, I'm doing my freenode/NA setup
  4. now say what room you want to hit, like #debian and in you go!

So how cool is Opera? We've got our speed dial setup, my blog in one tab, my email in another tab, and IRC up in yet another tab! That is freakin sweet and fast! All of this only burned 17Mb of disk space!















OK we'll save flash, java, sound, etc for later as we have other dependencies we'll need to take care of along the way. At least for now we can research how to make fluxbox not look like vomit! Next time we'll start the cleanup, I promise.

Thursday, February 4, 2010

Adding a text editor and a file manager

Now we've got some gui-ness going, but it looks like hell and that's just embarassing. To get fluxbox customized we're gonna need to navigate around our filesystem and edit a few text files. Now we can easily do that the badass way from the command line using ls, cd, and vi, but instead lets go ahead and fill out our graphical environment with a text editor and a file manager.

Once we've booted up, logged in, and done a "startx" to bring up fluxbox we can right click anywhere on the desktop to pull up a menu. Click Applications -> Terminal Emulators -> XTerm and viola we're back at a cli within our gui. Linux always seems to come back to this...

Now it's time to su to root to install a text editor and a file manager with aptitude. There are a billion different text editors and file managers, the ones below just happen to be my favorites right now so you can either fill in your own favorites (as long as they are in the Debian repos) or try these out for sport. We can install multiple packages with all dependencies by just putting them all in one line like this:
debian:/home/thom# aptitude install geany pcmanfm

After that we can type exit a few times to close out su and the XTerm session. The only price we need to pay for a great file manager and a great text editor is just a little disk space. Now if you right click on the desktop you'll see a few new items in the Applications menu.

  • Geany: we can try out Geany by clicking into that new menu item "Progamming" let's go ahead and open it up. I know I called it a text editor but technically it's an IDE, or Integrated Development Environment. If you type programming code into Geany it will recognize what it is and color code comments and alert you to open tags, etc. It can do LOTS of cool stuff, but it's also a heck of a nice text editor that can open many files in tabs for you to copy paste in and out of.
  • PCManFM: next let's take a look at that file manager, PCManFM is under our new File Management submenu. When we click it you'll see an error pop up saying that "GTK+ icon theme is not properly set" so we've got something to fix already! Click OK and take a peak at our app, notice the bottom bar where it says "... (XX hidden)" that's how many hidden files we don't see. If we click View and choose Show Hidden Files we'll see what's being hidden by the system. Look for a file named ".gtkrc-2.0" do you see it? If you saw that GTK+ icon error I'm guessing you don't. Lets go ahead and fix that.
  1. Right click on the right pane and Create New -> Empty File and name it EXACTLY ".gtkrc-2.0" and hit enter. You should now see that file in PCManFM.
  2. Right click the file and choose Open With Geany.
  3. In Geany type EXACTLY this "gtk-icon-theme-name="Raleigh"" I know putting double quotes inside of double quotes is bad form, get over your bad self.
  4. Save
  5. File -> Quit
  6. Close PCMamFM
Now we can open PCManFM without any errors!

OK, we're gonna follow this basic scheme to fix up lots of stuff in fluxbox. Boot up, login, start fluxbox, open PCManFM to browse to or create config files, then open them in Geany to modify and save. But what happens when we need to go to web pages to copy/paste out of? We'll get a real browser installed next time.

Monday, February 1, 2010

Loading up a lightweight GUI

I read a good thread a while back where someone stated Debian is where you end up with linux, not where you start. This makes sense to me, lots of people start up with Ubuntu or Suse or another well packaged distro, get their feet wet and find out they love linux, then start bumping into the limitations of the distro they are in and start hunting around. I think graphical environments seem to be a similar journey for many people.

Typically "newbie" distros default to full blown Gnome or KDE and they are both wonderful environments to work in, but many people feel they are too bloated. Don't get me wrong, I'll confess I've run both of them quite a bit over the years and I still run Gnome as the default on my primary laptop.

Taking one step away from the two huge environments we have XFCE. I ran Xubuntu 6.06 when it came out as my primary OS for about 6 months, and I've heard many people say XFCE is a wonderful balance between the niceties of a full graphical environment and the lightweight window managers we'll be discussing shortly. Because XFCE is all gtk under the hood it plays very well with Gnome utilities. If you are looking to take your first step out of Gnome or KDE and want to get your toes wet, XFCE is a great next step for many.

At the farthest end of the GUI spectrum from Gnome and KDE are a slough of basic window managers. People may have heard of these lesser known window managers, but people rarely seem to give them more than one boot before switching back to what they already know. It's true that there is curve to getting familiar with any of the lightweight window managers, but there was a big curve to switching to linux already and that was pretty rewarding wasn't it?

So over on the side of the blog there is a link for the old Linux Reality podcast, a few years back Chess did a few episodes about the differences between all the different window managers. I'd suggest going out and listening to them as they are great information and that podcast was very entertaining.

So bringing around our problem at hand, we have a pure CLI netinstall of Debian and I'd like a graphical envionment to run some apps I like. I've tried most wm's to hit the street over the last decade or so and I personally love fluxbox. It's not as skinny as some, it might be missing a feature from some other WM, but I really love the balance it holds. To me fluxbox is:
- well documented
- very mature
- highly customizable
- potentially beautiful
- very lightweight

You should try out a bunch of window managers, maybe you'll like icewm or rat poison better. For this little Debian box let's drop on some fluxbox to play with. We'll need to boot up and su to root, then we can run through the setup. First we need to get xorg, this is the package that any graphical environment will sit on top of:
debian:/home/thom# aptitude install xorg

That burns about 120Mb, but that's the cost of having a GUI. Next we will fetch fluxbox:
debian:/home/thom# aptitude install fluxbox

And that burns another 7Mb. First thing you'll notice is that you are still in the command line interface. Just because we've installed it doesn't tell linux we want to use it. Ain't that cool? If you are ready to experience the wonder of fluxbox, type exit to leave root and as your normal user launch X:
thom@test:~$ startx















... and BEHOLD! Oh wait, yeah it really doesn't look like anything. If a netinstall of Debian is a blank canvas of an operating system, fluxbox is a blank canvas of window manager. Go ahead and right click somewhere on the desktop, this is how you pull up a menu in fluxbox. Go ahead and poke around the menus and see whats in there. If you have the scrolling issue in the screenshot I've attached, click on the Configuration menu, choose Toolbar, and put the Placement at Top Center and you should be alright. At the bottom of the main menu you see "Exit" that just takes you back to the command line interface, click that and shutdown normally whenever you're ready.

Sunday, January 31, 2010

Installing programs

Now that we have a base load of Debian running we need to start installing software, but I thought this would be a great time to take a post and talk about ways to install and manage installed software in linux and specifically Debian.

The oldest and "hardest" method of installing software in linux is to compile from source code, sometimes you'll hear people talk about "make" and it's the same thing. I think compiling has got a bad rap in recent years, there is something pretty cool about compiling the exact versions of software you want for your exact machine architecture. Gentoo as created a loyal user base by this exact approach.

To overcome some of the pain of compiling and the associate dependency requirements, big distros setup packages you could install without compiling from source. Debian started using .deb packages and came up with a system for package distribution and installation. This system has become the home of 20,000 programs you can fetch and install anytime you like. The current version of the system is called the Advanced Package Tool or APT and there are several ways to access it from your Debian box.

Currently the most common ways to install software from APT is via the GUI front ends like:
  • Add/Remove in Gnome
  • KPackage in KDE (some old references to Adept are still lingering)
  • Synaptic which can be used in any Window Manager

From the command line you'll typically see people use either apt-get and aptitude in their examples, any older methods should be completely avoided. Since we have not installed any graphical environment on our test install let's chat about these options.
  • Apt-get has been the standard for a LONG time, like the better part of ten years! If you search on installing software in Debian you will find lots of examples listing apt-get as the command to use.
  • Aptitude is the new command to use in the latest versions of Debian, but that doesn't mean it's the best one to use on the old Debian box.

Here is the trick to managing your packages in Debian, pick ONE package manager and use it exclusively. If you have an old install that has had packages installed via apt-get you should continue to use it or google around and use aptitude to bring in all apt-get information then never use apt-get again.

Since we're running a current version on a fresh install we should use aptitude exclusively! This will let aptitide track all package dependencies when we install, and remove all supporting packages we don't need when we remove a program later.

First thing, let's think of something we want our Debian box to do, how about surf the web? We'll need a browser for that, and since we can't click the icon to launch Firefox we'll need something else, like "links" to run in text mode. First thing lets make sure we don't already have it with this command:
thom@test:~$ links slashdot.org
-bash: links: command not found

Yeah, that don't look good. Let's fix that:
thom@test:~$ aptitude install links

Hmmm, bunch of errors ending with "are you root?" dang, but we know how to fix that with "su" notice the prompt change:
debian:/home/thom# aptitude install links

There we go. Once we have the package installed we can leave root with a single "exit" then try to hit the interwebs again:
thom@test:~$ links slashdot.org
you can now see our console has turned into a text based web browser. Control + Z to exit.

Now that we can install and run software from the command line we're ready to start setting up our box. Next time we'll get a lightweight Window Manager up and running!

Sunday, January 24, 2010

Basics of a netinstall

OK so with a virtual machine setup and an iso image downloaded we are just about ready to run the basic install. The last point is only for people running a hardware installation that will require additional drivers. When I run the install on Vbox I don't need anything more, but when I run it on my R52 with Intel wireless I need a driver for my chip that isn't included. I'll go read the wiki

http://wiki.debian.org/ipw2200

Then I'll download the file and put it in the root of a USB thumb drive and attach it to the laptop prior to booting up the CDROM.

With Virtualbox up, Debian highlighted, and the iso mounted as a virtual CD-ROM we just press Start and wait for our installer to pop up.

* Once you click into a brand new vbox machine you will loose control of your keyboard and mounse on your main OS. Once we get everything up and running we can add "Virtualbox Guest Additions" and get seemless interaction. For now if you need to drop out to your host OS just hit the CTRL on the RIGHT side of your keyboard. You can redefine this key in Virtualbox via the Settings menu.
















Once greeted by the boot menu we just choose Install and input the appropriate settings we want when prompted. To save everyone from the screenshot hell that the Virtualbox post turned into, here is the short version:

Install
English
United States
US keymap
Choose network connection
Set the hostname
Set domain name
Choose timezone

This gets us up to partitioning, I usually setup a simple table manualy, here is what I'm going to do for this little install:
  • First I'll delete anything that is existing. In Vbox it should be a new disk so we can skip this.
  • Second I make the first primary partition on the disk equal to the amount of physical RAM and set it as a swap partition. For Vbox I'll just make this 256Mb.
  • Third I take the next 4Gb and set an ext3 primary partition and set it to bootable with a mount point of "/".
  • Finally I take all remaining space as "/home" as the final ext3 primary partition.
When I run my hardware install I'll keep 20Gb for / and about 140Gb for /home. OK, we can finish our table and write the changes to disk. There are lots of ins and outs of partitioning and formats, this would be a good spot to google around and do some research to see what would best fit your needs.

Set the root password and confirm it. DO NOT FORGET THIS PASSWORD!
Enter a full name for the user account you'll be logging in with
Press ENTER if you want to login with the same name you just set
Set and confirm a password for this user
Set your mirror country
Skip the proxy config unless you know you need it
Choose if you want to participate in the "popularity contest"
Now you can choose which components you want to install. I'm going to uncheck Desktop, and install Standard and Laptop only (my hardware install will be on a laptop)
I install GRUB in the MBR
Finally we "eject" media and reboot. We can unmount the iso off the virtualbox menu, hit ENTER.

We should be greeted with this menu after the machine resets:











You can either wait for timeout or press enter, then sit back and watch linux load in all it's glory, when it's done you've got this:











You can see I've put in my credentials and come out to a $ prompt. This is it, nothing but linux. This is the blank canvas where a user can build out EXACTLY the system they want to use, and that is what we'll start next time.

When it's time to shutdown you can either pause the machine from the Virtualbox console, or do the following:
1) Swtich user to root with the command "su" and enter the root password you defined during installation.
2) Enter the shutdown command "shutdown -h now" telling it to go all the way down immediately.

This should close up your Virtualbox, or power down your machine if you've done a hardware install.

Saturday, January 23, 2010

Getting Debian

When I'm thinking of trying out a new distro, or even an updated version of a distro I already use, I typically to download the iso image of the very latest version.

Since I'm looking at Debian I have some choices to make. First I need to choose what version of Debian I want to run, the choices are:
OLD STABLE - currently this is 4.0 or "Etch". This was a great version but I think it's getting a little old.
STABLE - as of today, 5.0 "Lenny" is listed as current stable. Debian recommends STABLE for all production systems.
TESTING - will be the next STABLE version, well once it's "stable". 6.0 is known as "Squeeze".
UNSTABLE - "SID" is unstable, since I don't do dev work I stay out of this chain.

OK, so maybe I could go a little bleeding edge with Squeeze, but I like Lenny a bunch so I want to test that out as my first choice. The next question is which iso to get? Basically this comes down to two parts: what is your machines architecture, and how do you want the media bundled?
- Debian builds their OS for PCs, old Macs, even mainframes. I'll be going i386 since it will play nicely with both my virtual environment and my older laptop.
- Debian has several combinations of packages available from DVD down to a business card CD. I don't like bloat so I'll be getting the smallest iso that will boot up with a working internet connection.

So knowing I want a netinstall of Lenny for i386 I can go to www.debian.org and click Getting Debian, Download Small CD, and click the link for either the 40Mb or the 180Mb sized i386 image. You can browse to the same spot or just click one of these: 40Mb or 180Mb I know the smaller one has everything I'll need so I'll be going with that.

One last thing, when I'm fetching new or large iso files I always use bit torrent. I get my copy and I leave my client open so I can seed the file for others. Be kind and do the same.

Thursday, January 7, 2010

Virtualbox

When I want to try out an OS I always run it virtually before I take the time to burn media and install it on a hard drive.

For virtualization software there are LOTS of options, each with lots of pros and cons. Personally I've been using Virtualbox for a few years and recommend that for people new to virtualization, but VMware Workstation is a popular option for many Windows users and you can get free timebomb copies if you want to try it out.

If you want to try out vbox you can get it HERE There are links for Windows and Linux hosts, and information about Virtualbox vs Virtualbox Open Source Edition (OSE) take a moment to read that.

My preference is Virtualbox OSE on a linux host. Since I'm running Ubuntu as my primary OS today, I just add it through Add/Remove Applications and I have it in my Application menu.












So I'm going to setup a new virtual machine to install debian on.













Slap in a name and pick OS and version.












When I try out live CD's I skip creating a new disk and I just don't mount one. In this case I'll need a drive to install to, so here is that wizard.












Unless you are really bent on blowing disk space, I'd suggest a dynamic disk. There is a risk that if your virtual machines all grow to be bigger than your physical drive capacity you will crash out. Not an issue for my use.


















Once your drive is setup you can confirm your VM settings and click Finish.












Now Debian 5.0 is in my machine list, but I need to mount the installation media.

















When I click on CD/DVD-ROM in the above window it brings up this screen where I can enable a drive, then either use my host computers optical drive or an ISO image.














Since I want to mount an ISO, I click that little folder and browse to the image I want to boot and click Select.














Now you see I'm going to boot up with the debian business card media in my virtual optical drive.

















Now my virtual machine is prepared to do some testing without any risk to my actual PC. If anyone is thinking about trying out a different OS, I think this is the easiest, fastest, and safest way to do it.

Saturday, January 2, 2010

New year, new blog

Does the world really need another linux blog? Probably not, but I need a place to put config files and little tricks I've over years. At a hobbyist pace, I'll be posting about:
  • My Debian build process
  • Fluxbox configuration
  • Applications I use
  • Shell scripts that I've found helpful
I hope that publishing these configuration files and code snippets will be helpful to someone searching for answers in the future.