Installation of imageserver3

From ImageWiki

Jump to: navigation, search

Contents

Disk partioning

The disks are partitioned using fdisk into the following:

 Disk /dev/sda: 146.6 GB, 146694733824 bytes
    Device Boot      Start         End      Blocks   Id  System
 /dev/sdb1               1          13      104391   fd  Linux raid autodetect
 /dev/sdb2              14        4247    34009605   82  Linux swap / Solaris
 /dev/sdb3            4248       17834   109137577+  fd  Linux raid autodetect


 Disk /dev/sdb: 146.6 GB, 146695782400 bytes
    Device Boot      Start         End      Blocks   Id  System
 /dev/sda1               1          13      104391   fd  Linux raid autodetect
 /dev/sda2              14        4247    34009605   82  Linux swap / Solaris
 /dev/sda3            4248       17834   109137577+  fd  Linux raid autodetect

Making sda1 and sdb1 into a single raid disk

Before creating the raid disk, the modules needed are loaded using the following commands

 modprobe raid1
 modprobe dm-mod

The following commands are used to create the raid disk /dev/mda:

 mknod /dev/md1 b 9 1
 mknod /dev/md3 b 9 3
 mdadm --create /dev/md1 --level=1 --raid-devices=2 /dev/sda1 /dev/sdb1
 mdadm --create /dev/md3 --level=1 --raid-devices=2 /dev/sda3 /dev/sdb3

Partitioning /dev/md3 using LVM2

First the partition /dev/md3 is initialized for LVM2 using

 pvcreate /dev/md3

A volume group 'vg' is created with the following command

 vgcreate vg /dev/md3

Volume group vg is partitioned into 2 partitions:

  • vg/root for /
  • vg/localscratch for /image/localscratch

Below are the commands used to create the partitions:

 lvcreate -L104G -nroot vg
 lvcreate -L12M -nlocalscratch vg

Below is how the volume looked like using 'lvs' command:

 LV           VG   Attr   LSize   Origin Snap%  Move Log Copy%
 localscratch vg   -wi-a-  12.00M
 root         vg   -wi-a- 104.00G

Formatting the disk

 mke2fs /dev/md1
 mke2fs -j /dev/vg/root
 mke2fs -j /dev/vg/localscratch
 mkswap /dev/sda2 && swapon /dev/sda2
 mkswap /dev/sdb2 && swapon /dev/sdb2

Unpacking files

Mounting drives

 mount /dev/vg/root /mnt/gentoo/
 mkdir /mnt/gentoo/boot
 mount /dev/md1 /mnt/gentoo/boot

Date

date MMDDhhmmYYYY

Download and unpacking files

 cd /mnt/gentoo

Download stage 3 to this directory.

 tar xjpf stage3*
 cd /mnt/gentoo/usr

Dowload portage snapshot to this director.

tar xjf portage*

Chrooting

 cd /
 mount -t proc proc /mnt/gentoo/proc/
 cp -L /etc/resolv.conf /mnt/gentoo/etc/
 chroot /mnt/gentoo /bin/bash
 env-update
 source /etc/profile

Setting time zone

 cp /usr/share/zoneinfo/Europe/Copenhagen /etc/localtime

Setting host and domain name

 cd /etc
 echo "127.0.0.1 ImageServer3 imageserver3 localhost" > hosts
 sed -i -e 's/HOSTNAME.*/HOSTNAME="imageserver3 "/' conf.d/hostname
 hostname imageserver3
 hostname -f

Kernel configuration

Updating make.conf

Before doing emerge the following lines are change/added to /etc/make.conf

 CFLAGS="-march=nocona -O2 -pipe"
 SYNC="rsync://rsync.gentoo.diku.dk/gentoo-portage/"
 GENTOO_MIRRORS="ftp://ftp.gentoo.diku.dk/"

Install kernel source, compile it and install the kernel

 emerge gentoo-sources *Not sure whether this is needed or not*
 emerge genkernel
 cd /usr/src/linux
 genkernel --menuconfig --makeopts=-j9 --dmraid --lvm2 all

In menu, the following are done

  • Off Reserfs under File systems
  • Enable RAID and then RAID-1 (press space bar 2 times) under Devices drivers -> Multi-device support

Configure system

 cd /etc

Change the lines in fstab to as shown

 /dev/md1            /boot           ext2            noauto,noatime  1 2
 /dev/vg/root            /               ext3            noatime         0 1
 /dev/sda2               none            swap            sw              0 0
 /dev/sdb2               none            swap            sw              0 0

Configure networking

 rc-update add net.eth0 default
 rc-update add sshd default

Set root password

 passwd

Edit /etc/conf.d/clock

 #TIMEZONE="Europe/Copehagen"

Edit /etc/conf.d/keymaps

 KEYMAP="dk"

Installing extra tools

 emerge syslog-ng vixie-cron dhcpcd gentoolkit grub ccache lvm2 mdadm
 rc-update add syslog-ng default
 rc-update add vixie-cron default

Configuring Grub

Changing /boot/grub/grub.conf

 default 0
 timeout 10
 title=Gentoo
 root (hd0,0)
 kernel /boot/kernel-genkernel-x86_64-2.6.22-gentoo-r8 root=/dev/ram0 dodmraid dolvm2 init=/linuxrc real_root=/dev/vg/root
 initrd /boot/initramfs-genkernel-x86_64-2.6.22-gentoo-r8

Install grub

 livecd etc # grub
 Probing devices to guess BIOS drives. This may take a long time.
 grub> root (hd0,0)
 root (hd0,0)
  Filesystem type is ext2fs, partition type 0xfd
 grub> setup (hd0)
 setup (hd0)
  Checking if "/boot/grub/stage1" exists... yes
  Checking if "/boot/grub/stage2" exists... yes
  Checking if "/boot/grub/e2fs_stage1_5" exists... yes
  Running "embed /boot/grub/e2fs_stage1_5 (hd0)"...  15 sectors are embedded.
 succeeded
  Running "install /boot/grub/stage1 (hd0) (hd0)1+15 p (hd0,0)/boot/grub/stage2 /boot/grub/menu.lst"... succeeded
 Done.
 grub> quit
 quit
Personal tools