Installation on CentOS: Difference between revisions

From Linix VServer
Jump to navigationJump to search
(Restored content from Wayback Machine)
 
(18 intermediate revisions by 10 users not shown)
Line 1: Line 1:
== Install CentOS 5 ==
<div id="content">


My CentOS 5 installation is a DVD install with only the "Desktop - GNOME" group selected.
<span id="top"></span>
<span id="installation-on-centos"></span>
= Installation on CentOS =


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 :)
<div id="bodyContent">


== Add the repository ==
<span id="siteSub"></span>
=== From Linux-VServer ===


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
<div id="contentSub">
[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
</div>
<div id="jump-to-nav">
 
Jump to: [[#column-one|navigation]], [[#searchInput|search]]
 
</div>
{| id="toc" class="wikitable toc" summary="Contents"
|-
| <div id="toctitle">
 
<span id="contents"></span>
== Contents ==
 
 
</div>
* [[#Install_CentOS_5|<span class="tocnumber">1</span> <span class="toctext">Install CentOS 5</span>]]
* [[#Add_the_repository|<span class="tocnumber">2</span> <span class="toctext">Add the repository</span>]]
* [[#Install_the_kernel|<span class="tocnumber">3</span> <span class="toctext">Install the kernel</span>]]
* [[#Install_util-vserver|<span class="tocnumber">4</span> <span class="toctext">Install util-vserver</span>]]
* [[#Post_installation_steps|<span class="tocnumber">5</span> <span class="toctext">Post installation steps</span>]]
* [[#Install_a_guest|<span class="tocnumber">6</span> <span class="toctext">Install a guest</span>]]
 
|}
 
<span id="Install_CentOS_5"></span>
<span id="edit-install-centos-5"></span>
== <span class="editsection">[<nowiki/>[[index.php?title=Installation_on_CentOS&action=edit&section=1|edit]]]</span> <span class="mw-headline"> Install CentOS 5 </span> ==
 
My CentOS 5 installation is a DVD install with only the &quot;Desktop - GNOME&quot; group selected.
 
On restart, a number of questions (timezone/security level/etc) are asked. At this stage set the &quot;SELinux&quot; 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 :)


== Update yum ==
<span id="Add_the_repository"></span>
<span id="edit-add-the-repository"></span>
== <span class="editsection">[<nowiki/>[[index.php?title=Installation_on_CentOS&action=edit&section=2|edit]]]</span> <span class="mw-headline"> Add the repository </span> ==


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.
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
yum update yum
Which should pick the version from the dhozac repository.


== Install the kernel ==
<pre>[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</pre>
<span id="Install_the_kernel"></span>
<span id="edit-install-the-kernel"></span>
== <span class="editsection">[<nowiki/>[[index.php?title=Installation_on_CentOS&action=edit&section=3|edit]]]</span> <span class="mw-headline"> Install the kernel </span> ==


To install the kernel, run
To install the kernel, run
yum install kernel


<pre>yum install kernel</pre>
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 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"
<pre>vi /etc/ssh/sshd_config</pre>
and add the line &quot;ListenAddress 192.168.0.1&quot;


== Install util-vserver ==
<span id="Install_util-vserver"></span>
<span id="edit-install-util-vserver"></span>
== <span class="editsection">[<nowiki/>[[index.php?title=Installation_on_CentOS&action=edit&section=4|edit]]]</span> <span class="mw-headline"> Install util-vserver </span> ==


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


== Post installation steps ==
<pre>yum install util-vserver{,-core,-lib,-sysv,-build}</pre>
<span id="Post_installation_steps"></span>
<span id="edit-post-installation-steps"></span>
== <span class="editsection">[<nowiki/>[[index.php?title=Installation_on_CentOS&action=edit&section=5|edit]]]</span> <span class="mw-headline"> Post installation steps </span> ==


Make certain /proc entries visible
Make certain /proc entries visible


/etc/init.d/vprocunhide start
<pre>/etc/init.d/vprocunhide start</pre>
 
<span id="Install_a_guest"></span>
== Install a guest ==
<span id="edit-install-a-guest"></span>
== <span class="editsection">[<nowiki/>[[index.php?title=Installation_on_CentOS&action=edit&section=6|edit]]]</span> <span class="mw-headline"> Install a guest </span> ==


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)


vserver testing01 build -m yum --context 4040 --hostname=test01.test.loc \
<pre>vserver testing01 build -m yum --context 4040 --hostname=test01.test.loc \
--interface eth0:192.168.101.101/255.255.0.0 -- -d centos5
--interface eth0=eth0:192.168.101.101/255.255.0.0 -- -d centos5</pre>
 
yum will install the minimal packages now. If you see something like
yum will install the minimal packages now. If you see something like


    /usr/lib/util-vserver/distributions/centos5/initpost: line 105:  3587 Killed
<pre>    /usr/lib/util-vserver/distributions/centos5/initpost: line 105:  3587 Killed
    $_VSERVER "$vserver" exec bash -c ': >/tmp/startwait' >&/dev/null
    $_VSERVER &quot;$vserver&quot; exec bash -c ': &gt;/tmp/startwait' &gt;&amp;/dev/null</pre>
 
Don't worry, it's okay.
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,
At this point you should be able to start and enter your vserver install. To start the guest do,


vserver testing01 start
<pre>vserver testing01 start</pre>
And to enter the guest, do


And to enter the guest, do
<pre>vserver testing01 enter</pre>
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


vserver testing01 enter
<pre>vyum testing01 -- install yum
vserver testing01 pkgmgmt internalize</pre>
Depending on your host distribution, you may also need to do
 
<pre>vserver testing01 exec bash -c &quot;rm -f /var/lib/rpm/__db*; rpm --rebuilddb&quot;</pre>
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.
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
If all goes well you now have a working setup :)
vyum testing01 -- install yum
 
vserver testing01 pkgmgmt internalize
<div class="printfooter">


Depending on your host distribution, you may also need to do
Retrieved from &quot;http://wiki.linux-vserver.org/Installation_on_CentOS&quot;
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:
</div>
vyum testing01 -- install yum vim-common vim-minimal vim-enhanced openssh-server openssh \
<div class="visualClear">
  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
mkdir /etc/vservers/testing01/apps/vunify
vserver testing01 hashify


Enter the guest and run:
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.


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)
</div>


Create /etc/resolv.conf with the appropriate details.
</div>


If all goes well you now have a working setup :)
</div>

Latest revision as of 00:44, 11 November 2025

Installation on CentOS[edit]

From Linux-VServer[edit]


Jump to: navigation, search

Contents[edit]

[edit] Install CentOS 5 [edit]

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 :)

[edit] Add the repository [edit]

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

[edit] Install the kernel [edit]

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"

[edit] Install util-vserver [edit]

To install util-vserver, run

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

[edit] Post installation steps [edit]

Make certain /proc entries visible

/etc/init.d/vprocunhide start

[edit] Install a guest [edit]

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 :)