Difference between revisions of "Installation on CentOS"

From Linux-VServer

Jump to: navigation, search
(Install a guest: Corrected small error in example description)
(use my repository, various other fixes and hints)
Line 5: Line 5:
 
On restart, a number of questions (timezone/security level/etc) are asked. At this stage set the "SELinux" option to disabled. If you skip this step, then simply modify the /etc/sysconfig/selinux file and disable selinux from there. You will need to reboot before this takes effect, but its okay to wait until you have installed the kernel before doing this (just to save some time :)
 
On restart, a number of questions (timezone/security level/etc) are asked. At this stage set the "SELinux" option to disabled. If you skip this step, then simply modify the /etc/sysconfig/selinux file and disable selinux from there. You will need to reboot before this takes effect, but its okay to wait until you have installed the kernel before doing this (just to save some time :)
  
== Install the vserver kernel ==
+
== Add the repository ==
  
I have found using Daniel's fedora kernel rpm's work great with CentOS 5, so I downloaded the relevent kernel RPMS files
+
In order to install the necessary packages, you will have to add the repository containing them to your yum configuration. Paste the following in /etc/yum.repos.d/dhozac-vserver.repo
 +
[dhozac-vserver]
 +
name=Linux-VServer related packages for CentOS $releasever - $basearch
 +
baseurl=http://rpm.hozac.com/dhozac/centos/$releasever/vserver/$basearch
 +
gpgkey=http://rpm.hozac.com/conf/keys/RPM-DHOZAC-GPG-KEY
  
wget -c http://rpm.hozac.com/dhozac/fedora/6/vserver/i386/kernel-2.6.20-1.2936.fc6.vs2.2.0.1.i686.rpm
+
== Install the kernel ==
  
Then install the kernel...
+
To install the kernel, run
 +
yum install kernel
  
rpm -ivh kernel-2.6.20-1.2936.fc6.vs2.2.0.1.i686.rpm
+
Double check the grub file to make sure it is the bootable kernel (/boot/grub/grub.conf). If all is okay we are ready to restart the server.
 
+
Double check the grub file to make sure its the bootable kernel (/boot/grub/grub.conf). If all is okay we are ready to restart the server.
+
  
 
At this stage (before the reboot) I also modify the hosts sshd config file, so it doesn't listen to every interface on the server. This blocks any guests attempt to run sshd.
 
At this stage (before the reboot) I also modify the hosts sshd config file, so it doesn't listen to every interface on the server. This blocks any guests attempt to run sshd.
Line 23: Line 26:
 
and add the line "ListenAddress 192.168.0.1"
 
and add the line "ListenAddress 192.168.0.1"
  
 +
== Install util-vserver ==
  
== Install util-vserver (from source via RPM) ==
+
To install util-vserver, run
 
+
  yum install util-vserver{,-core,-lib,-sysv,-build}
At this stage I had to add some packages to my installation
+
 
+
  sudo yum install rpm-build gcc-c++ e2fsprogs-devel beecrypt-devel doxygen tetex-latex
+
wget ftp://rpmfind.net/linux/fedora/extras/5/i386/dietlibc-0.30-1.fc5.i386.rpm
+
wget ftp://rpmfind.net/linux/fedora/extras/5/i386/dietlibc-lib-0.30-1.fc5.i386.rpm
+
sudo yum localinstall dietlibc-0.30-1.fc5.i386.rpm dietlibc-lib-0.30-1.fc5.i386.rpm
+
 
+
Now we are ready to make the util-vserver rpm's
+
 
+
wget -c http://ftp.linux-vserver.org/pub/utils/util-vserver/util-vserver-0.30.213.tar.bz2
+
rpmbuild -tb util-vserver-0.30.213.tar.bz2
+
 
+
And finally, install the new rpms
+
 
+
sudo yum localinstall /usr/src/redhat/RPMS/i386/util-vserver*
+
  
 
== Post installation steps ==
 
== Post installation steps ==
  
Make certain /proc entries visable (required every boot, so install the vprocunhide start script on boot)
+
Make certain /proc entries visible
  
  sudo /sbin/chkconfig --add vprocunhide
+
  /etc/init.d/vprocunhide start
sudo /etc/init.d/vprocunhide start
+
  
 
== Install a guest ==
 
== Install a guest ==
Line 53: Line 41:
 
As root, try the following to test your installation (this example installs a CentOS 5 guest)
 
As root, try the following to test your installation (this example installs a CentOS 5 guest)
  
  sudo vserver testing01 build -m yum --context 4040 --hostname=test01.test.loc \
+
  vserver testing01 build -m yum --context 4040 --hostname=test01.test.loc \
 
  --interface eth0=eth0:192.168.101.101/255.255.0.0 -- -d centos5
 
  --interface eth0=eth0:192.168.101.101/255.255.0.0 -- -d centos5
  
yum will install the minimal packages now. After the yum process completes i got this error:
+
yum will install the minimal packages now. If you see something like
  
     /usr/lib/util-vserver/distributions/fc6/initpost: line 105:  3587 Killed
+
     /usr/lib/util-vserver/distributions/centos5/initpost: line 105:  3587 Killed
 
     $_VSERVER "$vserver" exec bash -c ': >/tmp/startwait' >&/dev/null
 
     $_VSERVER "$vserver" exec bash -c ': >/tmp/startwait' >&/dev/null
  
Some part of the script is broken it seems, but it won't affect the install. At this point you must be able to start and enter your vserver install. To start it the vserver do,
+
Don't worry, it's okay.
  
  sudo vserver testing01 start
+
At this point you should be able to start and enter your vserver install. To start the guest do,
  
And to enter the vserver, do
+
vserver testing01 start
  
  sudo vserver testing01 enter
+
And to enter the guest, do
  
Now you must be inside the centos5 install, you can start installing the packages you need now.
+
vserver testing01 enter
In case yum is not installed, you can do it via the following in the host system
+
  
  sudo vyum testing01 -- install yum
+
If you want to manage the packages inside the guest, you will have to install some package management programs as well as internalize the RPM database. This can be achieved by
 +
vyum testing01 -- install yum
 +
vserver testing01 pkgmgmt internalize
  
To get out of the vserver to the host you should use
+
Depending on your host distribution, you may also need to do
 +
vserver testing01 exec bash -c "rm -f /var/lib/rpm/__db*; rpm --rebuilddb"
 +
You'll know it's required if a simple ''rpm -qa'' inside the guest complains about a database version mismatch.
  
  Ctrl+d
+
To get back to the host, just exit the shell.
  
 
If all goes well you now have a working setup :)
 
If all goes well you now have a working setup :)

Revision as of 05:02, 25 August 2007

Contents

Install CentOS 5

My CentOS 5 installation is a DVD install with only the "Desktop - GNOME" group selected.

On restart, a number of questions (timezone/security level/etc) are asked. At this stage set the "SELinux" option to disabled. If you skip this step, then simply modify the /etc/sysconfig/selinux file and disable selinux from there. You will need to reboot before this takes effect, but its okay to wait until you have installed the kernel before doing this (just to save some time :)

Add the repository

In order to install the necessary packages, you will have to add the repository containing them to your yum configuration. Paste the following in /etc/yum.repos.d/dhozac-vserver.repo

[dhozac-vserver]
name=Linux-VServer related packages for CentOS $releasever - $basearch
baseurl=http://rpm.hozac.com/dhozac/centos/$releasever/vserver/$basearch
gpgkey=http://rpm.hozac.com/conf/keys/RPM-DHOZAC-GPG-KEY

Install the kernel

To install the kernel, run

yum install kernel

Double check the grub file to make sure it is the bootable kernel (/boot/grub/grub.conf). If all is okay we are ready to restart the server.

At this stage (before the reboot) I also modify the hosts sshd config file, so it doesn't listen to every interface on the server. This blocks any guests attempt to run sshd.

vi /etc/ssh/sshd_config

and add the line "ListenAddress 192.168.0.1"

Install util-vserver

To install util-vserver, run

yum install util-vserver{,-core,-lib,-sysv,-build}

Post installation steps

Make certain /proc entries visible

/etc/init.d/vprocunhide start

Install a guest

As root, try the following to test your installation (this example installs a CentOS 5 guest)

vserver testing01 build -m yum --context 4040 --hostname=test01.test.loc \
--interface eth0=eth0:192.168.101.101/255.255.0.0 -- -d centos5

yum will install the minimal packages now. If you see something like

    /usr/lib/util-vserver/distributions/centos5/initpost: line 105:  3587 Killed
    $_VSERVER "$vserver" exec bash -c ': >/tmp/startwait' >&/dev/null

Don't worry, it's okay.

At this point you should be able to start and enter your vserver install. To start the guest do,

vserver testing01 start

And to enter the guest, do

vserver testing01 enter

If you want to manage the packages inside the guest, you will have to install some package management programs as well as internalize the RPM database. This can be achieved by

vyum testing01 -- install yum
vserver testing01 pkgmgmt internalize

Depending on your host distribution, you may also need to do

vserver testing01 exec bash -c "rm -f /var/lib/rpm/__db*; rpm --rebuilddb"

You'll know it's required if a simple rpm -qa inside the guest complains about a database version mismatch.

To get back to the host, just exit the shell.

If all goes well you now have a working setup :)

Personal tools