web stats

Tips For Linux Newbies

I would like this thread to become a compilation of various tips and tricks Linux newbies usually learn through much cursing and reading countless man pages and forums. This is meant to save people time when creating a working Linux system. I’m primarily focussing on desktop configurations myself, but I don’t mind if you add server tips as well. I’m still learning about Linux every day, so if you do not agree with what I wwrite, feel free to comment.

First of all, to the newbie: Linux is not Windows. No, you don’t need to read this whole rant, and no, I don’t agree with everything it says. It comes down to the fact that Linux is completely different from Windows. Linux is made by coders to do what they want it to do, not what the majority of people on this planet want. Because of that, it’s often more difficult to get something going, but once it’s up and running it usually works very well. If you don’t have any technical knowledge and don’t want to learn about computers, stay away from this thread; and IMO, stay away from Linux.

A little joke to illustrate my point:
*What do Linux users actually do with their computer?
-They spend weeks configuring it so that if they actually had to get some work done they could do it, and then they reformat and start again with a new release / distribution.

That’s not exactly true, but it is true that Linux generally takes more work to get up and running than Windows. It’s like using lego versus playmobil: half the fun is in building things, but you can’t actually play with it the way it comes from the store.

I’m going to assume the people who read this thread know at least the basics about the difference between hardware and software, what the main components in a computer are and have already read a bit about Linux. If not, feel free to start reading anyway and google anything you don’t understand.

First things first: partitioning your harddrive.

Partitioning your harddrive correctly is very important. It’s difficult to change your partition layout once your system is installed without breaking everything, and a good partition layout will make your system perform a lot better. Most distributions use a really shitty default partition layout, so make your own.

Here is the general layout I use (for a desktop system):
sda1 = swap = 512 Mb = swap
sda2 = /boot = 64 Mb = ext2
sda3 = / = 8 Gb = ext4
sda4 = /home = rest of the disk = ext4

swap: Swap space is virtual RAM, when you run out of RAM your OS starts filling your swap space. Make sure your swap partition is always the first partition on the disk. If swap is necessary it is accessed often so you want to put it on the fastest sectors of your harddisk. As your harddisk spins at a constant rate, the outer most sectors are read and written to faster, and harddisks are filled starting from the outside. Wether you need a swap partition or not is a huge debate. In my opinion, any desktop with at least 2 Gb of RAM does not need swap space, so modern computers don’t need it. On hardware with less RAM, use once or twice your RAM size, don’t go making a 2 Gb swap partition if you have 1 Gb of RAM, that’s ridiculous IMO. If you have multiple harddisks, devide your swap over the first sectors of all your harddisks, this makes it a tiny bit faster still. EDIT TO ADD: It seems hybernate puts everything in Ram in your swap partition, so it might be necessary to use a swap partition at least as big as your RAM to make sure hibernate functions properly. Will add when I figure out if and how every distro (well, at least the distro’s I care about) does this.

/boot The /boot folder is where Linux stores its kernel and the bootloader if it’s too big to fit in the MBR of your harddisk. Putting your kernel on a seperate tiny /boot partition formatted in ext2 reduces your boot time with 10 – 30 seconds. I don’t know the exact technical details of why it works, but it works; just make sure it’s not too big and it’s ext2. I don’t know why none of the distros I tried include this in their default partition layout, it doesn’t waste space and it’s a huge perceived performance boost when your system boots a lot faster.

/ The root of your system. This is where your whole operating system and all your applications will go (unless you make an even more advanced partitioning scheme, but that’s only really necessary on servers). For most distros, 8 Gb is enough, unless you’re going to install a lot of very big applications. For a small distro (like Crunchbang, my favorite lightweight easy to use distro) 4 Gb is plenty with room to spare for installing applications. If you’re using Gentoo (another distro I love) and intend on using Gnome or KDE you need at least 15 Gb of space in / ; preferably 20 Gb. Gentoo wastes a lot of space because it keeps the source of everything you install so you don’t have to redownload it when you want to reinstall it, and the compiling itself can also use up a sizeable amount of harddisk space. Ext4 because it’s the best.

/home is where all your personal files go. Documents, movies, music, pictures, it’s all in /home, so make this partition the biggest. Also ext4 because it’s the best, unless you want to access it from within Windows, in that case, make it NTFS.

Most distros have a graphical installer which makes it very easy to make your own partition layout, so do it. Assigning the mountpoints is usually nothing more than selecting them in a dropdown menu.

Once the installation is finished, edit /etc/fstab and add the options noatime,nodiratime (use relatime if any of your applications needs acces times to work properly – unlikely btw) to any ext3/4 partition and the option noauto to your /boot partition. And remember to mount it if you’re going to change your bootloader or your kernel. This way you avoid the file system check which happens automatically on any ext2 partition after x ammount of mounts. As your boot partition is read without mounting it during bootup and usually never written to, this check is not necessary.

More is for later.


Short guide to compiling from source

So for one reason or another you’ve downloaded an application as source instead of using your distro’s repositories. Either it’s not available in the repositories or it’s not the right version or you just wanna try something different (I personally don’t see any reason not to use the repositories if they have the version you want because they often add little patches to make an app work better with your specific ditribution, but you can do whatever the hell you want, that’s why you’re using linux in the first place). Now you’re staring at that darn tarball and you’re asking yourself “Now how do I install this thing? Clicking won’t work, drag-and-dropping to my programs menu won’t work?” Really simple, but there are a few things you should watch. Let’s say you wanna install application Duck and you’ve opened a console and navigated to the folder with the tarball (which is an archive, like a .zip / .rar file in case you’re wondering what that thing actually is) in it.

Untarring the tarball:

If the tarball ends in .tar.bz2 use
tar -xvjf ./duck-2.0.6.tar.bz2
If the tarball ends in .tar.gz use
tar -xvzf ./duck-2.0.6.tar.gz

Now you should have a folder named duck. Move in that folder, and here’s the part most people forget: Read the included textfiles. Read any file titled “help”, “installing”, “readme”, “release notes” etc., any file meant for you to read it. Or at least skim trough them. Those files will tell you about any dependencies you need to install first (and the developers of this awesome app didn’t bother to mention on their webpage or just forgot to mention), known problems with certain distributions / configurations / other installed applications / other things you need to take care of to actually get it working.

Compiling and installing the application

Now you’re in the recently untarred folder, you’ve scrutinized all the files you’re supposed to read / ignored them all (whatever – linux is all about choice, innit?) and installed any dependencies. Now you just type these commands:
./configure
make
make install
make clean

The last three commands can be combined into one:
make install clean

The “make clean” command is often forgotten. It deletes any files created for the compilation and installation process which aren’t needed for the installed application to run. Some people like to keep the installable executables so they don’t need to recompile while reinstalling an application. I like to keep my drive free of clutter, so I always issue a “make clean” after the installation is done; I’ve never had to install really large applications from source so compile times are not much of an issue to me. It’s up to you.

Most problems during installing from source – like most problems in Linux in general – arise because people don’t take the effort of reading the files they should read before installing. It can be a pain, especially if it’s a file full of coders patting their own backs with nothing useful in it. However, unlike most Windows readme files, there’s often very useful information in readme files in Linux.


In this thread I’m going to explain the basics of wine. I think it would be useful if we all post the apps we have runnng under wine and what we did to get it running.

What is WINE and does it work?

WINE is an attempt to write an open source windows API from scratch for linux. This involves “blackbox reverse engineering” – meaning they have no access to code. The entire thing is written by prodding and poking at MS binaries and attempting to copy the response. As a result it may not always work. What works and does not work depends on what calls the software makes and whether or not wine has implemented that call.

How do i Install WINE?

Install wine the same way you install any other app on you distro. Some distros delay upgrading to newer versions of WINE due to regression issues. If you wish you can also compile it from source.

Most of the time people use winetricks along side of wine. winetricks is a script that downloads MS libraries that are “freely redistributable” and installs them (with WINE). for example MS office spellcheck will not work without installing the “Microsoft Jscripy library” and so on.

you can download winetricks from:
Winetricks

you will need to set it as an exectutable before running it, This can be done with:
chmod +x /path/to/winetricks

How do i run apps with WINE?

it can be as simple as:

wine /path/to/executable.exe

but wine is not perfect, in many cases you will have to override dlls and install libraries with winetricks. It is not as difficult as it sounds but sometimes you may have to sacrifice many animals to various gods.

you can see exactly how well WINE handles your app by searching: WineHQ

for the sake of this tutorial

we will install MS office 2007

. The process is similar for all apps

wine appdb says office installer “works fine”. NOTE: This does not mean it will run, it only means it will successfully install, we will have to do more tweaking before it can run.

The first step is to install MS office 2007
you can install msoffice with:

wine /path/to/office/setup.exe

run the setup as normal type in your CD key ( 🙂 ). It will install the same as windows. After it has finished installing (you can close the installer) run:

winecfg

This is the wine configuration utility, here you can set overrides to various DLLs. For this particular app we will have to do a few things to get it running.
reading the wine appdb, we have to:

> set riched20.dll to “native(windows)”
we do this by going to the Libraries tab in the area labeled “New override for library” type in riched20.dll and click on Add. click on the Edit button. Set it to Native (Windows) and click OK.

> set usp10 to ‘native,builtin’ (done the same way as above)

In this case we will have to install jscript to get spellcheck to work. Making sure winetricks is set to exectubale – we type in a new terminal window:

/path/to/./winetricks wsh56js

This will install Jscript for you after that is done you can run MS office on linux.

other stuff

The above process of installing MS office is the same way you install all apps under WINE – sometimes you will have to muck about with winecfg and winetricks quite a bit longer (WINE appdb will tell you exactly what to do)
Sometimes wine appdb can be a bitch to decipher but if you app is even halfway popular someone has probably blogged it.

Windows app fonts look terrible under linux if you don’t have MS fonts installed. you can install them here: Corefonts

If you want an easier WINE way and don’t mind paying there are several supported GUI wine installers:
cadega – supported wine for games
crossover – suppoted wine for apps

Leave a Reply