GNU/Linux tips & tricks
Contents
- What GNU/Linux distribution to use
- Keeping Windows as a failsafe: dual-boot
- Compiling your own kernel
- Installing software
- Getting KDE 3.1
- Browsing the internet
- Playing MP3 files and watching DivX movies
- Ripping CDs and encoding them to MP3
- Instant messengers (eg. MSN)
- Long distance computing
What GNU/Linux distribution to use
This was not a very easy question. It's not very efficient to just try and install every distribution. But I choose Debian because it is true to the GNU spirit and not driven by the desire for profit. It is not the easiest distribution out there. If you're looking for something simple you should use Ubuntu. Even easier to set-up is Knoppix which is a full feautered system that boots from CD, the safest way to try Linux. As a sidenote, both of these alternatives are based on Debian.
UPDATE: I now use Ubuntu on my workstation, and Debian on the server. Ubuntu is very easy *and* good. Debian is *very* stable.
Keeping Windows as a failsafe: dual-boot
Naturally I couldn't just simply throw Windows away and never use it again. Notably because of Word compatibility and to be able to play a game once in a while. Dual-boot seemed an easy solution. I decided to stick with the boot manager that came with Windows XP. So when Debian asked if it should update the Master Boot Record (MBR) I answered no, to preserve XP's bootmanager. After some research I found out that it was relatively simple to add Linux to XP's bootmenu. First of all, you have to make your Linux partition bootable. Lilo is a popular for tool his. It is configured with the file /etc/lilo.conf. Enter "man lilo.conf" for details. When you have configured Lilo you can enter "lilo" as root to install the bootsector (not the same as MBR). Next, this bootsector has to be saved to a file. This is done with dd. Example:
dd if=/dev/hda1 of=/mnt/dos/linimage.bin bs=512 count=1
This means that we want to read the bootsector of /dev/hda1, my Linux partition, and want to write that to a file on /mnt/dos, my Windows partition (well, the partition with the bootmanager). We want to read 512 bytes, 1 time. You can choose any filename you want but keep it in the 8.3 format.
After you have done this you have to edit the file boot.ini which configures the XP (or NT) bootmanager. This can be done in Linux or Windows. Note that this file is usually write protected with the R, H and S attributes, so first take care of that with attrib for example. Add an entry to the end of the file that looks like this:
c:\linimage.bin="Linux"
That should do it, now you should be able to boot Linux. You can also make Linux the default by changing the Default=... line in Default=c:\linimage.bin. By changing the Timeout= value you can change how many seconds the bootmanager will wait before it automaticly boots the default.
UPDATE: Word compatibility attained with the help of Antiword and don't play games anymore. My main computer is now completely Windows-free.
More resources: Linux HOWTOs - Boot loaders and booting the OS (Especially 'Linux+NT-Loader')
Compiling your own kernel
If you have hardware that isn't supported by the kernel suplied with your distribution it is possible that you can get support for it by compiling your own kernel. I simply installed a debian package called kernel-source-2.4.20 and I was ready to go. The package extracted the sources to /usr/src/kernel-source-2.4.20/. In this directory I enter the following commands to compile my kernel:
- make clean
- make menuconfig
- make dep
- make
- make bzImage
- make modules
- make install
- make modules_install
The make menuconfig will let you configure all the options with a nice menu. I recommend reading all the instructions avalaible for each entry before enabling it. You can enter all these commands in one line if you seperate them with a semicolon (";").
After compilation check if you have to run lilo or update the bootsector. Reboot and check with uname -a if you're actually running the kernel you just compiled (it should show the date on which you compiled the kernel).
Installing software
If you use Debian there is an excellent way to install software, with apt-get. It downloads pre-compiled packages and does everything automagicly. Enter 'apt-get install packagename' to install something. Other distributions, like Red Hat, use the rpm package manager or something else.
But sometimes there is no pre-compiled package available. In this case you'll have to compile the program yourself. You'll have to download what is called a tarball, which contains the sources of the program. Extract the files from the tarball with 'tar -xzf filename.tar.gz' (sometimes the extension is abbreviated to .tgz). Sometimes there is an INSTALL file which contains specific instructions, if so, read it (otherwise there could be information in the README film or on the website of the program). Usually it comes down to entering './configure', 'make' and finally as root 'make install'.
Getting KDE 3.1
The Debian woody distribution contains and old version of KDE, for some reason unknown to me. If you want the latest KDE version (you probably do) you can add a line to /etc/apt/sources.list containing a mirror with the latest pre-compiled KDE packages. You can find such a mirror at www.apt-get.org. This site contains a whole lot of mirrors with unofficial packages, search for "kde" with your browser. After you have added the line (it should start with "deb ") to the sources.list file you should run apt-get update to download the new package lists. If you get an error you have probably mispelled something in sources.list. Now hold your breath and run apt-get install kde to update KDE. Ofcourse you can also download the packages yourself and install them all with dpkg -i *.deb.
Browsing the internet
KDE contains an excellent browser: Konqueror. It has some very handy functions. For example, if you want to search something on Google you can simply enter "gg:what you want" or "ggl:what you want". ggl is equivelant to pressing "I'm feeling lucky", which automaticly takes you to the first search result. This is very handy when you're looking for an URL and need it fast.
There's also Mozilla, an open-source version of Netscape. If you want a very simple and fast graphical browser, get Dillo.
Another fast browser I recently discovered is Opera. It is not open-source software but you can use it for free because it is ad-supported.
For console mode there is links, also very fast. The link points to elinks, an enhanced version of links, which in turn is an enhanced version of "lynx", probably the first browser ever.
Playing MP3 files and watching DivX movies
There is a good graphical MP3 player called xmms. It looks very much like Winamp. If you want a player for console (text) mode you can try ksmp3play.
DivX support was surprisingly easy to achieve. I just installed xine and it works perfectly. There is support for subtitles. Another popular player for Linux is MPlayer. This one is a little bit harder to configure so I don't is it as much as xine.
Ripping CDs and encoding them to MP3
First you'll have to get a library for the digital audio extraction. I advise to use cdparanoia, which does a great job at actually getting the right data from your CDs. Then you'll need a MP3 encoder. Lame is a very good one. If you want a pre-compiled package look at www.apt-get.org for a mirror.
Now you have all the necessary software to make high quality MP3s from your CDs. If you don't want to type in all the command line switches everytime or maybe don't even want to know them, you can download jack. Jack is a frontend and supports, among others, cdparanoia and lame. For setting up jack I advise to read the manual.
Instant messengers (eg. MSN)
For console mode there is the excellent centericq. It supports the most popular protocols like ICQ and MSN. I advise to enable the 'chat mode' in the options. If you want something graphical (smileys, fonts) I recommend kmerlin.
Long distance computing
You can install a program that enables you to log-in to your computer from anywhere on the internet. This enables you to work on files while you are at school/work or on vacation. You can also turn off your computer remotley and do everything else you can do in text-mode.
In the past this was done with a program called telnet, but telnet is not secure, anyone can tap the connection and read in plaintext what is being transmitted. So they made "ssh", Secure SHell, which uses encryption. On most Linux distributions you will be asked if you want to enable ssh logins, so it should be easy to set up. A very good ssh client for Windows is PuTTY. Clients for MAC or even DOS also exist.
A very interesting program to use when using your GNU/Linux computer remotely is screen. Apart from being very handy as a "window manager" for console, you can "detach" and "attach" a screen session from wherever you happen to login to your computer. So you can keep your programs running while being able to control them from anywhere you want to.