Advertisment

Webmin as ISPs' Control Panel

author-image
PCQ Bureau
New Update

To set up domains and websites for customers on Linux, you may have to manually tinker various configuration files. Ever hoped for a free graphical control panel that asks a couple of questions and sets up the remaining for you? Virtualmin is one such tool. It is a plugin (aka, module) for Webmin, which is a popular Web-based configuration tool for configuring Linux machines and various services. Virtualmin works in tandem with other Webmin modules for setting up the Web server, DNS, mail and database server. 

Advertisment

In this article we will talk about setting up multiple domains with Web, e-mail and database servers on a machine running PCQLinux 2004 (given out in March 2004). Since a single machine runs services for multiple domains, giving the illusion of multiple servers at play, it is called setting up virtual servers. For a real-life setup you will need to carry out the below-mentioned setup on an Internet server. 

Direct

Hit!
Applies

to:
System administrators of ISPs
USP:

Quickly set up and control multiple domains, websites etc through a Web-based interface
Links:

www.webmin.com/index8.html

This article is also suited for those Internet over cable service providers who would like to entice their users by providing Web, mail and database services on their intranet server. 

Advertisment

Install Virtualmin



If you are going for a fresh installation of PCQLinux 2004, then make sure you select the following packages on the Package Selection Screen: Web Server, Mail Server>imap, Mail Server>postfix, DNS Name Server, SQL Database Server>mysql-server, Server Configuration Tools>redhat-switch-mail, PCQLinux Specials>

Management>webmin.

Otherwise, you may need to manually install the RPMs from the PCQLinux CDs. 

Download the Virtualmin module for Webmin from www.webmin.com/download/virtualmin/virtual-server-1.71.wbm.gz. Start Webmin as:

Advertisment

service webmin start

Access Webmin using https://:10000/. Log in using root as username and the corresponding password (of the root user on the machine). If you get an authentication error, try logging in without a password and make sure that you set a password after login by clicking on Webmin>Webmin Users>root. 

Next, click on Webmin>Webmin Configurations>Webmin Modules. Under 'Install Module', select the second option labeled 'From uploaded file' and click on Browse. Browse and select the file virtual-server-1.71.wbm.gz. Then click on 'Install Module'. 

Advertisment

Start required services



Virtualmin uses Postfix mail server to provide mail services, but the default mail server or MTA (Mail Transfer Agent) on PCQLinux 2004 is Sendmail. Issue the following to set Postfix as the default

MTA.

redhat-switch-mail

Select Postfix and click on OK. 

Advertisment

Next, we need to set up the services used by Virtualmin to start whenever the machine is started or rebooted. For this, issue the following.

ntsysv

Select the services httpd, ipop3, mysqld, named, postfix and webmin. Select OK. Issue the command 'service xinetd restart' or, better, reboot the machine.

Advertisment

When the machine is up, fire up Webmin using the URL https://:10000/. Virtualmin requires some simple configurations for the Web server (Apache), Postfix and DNS through

Webmin. 

Click on Servers>Apache Webserver and then on Configure. In the following screen, go to Networking and Addresses. Tick the checkbook labeled 'Include all addresses' and save it. On Webmin, click on Servers>Bind DNS Server>Module Config. For 'Chroot directory to run bind under', click on the radio button next to the text field and fill in /var/named/chroot. Scroll down and then save it. Click on Servers>Postfix Configuration>General Options. For 'Network interfaces for receiving mail' click on All and then on 'Save and Apply'. Click on Servers>Postfix Configuration>Virtual Domains. For Domain mapping lookup tables, click on the radio button next to the text field and fill in the following in the text field.

hash:/etc/postfix/virtual 

Advertisment

Click on 'Save and Apply'. On the Postfix Configuration page, click on 'Stop Postfix' and then on 'Start

Postfix'.

Set up virtual servers



On Webmin go to Servers>Virtualmin Virtual Servers. Make sure that Apache, Bind and mail server are running by clicking on their respective buttons at the bottom. Now, to create a new virtual server for domain pcqlabs.net, click on 'Add a new virtual server'. For 'Domain name', type in pcqlabs.net. For description, type in any text, say, the domain for PCQuest Test Labs. For Unix user's password, fill in any preferred password. The 'Web server type' (at the bottom) can be name based or IP based. The easiest is to have name based because IP based requires you to afford a dedicated IP address for the site. To understand name-based and IP-based websites refer to the article Virtual Hosting on Apache at www.pcquest.com/content/ search/showarticle.asp?arid=33692. Leave the other options at default and click on 'Create Server'. 

Jump out of Webmin and create an HTML file and name it as index.html. Upload the file to the Web server using the

following command.

scp index.html pcqlabs@pcqlabs.net:/home/pcqlabs/public_html

When prompted, type in the password that you had specified while creating the virtual server. The file will be uploaded to the website's directory for your domain. Specify the IP address of the PCQLinux machine as the DNS server for your machine or any other machine on the network. In Windows this can be done through TCP/IP settings. In Linux add the following line to the file called resolv.conf found in /etc directory.

nameserver 192.168.0.1

Substitute 192.168.0.1 with the IP address of the PCQLinux 2004 machine in your case. Launch the Web browser and key in http://www.pcqlabs.net. And voila, you should be able to see the page that you've uploaded to the server. 

Thus, with a few inputs, Virtualmin has set up a DNS and website for your domain. It has also set up an e-mail domain and a MySQL database for

pcqlabs.net. 

To see these working, click on pcqlabs.net on the Virtualmin Virtual Servers page. Click on Edit Mail Users>pcqlabs. For 'Primary email address enabled' select yes and then save it. 

Point your e-mail client (Outlook, Eudora etc) to mail.pcqlabs.net and you should be able to send and receive mail for pcqlabs@pcqlabs.net. You can create more e-mail users for the domain through Virtualmin Virtual servers>pcqlabs.net>Edit Mail Users>Add a user to this domain. Alternatively, you can create e-mail aliases through Virtualmin Virtual

servers>pcqlabs. net>Edit Mail Aliases. To check out the database, SSH to the server as:

ssh pcqlabs@pcqlabs.net

When prompted, issue the password specified during the creation of the virtual server. Next issue the following command.

mysql -u pcqlabs -p pcqlabs

When prompted, supply the same password as before. You will be dropped onto a MySql prompt. Issue the following there.

use pcqlabs

Virtualmin creates a database named pcqlabs in case of pcqlabs.net domain. Using the above command you have specified to use this database. Subsequently, you can issue SQL queries to create tables and insert data into the database. You can set up a server-side scripting language such as PHP on Apache and make pcqlabs.net a database-enabled website that can use the database named pcqlabs. For more refer to

www.webmin.com/index8.html

Shekhar Govindarajan 



IT4Enterprise

Advertisment