H-Sphere Documentation Sysadmin Guide

For more information contact us at info@psoft.net

VPS Installation

 

Related Docs:  

VPS Quota Reconfiguration VPS Configuration VPS User Manual

 

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

 

Operating 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 that the server runs on the Intel (i386) or Athlon processor. Cyrix and other CPUs are not recommended;
- 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-2.4.18-27.7.vserver.rc2.<your_processor_type>.rpm
    for SMP servers:
    kernel-smp-2.4.18-27.7.vserver.rc2.<your_processor_type>.rpm,
    where <your_processor_type> is CPU type on your host box: i386, i586, i686, athlon.
  • modutils-2.4.18-3.7x.i386.rpm, modutils-devel-2.4.18-3.7x.i386.rpm - standard modutils package updates for the 2.4.18 kernel.
  • hsphere-vps-x.xx-x.noarch.rpm - H-Sphere VPS package, x.xx-x is the release version.
  • hsphere-sudo-1.6.3p5.rpm - H-Sphere package that enables users to execute commands as another user, e.g., as superuser.

 

Installation Procedure

  1. Enter the server console under root. The installation procedure requires reboot, therefore it is preferable to reboot from the server console so that you may reload from the old kernel if the problem with the new one occurs.
  2. Download the packages and put them into separate directory, for example, ~inst:
    # wget http://psoft.net/shiv/HS/VPS/kernels/<your_processor_type>/kernel-2.4.18-27.7.vserver.rc2.<your_processor_type>.rpm
    # wget http://psoft.net/shiv/HS/VPS/modutils-2.4.18-3.7x.i386.rpm
    # wget http://psoft.net/shiv/HS/VPS/modutils-devel-2.4.18-3.7x.i386.rpm
    # wget http://psoft.net/shiv/HS/VPS/hsphere-vps-x.xx-x.noarch.rpm
    # wget http://psoft.net/shiv/HS/RH73/hsphere-sudo-1.6.3p5.rpm
    

    Here, x.xx-x is the release version.
    <your_processor_type> is the type of processor(s) on your host machine:

    Download VPS-related packages from http://psoft.net/shiv/HS/VPS/, kernel packages from http://psoft.net/shiv/HS/VPS/kernels/.
  3. 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:

    # rpm -ivh kernel-2.4.18-27.7.vserver.rc2.<your_processor_type>.rpm
    or # rpm -ivh kernel-smp-2.4.18-27.7.vserver.rc2.<your_processor_type>.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-27.7.vserver.rc2.
    The old one would look like vmlinuz-2.4.18-3.

    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-27.7.vserver.rc2)
                  root (hd0,0)
                  kernel /vmlinuz-2.4.18-27.7.vserver.rc2 ro root=/dev/sda5
                  initrd /initrd-2.4.18-27.7.vserver.rc2.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-27.7.vserver.rc2
            label=linux_patched
            initrd=/boot/initrd-2.4.18-27.7.vserver.rc2.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-27.7.vserver.rc2, the update is performed successfully.

    7) Install the H-Sphere sudo package:

    #rpm -ivh hsphere-sudo-1.6.3p5.rpm
    

    8) Install the vps package hsphere-vps-x.xx-x.noarch.rpm
    (x.xx-x is the release version):

    # rpm -ivh hsphere-vps-x.xx-x.noarch.rpm
    

    9) Check Virtual Private Server version:

    # rpm -qa|grep hsphere-vps
    
    You will see something similar to:
    hsphere-vps-x.xx-xx
    

    10) RedHat installation RPMS should be available on your server. If you don't have this directory on the server, 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
    

 

VPS 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-27.7.vserver.rc2
Kernel build: 1056256121
Tools package: hsphere-vps-0.98-29

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>.

a) You must point to all Virtual Private Servers home directory which you created in step 4:
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]

b) On the next step, you need to 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

c) 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]

d) Every virtual server should have its own "virtual" net card. It is recommended to leave the same name as for the network card:
VPSs will be used alias of ethernet device: [eth0]

e) You should specify the directory with the full set of RPMS copied or mounted on the previous 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]

f) Next, 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]?

g) You can install additional packages for your VPS, such as: gcc compiler, Perl interpreter, Apache web server, Midnight Commander (mc):
Would you like to install additional packages such as: "gcc perl http mc" [y/n]?
If you answer [yes], you are given an opportunity to configure the list of packages and services to be available on your Virtual Private Servers:

Additional packages/services:

1 - [+] gcc
2 - [+] perl
3 - [ ] http
4 - [ ] mc

--------------------------
[ s ] - save and exit
[ e ] - exit without saving
---------------------------
Enter the number of the package/service to be turned on/off,
or choose an option:	   
	   

Available services:

Additional packages/services:

1 - [+] httpd

--------------------------
[ s ] - save and exit
[ e ] - exit without saving
---------------------------
Enter the number of the package/service to be turned on/off,
or choose an option:
         

At this point, the script will finish the configuration with the following notification (see configuration scripts here):

	   
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

Some Virtual Private Server related files:

# ls -la /hsphere/local/config/vserver
drw-------    3 root     root         4096 Jul  3 13:00 .
drwxr-xr-x    3 root     root         4096 Apr  2 08:01 ..
drwxr-xr-x    6 root     root         4096 Jul  3 12:57 cp
-rw-r--r--    1 root     root         3875 Jul  1 20:44 rpm_base.cfg
-rw-r--r--    1 root     root          143 Jul  1 20:44 rpm_gcc.cfg
-rw-r--r--    1 root     root           77 Jul  1 20:44 rpm_http.cfg
-rw-r--r--    1 root     root           72 Jul  1 20:44 rpm_mc.cfg
-rw-r--r--    1 root     root          792 Jul  1 20:44 rpm_perl.cfg
-rw-r--r--    1 root     root           21 Jul  1 20:44 rpm_quota.cfg
-rw-r--r--    1 root     root         3463 Jul  3 12:57 vps.cfg
-rw-r--r--    1 root     root         3463 Jul  3 15:05 vps.cfg.bak
-rw-r--r--    1 root     root         3449 Jul  1 20:44 vps.cfg.default
-rw-r--r--    1 root     root           57 Jul  3 12:57 vps.list

Here:

cp directory, is the directory where the Virtual Private Servers and Control Panel common files are located. These files are managed every five minutes by the /hsphere/shared/scripts/cron/vps-cron.pl cron script which analyzes the cp/vps_name.in files posted by Control Panel, creates Virtual Private Servers and configures them, writes the cp/vps_name.out files with completed tasks.

rpm_base.cfg - the minimal set of packages required for Virtual Private Server installation.
rpm_gcc.cfg - the set of packages required for gcc compiler installation on VPS.
rpm_http.cfg - the set of packages required for Apache web server installation.
rpm_mc.cfg - the set of packages required for MC installation.
rpm_perl.cfg - the set of packages required for Perl installation.
rpm_quota.cfg - the set of packages required for VPS quota installation.
vps.cfg - the main configuration file for all Virtual Private Servers.
vps.cfg.bak - the main configuration file backup.
vps.cfg.default - the default configuration for all Virtual Private Servers.
vps.list - the list of all known VPS and the list of Virtual Private Servers scheduled to be removed.

VPS configuration files (vps_name.conf) and shell scripts for them (vps_name.sh) are also located there.

If you have problems with VPS, you may check the VPS log file: /var/log/hsphere/vps.log.

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-27.7.vserver.rc2
Kernel build: 1056256121
Tools package: hsphere-vps-0.98-29
Following Virtual Private Servers found on the host [vps.psoft]:

===================================================================================================================
ID NAME         IP(s)           STATUS  DISK INF.               MEMORY INF.             PROCESSES       TRAFIC
-------------------------------------------------------------------------------------------------------------------
 3 vps1_name    192.168.112.232 running 4000 Mb 1262.734 Mb     0 Mb    1093.750 Mb     1000    89      2572.193 Mb
 4 vps2_name    192.168.112.233 running 2000 Mb 620.069 Mb      256 Mb  136.449 Mb      1000    38      0.721 Mb
 5 vps3_name    192.168.112.234 running 1000 Mb 617.470 Mb      256 Mb  135.871 Mb      1000    38      0.714 Mb
 6 vps4_name    192.168.112.231 suspen. 2000 Mb 486.840 Mb      128 Mb  1.602 Mb        1000    1       489.916 Mb
-------------------------------------------------------------------------------------------------------------------	
	

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 Network Configuration

Since H-Sphere virtual private servers are logically separate boxes, their network interfaces must be configured identically to separate boxes in your H-Sphere cluster. Even though the main server has only one physical network adapter, the kernel emulates separate logical network adapters for each virtual private server. Hence, it is NOT correct to treat VPS IPs as aliases to the main server IP.

Interaction with the main server. Logically separate, the main server and virtual private servers don't communicate with each other directly or interact any differently from regular servers. Virtual private servers don't know anything about their 'parent', they don't even know about their virtual nature!

Configuring IPs. VPS IPs are set up automatically and are registered in the settings of the virtual private servers, not the main server. DON'T configure virtual private server IPs in the main server settings.

Adding or Changing IPs. VPS IPs or netmasks can be added or changed only through the Control Panel. This can't be done by editing the settings of the virtual private servers.

VPS Gateway. Virtual private servers should use the gateway of the main server only if they belong to its subnet. If placed in different subnets, they must be given different gateways.


Related Docs:  

VPS Quota Reconfiguration VPS Configuration VPS User Manual



Home   Products   Services   Partners   Support   News   Contact   Forum
© Copyright 1998-2003. Positive Software Corporation.
All rights reserved.