Cheap VPS & Xen Server


Residential Proxy Network - Hourly & Monthly Packages

Ubuntu 11.04 Generic – The SysAdmin Way


In this tutorial I will guide you trough the setup of Ubuntu 11.04 Generic system the way a good linux system administrator would install it. After it is complete you will have a great starting point for all of your future Ubuntu linux needs. By that I mean the following: If you are using virtual environment, you will have an image that you can clone and convert in any supported virtual format and use it as a starting point for all of your Ubuntu virtual projects. If you install this on a real hardware you can also clone you installation and use it as a starting point on various other machines with similar hardware. I will not cover cloning and conversion in this tutorial. Also as I will edit and tweak few system settings in this tutorial that I will not explain much, I hope this guide will encourage you to further explore those options and Linux in general. So let us start!

01. What you will need

If you want to test things in virtual environment I would recommend using VirtualBox, as it is free virtual manager that will work in most operating systems. If you plan to do the installation an real hardware, any desktop/notebook/workstation/server will work (even the really old ones). For this specific installation I will use Ubuntu 11.04 MinimalCD, so you will need an internet connection to download parts of installation during the setup process.

 

02. How long will it take

If you know your way around Linux, hour or two minimum. If you are basic user, a little longer.

 

03. Generic Ubuntu Installation – The installation

Download Ubuntu 11.04 MinimalCD, burn it on a CD and boot you computer/virtual machine from it.

01

Select Advanced options.

02

Select Command-line expert install.

03

Select Choose language.

04

Choose you default language. I will continue with English, but you can select whatever language you prefer (based on the country you live in).

05

Select your location (country you live in). I will continue with US.

06

Based on the location you selected in previous step, choose you locales. I will continue with en_US.UTF-8.

07

If you want you can select another language. If you did not go with English in the previous step you can select it now. If you think it will not be needed, just press Continue.

08

Configure the keyboard.

09

Select Yes to configure keyboard.

10

Press one of the offered keys.

11

Select No, unless you speak German or similar language that has required character.

12

Press required character if you speak Croatian or similar language.

13

Select proper value for your AltGr key (if you have one). Mine is right alt.

14

Select proper value for your Compose key (if you have one). I don’t have that key.

15

Press Enter to detect network hardware.

16

Deselect usb-storage. It will come again later in the installation, so you will also deselect this option.

17

Just press Continue. It will also come again later in the install, so you will press Continue again.

18

Press Enter to configure the network.

19

Press Yes if you wat to auto-configure you network over DHCP. If you don’t wan’t to do that, or you don’t have DHCP server/router in front of your machine, press No. I will use DHCP auto-configuration.

20

Select hostname for your installation. Go with generic name like u1104x64 (Ubuntu 11.04 x64) as this is a generic installation.

21

Leave the domain name blank.

22

Press Enter to select an Ubuntu archive mirror.

23

Select http protocol for file downloads.

24

Go to the top of the list and select enter information manually.

25

Enter archive.ubuntu.com as we are going to use the default Ubuntu archive mirror.

26

Press Continue and leave archive mirror directory as it is.

27

Fill in the proxy information if you use one. Leave it blank if your proxy is transparent or you don’t use one.

28

Press Enter to download installer components.

29

Just press Continue, we won’t select nothing now, as we want a clean installation.

30

Now you can go do something else, as this step will last a couple of minutes.

31

Press Enter to configure the clock.

32

Choose Yes to configure clock using NTP.

33

Enter settings for NTP server nearest to your location (as I’m in Zagreb/Croatia mine is zg1.ntp.carnet.hr).

34

Press Yes if time zone selected is ok for you.

35

Press Enter to detect disks.

36

Press Enter to partition disks.

37

Select Manual partitioning method.

38

Select hard disk and press Enter to continue. Mine is marked as SCSI1 and sda, wich does not have to be your case.

39

Select Yes to create a new partition table.

40

Select msdos type as the most general one.

41

Select FREE SPACE line and press Enter to create first partition. I’m going to use all physical partitions, so I can use max. four of them. If you need more you will have to use logical partitions, which I’m not gonna cover in this tutorial.

42

Select Create a new partition and press Enter.

43

Our first partiton is goint to be /boot, and I don’t plan to use more than 128 MB for that one. If you think that for some reason you need more space for /boot partition, enter the value you find sutable.

44

Select Primary and press Enter.

45

Select Beginning and press Enter.

46

Let’s configure our /boot partition with the following options:

  • Use as: Ext4 journaling file system – as this is /boot partition we have no other option than Ext4 so we’ll use that one.
  • Mount point: /boot – This one explains it’s self.
  • Mount options: noatime – Linux records information about when files were created and last modified as well as when it was last accessed. There is a cost associated with recording the last access time. As I’m always trying to get the most performace out of my installations I will use noatime mount option (which will not record information listed before), as it may lead to significant performance improvements.
  • Label: none – I don’t use labels, which does not have to stop you from using ones.
  • Reserved blocks: 0% – Reserved block percentage reserves X percentage (default 5) of file system blocks for root/privileged user and prevents the root/privileged user owned processes from failure when file system is 100% full. As a good SysAdmin I’m always watching (monitoring) to have enough free space on my HDD-s, so I don’t use reserverd blocks. If you forget on things like that, leave this value at 5% default.
  • Typical usage: standard – Leave the default value.
  • Bootable flag: on – Set to on, as it is /boot partition.

To finish the process position yourself to Done setting up the partition and press

47

 

Select FREE SPACE line and press Enter to create second partition.

48

This will be our swap partition, and if we stick to some general rules when creating swap partitions, we should use the size that is equal to our RAM size, or RAM size times 1.5. Since I have a VM with 512 MB of RAM I will use 768 MB for swap space. Ofcourse todays computers all come with large RAM size, so you can use some small value like 1 GB, or skip this step and don’t use swap at all.

44

Select Primary and press Enter.

45

Select Beginning and press Enter.

49

Set this partition as seen on picture. Set Use as on swap area and we will not use bootable flag since we already created our /boot partition.

50

Select FREE SPACE line and press Enter to create third and final partition for this installation.

51

Leave the size as it is and just press Continue.

44

Select Primary and press Enter.

45

Select Beginning and press Enter.

52

Let’s configure our / (root) partition with the following options:

  • Since I have small virtual disk (8 GB), I’m using what’s left of space after creating /boot and swap partitions for root partition. Of course if you are installing this ona a real machine with a large disk, I recommend you create an 8 GB (max. 15 GB) root partition, and use rest to create fourth physical partition with mount point on /home or /media/storage, or create logical partition and add several more extended partitions on it. It’s your choice.
  • Use as: XFS journaling file system – XFS is a high-performance journaling file system created by Silicon Graphics, originally for their IRIX operating system and later ported to the Linux kernel. XFS is particularly proficient at handling large files and at offering smooth data transfers. If we consider root partition to act as a storage partition for all of our files and data, XFS file system is the best choice if we consider performance.
  • Mount point: / – This one explains it’s self.
  • Mount options: noatime – Same as /boot.
  • Label: none – I don’t use labels, which does not have to stop you from using ones.
  • Bootable flag: off – We already created our /boot partition so leave bootable flag at off.

To finish the process position yourself to Done setting up the partition and press Enter.

53

To finish partitioning press Finish partitioning and write changes to disk.

54

Press Yes to continue.

 

55

Press Enter to install the base system.

56

Again you can go do something else as this is going to take some time.

57

The advantage of installing Ubuntu from MiniCD is that you can select newest available kernel. Select linux-image-2.6.38-8-generic (current kernel at the time I’m installing this) and press Enter to continue.

58

Since I’m planing to use this first step installation on other machines/VM’s I will select generic driver package to be installed. If you plan to install this on a single machine/VM you can select targeted. Your choice again. But be warned, if you plan to migrate your installation or clone it on other disk that is different from the one you are installing this now, there is a big chance the thing will not work. My recommendation is to go with the generic package.

59

Press Enter to continue.

60

Press Yes to continue.

62

Insert password, but please respect some general rules since it’s a root password. Don’t use less than 7 characters, and use combination of small and capital letters, numbers and/or special characters.

 

 

Repeat the password from the previous step and press Continue.

64

I will skip creation of normal user, but if you did not allow creation of root account, continue and create normal user.

65

Skip the configuration of the package manager and software installation, we will do that later. Continue with the installation of the GRUB boot loader.

66

I’m having only one disk so I will install boot loader to master boot record. If you have multiple disks or RAID configured disks, you will have to dig the net a bit to find solution where to install boot loader.

67

We are almost done with the first part! Press Finish the installation.

68

Your choice!

69

There, first part done. Press Continue to reboot the machine. Remove media from your CD-Rom device or unmount it if you are using VM.

70

Let’s see what we have:

  • Clean installation of Ubuntu base system with basic software.
  • Latest kernel availabe for selected distribution.
  • Ready to clone image for other machines/VM’s… can be used but few additional step are required, what leads us to next chapter – Extended Generic Ubuntu Installation.

03.01 Extended Generic Ubuntu Installation

Now that we have a nice clean installation, we will do some basic system configuration and tuning. Let’s start with /etc/default and the files located in that folder.

71

Log in using root account, or a normal user account if you created one. Since all steps in this part of installation require elevated privileges, for normal user you will have to add sudo in front of every command. If using normal user account, you can become root by typing

sudo su

To enable root account type the following

sudo passwd root

Type in the root password. Now you can directly log in as root.

 

Customize /etc/default

Let’s start with /etc/default/bootlogd. Bootlogd runs in the background and copies all strings sent to the /dev/console device to a logfile. This is useful if you want to check that all services you configured to start with the system are really started. You can do this by listing the content of /var/log/boot.log file.

vi /etc/default/bootlogd

#Run bootlogd at startup ?
BOOTLOGD_ENABLE=Yes

Next we are going to edit /etc/default/ntpdate. There are several packages related to NTP in the Ubuntu archive, probably the simplest is the client ntpdate. We will configure it to use our local time provider (mine is zg1.ntp.carnet.hr).

vi /etc/default/ntpdate

Locate and edit the following line:

# List of NTP servers to use (Separate multiple servers with spaces.)
# Not used if NTPDATE_USE_NTP_CONF is yes.
NTPSERVERS="zg1.ntp.carnet.hr"

Next we are going to reduce the number of active consoles at the startup. We will never use all the virtual consoles (TTY) that is provided with most Linux distribution. Why leave it there and let it eat memory. You can decrease startup time by removing unwanted virtual console or TTY.

vi /etc/default/console-setup

Locate and edit the following line:

# Setup these consoles. Most people do not need to change this.
ACTIVE_CONSOLES="/dev/tty[1-2]"

Now we need to turn off those extra consoles from actually starting themselves at startup. We need to edit tty6.conf, tty5.conf, tty4.conf and tty3.conf files located at /etc/init/ folder. The procedure is the same for every file.

vi /etc/init/tty6.conf

Locate and comment the following line:

# start on runlevel [23]
# stop on runlevel [!23]

# respawn
# exec /sbin/getty -8 38400 tty6

Let’s edit our next file. We still don’t have need for IPv6, especially for our Desktops at local networks so let’s disable it at startup by editiong grub config file.

vi /etc/default/grub

Locate and edit the following line:

GRUB_CMDLINE_LINUX_DEFAULT="ipv6.disable=1"

Now we need to confirm this change by executing the following command:

update-grub

Now we will prevent system messages from being translated, by editing locale file.

vi /etc/default/locale

Add the following line at the bottom:

LC_MESSAGES=POSIX

To confirm this change logout from your console and log back in again.

Next we will edit FSCKFIX line in rcS file. When Linux checks the file system, and finds error, fsck is called with -a option, and will only repair if no major damages are found, but if you want that fsck to try to fix the file system no matter the magnitude of the error, change FSCKFIX variable to yes.

vi /etc/default/rcS

Locate and edit the following line:

FSCKFIX=yes

That’s it. We are done editing /etc/default files. Now let’s finish the extended step of generic installation by configuring a few more options.

 

Let’s put it to use

We have installed Ubuntu, and we have a nice clean image so far, yey for us! But other than looking at the blinking command prompt, there is no much use from what we have. So let’s make it useful! Let’s start with configuration of debconf, a software utility for performing system-wide configuration tasks on Unix-like operating systems.

dpkg-reconfigure debconf

72

Select Dialog and press Enter.

73

As a Sys Admin, yes I am a control freak. So select low!

In the initial setup of our installation we have skipped package management configuration. We are going to configure it now, by editing the following file:

vi /etc/apt/sources.list

If there is any content present, delete it. All of it, and insert the following lines:

deb http://archive.ubuntu.com/ubuntu natty main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu natty-updates main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu natty-security main restricted universe multiverse

What we have done is enable main distribution (natty) repositories and updates/security repositories. This will be enough for most of software installations there will be needed.

If you want you can delete 10-help-text file. It prints help text associated with the distro copyright after every login. I don’t like that so I delete it.

rm /etc/update-motd.d/10-help-text

Let’s update our system. Execute the following command:

apt-get update

I don’t really like apt-get, and since Ubuntu 10.10 (Maverick Merkat) there is no aptitude in default installation, so first I’m going to install that. Aptitude is basically the same thing as apt-get but it has user interface and is much more user friendly.

apt-get install aptitude

At Do you want to continue [Y/n], enter Y and press Enter.

Now start aptitude by executing:

aptitude

Press Alt+T to initiate main menu and then go to Options –> Preferences, and by hitting Space key edit following options:

[X] Advance to the next item after changing the state of package
[ ] Install recommended packages automatically

Exit aptitude by hitting Q key twice.

Now we are going to upgrade our system by executing:

aptitude full-upgrade

At Do you want to continue [Y/n], enter Y and press Enter.

74

Select Ok and press Enter to continue.

We have a fully upgraded system so let’s do the cleanup and delete downloaded package files by executing:

aptitude clean

Now we are going to install our first software packages so let’s see which ones:

  • dma – The DragonFly Mail Agent is a small Mail Transport Agent designed for home and office use. We don’t want to install Postfix or similar just to send simple messages.
  • safecat –Safecat copies standard input to a qmail-style maildir as reliably and quickly as qmail itself. It can be used to deliver mail messages to qmail folders, or to spool data securely for later use by non-email-related applications. We will use it to process double-bounce messages.
  • emacs23-nox –My preffered text editor (nox means No X, as it will not install GUI frontend for desktop managers like Gnome and KDE). You don’t have to install emacs if you don’t like it. Choose your preffered text editior here.
  • debconf-english –This package is an alternative to the debconf-i18n package, intended for systems that are administerd only in english, and low-footprint systems.
  • debconf-i18n_ –full internationalization support for debconf. You noticed “_” at the end of the package name. It means I don’t want it so I have used the “_” character that aptitude will understand as purge order. It will remove the package and it’s installation files from our system.
  • bsd-mailx –mailx is the traditional command-line-mode mail user agent. Even if you don’t use it, it may be required by other programs.
  • sysfsutils –This package ships a configuration file /etc/sysfs.conf which allows to conveniently set sysfs attributes at system bootup. We will use it to configure some options on our disks later.
  • localepurge –Reclaim disk space by removing unneeded localization files.

To install all of these, execute the following command:

aptitude install -R -y dma safecat emacs23-nox debconf-english debconf-i18n_ bsd-mailx sysfsutils localepurge

75

If you intend to use generic image on other machines/VM’s, leave the System mail name as it is and press Ok to continue (as it will be configured on the machine/VM you intend to use it on).

76

If you intend to use generic image on other machines/VM’s, leave the Smarthost empty, as it will be configured on the machine/VM you intend to use it on.

77

Select Ok and press Enter to continue.

Make your choice (usually it’s not necessary), and press Ok to continue.78

Make your choice (usually it’s not necessary), and press Ok to continue.

79

Select Yes and press Enter to continue.

80

Select No and press Enter to continue.

81

Select Yes and press Enter to continue.

82

Select No and press Enter to continue.

83

Select Yes and press Enter to continue.

When the installation is over, let’s do the cleanup and delete downloaded package files by executing:

aptitude clean

Let’s also defragmet our root partition by executing:

xfs_fsr -v /dev/sda3

Reboot the system by executing:

reboot

 

04. The conclusion

As I stated at the beginning of this tutorial, what you have now is a great starting point for all of your future Ubuntu projects.

If you use it for virtualization:

  • Multiple clone option
  • Conversion and migration to all supported VM systems

If you use it for real machines:

  • Simple creation of full HDD image by using dd
  • Also simpe deployment to other HDD-s/machines using dd
  • Cloning/deployment by using any other commercial or free cloning tool

Don’t forget at least to change host name and network settings when cloning this installation to other machines/VM-s to avoid possible conflicts, and enjoy Ubuntu. That’s all folks!

 

 

 

Comments

comments