Installation (Ubuntu): Difference between revisions

From vwiki
Jump to navigation Jump to search
(→‎Change IP Address: Updated /etc/resolv.conf section)
m (Minor reword)
Line 1: Line 1:
Much of this page was originally borrowed heavily from the following pages - they are well worth a read!
Whilst this page was written with the installation of a Ubuntu Server 10.04 LTS in mind, it can also be used for Ubuntu 12.
* http://www.howtoforge.com/perfect-server-ubuntu8.04-lts
* http://www.howtoforge.com/how-to-install-ubuntu8.04-with-software-raid1
 
This page deals with installation of a Ubuntu Server 10.04 in a VM installed on one partition, with the option of using software RAID across two VMDK's.


== Prepare Virtual Machine ==
== Prepare Virtual Machine ==
Line 83: Line 79:
# Then select '''Done configuring this partition''' then finally '''Finish partitioning and write changes to disk''', and confirm to '''Write the changes to disks'''
# Then select '''Done configuring this partition''' then finally '''Finish partitioning and write changes to disk''', and confirm to '''Write the changes to disks'''
# Accept the "The kernel was unable to re-read...system will need to restart" complaints for each RAID multidisk, after which the install will continue (note there's a little more to do post install to ensure you can boot using the second disk should the first fail).
# Accept the "The kernel was unable to re-read...system will need to restart" complaints for each RAID multidisk, after which the install will continue (note there's a little more to do post install to ensure you can boot using the second disk should the first fail).
Much of this page was originally borrowed heavily from the following pages - they are well worth a read!
* http://www.howtoforge.com/perfect-server-ubuntu8.04-lts
* http://www.howtoforge.com/how-to-install-ubuntu8.04-with-software-raid1


== Post OS Install Config ==
== Post OS Install Config ==

Revision as of 06:59, 22 June 2013

Whilst this page was written with the installation of a Ubuntu Server 10.04 LTS in mind, it can also be used for Ubuntu 12.

Prepare Virtual Machine

  1. Create a virtual machine with the following options (use Custom)
    • Guest OS: Linux > Ubuntu 64bit
    • CPU: 1
    • Memory: 512 MB
    • Disk: 36GB
  2. Then add a second 36GB disk on a separate physical datastore (if you intend to use software RAID)
  3. Attach Ubuntu install ISO to the CD-ROM

Note that the specs above should be altered to suit your purposes. Whilst there is no need to use a 64 bit OS as opposed to 32 bit if you don't need to address lots of memory, it is standard these days.

OS Installation

Installing Ubuntu Server (LTS) is relatively painless, its generally a case of following the default or sensible choices for your locale. However, below are step-by-step instructions, which you probably won't require, but may help if you're not familiar with the terminology.

If you're completely new make sure you read through the instructions 1st, so that you're prepared for the information you'll need to provide.

  1. Select language for installer
  2. Select Install Ubuntu Server
  3. Choose Language screens
    1. Select language for server (and remainder of the installer)
    2. Select location
  4. Ubuntu Installer Main Menu screens
    1. Select Yes for questions to determine appropriate keyboard, or No to just select a keyboard layout
  5. Configure the network screen
    1. Enter the hostname for the server (not a FQDN, so hostname rather than hostname.domain.com)
  6. Configure the clock screen
    1. Select Yes to accept the suggested timezone, or No to alter
  7. Partition disks screens
    1. Select Guided - use entire disk and set up LVM
    2. Select the disk to partition and install the OS onto
    3. Select Yes to Write the changes to disks and configure LVM
    4. Accept the full amount to partition
    5. Select Yes to Write the changes to disks
  8. Set up users and passwords screens
    1. Enter your name
    2. Enter your username (that you will use to login with)
    3. Enter your password
      • If you use a weak password (eg less that 8 characters) you'll be asked to confirm this is OK once you've verified it
    4. Re-enter (verify) your password
    5. Select No to not Encrypt your home drive
      • If you are really worried about your dat being compromised you should consider encrypting the whole drive during its partitioning
  9. Configure the package manager screen
    1. Enter proxy server details if required for server to access the internet for updates
  10. Select and install software screen
    1. Select No automatic updates if you want to control how updates are applied yourself, otherwise select Install security updates automatically
  11. Software selection screens
    1. Select OpenSSH Server (press [Space] when item is highlighted), this allows you to Putty/SSH to the server
    2. Select any other required software, eg
      • DNS Server - Only required if you want your server to be a DNS server; or in order to configure split DNS, which is required for an exchange server install
      • LAMP Server - Only required for Apache webserver (with MySQL and PHP)
  12. Configuring grub-pc screen
    1. Select Yes to Install the GRUB boot loader to the master boot record
  13. Finish the installation screen
    1. Select Continue

Install on Software RAID

On the Partition Disks screens use the following to setup software RAID during OS installation.

  • If setting up software RAID follow the steps below, otherwise just select Guided - use entire disk and set up LVM
  1. Select "Manual
  2. Then create a partition...
    1. Select the first disk (sda) and on the next screen, Yes, to Create new empty partition table on this device?
    2. Select the FREE SPACE, then Create a new Partition, and use all but the last 2GB of space,
    3. And then select type of Primary, and create at Beginning
    4. Change Use as to physical volume for RAID, and change the Bootable flag to Yes, the select Done setting up this partition
  3. Repeat the above on the remaining FREE SPACE on sda, to create another primary physical volume for RAID, but 'not bootable
  4. Select the second disk, sdb, and repeat the steps taken for sda to create two identical partitions
  5. On the same screen, select the Configure Software RAID option (at the top), and then confirm through the next screen
  6. Create a RAID pack/multidisk...
    1. Select Create MD device, then select RAID1 (ie a mirror), then confirm 2 Active devices, and 0 Spare devices
    2. Select both /dev/sda1 and /dev/sdb1 partitions, and then select Finish
  7. Repeat the above to create a RAID volume using /dev/sda2 and /dev/sdb2 partitions
  8. Now select the RAID device #0 partition (select the #1 just under RAID1 device line), and change the Use as and select Ext3...
  9. Change the Mount point to /, then select Done configuring this partition
  10. Now select the RAID device #1 partition (select the #1 just under RAID1 device line), and change the Use as and select Swap area
  11. Then select Done configuring this partition then finally Finish partitioning and write changes to disk, and confirm to Write the changes to disks
  12. Accept the "The kernel was unable to re-read...system will need to restart" complaints for each RAID multidisk, after which the install will continue (note there's a little more to do post install to ensure you can boot using the second disk should the first fail).

Much of this page was originally borrowed heavily from the following pages - they are well worth a read!

Post OS Install Config

Enable Root

  1. Use the command sudo passwd root
  2. Enter your user password
  3. Enter a strong password for the root account

Finish Software RAID config

Only if configured during install

  1. Start-up grub (by entering grub and enter the following commands (seems to work better via SSH than direct console)...
    • device (hd1) /dev/sdb
    • root (hd1,0)
    • setup (hd1)
    • quit
  2. Then edit the /boot/grub/menu.lst config file. Go to the end of the file where the boot options are, and create a copy of the first option and edit the following lines
    • title Add "Primary disk fail" or something similar to end
    • root Change hd0 to hd1
  3. To check the RAID setup of your drives use
    • mdadm --misc -D /dev/md0
    • mdadm --misc -D /dev/md1

Change IP Address

  • Edit the /etc/network/interfaces file in the following fashion to set static address details
# The primary network interface
auto eth0
iface eth0 inet static
        address 192.168.1.150
        netmask 255.255.255.0
        network 192.168.1.0
        broadcast 192.168.1.255
        gateway 192.168.1.1
  • Then check the local hosts file /etc/hosts, so that the IP v4 part looks like this (so the host can resolve itself)...
127.0.0.1       localhost
192.168.1.150   hostname.domain.com   hostname
  • Check that DNS resolution is setup correctly in /etc/resolv.conf. Add additional DNS nameservers as required, as found in in order of preference. You can also add the domain of the server (domain), and add domain suffix searches (search), both are optional. For example...
nameserver 192.168.1.20
nameserver 127.0.0.1
domain domain.com
search domain.com
search anotherdomain.com
  • Then restart networking
    • sudo /etc/init.d/networking restart

Update the OS

  1. Run the following command to update the apt package database
    • apt-get update
  2. To install any updates
    • apt-get upgrade
    • If updates are being held back (eg linux image), then use aptitude safe-upgrade

Install VM Tools

The pre-built modules that come with the VMTools installer aren't compatible, therefore the script needs to be able to compile them, however the required library files aren't available by default, so the procedure is a little laboured.

Ubuntu 8.04 LTS

  1. Install the build library files...
    • apt-get install build-essential
    • apt-get install linux-headers-2.6.24-26-server
      • Use uname -r to get the right headers version number
  2. Select "Install VM Tools" from the VI Client
  3. Mount the VM Tools CD-ROM
    • mount /media/cdrom0/
  4. Copy to home directory
    • cp /media/cdrom/VMwareTools-4.0.0-219382.tar.gz /home/user/
  5. Uncompress and then move into the vmware-tools-distrib directory
    • tar xf VMwareTools-4.0.0-219382.tar.gz
    • cd vmware-tools-distrib
  6. Run the install script
    • ./vmware-install.pl
  7. Restart
    • shutdown -r now

Ubuntu 10.04 LTS

VM Tools can be installed via two methods, neither of which is ideal...

  • Using the normal VM Tools CD - requires additional library install and sometimes mounting the CDROM doesn't work too well.
  • Using APT package manager - doesn't work quite as well as it could (upgrading VM Tools isn't supported), and support for this method is rumoured to be dropped in future releases

VM Tools CD

  1. Install the build library files...
    • apt-get install build-essential
  2. Select "Install VM Tools" from the VI Client
  3. Mount the VM Tools CD-ROM
    • mount /dev/cdrom /media/cdrom/
    • If unable to mount, see Unable to Mount CD-ROM, mounting read-only is expected
  4. Copy to tmp directory (version number below will vary)
    • cp /media/cdrom/VMwareTools-4.0.0-236512.tar.gz /tmp/
  5. Unmount the CD-ROM, and move into tmp directory
    • umount /media/cdrom/
    • cd /tmp/
  6. Uncompress and then move into the vmware-tools-distrib directory
    • tar xzvf VMware*.gz
    • cd vmware-tools-distrib /
  7. Run the install script, and accept defaults
    • ./vmware-install.pl
  8. Restart (not actually required, but I tend to on a new install to be sure that VMtools start properly following a bounce)
    • shutdown -r now

APT Package Manager

  1. Install VM Tools using apt package manager
  2. Open VMware Packaging Public GPG Key at http://packages.vmware.com/tools/VMWARE-PACKAGING-GPG-KEY.pub
  3. On the server open a new file called VMWARE-PACKAGING-GPG-KEY.pub with the /tmp directory
  4. Copy and paste the contents of the webpage into the file and save
  5. Import the key using the following command
    • apt-key add /tmp/VMWARE-PACKAGING-GPG-KEY.pub
    • You should get OK returned
  6. If you need to add a proxy see http://communities.vmware.com/servlet/JiveServlet/download/1554533-39836/Vmware%20Tools%20Guide%20Linux%20osp_install_guide.pdf
  7. Open a new vi in VI called /etc/apt/sources.list.d/vmware-tools.list
  8. Add the following line
  9. Update the repository cache
    • apt-get update
  10. Install VM Tools
    • apt-get install vmware-tools

NTP

Not required if your server doesn't really need bang on accurate time

Out of the box your server will sync every time its restarted and drift a bit in-between. There is an additional resource demand in running the NTP daemon so unless you need to, there's no need to install the full blown NTP daemon.

I tend to have one or two servers updating from remote (public) servers, and then all others updating from those.

  1. Install the service
    • apt-get install ntp
  2. Update the NTP config file, /etc/ntp.conf (Example below is for a server updating from public European servers - see http://www.pool.ntp.org/)
    • server 0.europe.pool.ntp.org
    • server 1.europe.pool.ntp.org
    • server 2.europe.pool.ntp.org
    • server 3.europe.pool.ntp.org
  3. Restart the NTP service
    • service ntp restart
  4. Verify using the following commands
    • ntpq -np
    • date