Linux Newbie Guide
So, you've heard about this operating system called Linux, and are curious to try it out on your PC? This guide intends to demonstrate some of the basics, such as the layout of the Linux filesystem, how to install applications (through a package manager), and of course, how to get Linux running on your PC. (No responsibility is taken for any data loss, etc.).
Firstly, there are a number of options for installing it on your PC.
This is the standard installation method, which will install Linux on its own partitions on the hard drive. This can be done by itself (being the only OS on the computer), or as a dual-boot with another OS. If dualbooting with Windows, make sure to install Windows BEFORE installing Linux. Installing Windows after installing Linux will mean that the Windows bootloader will overwrite the Linux one (I think)...basically, you won't be able to boot Linux.
This is not really an installation method as such, but is very useful for trying Linux. What a LiveCD does, is that when you boot the PC with the LiveCD in the drive (and the BIOS set to boot off the optical drive), you will load a complete Linux desktop off the CD (loading it into RAM). You can try out an installation with this, and I find it particularly useful to use as a rescue disc in case you can't boot your standard OS. It is also a reasonably effective method of testing whether your hardware will be supported by default.
Many modern distros (Ubuntu is a prime example) will combine the Live CD and an install CD, essentially meaning that you can boot into the OS off the CD, and then install it to the hard drive through the CD. Some operating systems could also be installed from a USB pendrive in this way.
Wubi is a relatively new installation method which is designed for Ubuntu only (sorry for the Ubuntu references, but it's what I'm used to), where Linux will be installed (or uninstalled) though Windows as a Windows application, with the option to boot Ubuntu Linux placed in the Windows boot menu. Wubi does not repartition your hard drive.
If anyone's used VMware or similar virtualisation programs, they'll know what I'm talking about. It's useful if you need to run Linux at the same time as Windows (or OSX). An example would be if you're designing a webpage and want to see how it looks on a Linux machine compared to a Windows machine.
Partitioning Linux and the Linux filesystem
"Where's the C: drive?" is a cry of Linux newbies everywhere. The Linux (well, the UNIX filesystem) is arranged completely different to Windows. Rather than having a separate 'drive' for each physical drive, the whole filesystem is arranged in a tree. The main (I guess the closest thing to C:) part of this filesystem is the root directory. This is called /, and all other directories will fall under this. Extra physical drives will be mounted (made so Linux can access them) through other directories (like /media/cdrom or /movies).
These directories have their own functions, as do the "Program Files" and "Documents and Settings" directories on a Windows machine. Some of these directories work in a similar way to Windows directories:
/home/username - This is the Linux equivalent of the C:\Documents and Settings\Username directory. In a standard install it is the only directory that non-root (Administrator) users have write access to. /usr and /opt - These are roughly the equivalent of the Program Files directory, and will contain installed applications.
Now, back to partitioning. On a single-drive, Linux-only machine, you can have a minimum of two partitions. The first partition will be the root directory (/), which will take up nearly all of the hard drive space. The second partition will be the swap directory (equivalent of pagefile.sys), which will not be visible to users. Typically the swap directory is to be twice the size of the amount of RAM in the machine, but I've usually made mine about 512MB-1GB, with no hit to performance.
Many systems will wish to put some directories as a separate partition (even on a separate physical drive), so you might allocate a certain amount of space for the root directory, and another partition for the /home directory.
The process for partitioning your system during installation will vary between distributions. The example distribution Ubuntu includes a simple partitioning tool in all of the installation media, it will allow you to create the standard maximum of 4 primary partitions and then logical partitions within, with support for creating most of the popular file-systems, NTFS excluded (desirable?).
Why are there so many different distributions?
The reason for the large variety of distributions is that Linux is all about choice and customisation. No two PCs are the same, and no two users are the same. The major differences between distributions are the package management systems (how to install programs), the standard desktop used (the two largest are GNOME and KDE), and the extra applications used. Some people will prefer the KDE desktop with Debian's APT package manager, others will prefer GNOME using Redhat/Fedora's RPM package management system. Some will desire only the applications they use everyday to be installed by default, others will want everything and the kitchen sink installed. Some will want flashy desktops with 3D effects on the windows, some will want a minimal desktop designed to run on low-end hardware, and some will require no graphical desktop at all (perhaps with server applications installed). This is before even discussing the plethora of different options there are for server environments.
One of the most popular distributions currently out there is the Ubuntu Linux distribution. The standard distribution is based on APT with a GNOME desktop (although derivatives of Ubuntu come with other desktops).
A time-line of Linux distributions can be found here showing the main forks and where the various distributions are built from.
Why would I want to use Linux?
There are a multitude of reasons why people use Linux. Some of them are listed below. This is by no means exhaustive.
- Software Cost: Linux is 100% free. Will not cost you a cent of your hard-earned (other than perhaps to cover the cost of a disc to burn it on). You are legally entitled to copy, redistribute and even modify the software in any way you see fit to suit your needs. Some distributions such as Ubuntu provide a service where they will happily ship a professionally cut disc of the latest release to you anywhere in the world - for free! Alternatively, just download the ISO image and burn it to a blank disc.
- Hardware Cost: Linux is a very efficient and robust operating system with has a very low resource footprint in comparison to other popular commercial operating systems. Many people have used Linux to rejuvenate an old PC and attained close to as much renewed response time out of it as a modern day PC and the upshot is you get access to a multitude of modern-era software too! And unlike some commercial OS', you are not required to upgrade your hardware to be able to run the latest and greatest version of the OS everytime. :-)
- Flexibility: Linux is completely modifiable to suit YOUR needs, not what the vendor THINKS you need. One such example is the multitude of new distros built to service specific purposes out of one parent distro. Distros born from Ubuntu include Mythbuntu (PVR/media), Ubuntu Studio (music/video editing), Mint (multimedia-ready desktop), and Crunchbang (fast desktop with small memory footprint). There are even variants of the standard Ubuntu distro to suit specialised needs such as Ubuntu Christian Edition and Ubuntu Muslim Edition - each with modifications to things such as firewall rules for child-safe Internet surfing, and the provision of extra educational software such as Bible/Kuran study that can be very useful to its intended audience. This is just a sample of the variants out there.
- Freedom: The concept behind Linux is that software should be free for anyone to use, learn from and improve upon. Nearly all Linux software is released under the GNU Public Licence (GPL) version 2 or greater. This licence legally protects developers to be able to freely distribute their software and receive recognition for it without the risk of someone ripping your efforts off as their own. This is the ultimate pooling of knowledge and is of enormous benefit to the next generation of coders. Some of the greatest software we take for granted today was born as Free Software on Linux and ported to other platforms.
- Reliability: Some of the biggest corporates including the likes of HP and IBM, and a huge number of websites use Linux over other alternatives because of one simple feature - reliability and a reduction in the Total Cost of Ownership (TCO). It is not uncommon to see Linux servers running for years without a restart. This reduces the costs needed to maintain and run a server because you don't need technicians fawning over it all the time.
- Fun: Linux provides a unique window into how an Operating System is put together and how it works. It is also just downright fun using it, customising it to what you want or need. It suits the hardened geek to the most timid grandmother and everything in between. Linux is not hard - if you can move around Windows or OS X, you can move around Linux. Many AmigaOS stalwarts have found a new home in Linux with its familiar environment.
- Ease of use: Contrary to popular belief, Linux has far fewer issues installing new hardware and gaining access to new software than the Redmond giant. Linux makes use of "repositories" which are giant pools of software that can be installed at the click of a mouse, or a single command on the command-line. No manual downloading, unpacking and installing of software, and with the use of package managers to access these repositories, you can be kept up to date with the latest versions of all software, not just the operating system, without being encumbered by an "Update" website that you can only download from if you meet certain "Genuine Advantage" requirements. There is a Linux equivalent of almost everything you have used on a commercial operating system and it is rare to need to step outside of what the repository offers you. For example, Ubuntu has a repository that is over 45GB in size comprising more than 25,000 pieces of individual software covering just about every gamut imaginable.
This is distribution dependent, and relies quite heavily on which package management system is used.
Software is usually installed from online software repositories. Software can be installed by using the command line interface (CLI) or by using a graphical user interface (GUI). Differences in the CLI syntax varies by distribution, as does the GUI software. Popular GUI software includes Synaptic for systems based on Debian that use the apt method.
Installing software using a CLI is usually not as bad or painful as people new to linux imagine. For example, to install the Mozilla Firefox web-brower using the Debian APT package manager (continuing with the Ubuntu theme):
apt-get install mozilla-firefox
Will attempt to install the package "mozilla-firefox", however, installing packages requires administrator privileges, so, generally, unless you're logged in as root (which is not advised), you will need to use one of either the sudo or su commands. Su temporarily allows the current user assume the shell and thus privileges of another user, wheras sudo allows you to issue one command or series of commands as another user, once the command has completed, you're back to your original shell, seemingly having never left. Until someone familiar with su adds something, we'll continue the article using sudo:
sudo apt-get install mozilla-firefox
Will attempt to install mozilla-firefox with superuser privileges. Immediately after issuing this command, you will be asked for the superuser password. Given the correct password, it will download and install the package and any dependencies as root, and all will be well.
Dependencies are basically packages or files which another package requires in order to run correctly. For example, the package firefox-greasemonkey, which installs the popular greasemonkey plugin for firefox, requires that several of the core firefox packages be installed first. You cannot add plugins to a browser that is not yet installed after all.