OS installation

From Smith family
Jump to: navigation, search
Server setup
← Previous Next →
Router setup Hostname and IP

Installation of the operating systems is straightforward. The server has Ubuntu Server edition installed and the desktop machine has Kubuntu (no reason for selecting KDE, other than it's what I'm used to).

The installation scripts for the server should ask if you want to install a standard LAMP server; you do. The server needs the additional packages build-essentials (for basic software development) and openssh-server (as the server will be run as a headless box). Other necessary packages will be mentioned with the relevant setup.

Partitioning the root filesystem (with LVM)

For both setups, I don't bother doing anything complicated with disk partitioning. I have the recommended size partition for swap, and allocated a few GB each for /var/log and /tmp, and everything else just goes into one large partition. However, for reasons that aren't that clear any more, I couldn't get the installer to create those partitions, so I had to do it manually. This was complicated by the fact that I wanted to resize the root filesystem, which you can't do when it's mounted.

The way around it is to boot the system, after installation, with the Ubuntu Live CD. (This requires that the machine has a keyboard, mouse, and monitor attached. Something to bear in mind if you're installing Ubuntu on a headless server.) Once you've started Ubuntu, use the "Try Ubuntu" option.

  • Open a terminal and install the LVM tools:
user@subuntu:~$ sudo -i
root@ubuntu:~# apt-get install lvm2
  • Find the name of the root filesystem LVM:
root@ubuntu:~# lvs
root@ubuntu:~# vgchange --available y server
  • Resize the logical volume containing the root filesystem, including resizing the filesystem there:
lvresize --resizefs --size -50G /dev/server/root
  • Now you have some space, you can resize the swap logical volume
root@ubuntu:~# swapoff -v /dev/server/swap
root@ubuntu:~# lvresize /dev/server/swap -L +2G
root@ubuntu:~# mkswap /dev/server/swap
root@ubuntu:~# swapon -va
(You won't need the swapon and swapoff commands if you're doing it from the LiveCD.)
  • Create two new logical volumes, for /var/log and /tmp, and add filesystems to them:
root@ubuntu:~# lvcreate -L 20G -n tmp server
root@ubuntu:~# lvcreate -L 25G -n varlog server
root@ubuntu:~# mkfs.ext4 /dev/server/tmp
root@ubuntu:~# mkfs.ext4 /dev/server/varlog
  • Create mount points and mount the root, varlog partition, and tmp partitions:
root@ubuntu:~# mkdir /media/rootfs
root@ubuntu:~# mount /dev/server/root
root@ubuntu:~# mkdir /media/varlog
root@ubuntu:~# mount /dev/server/varlog
root@ubuntu:~# mkdir /media/tmp
root@ubuntu:~# mount /dev/server/tmp
  • Copy the existing contents of /var/log to the new logical volume:
root@ubuntu:~# cp -pr basefs/var/log/* varlog/
  • Modify /etc/fstab to use the new volumes. Add these lines immediately after where the root filesystem is mounted:
/dev/mapper/server-tmp /tmp               ext4    defaults 0       1
/dev/mapper/server-varlog /var/log        ext4    defaults 0       1
  • Remove the LiveCD and reboot.
  • After booting, change the permissions on /tmp:
chmod a+rwx /tmp
chmod o+t /tmp
(You may have problems with MySQL, so that my need reinstalling.)

(See more on LVM management and Extending swap on LVM.)

Install proprietary graphics card driver

I have a NVidia GeForce G210 video card. The proprietary video card driver uses the card's GPU for better graphics; the open source one makes KDE hang all too often. This means you need to install the proprietary driver as soon as the OS is installed on the desktop machine.

To check that the card is supported, do:

root@desktop:~# lspci | grep -i nvidia
02:00.0 VGA compatible controller: nVidia Corporation GT218 [GeForce G210] (rev a2)

note the code at the start of the line, and use that to find the PCI ID of the card:

root@desktop:~# lspci -n | grep 02:00
02:00.0 0300: 10de:0a60 (rev a2)

and check that the PCI ID you get is in the list of supported products (Mine's 10de:0a60; the GeForce 6600 on the old machine was 10de:00f2).

Installing the driver is easy. Go to KMenu -> System -> Hardware Drivers Manager (in Kubuntu 10.04, it's K -> Applications -> System -> Hardware Drivers) and check the box to enable the restricted drivers for the NVIDIA card. Adept will then download the right package for you. Restart X (Rebooting the machine is probably easier) and all should be fine.

Full details are at the Nvidia driver how to on the Ubuntu documentation site.