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.