# Installation

This chapter provides a quick overview of installing Ubuntu &distro-rev; Server Edition. For more detailed instructions, please refer to the Ubuntu Installation Guide.

## Preparing to Install

This section explains various aspects to consider before starting the installation.

### System Requirements

Ubuntu &distro-rev; Server Edition supports two (2) major architectures: Intel x86 and AMD64. The table below lists recommended hardware specifications. Depending on your needs, you might manage with less than this. However, most users risk being frustrated if they ignore these suggestions.

Recommended Minimum Requirements

Install Type | RAM | Hard Drive Space
--- | --- | ---
Base System | All Tasks Installed
Server | 128 megabytes | 500 megabytes | 1 gigabyte

The Server Edition provides a common base for all sorts of server applications. It is a minimalist design providing a platform for the desired services, such as file/print services, web hosting, email hosting, etc.

The requirements for UEC are slightly different for Front End requirements see and for UEC Node requirements see .

### Server and Desktop Differences

There are a few differences between the Ubuntu Server Edition and the Ubuntu Desktop Edition. It should be noted that both editions use the same apt repositories. Making it just as easy to install a server application on the Desktop Edition as it is on the Server Edition.

The differences between the two editions are the lack of an X window environment in the Server Edition, the installation process, and different Kernel options.

#### Kernel Differences:

- The Server Edition uses the Deadline I/O scheduler instead of the CFQ scheduler used by the Desktop Edition.

- Preemption is turned off in the Server Edition.

- The timer interrupt is 100 Hz in the Server Edition and 250 Hz in the Desktop Edition.

When running a 64-bit version of Ubuntu on 64-bit processors you are not limited by memory addressing space.

To see all kernel configuration options you can look through `/boot/config-&linux-kernel-version;-server`. Also, Linux Kernel in a Nutshell is a great resource on the options available.

### Backing Up

- Before installing Ubuntu Server Edition you should make sure all data on the system is backed up. See for backup options.

  If this is not the first time an operating system has been installed on your computer, it is likely you will need to re-partition your disk to make room for Ubuntu.

  Any time you partition your disk, you should be prepared to lose everything on the disk should you make a mistake or something goes wrong during partitioning. The programs used in installation are quite reliable, most have seen years of use, but they also perform destructive actions.

## Installing from CD

The basic steps to install Ubuntu Server Edition from CD are the same for installing any operating system from CD. Unlike the Desktop Edition the Server Edition does not include a graphical installation program. Instead the Server Edition uses a console menu based process.

- First, download and burn the appropriate ISO file from the Ubuntu web site.

- Boot the system from the CD-ROM drive.

- At the boot prompt you will be asked to select the language. Afterwards the installation process begins by asking for your keyboard layout.

- From the main boot menu there are some additional options to install Ubuntu Server Edition. You can install a basic Ubuntu Server, or install Ubuntu Server as part of a Ubuntu Enterprise Cloud. For more information on UEC see . The rest of this section will cover the basic Ubuntu Server install.

- The installer then discovers your hardware configuration, and configures the network settings using DHCP. If you do not wish to use DHCP at the next screen choose "Go Back", and you have the option to "Configure the network manually".

- Next, the installer asks for the system's hostname and Time Zone.

- You can then choose from several options to configure the hard drive layout. For advanced disk options see .

- The Ubuntu base system is then installed.

- A new user is setup, this user will have root access through the sudo utility.

- After the user is setup, you will be asked to encrypt your `home` directory.

- The next step in the installation process is to decide how you want to update the system. There are three options:

  - No automatic updates: this requires an administrator to log into the machine and manually install updates.

  - Install security updates Automatically: will install the unattended-upgrades package, which will install security updates without the intervention of an administrator. For more details see .

  - Manage the system with Landscape: Landscape is a paid service provided by Canonical to help manage your Ubuntu machines. See the Landscape site for details.

- You now have the option to install, or not install, several package tasks. See for details. Also, there is an option to launch aptitude to choose specific packages to install. For more information see .

- Finally, the last step before rebooting is to set the clock to UTC.

If at any point during installation you are not satisfied by the default setting, use the "Go Back" function at any prompt to be brought to a detailed installation menu that will allow you to modify the default settings.

At some point during the installation process you may want to read the help screen provided by the installation system. To do this, press F1.

Once again, for detailed instructions see the Ubuntu Installation Guide.

### Package Tasks

During the Server Edition installation you have the option of installing additional packages from the CD. The packages are grouped by the type of service they provide.

- Cloud computing: Walrus storage service

- Cloud computing: all-in-one cluster

- Cloud computing: Cluster controller

- Cloud computing: Node controller

- Cloud computing: Storage controller

- Cloud computing: top-level cloud controller

- DNS server: Selects the BIND DNS server and its documentation.

- LAMP server: Selects a ready-made Linux/Apache/MySQL/PHP server.

- Mail server: This task selects a variety of package useful for a general purpose mail server system.

- OpenSSH server: Selects packages needed for an OpenSSH server.

- PostgreSQL database: This task selects client and server packages for the PostgreSQL database.

- Print server: This task sets up your system to be a print server.

- Samba File server: This task sets up your system to be a Samba file server, which is especially suitable in networks with both Windows and Linux systems.

- Tomcat server: Installs the Apache Tomcat and needed dependencies Java, gcj, etc.

- Virtual machine host: Includes packages needed to run KVM virtual machines.

- Manually select packages: Executes apptitude allowing you to individually select packages.

Installing the package groups is accomplished using the tasksel utility. One of the important difference between Ubuntu (or Debian) and other GNU/Linux distribution is that, when installed, a package is also configured to reasonable defaults, eventually prompting you for additional required information. Likewise, when installing a task, the packages are not only installed, but also configured to provided a fully integrated service.

For more information on the Cloud Computing tasks see .

Once the installation process has finished you can view a list of available tasks by entering the following from a terminal prompt:

    tasksel --list-tasks

The output will list tasks from other Ubuntu based distributions such as Kubuntu and Edubuntu. Note that you can also invoke the `tasksel` command by itself, which will bring up a menu of the different tasks available.

You can view a list of which packages are installed with each task using the --task-packages option. For example, to list the packages installed with the DNS Server task enter the following:

    tasksel --task-packages dns-server

The output of the command should list:

    bind9-doc
    bind9utils
    bind9

Also, if you did not install one of the tasks during the installation process, but for example you decide to make your new LAMP server a DNS server as well. Simply insert the installation CD and from a terminal:

    sudo tasksel install dns-server

## Upgrading

There are several ways to upgrade from one Ubuntu release to another. This section gives an overview of the recommended upgrade method.

### do-release-upgrade

The recommended way to upgrade a Server Edition installation is to use the do-release-upgrade utility. Part of the update-manager-core package, it does not have any graphical dependencies and is installed by default.

Debian based systems can also be upgraded by using `apt-get dist-upgrade`. However, using do-release-upgrade is recommended because it has the ability to handle system configuration changes sometimes needed between releases.

To upgrade to a newer release, from a terminal prompt enter:

    do-release-upgrade

It is also possible to use do-release-upgrade to upgrade to a development version of Ubuntu. To accomplish this use the -d switch:

    do-release-upgrade -d

Upgrading to a development release is not recommended for production environments.

## Advanced Installation

### Software RAID

RAID is a method of configuring multiple hard drives to act as one, reducing the probability of catastrophic data loss in case of drive failure. RAID is implemented in either software (where the operating system knows about both drives and actively maintains both of them) or hardware (where a special controller makes the OS think there's only one drive and maintains the drives 'invisibly').

The RAID software included with current versions of Linux (and Ubuntu) is based on the 'mdadm' driver and works very well, better even than many so-called 'hardware' RAID controllers. This section will guide you through installing Ubuntu Server Edition using two RAID1 partitions on two physical hard drives, one for / and another for swap.

#### Partitioning

Follow the installation steps until you get to the Partition disks step, then:

- Select Manual as the partition method.

- Select the first hard drive, and agree to "Create a new empty partition table on this device?".

  Repeat this step for each drive you wish to be part of the RAID array.

- Select the "FREE SPACE" on the first drive then select "Create a new partition".

- Next, select the Size of the partition. This partition will be the swap partition, and a general rule for swap size is twice that of RAM. Enter the partition size, then choose Primary, then Beginning.

- Select the "Use as:" line at the top. By default this is "Ext4 journaling file system", change that to "physical volume for RAID" then "Done setting up partition".

- For the / partition once again select "Free Space" on the first drive then "Create a new partition".

- Use the rest of the free space on the drive and choose Continue, then Primary.

- As with the swap partition, select the "Use as:" line at the top, changing it to "physical volume for RAID". Also select the "Bootable flag:" line to change the value to "on". Then choose "Done setting up partition".

- Repeat steps three through eight for the other disk and partitions.

#### RAID Configuration

With the partitions setup the arrays are ready to be configured:

- Back in the main "Partition Disks" page, select "Configure Software RAID" at the top.

- Select "yes" to write the changes to disk.

- Choose "Create MD device".

- For this example, select "RAID1", but if you are using a different setup choose the appropriate type (RAID0 RAID1 RAID5).

  In order to use RAID5 you need at least three drives. Using RAID0 or RAID1 only two drives are required.

- Enter the number of active devices "2", or the amount of hard drives you have, for the array. Then select "Continue".

- Next, enter the number of spare devices "0" by default, then choose "Continue".

- Choose which partitions to use. Generally they will be sda1, sdb1, sdc1, etc. The numbers will usually match and the different letters correspond to different hard drives.

  For the swap partition choose sda1 and sdb1. Select "Continue" to go to the next step.

- Repeat steps three through seven for the / partition choosing sda2 and sdb2.

- Once done select "Finish".

#### Formatting

There should now be a list of hard drives and RAID devices. The next step is to format and set the mount point for the RAID devices. Treat the RAID device as a local hard drive, format and mount accordingly.

- Select "#1" under the "RAID1 device #0" partition.

- Choose "Use as:". Then select "swap area", then "Done setting up partition".

- Next, select "#1" under the "RAID1 device #1" partition.

- Choose "Use as:". Then select "Ext4 journaling file system".

- Then select the "Mount point" and choose "/ - the root file system". Change any of the other options as appropriate, then select "Done setting up partition".

- Finally, select "Finish partitioning and write changes to disk".

If you choose to place the root partition on a RAID array, the installer will then ask if you would like to boot in a degraded state. See for further details.

The installation process will then continue normally.

#### Degraded RAID

At some point in the life of the computer a disk failure event may occur. When this happens, using Software RAID, the operating system will place the array into what is known as a degraded state.

If the array has become degraded, due to the chance of data corruption, by default Ubuntu Server Edition will boot to initramfs after thirty seconds. Once the initramfs has booted there is a fifteen second prompt giving you the option to go ahead and boot the system, or attempt manual recover. Booting to the initramfs prompt may or may not be the desired behavior, especially if the machine is in a remote location. Booting to a degraded array can be configured several ways:

- The dpkg-reconfigure utility can be used to configure the default behavior, and during the process you will be queried about additional settings related to the array. Such as monitoring, email alerts, etc. To reconfigure mdadm enter the following:

      sudo dpkg-reconfigure mdadm

- The `dpkg-reconfigure mdadm` process will change the `/etc/initramfs-tools/conf.d/mdadm` configuration file. The file has the advantage of being able to pre-configure the system's behavior, and can also be manually edited:

      BOOT_DEGRADED=true

  The configuration file can be overridden by using a Kernel argument.

- Using a Kernel argument will allow the system to boot to a degraded array as well:

  - When the server is booting press Shift to open the Grub menu.

  - Press e to edit your kernel command options.

  - Press the down arrow to highlight the kernel line.

  - Add "bootdegraded=true" (without the quotes) to the end of the line.

  - Press Ctrl x to boot the system.

Once the system has booted you can either repair the array see for details, or copy important data to another machine due to major hardware failure.

#### RAID Maintenance

The mdadm utility can be used to view the status of an array, add disks to an array, remove disks, etc:

- To view the status of an array, from a terminal prompt enter:

      sudo mdadm -D /dev/md0

  The -D tells mdadm to display detailed information about the `/dev/md0` device. Replace `/dev/md0` with the appropriate RAID device.

- To view the status of a disk in an array:

      sudo mdadm -E /dev/sda1

  The output if very similar to the `mdadm -D` command, adjust `/dev/sda1` for each disk.

- If a disk fails and needs to be removed from an array enter:

      sudo mdadm --remove /dev/md0 /dev/sda1

  Change `/dev/md0` and `/dev/sda1` to the appropriate RAID device and disk.

- Similarly, to add a new disk:

      sudo mdadm --add /dev/md0 /dev/sda1

Sometimes a disk can change to a faulty state even though there is nothing physically wrong with the drive. It is usually worthwhile to remove the drive from the array then re-add it. This will cause the drive to re-sync with the array. If the drive will not sync with the array, it is a good indication of hardware failure.

The `/proc/mdstat` file also contains useful information about the system's RAID devices:

    cat /proc/mdstat
    Personalities : [linear] [multipath] [raid0] [raid1] [raid6] [raid5] [raid4] [raid10]
    md0 : active raid1 sda1[0] sdb1[1]
          10016384 blocks [2/2] [UU]

    unused devices: <none>

The following command is great for watching the status of a syncing drive:

    watch -n1 cat /proc/mdstat

Press Ctrl+c to stop the watch command.

If you do need to replace a faulty drive, after the drive has been replaced and synced, grub will need to be installed. To install grub on the new drive, enter the following:

    sudo grub-install /dev/md0

Replace `/dev/md0` with the appropriate array device name.

#### Resources

The topic of RAID arrays is a complex one due to the plethora of ways RAID can be configured. Please see the following links for more information:

- Ubuntu Wiki Articles on RAID.

- Software RAID HOWTO

- Managing RAID on Linux

### Logical Volume Manager (LVM)

Logical Volume Manger, or LVM, allows administrators to create logical volumes out of one or multiple physical hard disks. LVM volumes can be created on both software RAID partitions and standard partitions residing on a single disk. Volumes can also be extended, giving greater flexibility to systems as requirements change.

#### Overview

A side effect of LVM's power and flexibility is a greater degree of complication. Before diving into the LVM installation process, it is best to get familiar with some terms.

- Volume Group (VG): contains one or several Logical Volumes (LV).

- Logical Volume (LV): is similar to a partition in a non-LVM system. Multiple Physical Volumes (PV) can make up one LV, on top of which resides the actual EXT3, XFS, JFS, etc filesystem.

- Physical Volume (PV): physical hard disk or software RAID partition. The Volume Group can be extended by adding more PVs.

#### Installation

As an example this section covers installing Ubuntu Server Edition with `/srv` mounted on a LVM volume. During the initial install only one Physical Volume (PV) will be part of the Volume Group (VG). Another PV will be added after install to demonstrate how a VG can be extended.

There are several installation options for LVM, "Guided - use the entire disk and setup LVM" which will also allow you to assign a portion of the available space to LVM, "Guided - use entire and setup encrypted LVM", or Manually setup the partitions and configure LVM. At this time the only way to configure a system with both LVM and standard partitions, during installation, is to use the Manual approach.

- Follow the installation steps until you get to the Partition disks step, then:

- At the "Partition Disks screen choose "Manual".

- Select the hard disk and on the next screen choose "yes" to "Create a new empty partition table on this device".

- Next, create standard /boot, swap, and / partitions with whichever filesystem you prefer.

- For the LVM /srv, create a new Logical partition. Then change "Use as" to "physical volume for LVM" then "Done setting up the partition".

- Now select "Configure the Logical Volume Manager" at the top, and choose "Yes" to write the changes to disk.

- For the "LVM configuration action" on the next screen, choose "Create volume group". Enter a name for the VG such as vg01, or something more descriptive. After entering a name, select the partition configured for LVM, and choose "Continue".

- Back at the "LVM configuration action" screen, select "Create logical volume". Select the newly created volume group, and enter a name for the new LV, for example srv since that is the intended mount point. Then choose a size, which may be the full partition because it can always be extended later. Choose "Finish" and you should be back at the main "Partition Disks" screen.

- Now add a filesystem to the new LVM. Select the partition under "LVM VG vg01, LV srv", or whatever name you have chosen, the choose Use as. Setup a file system as normal selecting /srv as the mount point. Once done, select "Done setting up the partition".

- Finally, select "Finish partitioning and write changes to disk". Then confirm the changes and continue with the rest of the installation.

There are some useful utilities to view information about LVM:

- vgdisplay: shows information about Volume Groups.

- lvdisplay: has information about Logical Volumes.

- pvdisplay: similarly displays information about Physical Volumes.

#### Extending Volume Groups

Continuing with srv as an LVM volume example, this section covers adding a second hard disk, creating a Physical Volume (PV), adding it to the volume group (VG), extending the logical volume `srv` and finally extending the filesystem. This example assumes a second hard disk has been added to the system. This hard disk will be named `/dev/sdb` in our example. BEWARE: make sure you don't already have an existing `/dev/sdb` before issuing the commands below. You could lose some data if you issue those commands on a non-empty disk. In our example we will use the entire disk as a physical volume (you could choose to create partitions and use them as different physical volumes)

- First, create the physical volume, in a terminal execute:

      sudo pvcreate /dev/sdb

- Now extend the Volume Group (VG):

      sudo vgextend vg01 /dev/sdb

- Use vgdisplay to find out the free physical extents - Free PE / size (the size you can allocate). We will assume a free size of 511 PE (equivalent to 2GB with a PE size of 4MB) and we will use the whole free space available. Use your own PE and/or free space.

  The Logical Volume (LV) can now be extended by different methods, we will only see how to use the PE to extend the LV:

      sudo lvextend /dev/vg01/srv -l +511

  The -l option allows the LV to be extended using PE. The -L option allows the LV to be extended using Meg, Gig, Tera, etc bytes.

- Even though you are supposed to be able to expand an ext3 or ext4 filesystem without unmounting it first, it may be a good pratice to unmount it anyway and check the filesystem, so that you don't mess up the day you want to reduce a logical volume (in that case unmounting first is compulsory).

  The following commands are for an EXT3 or EXT4 filesystem. If you are using another filesystem there may be other utilities available.

      sudo umount /srv
      sudo e2fsck -f /dev/vg01/srv

  The -f option of e2fsck forces checking even if the system seems clean.

- Finally, resize the filesystem:

      sudo resize2fs /dev/vg01/srv

- Now mount the partition and check its size.

      mount /dev/vg01/srv /srv && df -h /srv

#### Resources

- See the Ubuntu Wiki LVM Articles.

- See the LVM HOWTO for more information.

- Another good article is Managing Disk Space with LVM on O'Reilly's linuxdevcenter.com site.

- For more information on fdisk see the fdisk man page.