Gentoo OpenVZ Server Setup
From KdjWiki
Contents |
Pre-Setup - Detach
All configuration files (or samples at least) can be found on the Gentoo OpenVZ Config Files page.
1) Boot from CD
2) Set root password:
# passwd
3) Start SSH Server:
# /etc/init.d/sshd start
4) Determine IP address:
# ifconfig | grep "inet addr" | grep -v "127.0.0.1"
5) Connect from other computer:
$ ssh root@{ip-address}
6) Detach Console:
# screen -S install
HDD Setup (RAID)
Configure the disks with fdisk:
RAID 1
Assume 2 HDD - /dev/hda and /dev/hdc
- /dev/hda1 : type fd, size 100MB, boot flag = on
- /dev/hda2 : type 82 (swap), size 2xRAM size
- /dev/hda3 : type fd, size = 10GB
- /dev/hda4 : type 83, size = remainder
Duplicate for /dev/hdc:
# sfdisk -d /dev/hda | sfdisk /dev/hdc
RAID-1 module and devices (may be required):
# modprobe raid1 # mknod /dev/md1 b 9 1 # mknod /dev/md3 b 9 3
RAID-1 partitions (non-swap):
# mdadm --create /dev/md1 --level=1 --raid-devices=2 /dev/hda1 /dev/hdc1 # mdadm --create /dev/md3 --level=1 --raid-devices=2 /dev/hda3 /dev/hdc3
Make filesystems:
# mke2fs /dev/md1 # mke2fs -j /dev/md3 # mke2fs -j /dev/hda4 # mke2fs -j /dev/hdc4 # mkswap /dev/hda2 && swapon /dev/hda2 # mkswap /dev/hdc2 && swapon /dev/hdc2
Base System
Mount partitions:
# mount /dev/md3 /mnt/gentoo # mkdir /mnt/gentoo/boot # mount /dev/md1 /mnt/gentoo/boot
Prepare for install:
# date {MMDDhhmmYYYY}
# cp -L /etc/resolv.conf /mnt/gentoo/etc/resolv.conf
Download required files:
# cd /mnt/gentoo # wget -c http://ftp.swin.edu.au/gentoo/releases/x86/current/stages/stage3-i686-2006.1.tar.bz2 # tar xvjpf stage3-*.tar.bz2 # wget -c http://ftp.swin.edu.au/gentoo/snapshots/portage-latest.tar.bz2 # tar xvjf portage-latest.tar.bz2 -C /mnt/gentoo/usr
Chroot to system:
# mount -t proc none /mnt/gentoo/proc # mount -o bind /dev /mnt/gentoo/dev # chroot /mnt/gentoo /bin/bash # env-update # source /etc/profile
Update portage:
# emerge --sync
and if required:
# emerge -uv portage
Switch to correct timezone:
# cp /usr/share/zoneinfo/Australia/Sydney /etc/localtime
# date {MMDDhhmmYYYY}
Install Standard Gentoo First
# USE="-doc symlink" emerge gentoo-sources # cd /usr/src/linux # make menuconfig
Note: Remember to include all required ide, raid, and filesystems drivers (don't add as modules). I also included my scsi and ethernet drivers.
# make && make modules_install # cp arch/i386/boot/bzImage /boot/
Download gentoo template:
# wget -c http://ftp.swin.edu.au/gentoo/experimental/x86/vserver/stage3-i686-20060317.tar.bz2