Difference between revisions of "Installation on CentOS"

From Linux-VServer

Jump to: navigation, search
(Install a guest)
m (Install the kernel)
 
(16 intermediate revisions by 10 users not shown)
Line 1: Line 1:
== Install CentOS 5 ==
+
== Install CentOS ==
  
My CentOS 5 installation is a DVD install with only the "Desktop - GNOME" group selected.
+
My CentOS installation is a DVD install of CentOS 5 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 :)
+
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 it's okay to wait until you have installed the kernel before doing this (just to save some time :)).
  
 
== Add the repository ==
 
== 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
+
In order to install the necessary packages, you will have to add the repository containing them to your yum configuration.  
 +
 
 +
For CentOS 5 paste the following in '''/etc/yum.repos.d/dhozac-vserver.repo'''
 
  [dhozac-vserver]
 
  [dhozac-vserver]
 
  name=Linux-VServer related packages for CentOS $releasever - $basearch
 
  name=Linux-VServer related packages for CentOS $releasever - $basearch
 
  baseurl=http://rpm.hozac.com/dhozac/centos/$releasever/vserver/$basearch
 
  baseurl=http://rpm.hozac.com/dhozac/centos/$releasever/vserver/$basearch
 +
gpgkey=http://rpm.hozac.com/conf/keys/RPM-DHOZAC-GPG-KEY
 +
 +
For CentOS 6 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/rhel/$releasever/vserver/$basearch
 
  gpgkey=http://rpm.hozac.com/conf/keys/RPM-DHOZAC-GPG-KEY
 
  gpgkey=http://rpm.hozac.com/conf/keys/RPM-DHOZAC-GPG-KEY
  
Line 16: Line 24:
  
 
Before you do anything else, update yum. If you don't, you'll have to sit through lots of "you're using a knackered version of yum. Wait 5 seconds" messages.
 
Before you do anything else, update yum. If you don't, you'll have to sit through lots of "you're using a knackered version of yum. Wait 5 seconds" messages.
 +
 
  yum update yum
 
  yum update yum
 +
 
Which should pick the version from the dhozac repository.
 
Which should pick the version from the dhozac repository.
  
Line 23: Line 33:
 
To install the kernel, run
 
To install the kernel, run
 
  yum install kernel
 
  yum install kernel
 +
 +
To install the kernel on CentOS 6, run
 +
yum --disablerepo=* --enablerepo=dhozac-vserver 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.
 
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, which would block any guest's attempt to run sshd.
+
At this stage (before the reboot) I also modify the host's sshd_config file, so it doesn't listen to every interface on the server, which would block any guest's attempt to run sshd.
  
 
  vi /etc/ssh/sshd_config
 
  vi /etc/ssh/sshd_config
  
and add the line "ListenAddress 192.168.0.1"
+
and add the line "<code>ListenAddress <host IP address></code>".
  
 
== Install util-vserver ==
 
== Install util-vserver ==
Line 39: Line 52:
 
== Post installation steps ==
 
== Post installation steps ==
  
Make certain /proc entries visible
+
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: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
+
 
+
To get back to the host, just exit the shell.
+
 
+
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.
+
 
+
Optionally, the following may be run to increase the functionality of the guest:
+
vyum testing01 -- install yum vim-common vim-minimal vim-enhanced openssh-server openssh \
+
  gcc gcc-c++ kernel-devel bison openssl-devel libtermcap-devel ncurses-devel doxygen \
+
  curl-devel newt-devel mlocate lynx tar wget nmap bzip2 speex speex-devel unixODBC \
+
  unixODBC-devel libtool-ltdl libtool-ltdl-devel mysql-connector-odbc mysql mysql-devel \
+
  passwd
+
mkdir /etc/vservers/testing01/apps/vunify
+
vserver testing01 hashify
+
  
Enter the guest and run:
+
  service vprocunhide start
  pwconv
+
which splits /etc/passwd into /etc/passwd and /etc/shadow.
+
  
Then remove any lines which contain 'pam_loginuid.so' from /etc/pam.d/sshd, /etc/pam.d/login and /etc/pam.d/remote.
+
Enable the vservers-default initscript, so that guests marked default are started on boot.
  
Edit /etc/ssh/sshd_config and change the line '#ListenAddress 0.0.0.0' to 'ListenAddress w.x.y.z' (where w.x.y.z is the IP allocated to the guest)
+
chkconfig vservers-default on
  
Create /etc/resolv.conf with the appropriate details.
+
== All done! ==
 +
Once your host is setup, you can start [[Building Guest Systems|building guest systems]].
  
If all goes well you now have a working setup :)
+
[[Category:Installation]]

Latest revision as of 13:11, 17 October 2012

Contents

[edit] Install CentOS

My CentOS installation is a DVD install of CentOS 5 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 it's okay to wait until you have installed the kernel before doing this (just to save some time :)).

[edit] Add the repository

In order to install the necessary packages, you will have to add the repository containing them to your yum configuration.

For CentOS 5 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

For CentOS 6 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/rhel/$releasever/vserver/$basearch
gpgkey=http://rpm.hozac.com/conf/keys/RPM-DHOZAC-GPG-KEY

[edit] Update yum

Before you do anything else, update yum. If you don't, you'll have to sit through lots of "you're using a knackered version of yum. Wait 5 seconds" messages.

yum update yum

Which should pick the version from the dhozac repository.

[edit] Install the kernel

To install the kernel, run

yum install kernel

To install the kernel on CentOS 6, run

yum --disablerepo=* --enablerepo=dhozac-vserver 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 host's sshd_config file, so it doesn't listen to every interface on the server, which would block any guest's attempt to run sshd.

vi /etc/ssh/sshd_config

and add the line "ListenAddress <host IP address>".

[edit] Install util-vserver

To install util-vserver, run

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

[edit] Post installation steps

Make certain /proc entries visible.

service vprocunhide start

Enable the vservers-default initscript, so that guests marked default are started on boot.

chkconfig vservers-default on

[edit] All done!

Once your host is setup, you can start building guest systems.

Personal tools