Sunday, November 22, 2009

Ubuntu variantions

In last few years Ubuntu has become a very popular Linux distribution. It's very user-friendly, powerful, but also lightweight. Basically it contains only one window manager - Gnome. This is because the founder of Ubuntu, Mark Shuttleworth didn't want Ubuntu to be too complex. Thanks to this it is also possible to have Ubuntu on one single CD. But there are many people, who prefer other window manager like KDE rather than Gnome. For those people there many Ubuntu variants available. Now let's have a look at those variants.
  • Ubuntu is the standard edition with Gnome
  • Kubuntu is basically a usual Ubuntu, but with KDE.
  • Xubuntu uses Xfce as a windows manager and tends to be more lightweight.
  • Fluxbuntu with Fluxbox as a windows manager
  • Edubuntu is designed to be used in schools and for education.
  • UbuntuLite should be extremely lightweight and easy to use.
  • Ubuntu CE is a Christian edition of ubuntu
  • Ubuntu Muslim Edition is self-describing

So as you can see, Ubuntu is very flexible, though most people will be just fine with Ubuntu or Kubuntu, which are the most usual variants. Please note, that you can have some combined version as well. For example you can use KDE in Ubuntu as well. It may be simply installed by typing 

sudo apt-get install kdebase

 to your console. So it's up to you to decide which version you would like to use, but as you can see it's not a big problem it you change your mind later.

Sunday, November 15, 2009

How I have installed Debian Linux on D945GSEJT

I have recently upgraded my home server, which was running running on an old Via Epia motherboard. I decided to try one of the Intel motherboards - D945GSEJT. It seemed to me as a good solution. It contains Atom N270 processor, which is just powerful enough to run my small server, Gigabit LAN, 2 SATA connectors, 1 PCI for further expansion and one mini-PCIEx for Wlan adapter.

The mainboard contains notebook chipset, which is really power efficient, but be careful when ordering the memory module, because there is only notebook SODIMM DDR II slot. I bought a Kingston 667MHz module, which works just fine. Also note the power connector. There's no big ATX connector, so there's no need for an ATX power source. All you need is 12V power adapter.

The mainboard itself came in bulk with nothing much extra, but there's no need for anything. The first problem I had was, that I didn't mention the lack of 40-pin IDE when I was ordering this mainboard. There's only one 44-pin notebook IDE, which I have used to install 1024MB flash for the operating system, because I don't want to have the system on my RAID array.

So I installed everything into an EMCO mini-ITX case, but for the power I have used one DC/DC converter, because I wanted the server to be powered by 24V. I have already another ATX power source in the case, which I have used to power my two RAID hard-drives. I know, that it is really not necessary to have two power sources, but it feels a bit safer to me, because I don't want to loose any data.

Now here came the time to install the operating system. I have decided to put my favorite Debian Lenny, which is indeed a really great choice for a server. I have booted the netinstall from a flash, but I didn't get too far, because the Realtek Ethernet Controller wasn't properly recognised by the installer. I decided to install the system by installing another PCI Ethernet Controller, using which I have successfully installed the Debian.

After the installation I wanted to make my onboard controller work. I tried searched a bit and I have found out, that the solution would be to install r8168 kernel module. So I downloaded the sources and compiled the module. This way I got it to work, but I have noticed that after few hours of running the Ethernet disconnects. I wondered what to do and I have finally found out, that the issue is fixed in newer kernel and the controller works with r8169 module in recent kernel versions.

I downloaded the 2.6.31-4 kernel source and after successful compilation, which indeed took very long (10 hours) on this mainboard, I installed it. When I rebooted the system I got fully working network running at 1Gbit with no service interruptions like with r8168. So if you have a similar problem, then this is the way to go. Just upgrade to newest kernel and use r8169 module.

Overall I must say, that I quite happy with this piece of hardware. With two hard drives connected it takes about 20W and it's completely fan-less, which is nice. The only problem I had was during the installation, but that was nothing too problematic to solve. So if you're deciding which mainboard to buy for your next server, then I can really recommend you this one.

You can find similar articles from another authors here:

Saturday, November 14, 2009

Man Pages in Linux

In today's article we will talk about manual pages, or so called man pages in Linux. So what are they good for? Everybody once gets into a situation, when he needs to know a syntax for some command. You may of course search on Google but there's also one alternative way provided natively in almost every Linux distribution. I am of course talking about those man pages.

Now imagine, that you would like to know anything about the ls command. This is the time, when man pages may be very useful. Just type this into the console:

man ls

You will get into a program for viewing these pages and the man page for ls will be opened. Right now you can have a look at the syntax, at some description and at the available parameters. At the end you will be able to see some informations about the program itself, like its author and other informations. Now that you have read all the informations you will want to leave back to the console. This is done by typing :q on your keyboard.

So this is how you may use man pages. Sometimes you may get into a situation, when there's no Linux console available. In this case you may view man pages on this website:

Thursday, November 12, 2009

Free Disk space in Linux (df command)

Have you ever wondered how to find out how much free space you have on your hard drive? It's really easy to find out and we will discuss this in today's article. Just run this command:


 This will give you a table with remaining space on all of your disks. There are some options you may use with this command. I will list some of the most important.

  • -h, --human-readable - will show results in human readable format (e.g. 256M, 80G)
  • -H, --si - likewise, but use powers of 1000, not 1024
  • -l, --local - limit to local file systems only
  • -t, --type=TYPE - limit to file systems of given type only

So this is how to find out your free disk space. It should work on all linux distributions.

Wednesday, November 11, 2009

/etc/hosts file

File /etc/hosts is a configuration file you will find in almost any operating system including for example Windows. It is a very basic file for configuring the network. This one is used for locally mapping hostnames to IP addresses. The system will always prefer to use /etc/hosts file, rather than any DNS server. So if you have a record with an IP address in your /etc/hosts the system will use this one, if you try to access the hostname you specify.

The syntax is really easy. First you specify an IP address of the host and then all aliases divided by a space. You may specify unlimited number of aliases. So your /etc/host file may look like this: localhost my-computer server second-computer

 Once you save this file you may try a ping to second-computer or server and it will go to The changes you made will be applied immediately once you save the file. There's no need to restart any service or run some program.

There are some limitations for the alias format. It may contain any alphanumeric character,  minus sign ("-") and a dot (".") but these two must not be located on the beginning or at the end of the alias.

You may also find this file useful, when you would like to block to some server with for example fraudulent content. If you'd like to block access to for example you can add this line:

This will resolve as, which doesn't lead anywhere.

Tuesday, November 10, 2009

Setting up NFS server

Though using samba may work really well sometimes you may like to have a more native linux solution for sharing files. A situation, where I would use NFS rather than Samba is a sharing between two linux computers.

First you will have to install a package providing nfs server on your system. On ubuntu or debian I would do that by

apt-get install nfs-kernel-server

Now, assuming that you have an NFS daemon installed it's time for configuring it. The configuration in stored in /etc/exports file and should look like this, when you open it:

# /etc/exports: the access control list for filesystems which may be exported
# to NFS clients. See exports(5).
# Example for NFSv2 and NFSv3:
# /srv/homes hostname1(rw,sync,no_subtree_check) 
# Example for NFSv4:
# /srv/nfs4 gss/krb5i(rw,sync,fsid=0,crossmnt,no_subtree_check)
# /srv/nfs4/homes gss/krb5i(rw,sync,no_subtree_check)

Every single line in this file will create a new exported (shared) folder. Let's imagine, that you would like to make folder /sharing available to all computers in your local network. This is achieved by this line:


As you can see the syntax is really easy. First you specify the folder, you would like to export, and then the host, that will have access to this share. I have specified an ip address and a mask, which will allow access to all computers with ip range from The ip address is specified in a format of address/mask. The mask may be written in both formats(,24)-You can specify a hostname, or a domain as well. Setting * will allow access to anyone.

All other options are specified inside parenthesis right after the allowed clients. Let's specify at least the most important ones.

  • ro - read only
  • rw - read and write
  • sync - reply to requests only after the changes have been committed to stable storage
  • no_subtree_check - disables subtree check
  • root_squash - maps requests from uid 0 to anonymous user
  • no_root_squash - turns off root squashing - will access all files as root
  • all_squash - maps all users to anonymous user

I know, that some explanations aren't absolutely clear. You may have a look at man exports for more detailed description.

Every time you finish altering /etc/exports you must execute this:

exportfs -a

After this your nfs server is all set and you should be ready to connect.

Monday, November 9, 2009

/etc/fstab file

Imagine a situation that you have mounted something (e.g. some nfs share) anywhere on your system using the mount command. Everything works fine but if you restart your computer, your folder is not mounted anymore. 

If you would like your system to mount everything on boot, updating /etc/fstab file is the way to go. The file fstab is a plain text configuration file for setting mount points. Fstab is an abbreviation of File System Table. For altering this file you'll need to become root. It should be located in /etc/fstab on all distributions.

If you open your fstab file it should look like this one:

# /etc/fstab: static file system information.
# Use 'vol_id --uuid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
proc /proc proc defaults 0 0  
/dev/sda1 / ext3 defaults 0 1
/dev/scd0 /media/cdrom0 udf,iso9660 user,noauto,exec,utf8 0 0
/dev/sda5 /win ntfs 0 0

You can see, that the syntax is very simple. Every one line in this file stands for one mounted device. There should always be 6 parameters on every line, divided by one or more spaces.

The first parameter is the device you would like to mount and the second one specifies the mount point (a folder, where the device will be mounted). The third parameter stands for the file system. You may also specify auto, if you wish to let the system guess.

The fourth parameter is for writing parameters. The most important are:

  • noauto - don't connect automatically on startup
  • users - users can access this device
  • codepage - codepage of filenames
  • iocharset - codepage to which the filenames will be converted
  • noexec - don't execute files on this device
  • umask - setting file access rights mask
  • ro - read only
  • rw - read and write.

All values are separated by comma(,). If you don't have any parameters to set write defaults.

The fifth parameter may only be 1 or 0. If you'd like this drive to be backuped by the dump, then set 1, otherwise set 0.

And finally, the sixth parameter marks the order for drive check by the fsck. The root folder / should always be checked first, so set 1. If you don't want your drive to be checked, then write 0. This will disable the check.

You can of course use fstab to mount nfs or samba shares. This is an example of setting nfs share: /mnt/server nfs rw 0 0

If you have this line in your fstab file, then /sharing folder on will be always mounted to /mnt/server on your local system. If you are using samba, then it is very similar, but you will usually have to set your username and a password.

// /mnt/server smbfs username=user,password=pass,rw 0 0

If you are looking for more detailed description, then you may have a look at fstab man page.

Sunday, November 8, 2009

How to use mount

In Windows operating system you have one root folder for device you connect (eg. C:,D:..), but in Linux, or any POSIX system in general, there is always only one root folder /. This root folder is a place, where your main hdd is usually mounted, but if you wish to work with another disk, or any other device, you will have to create a new folder and then mount the device to this folder.

Let's imagine, that you have just connected a flash disk and you would like to have a look at the data in your flash. First you will have to find the device descriptor for your flash. All descriptors are located in /dev folder. Every connected device should have its own descriptor in this directory. All hard drives descriptors are called /dev/hdx, where x is a letter. Your first hdd should be /dev/hda. But you will need to mount the partition, not the drive itself. Partitions are called /dev/hdxy, where x is still the same letter, and y is a number marking the partition. So if you have one partition on disk /dev/hda it should be called /dev/hda1.

There's one small complication with non-IDE drives. These are not called /dev/hdx, but /dev/sdx. The sd stands for "special device". But now, to make things easier, in kernel 2.6.31 and newer, there are no /dev/hdx devices anymore. Every storage device is now called /dev/sdx, no matter, whether it's an IDE device, or not.

If you have connected your flash, you should be shown some message showing the descriptor for your new device. Now imagine your new flash is called /dev/sdc and has one partition called /dev/sdc1, which you would like to mount to /mnt/flash. First thing you will have to do is to make sure, that you have folder /mnt/flash on your system and then mount the flash.

mkdir /mnt/flash
mount /dev/sdc1 /mnt/flash

Now you should be able to view the /mnt/flash directory, where you should see the contents of your flash disk. We have used the mount command for the first time. Its basic syntax is 

mount -t type device dir

 If you don't specify the -t option, as we did, mount will try to decide the type (e.g. filesystem) itself. Now you know how to mount a storage device but mount can do even more interesting things.  You can for example mount a nfs share to your computer.

mount -t nfs /mnt/server

 This would mount a share folder located on to our local /mnt/server folder. If your server is running Windows and has a samba share, you can mount it as well.

mount -t smbfs // /mnt/server -o username=user,password=pass

You can see, that there is some difference. You will have to specify your username and your password to make it work.

So now we have something mounted, but you may also want to unmount something. We will use the umount command. Its syntax is really simple. It may look like this

umount /dev/sdc1

If you have troubles, like getting "device is bussy" you may also try this.

umount -l /dev/sdc1

This should work as a workaround. Please note, that if you mount with the mount command it will be mounted only until you restart the system. If you wish your mount to stay mounted even after reboot, you would have to use /etc/fstab file. We will have a look at this next time.

Saturday, November 7, 2009

How to set up Samba server

Imagine, that you have a computer running linux (e.g. home server) and you would like to share some files with your windows computer. Now you have two possibilities. You can either install nfs client on your windows computer, or a samba server on linux. Today we will have a look on how to set up a samba server on your linux system.

First you will need to install the samba itself. This differs a lot according to your distribution, but on debian I would do simply

apt-get install samba

Now, that you have the samba installed on your computer, it's time for the funny part, the configuration. The main configuration file of samba should be /etc/samba/smb.conf. It will be filled with some default data, but I recommend you to delete this file and start writing a new one with your favourite editor.

rm /etc/samba/smb.conf
nano /etc/samba/smb.conf

Now fill your new file with this:

workgroup = MASLIK.CZ
server string = samba server
browseable = yes
hosts allow = 10.0.0.
security = user
hide dot files = yes

path = /export
browseable = yes
writable = yes

 This is the very basic configuration. You should of course fill your own values to workgroup and hosts allow in the global part. After that part we define all of our shares. I have one folder defined. For windows clients it will be shown as a sharing folder (the [sharing] string manages this), but the real folder shared is /export. You may of course also set writable = no, if you wish to have a read-only folder.

After changing the configuration file you should restart the samba daemons, if you are not planning to restart your computer.

/etc/init.d/samba restart

Now the last step, you have to take is to make a new samba password for any user, that will have access to your samba server. You will do that by this command:

smbpasswd -a user

After entering this command you will be prompted to enter the new password. This would create a password for user user, so fill your own username. Finally you may also like to use chmod to update the access rights to your shared folder.

So I wish you good luck with setting up your server. Samba of course gives us many more possibilities of settings. One of the most important is a printer sharing. We will have a look at that next time.