Next Previous Contents

6. Creating Virtual Servers

6.1 Please check!

Before you continue, please check that your template filesystem is all set and as root, try the following:

chroot /virtual/template

Try some commands within the chroot'd environment. It should appear like a mini Linux system. Make sure you are happy with the commands. If not, copy them over from the main server or edit the virt_template.conf file and try re-creating the template filesystem.

6.2 IP Aliasing

To set up virtual servers to reside on one main server, you will need to set up IP Aliasing. This will have to be done with any method of hosting virtual servers that you choose. There is a HOWTO on this subject: Mini How-to on Setting Up IP Aliasing On A Linux Machine by Harish Pillay. That HOWTO should set you in the proper direction. Once you set up IP Aliasing for a virtual server, test it, ping it. Obviously it will point to your main server for now.

6.3 DNS

DNS for the servers should be set up normally. There is an HOWTO for this: DNS HOWTO by Nicolai Langfeldt.

Although, as of Virtfs 0.70.0, the /etc/resolv.conf file for your virtual server will be created. Specifically you will want to change the values of the Primary DNS and Secondary DNS. When the virtual server has been created, /etc/resolv.conf will automatically be filled in.

6.4 Virtuald

Explained above, virtuald is written in C (Brian Ackerman, from his HOWTO) which is meant to direct a specific service to the directory where a virtual service exists. It should be placed in your /etc/inetd.conf directory. More on this later..

6.5 tcp_virtuald

This file does exactly what virtuald achieves, but if you want your services to run through the tcpd service, you will want to use this version of virtuald. Details on implementing tcp_virtuald is described below.

6.6 Virtfs

Introduction

This is the Perl script which will help you setup and maintain your virtual servers. Virtfs uses dialog to present you with your choices in a simple but tidy look running from the command line. The main page for Virtfs has screenshots.

/etc/virt.conf Configuration

This is an important configuration file that you must look through before firing up Virtfs. There are two sections to this file: the <Configuration> and <Shell Commands> sections. The <Shell Commands> section is very similar to the <Custom Template> section (as described above). This section is compromised of shell commands that virtfs will execute upon the creation of a new virtual server. You may not even need it, especially if you customised your template directory well.

The <Configuration> section is well documented and easy to follow through. For example, if you would like to change the UI program from dialog to Xdialog, you may do so under the Dialog value.

An important variable to edit (or not to) is the Leading Virtual Directory. Your template directory should be contained in this. Typically, the value of this is /virtual (your template directory would then be /virtual/template). This way, all your virtual servers will be stored in /virtual (for example, vserver.com will be in /virtual/vserver.com).

Upon starting up Virtfs you have the choice to either create a new server, or maintain an existing virtual server that you have set up before. When you choose a virtual server to configure, you can delete the server, switch on/off FTP and Mail services, add/remove users and groups, set up Apache, etc. You can even log into the virtual server as a specified user. Virtfs should help in the daily administration tasks, basically.

After setting up the networking and DNS configuration (for a virtual server), you will want to run Virtfs to set up your virtual servers. After setting them up, you may want to run Virtfs again and again to take care of the system administration for a particular virtual server.

6.7 The FTP files

In order to make ftp service work on your virtual servers, you may have to edit /etc/virt.conf to enable some files that are needed. You will have to edit the line:

ftp files = /etc/ftpaccess /etc/ftpusers /etc/ftpconversions /etc/ftphosts
Everytime a server is enabled, Virtfs copies the files from the main server (the values from the ftp files value) to the virtual server. These files are not hard linked as each server may need their own copy of these files. These files are server dependant.

6.8 The ldconfig files

As of v.0.60.0, Virtfs will create a /etc/ld.so.conf file for your virtual server (this is for setting up your system's libraries). You can edit the directories which are first placed into the ld.so.conf file by editing /etc/virt.conf and changing the value of ldconfig libs. Each directory should be seperated by a space.

6.9 Virtrun

Virtrun is another Perl script (real simple) which also uses dialog. If you are in a rush you can execute a command for a specific virtual server. For example, the listing of a particular directory, or to su over (even thoug Virtfs can achieve this for you). Virtrun basically does the chroot for you.


Next Previous Contents