|
VPS (Virtual Private Server) technology is a cost effective solution
that allows splitting your Linux boxes into many virtually isolated servers
and saves you hardware related capital investments.
On the one hand, a generic virtual server can provide complete root access,
can have its own processes, users, and multiple IP addresses.
On the other, virtual servers share the same Linux kernel and live on the same file system,
which allows shared administrative tasks, such as:
- data backups,
- task monitoring,
- sharing files and directories, and more.
VPS package to be installed is a modified version of
FreeVPS, a free Linux-based solution.
Each FreeVPS server has:
- memory and disk space limits,
- private localhost network interface,
- permissions to install its own application software and modify its config files,
- permissions to configure/modify root application software,
- permissions to delete, add, modify any file, including files in the /root directory.
FreeVPS extends the Linux vserver product.
This document will guide you through preparation of the server where the VPS package would be
installed, and through the VPS installation and configuration procedure, including:
For more information on VPS, contact vps@psoft.net.
System Requirements
H-Sphere VPS requires a separate box with RedHat 7.3.
Other versions and operating systems are not supported.
We provide you with the kernel installation package patched to support VPS.
To install the patched kernel,
please follow the instructions below.
System requirements:
- It is highly advised to use an Intel (i686) or Athlon processor.
Cyrix and other CPUs are not recommended;
- Each virtual server needs at least 60 MB of RAM and 500 MB of disk space;
- RedHat installation should include the minimal set of packages, namely:
standard RedHat kernel 2.4.18, C compiler and Perl.
No X visualization packages like KDE should be installed;
- On the RedHat installation process, a special option should be chosen
to install kernel source files;
- Make sure to have one large partition allocated for virtual server homes
where dozens of clients would have
individual Linux operating systems installed.
Required Packages
The following packages should be installed:
Kernel, version 2.4.18-27.7, patched to support VPS:
kernel-freevps-1.1-0.<CPU>.rpm
for SMP servers:
kernel-freevps-smp-1.1-0.<CPU>.rpm
where <CPU> is CPU type on your host box:
i386, i586, i686, athlon.
The latest kernel releases
can be found in the FreeVPS download area.
Linux vserver utilities
(Linux vserver project):
vserver-0.22-1.i386.rpm
FreeVPS tools:
freevps-tools-1.1-1.i386.rpm
H-Sphere VPS scripts:
hsphere-vps-1.1-1.i386.rpm
Standard modutils package updates for the 2.4.18 kernel:
modutils-2.4.18-3.7x.i386.rpm
modutils-devel-2.4.18-3.7x.i386.rpm
hsphere-sudo-1.6.3p5.rpm - H-Sphere package that enables users
to execute commands as another user, e.g., as superuser.
Please also check
the list of VPS releases and patches.
Installation Procedure
Enter the server console as root. The installation procedure requires reboot, therefore it is
preferable to reboot from the server console so that you can reload from the old kernel if the
problem with the new one occurs.
Download the packages and put them into a separate directory,
for example, to /root/inst:
# wget http://www.psoft.net/shiv/HS/VPS/modutils-2.4.18-3.7x.i386.rpm
# wget http://www.psoft.net/shiv/HS/VPS/modutils-devel-2.4.18-3.7x.i386.rpm
Kernel without SMP:
# wget http://www.freevps.com/download/rpms/<CPU>/kernel-freevps-1.1-0.<CPU>.rpm
Kernel with SMP:
# wget http://www.freevps.com/download/rpms/<CPU>/kernel-freevps-smp-1.1-0.<CPU>.rpm
# wget http://www.freevps.com/download/releases/vserver-0.22-1.i386.rpm
# wget http://www.freevps.com/download/rpms/i386/freevps-tools-1.1-1.i386.rpm
# wget http://www.psoft.net/shiv/HS/VPS/hsphere-vps-1.1-1.i386.rpm
# wget http://www.psoft.net/shiv/HS/RH73/hsphere-sudo-1.6.3p5.rpm
Here, <CPU> is the CPU type of your host server.
Install the packages in the following sequence:
1) Update modutils:
# rpm -U modutils-2.4.18-3.7x.i386.rpm modutils-devel-2.4.18-3.7x.i386.rpm
2) Install the new kernel package:
Kernel without SMP:
# rpm -ivh kernel-freevps-1.1-0.<CPU>.rpm
Kernel with SMP:
# rpm -ivh kernel-freevps-smp-1.1-0.<CPU>.rpm
Go to the /boot directory to check if the kernel update takes place:
# cd /boot
# ls -la
The new kernel is vmlinuz-2.4.18-freevps-1.1-0.
The old one would look like vmlinuz-2.4.18-3 or
vmlinuz-2.4.18-27.7.vserver.rc2.
3) Modify the boot loader, (a) for GRUB or (b) for LILO:
(a) GRUB: Edit the /boot/grub/grub.conf configuration file:
# vi /boot/grub.conf
The file should look like this:
default=0
timeout=10
splashimage=(hd0,0)/grub/splash.xpm.gz
title Red Hat Linux (2.4.18-freevps-1.1-0)
root (hd0,0)
kernel /vmlinuz-2.4.18-freevps-1.1-0 ro root=/dev/sda5
initrd /initrd-2.4.18-freevps-1.1-0.img
title Red Hat Linux (2.4.18-3)
root (hd0,0)
kernel /vmlinuz-2.4.18-3 ro root=/dev/sda5
initrd /initrd-2.4.18-3.img
default=0 means that GRUB would take the first title record
as the boot image, i.e., our new kernel.
GRUB loader would update the kernel automatically after reboot.
(b) LILO:
Step 1: Modify the lilo.conf configuration file:
# vi /etc/lilo.conf
Copy and paste the kernel image settings lines
and change the kernel number and the label parameter.
Change the default kernel loading parameter to the new kernel label name.
Important! Do not delete the old kernel image settings! If you delete these lines and
something goes wrong with the new kernel installation, your system would not start!
After these changes, lilo.conf would look like:
prompt
timeout=50
default=linux_patched
boot=/dev/sda
map=/boot/map
install=/boot/boot.b
message=/boot/message
linear
image=/boot/vmlinuz-2.4.18-3
label=linux
initrd=/boot/initrd-2.4.18-3.img
read-only
root=/dev/sda5
image=/boot/vmlinuz-2.4.18-freevps-1.1-0
label=linux_patched
initrd=/boot/initrd-2.4.18-freevps-1.1-0.img
read-only
root=/dev/sda5
Step 2: Type lilo to apply changes:
# lilo
You will see the line:
Added linux
Added linux_patched *
4) Look for partition where you would install all
Virtual Private Servers (VPS root directory).
Check the partition size by the df command.
It may look like this:
Filesystem 1k-blocks Used Available Use% Mounted on
/dev/hda7 2016016 569184 1344420 30% /
/dev/hda1 124427 26168 91835 23% /boot
/dev/hda2 30233928 23810084 4888032 83% /home
none 515560 0 515560 0% /dev/shm
/dev/hda6 2016016 33520 1880084 2% /tmp
/dev/hda3 10080520 8050124 1518328 85% /usr
/dev/hda5 7052464 124024 6570196 2% /var
Partition where the virtual servers would be installed should have enough disk space.
You can choose an existing partition, but it recommended to mount a separate partition
for the VPS root directory.
It may be like this:
/dev/hda9 24359384 243590 241158 1% /vservers
or
/dev/hda9 24359384 243590 241158 1% /hsphere/local/vservers
5) Reboot the server:
# shutdown -r now
6) Check if the kernel update takes effect:
# uname -a
If the kernel version is 2.4.18-freevps-1.1-0,
the kernel is patched successfully.
7) Install the H-Sphere sudo package:
# rpm -ivh hsphere-sudo-1.6.3p5.rpm
8) Install the Linux vserver utilities package:
# rpm -ivh vserver-0.22-1.i386.rpm
9) Install the generic FreeVPS tools package:
# rpm -ivh freevps-tools-1.1-1.i386.rpm --replacefiles
10) Install H-Sphere VPS scripts package:
# rpm -ivh hsphere-vps-1.1-1.i386.rpm --replacefiles
11) RedHat installation RPMS should be available on your server.
If you don't have this directory on the server, you have two ways how to make these RPMS available:
You could mount the directory on CD-ROM or another server,
or copy the packages to a certain directory from the installation CD or from another place.
For example, mount CD-ROM on another server to the target directory:
mount -t nfs
domain_name_or_ip:/mnt/cdrom/RedHat/RPMS
target_mount_directory
For a permanent access to the RPMS directory on another server,
add the following automount line to /etc/fstab:
domain_name_or_ip:source_mount_directory
target_mount_directory nfs defaults 0 0
Then, mount to the target directory:
# mount target_mount_directory
Alternatively, you could let the vps-configure.pl VPS host configuration script
download the required RedHat installation RPMS from RedHat site during
VPS host configuration procedure described below in this document.
VPS Host Configuration
To configure all Virtual Private Servers, run configuration script:
# /hsphere/shared/scripts/vps-configure.pl
If your installation was successful, you'll see information about Virtual Private Server:
Kernel version: 2.4.18-freevps-1.1-0
Kernel build: 1069334038
vserver utilities package: vserver-0.22-1
Base freevps tools package: freevps-tools-1.1-1
H-Sphere VPS scripts package: hsphere-vps-1.1-1
Linux code: RH73
With the further steps, you'll perform basic configuration for all your VPSs.
The default values are enclosed in square brackets ([ ]). To accept them, press <ENTER>.
Point to all Virtual Private Servers home directory
which you created on step 4 of the installation:
Please point to the directory where all Virtual Private Servers will be stored.
Make sure it has enough disk space!
The default is: [/hsphere/local/vservers]
Choose the gateway. The gateway of the main server, which is
suggested as the default, should be selected if the main server and the virtual private servers
will belong to the same subnet. Otherwise, enter a different gateway's IP:
Gateway will be used for routing by VPSs: [192.168.112.1]
See also VPS Network Configuration
Specify the IPs of your name servers. If you are running the script for the first time,
no defaults are suggested. Once you enter name server IPs, they will be remembered and used when
you run the script again:
Enter name server IP(s) separated with spaces: [192.168.112.1 192.168.112.102]
On this step, the script tries to find this host's network device. To accept the suggested value,
press Enter. Otherwise, enter a different device name:
Host ethernet device will be used for VPSs: [eth0]
If it is required to assign more than 16 IPs to VPS, type "yes" on the prompt to
use ethernet aliases:
Would you like to use virtual ethernet device [eth0] aliases instead of creating new
virtual devices [yes/no]?
Normally, VPS supports up to 16 virtual ethernet devices, and up to 16 IPs per each virtual
ethernet device, thus totally 16x16=256 IPs available for assignment per VPS.
But if it requires to assign more than 16 different IPs to VPS, you need to
reconfigure your VPS to assign IPs to virtual ethernet devices aliases.
Specify the directory with the full set of RPMS. If you don't have the RPMS, they will be
downloaded to this directory on the next step. If your RPMS are located in the default directory
(/home/RedHat/7.3/RedHat/RPMS), just press Enter, otherwise, type the actual path to the RPMS directory:
Please specify where Linux RedHat 7.3 installation RPMs are located.
The default is: [/home/RedHat/7.3/RedHat/RPMS]
If you don't have required RPM packages for the base Linux RedHat 7.3 installation
(e.g. you installed RedHat 7.3 from a CD-ROM), answer YES (type 'yes'),
and the script will download 257 packages, 130MB total:
Would you like the script to automatically download
required for Linux RH73 installation RPMs [yes/no]?
You can install additional packages for your VPS, such as:
gcc - cc and gcc GNU compilers;
samba - to allow access of SMB shares;
http - Web server;
php - HTML-embedded scripting language;
mysql,postgresql - database servers;
sendmail - Mail Transport Agent;
up2date - The RedHat Update Agent;
mc - Midnight Commander.
You can also enable some additional services:
httpd - Startup script for Apache Web Server;
sendmail - This service takes care of starting and stopping sendmail;
mysqld - This service takes care of starting and stopping the MySQL subsystem (mysqld);
postgresql - This is the init script for starting up the PostgreSQL server;
rhnsd - Starts Red Hat Network Daemon to keep your system up-to-date;
winbind - Starts and stops the Samba winbind daemon.
You will get the following prompt:
Would you like to install additional packages such as: "gcc http mc" [y/n]?
If you have chosen to install additional packages, you are given an opportunity to
configure the list of packages and services to be available on your Virtual Private Servers:
Lists of additional packages to install:
1 - [+] gcc
2 - [+] samba
3 - [ ] http
4 - [ ] sendmail
5 - [ ] php
6 - [ ] mysql
7 - [ ] postgresql
8 - [+] mc
9 - [ ] up2date
--------------------------
[ a ] - add
[ d ] - delete
[ c ] - change priority
[ n ] - new package list
[ s ] - save and exit
[ e ] - exit without saving
---------------------------
Enter the number of the list to be turned on/off,
or choose an option:
Additional services:
1 - [ ] httpd
2 - [ ] sendmail
3 - [ ] mysqld
4 - [ ] postgresql
5 - [ ] rhnsd
6 - [+] winbind
--------------------------
[ a ] - add
[ d ] - delete
[ c ] - change priority
[ s ] - save and exit
[ e ] - exit without saving
---------------------------
Enter the number of the service to be turned on/off,
or choose an option:
This wizard helps you to manipulate with lists of packages and services to be available
on your VPS(s). Type the number of a list/service to enable/disable it on your VPS(s).
Options:
[ a ] - add new list/service.
a) If you are going to enable a new List of additional packages, the
script will promt you to enter the name of a list.
Available lists to include:
--------------------------
gcc
http
mc
mysql
php
postgresql
samba
sendmail
up2date
--------------------------
Enter list name to add:
Mind that each list of additional packages (<list_name>) corresponds to the
rpm_<list_name>.cfg file in the /hsphere/local/config/vserver/RH73
directory, which contains the list of RPM packages required to install
service/program to satisfy all dependences. For example:
# cat /hsphere/local/config/vserver/RH73/rpm_samba.cfg
cups-libs-1.1.14-15.i386.rpm
samba-common-2.2.3a-6.i386.rpm
samba-client-2.2.3a-6.i386.rpm
If this configuration file doesn't exist, you need to create it. Use [ n ] option to create
a list of additional packages.
b) If you are going to enable new Additional services, the script will promt you to
enter the name of a service.
Mind that service must be installed to a virtual server.
/etc/rc.d/init.d/<service_name> is required to start/stop the service in your
virtual server(s).
For example, to enable the winbind service, packages from the samba
list (/hsphere/local/config/vserver/RH73/rpm_samba.cfg)
will install the /etc/rc.d/init.d/winbind file.
[ d ] - deletes lists/services from enabled additional package lists/services.
[ c ] - changes list installation priority.
For example, installation packages from the http package list
(packages required to instal Apache Web server) require
the gcc package to be installed first.
[ n ] - helps you to create your own list of additional packages to install.
Enter the name of the new list of package (i.e., my_list)
and the names of RPM packages to be added to the list.
Press Enter after each package name. When you finish, press Ctrl+D.
Remember that all of this packages must be located in the RPMS directory.
If these packages are not there, you will be promted to download them.
Then, you save the list and exit ([ s ]), or exit without save ([ e ]).
If you don't have required RPM packages for the base Linux RedHat 7.3 installation (e.g.
you installed RedHat 7.3 from CD-ROM), answer YES (type 'yes'), and the script will download
188 packages, 85MB total:
Would you like to automatically download all required Linux installation RPMs [yes/no]?
If you chose to download the packages (answered YES on the previous step),
you will be asked for their location:
Please specify the URL where Linux RH73 installation RPMs are located.
The default is: [ftp://192.168.112.77/pub/RedHat/7.3/RedHat/RPMS]
If the URL you have entered is valid, the download will start:
Downloading packages ...
base packages:
4Suite-0.11.1-8.i386.rpm [OK]
Distutils-1.0.2-2.noarch.rpm [OK]
...
------------------------------------
153 packages successfuly downloaded.
0 packages skipped.
0 packages failed to download.
gcc packages:
binutils-2.11.93.0.2-11.i386.rpm [OK]
cpp-2.96-110.i386.rpm [OK]
...
------------------------------------
5 packages successfuly downloaded.
0 packages skipped.
0 packages failed to download.
perl packages:
perl-5.6.1-34.99.6.i386.rpm [OK]
perl-CGI-2.752-34.99.6.i386.rpm [OK]
...
------------------------------------
24 packages successfuly downloaded.
0 packages skipped.
0 packages failed to download.
http packages:
mm-1.1.3-4.i386.rpm [OK]
apache-devel-1.3.23-11.i386.rpm [OK]
...
------------------------------------
3 packages successfuly downloaded.
0 packages skipped.
0 packages failed to download.
mc packages:
gpm-1.19.3-21.i386.rpm [OK]
gpm-devel-1.19.3-21.i386.rpm [OK]
...
------------------------------------
3 packages successfuly downloaded.
0 packages skipped.
0 packages failed to download.
If some packages fail to download, please download them manually
or run this script once again.
Specify if all VPSs will start at system reboot. Type 'y', 'yes' or press Enter for YES.
If you choose 'no', none of your VPSs will be started automatically, and you will have to resume
every individual VPS manually in the control panel after the system reboot:
Would you like all VPSs to start at physical server startup [y/n]?
At this point, the script will finish the configuration with the following notification
(see VPS cron scripts in VPS scripts documentation):
Writing to crontab: vps-cron-fix.pl [OK]
Writing to crontab: vps-cron.pl [OK]
Writing to crontab: vps-cron-traf.pl [OK]
Writing to crontab: vps-cron-delete.pl [OK]
Changing chkconfig... [OK]
In the end, you'll be prompted to save the changes you have made:
Save your changes [y/n]?
For more options run:
# /hsphere/shared/scripts/vps-configure.pl --help
Physical/Logical VPS Server Configuration Via Control Panel
To add and configure physical and logical VPS servers in H-Sphere:
- Generate SSH keys on your CP server
and place them to VPS host server to provide SSH connection between VPS host and CP server;
- Follow the instructions on
adding and configuring physical and logical VPS servers
via H-Sphere interface.
IMPORTANT:
Common instructions on adding physical and logical servers
in Control Panel are not applicable in this case!
Getting VPS Status
To get information about existing Virtual Private Servers on your host,
run thevps-list.pl script:
# /hsphere/shared/scripts/vps-list.pl
Kernel version: 2.4.18-freevps-1.1-0
Kernel build: 1069944738
Tools package: 1.1-1
Linux code: RH73
Free disk space on [/vservers]: 15002 Mb
Virtual Private Servers found on the host:
--------------------------------------------------------------------------------------------------------
ID NAME STATUS VDEV(HDEV):IP DISK INF. (Mb) MEMORY (Mb) PROCESSES TRAFFIC (Mb)
--------------------------------------------------------------------------------------------------------
3 231.psoft running eth0(eth0):192.168.112.231/24 4000 799.026 0 884.547 1000 82 9.663
4 232.psoft running eth0(eth0):192.168.112.232/24 4000 753.694 0 851.078 1000 74 8.183
5 233.psoft running eth0(eth0):192.168.112.233/24 4000 510.628 500 10.172 100 6 0.003
6 234.psoft running eth0(eth0):192.168.112.234/24 4000 752.632 0 851.121 1000 74 8.174
7 235.psoft running eth0(eth0):192.168.112.235/24 5000 510.632 500 10.180 100 6 0.010
8 236.psoft suspen. eth0(eth0):192.168.112.236/24 5000 818.647 500 0.000 100 0 0.000
9 237.psoft running eth0(eth0):192.168.112.237/24 5000 510.604 500 10.176 100 6 0.003
10 238.psoft running eth0(eth0):192.168.112.238/24 4000 510.620 500 10.180 100 6 0.003
eth1(eth0):192.168.112.243/24
eth2(eth0):192.168.112.244/24
--------------------------------------------------------------------------------------------------------
You would be prompted to display all VPS settings:
Display all VPS settings on this host [y/n]?
If you agree, you would obtain all configuration information
related to Virtual Private Servers on your host:
- VPS configuration parameters;
- crontab settings;
- chkconfig settings.
VPS Package Installer
To install additional packages on existing VPS, use the vps-pkg-inst.pl script.
It installs package/lists of packages to the VPS you specified or to all known VPS on the host.
Run # ./vps-pkg-inst.pl -h to get help on the script options:
vps-pkg-inst.pl - tools to install package(s) on Virtual Private Server(s)
usage: vps-pkg-inst.pl VPS_NAME|--all|-a OPTIONS
[VPS_NAME] Virtual Private Server name to install package(s)
--all|-a install package(s) on all known VPSs
OPTIONS:
--package=<package_name>|-p <package_name>
Install package. Full path to the package required.
--list=<list>|-l <list>
Install package(s) included to the <list>.
rpm_<list>.cfg file must be located in [/hsphere/local/config/vserver/RH73]
All RPM packages included in <list>, must be located in [/RPMS]
The first script argument is the VPS name.
If -a (or --all) option is specified, the installation will be performed to all known VPSs.
Options:
--package=<package_name>
-p <package_name> - installs RPM package <package_name>.
Full path to <package_name> is required.
Example:
--package=/pub/RedHat/7.3/RedHat/RPMS/mc-4.5.55-5.i386.rpm
-p /pub/RedHat/7.3/RedHat/RPMS/mc-4.5.55-5.i386.rpm
--list=<mylist>
-l <mylist> - installs package(s) included to <mylist>.
The rpm_<mylist>.cfg file must be located in /hsphere/local/config/vserver/RH73:
# ls -la /hsphere/local/config/vserver/RH73/rpm_php.cfg
-rw-r--r-- 1 root root 126 Nov 18 05:38 /hsphere/local/config/vserver/RH73/rpm_php.cfg
Example:
--list=php
-l php
Examples:
-
# cd /hsphere/shared/scripts
# ./vps-pkg-inst.pl 241.tst -l php (# ./vps-pkg-inst.pl 241.tst --list=php)
Preparing... ########################################### [100%]
1:php ########################################### [ 20%]
2:php-devel ########################################### [ 40%]
3:php-imap ########################################### [ 60%]
4:php-ldap ########################################### [ 80%]
5:php-odbc ########################################### [100%]
-
# ./vps-pkg-inst.pl -a --package=/RPMS/mc-4.5.55-5.i386.rpm
Installing packages to all known Virtual Private Servers...
Installing on [231.tst]...
Preparing... ########################################### [100%]
1:mc ########################################### [100%]
[OK] installation successfull
Installing on [232.tst]...
Preparing... ########################################### [100%]
package mc-4.5.55-5 is already installed
[ERROR] installation failed.
For more information, see
VPS Scripts guide.
|