How to use the documentation - Start here. It provides a brief (about one page) overview of the conventions and organization of this documentation.
Installation Guides - Automatic and manual installation procedures for Virtualmin Professional and GPL.
Upgrading Virtualmin Software - Upgrading Virtualmin and related software from within Virtualmin and from the command line.
Step by Step Tutorials - Simple task-oriented guides for dozens of common tasks in Virtualmin, such as logging in, using email, creating virtual servers, etc. all in one big list (also available categorized below).
Installation FAQ - Have questions about installing Virtualmin?
Installation Troubleshooting - Troubleshooting common installation problems.
POP3 and IMAP Configuration - How to configure common mail clients to download mail for POP3 and IMAP.
Spam and Anti-Virus Scanning - Explanation of Spam and Virus scanning features in Virtualmin.
Email FAQ - Have questions about the Virtualmin email stack?
Email Troubleshooting - Troubleshooting common email problems.
DomainKeys Identified Mail - Signing outgoing email with DKIM signatures.
Sender Dependent Outgoing IP Address - Controlling the IP address used for outgoing SMTP connections.
Website Content - Uploading and managing website content and data.
Web server FAQ - Have questions about web service and web applications in Virtualmin?
Website Troubleshooting - Troubleshooting common problems with web service.
Subversion and Virtualmin - Creating SVN repositories hosted with Virtualmin.
Git and Virtualmin - Creating Git repositories hosted with Virtualmin.
Using Nginx - Using the Nginx webserver with Virtualmin instead of Apache.
Multiple PHP Versions - Setting up multiple PHP versions on CentOS
Ruby on Rails support in Virtualmin - Installing and managing a Ruby on Rails environment under Virtualmin.
PHP support in Virtualmin - Working with PHP in a Virtualmin environment.
Remote Databases - Configuring and using remote databases in Virtualmin
Databases FAQ - Have questions about databases in Virtualmin?
Virtual Server Owners Guide - A brief guide for virtual server account holders, covering logging in, uploaded and managing web content, and creating mailboxes.
Resellers Guide - A guide for Virtualmin resellers, covering creation and management of virtual servers.
Mail and FTP Users - A guide for Virtualmin mailbox account holders, covering logging into Usermin, and basic usage of mail features.
Security FAQ - Frequently asked security questions
PCI Compliance - Details on setting up a PCI compliant server
Command Line API - Command line tools for managing Virtualmin.
Command Line API Examples - Example code snippets for performing tasks with the Virtualmin command line API.
Remote API - Remote access to the Virtualmin API.
Pre and Post Domain Modification Scripts - Writing your own scripts to be run when a virtual server is changed.
Writing Virtualmin Plugins - Building Webmin modules that interact with Virtualmin.
Creating Install Scripts - Making applications easily installable with the Virtualmin Install Scripts interface.
Creating New Content Styles - Creating new content styles for the Virtualmin website editor, or converting existing templates for use in Virtualmin.
Backup and Restoration - Backing up and restoring Virtualmin virtual servers.
Migrating To a New Server - How to migrate your Virtual Servers from an existing server to a new server.
Virtualmin on Low Memory Systems - Configuration tips for running Virtualmin on systems with 512MB or less memory.
Mobile Devices and Virtualmin - Using Virtualmin on iPhone, Android, Palm Pre, or any other mobile device with a web browser.
Support Requests and Remote Login Access - Using the Virtualmin Support module to file tickets from within Virtualmin and get hands-on support for Virtualmin Professional and Cloudmin products.
OS Notes - Notes and caveats about specific operating systems. While Virtualmin and Webmin are generally fully functional on most modern Linux and UNIX systems, there are some known issues with some operating systems and versions.
More...Installation Guide - How to install Cloudmin.
Introduction to Virtualization Concepts - What virtualization is and how it works.
Using Cloudmin - An introduction to various tasks in Cloudmin.
Virtual Server Owners Guide - A brief guide for virtual server account holders, covering logging in, uploaded and managing web content, and creating mailboxes.
Resellers Guide - A guide for Virtualmin resellers, covering creation and management of virtual servers.
Mail and FTP Users - A guide for Virtualmin mailbox account holders, covering logging into Usermin, and basic usage of mail features.
To access the Usermin Webmail system, browse to port 20000 on your domain name, using the HTTPS protocol.
For example:
https://www.domain.tld:20000
Login using your mailbox username and password.
Usermin provides a left-hand menu, and a right-hand content pane.
In the left-hand menu, there is a Mail tab and a Usermin tools tab. The Mail tab includes a list of available mail folders, a search box, and links for folder management, address book, mail preferences, change passwords, system information, and switch user.
The right pane displays either the active folder, mail message, or Usermin tool that has been selected in the left-hand menu.
A guide for Virtualmin Reseller account holders. Documents domain creation, editing, maintenance, and script installation.
Virtualmin, combined with Webmin and Usermin, provides a complete virtual hosting administration system, allowing for four tiers of operation, "administrator", "reseller", "domain owner", "mail user". This guide is for the second, or reseller, tier of the system. The reseller account type has the ability to create, update and delete domains, manage email addresses within the domains under her control, and optionally install scripts and monitor bandwidth and disk usage. This guide covers only Virtualmin's extensive virtual hosting features that are available to Reseller account holders.
Any web browser can be used with Virtualmin, though some themes use advanced browser features that work better in browsers with good CSS support (Firefox, Safari, Opera and Konqueror all fit this description, while Internet Explorer currently does not). It is even possible to use a text-mode browser like lynx or links to use Virtualmin.
To login to Webmin (because Virtualmin is part of Webmin, one logs into Webmin and browses to the Virtualmin module), browse to the address of your server using the HTTPS protocol on port 10000. For example, if your Virtualmin server was running on hostname hosting1.virtualmin.com, you would enter https://hosting1.virtualmin.com:10000 in the URL field of your browser.
Your administrator will provide you a username and password to use for logging in.
Within most Webmin modules, there will be a help link in the upper left corner of the page. Clicking it will open a help window with documentation about the specific page you are on. Most options in Webmin can be clicked on to get a popup help window describing that specific option. The Virtualmin module has extensive online help in addition to this manual, so if any option or feature confuses you, you don't have to find the appropriate section in this guide. Clicking on it will popup the help window with help specific to the item you clicked.
At the bottom of the left-hand menu, you'll find a Logout link. Clicking this link will, obviously, log you out of Webmin.
To create a new virtual server, click the Create Server* menu heading in the left menu bar, and then click the *Create Virtual Server item.
A new page full of options will be displayed in the right content window. We'll assume that most default settings are appropriate for our domain for the sake of simplicity in this example, but later on we'll dive into the depths of custom Server Templates, skeleton directories and customization of the default settings for new domains. After a fresh install, Virtualmin has pretty reasonable defaults for the vast majority of environments, though, so we can create a domain easily and expect it to be useful right away.
image:images/first-domain.png["Screenshot of Virtualmin Create Domain page"]
In the above, I have filled in everything that is needed to create a domain with most features enabled. I only specified a few options: Domain name, Description, Contact email address, and Administration password. The rest I've left at their default values. If you aren't sure what a particular option means, click on the name of the option, and a help window will pop up to describe the option. Every option in Virtualmin has a popup help link, and most pages have a general overview help link in the upper left corner of the page.
You must always provide a domain name for a virtual server account (there are ways to create websites for users without domains using Virtualmin, but that is a much simpler problem and isn't the focus of Virtualmin).
The description is simply a short description of the domain. It is free text, and does not impact any aspect of the virtual server, so it can be just about anything. It will appear as the "Real Name" of the domain user in the Users and Groups module.
Here, you select what email address should receive notifications about this domain, including the creation email that lists the available services, provides login instructions, etc. If you choose to generate the password later on, this may be the only way for the user to find out the password, so it may be appropriate to choose Other address.. and enter the users preferred address in the field provided.
You can choose to have a password generated randomly, which is a good idea from a security standpoint. Virtualmin will generate a reasonably long (8+ characters) random password, which will be sent to the user via email. They can, of course, immediately change the password when they login.
All of the other options can generally be left alone. We'll discuss many of them in more detail later on, but for now, let's just assume that the defaults are perfect.
When you click the Create Server button, Virtualmin will spin into action...it will create the new user and group, add Apache virtual host configuration, add a zone and domain to BIND, add virtual domain configuration to Postfix, create new databases and users in MySQL and PostgreSQL, configure SpamAssassin and ClamAV for the domain, configure log rotation and Webalizer log reports, (woo! I'm getting tired just talking about it...that Virtualmin works hard so you don't have to) and configures any optional Virtualmin Plugin features, like Mailman mailing lists or SubVersion revision control repositories.
Now you can return to the Virtualmin main page and you'll see your new domain in the list of available domains. Clicking on the domain allows you to edit all of the options we just configured, so you can always return to the domain to alter the settings (be careful with that feature, however, as turning off a feature may delete user data...Virtualmin will warn you before destructive changes).
The domain owner can also login using the new domain account and the password you assigned (or that was randomly generated).
Bandwidth monitoring is a standard feature of Virtualmin, allowing the administrator to limit bandwidth usage or simply notify users and administrators when a domain is approaching and has surpassed their allotted network bandwidth.
To find out bandwidth usage of your domains, click the Bandwidth Usage link in the left-hand menu (if unavailable, bandwidth monitoring has not been enabled for your account).
Virtualmin Professional provides the ability for domain owners, resellers, and administrators to easily install dozens of PHP and Perl scripts within a Virtualmin domain. It also allows for one or more scripts to be installed automatically on server creation, based on the selec ted Server Template for the new domain. New Script Installer scripts can also easily be writ ten using the Install Scripts to add support for internally developed applications.
To install a new script select the domain you'd like to install for in the dropdown menu at the top of the left-hand menu, and then click Install Scripts. Then, click the radio button next to the script you'd like to install, and optionally select a version (often both a stab
le and development version are provided). Finally, scroll to the bottom of the page and clic
k the Show Install Options button.
On this page, you'll be able to select the database to use from existing databases, optionally create a new database, and choose the name of the subdirectory to install the script under.
Clicking Install Now will then install the script and setup the database with the appropr
iate items. Some scripts don't need a database, and so the database-related option will be unavailable.
Virtualmin allows you, the domain virtual server account holder, to manage your website files, mailboxes, databases, DNS entries, and install scripts.
Virtualmin is the administrative interface, or control panel, you will use for most of the administrative functions you'd like to accomplish. You can open your account using any browser (modern browsers like Firefox, Safari, and Opera are recommended), by browsing to port 10000 on the server address using the HTTPS protocol.
For example, if your domain were virtualmin.com, you could access it at the URL: https://virtualmin.com:10000
Enter your username and password, as provided by your system administrator.
When you login to Virtualmin, you'll see a left-hand menu bar and a right-hand content page, as shown in the diagram below:
image:/images/first-look.png
The left menu contains all of the options available for your domain. Some shown here might not be available in your menu, it depends on the options available for your domain.
The right content page opens with a summary of your virtual server data, such as number of domains, disk usage, mailboxes etc.
There are several ways to upload content to your Virtualmin account. You can use any of them or all of them, based on your needs and skills.
The preferred method for sending many files, directories of files, or very large files, is the SSH protocol. SSH is a fast and secure protocol, that allows you to safely login, upload and download files, and manage existing files. SCP is the name for file transfer commands that work using the SSH protocol. Likewise, FTP over SSH (sometimes also called FISH, or SFTP) is a mechanism for providing FTP-like service over a secure link.
There are many graphical and textmode clients for the SSH protocol available for free and commercially.
We'll cover where to find SSH-capable clients for your Operating System, and we'll provide a few examples of using them to manage the files in your Virtualmin account.
pscp
The best free command line SCP client is called pscp.exe and it can be found at:
http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html
It is related to PuTTY, which is a very nice free SSH client.
After you've placed the pscp.exe file into your system path, using it is quite simple. In a DOS shell, simply enter a command like the following:
C:\> pscp.exe myfile.htm user@domain.tld:/home/user/public_html
Then, enter your password at the prompt, and hit enter. This will copy the file "myfile.htm", located in the current directory, to the /home/user/public_html folder on the Virtualmin server.
Filezilla
A free graphical FTP client that supports FTP over SSH is Filezilla. http://filezilla.sourceforge.net/|Filezilla Home Page.
To Configure Filezilla:
Your admin user will be able to use a graphical FTP style program or Dreamweaver to upload their pages now.
WinSCP
Another good free graphical FTP over SSH option is WinSCP:
http://winscp.net/eng/index.php|WinSCP Home Page
After installation, simply start it up. It will ask for your login information. Enter the details as provided by your system administrator for hostname, username, and password. Then click Login.
Now you'll see a window displaying the files in your Virtualmin account home directory. You can copy files into your public_html directory to make them accessible via the webserver, or into the cgi-bin directory, if the files are executable CGI scripts.
scp
Mac OS X includes the free OpenSSH SCP client, called simply scp. Usage is just like Linux and UNIX scp clients. Open a Terminal and execute a command like the following:
$ scp myfile.htm user@domain.tld:/home/usr/public_html
After this hit enter, and then enter your password.
Cyberduck
Cyberduck is a popular Mac-native Open Source graphical FTP client that supports SCP, SFTP, FTP over SSL, WebDAV/SSL, and Amazon S3 secure connections.
It also integrates very cleanly with most favorite external OSX text editors, like SubEthaEdit, BBEdit, TextWrangler, Text-Edit Plus, TextMate, mi, Smultron, JeditX, CSSEdit, CotEditor and Tag, skEdit, and PageSpinner.
Download it for free from here:
[http://cyberduck.ch_ Cyberduck Home Page]
scp
Like Mac OS X, all Linux distributions include a complete SSH implementation, including the scp command. Run the following to copy a file named "myfile.htm" to the domain.tld server using the username "user":
$ scp myfile.htm user@domain.tld:/home/usr/public_html
After this hit enter, and then enter your password.
gftp
gftp is a popular Gnome-based graphical FTP client that also supports scp and FTP over SSH protocol connections.
Download it for free from here:
[http://gftp.seul.org/ gftp Home Page]
Or, preferably, simply install the package provided by your OS vendor. gftp is very popular and is available from the majority of Linux distributions, so you don't need to build it yourself.
Your FTP client should be configured to connect to yourdomain.tld, or, if DNS has not yet propagated, you could use the IP address or temporary hostname given to you by your administrator (which will be of the form youdomain.hostdomain.tld). You will use the domain account name and password given to you by your system administrator. Note that, by default, only the domain account has FTP access to the website data for your account, and additional users are only email users.
All of our products are available to run instantly on Amazon Web Services EC2 instances. The following documents cover starting instances of Virtualmin or Cloudmin on EC2.
Virtualmin GPL AMI - Virtualmin GPL, or Open Source virtual hosting control panel, running on CentOS 5.
Virtualmin Professional Paid AMI - Virtualmin Professional, our commerical virtual hosting control panel, running on CentOS 5 in an EC2 paid instance.
Cloudmin Paid AMI - Cloudmin, our cloud computing management control panel, running on CentOS 5 in an EC2 paid instance. Cloudmin can manage EC2 instances from within EC2.
Amazon has recently launched a service called DevPay where commerical software like Virtualmin Pro can be purchased to run on their EC2 service. This means that instead of creating an EC2 instance and installing Cloudmin on it manually, you can instead use an image that has it pre-installed, and available for immediate use. We how have an AMI available that contains Cloudmin 2.6, with support for managing EC2 instances only.
Subscribers to the paid AMI for Cloudmin are charged $25 per calendar month. In addition, regular EC2 per-instance-hour and per-megabyte charges apply. And any additional instances you create using it will be charged at normal rates.
To use the Cloudmin paid AMI, the steps to follow are :
ec2-describe-images -o 541491349868
You should see at least one in the available state.
ec2-add-keypair vgpl-keypair >~/.ssh/id_rsa-vgpl-keypair chmod 700 ~/.ssh/id_rsa-vgpl-keypair
ec2-run-instances ami-972aecfe -k vgpl-keypair
This will output the new instance ID, which is like i-10a64379
ec2-describe-instances
You will need to wait until it is in the running state. You will then be able to see the public hostname, which looks like ec2-72-44-33-55.z-2.compute-1.amazonaws.com .
ec2-authorize default -p 22 ec2-authorize default -p 25 ec2-authorize default -p 10000 ec2-authorize default -p 10001 ec2-authorize default -p 10002 ec2-authorize default -p 10003 ec2-authorize default -p 10004 ec2-authorize default -p 10005 ec2-authorize default -p 10006 ec2-authorize default -p 10007 ec2-authorize default -p 10008 ec2-authorize default -p 10009 ec2-authorize default -p 53
ssh -i ~/.ssh/id_rsa-vgpl-keypair root@ec2-WHATEVER.compute-1.amazonaws.com
The version of Cloudmin that the paid AMI installs doesn't have all the features of the full version, such as the ability to manage Xen instances, Linux Vservers and Solaris Zones. Instead, it is limited to creating, managing and protecting EC2 instances.
Before you use Cloudmin to control EC2 instances, you must add at least one account with the following steps :
Cloudmin also needs at least one SSH key to login to EC2 instances it creates. To add one, do the following :
You can now create your first EC2 instance. Click reload in your browser to refresh the page, then open the New System category on the left and click Create EC2 instance. You should only need to select an AMI and enter a description, then click Create System to kick off the creation of the EC2 instance.
For the full Cloudmin documentation, see the Cloudmin Manual page. Ignore the sections related to Xen, Vservers and Zones, as they are not supported by this paid AMI.
| Region | Location | Operating System | AMI |
|---|---|---|---|
| US East | Virginia | CentOS | ami-9129eff8 |
| US East | Virginia | Debian | ami-6735f30e |
| US West | California | CentOS | ami-1b0f525e |
| Europe | Ireland | CentOS | ami-bce1d1c8 |
| Southeast Asia | Singapore | CentOS | ami-503c4702 |
| Northeast Asia | Japan | CentOS | ami-d0b80dd1 |
| US East | Virginia | Amazon Linux | ami-c5cd70ac |
Amazon's Elastic Computing Cloud (EC2) is a commercial service that provides virtual Linux systems running on Amazon's network, for which customers are charged by the hour. One of its useful features is the ability to launch a virtual system using a machine image (AMI) defined by another user, which could contain anything from a basic install of Linux up to a full application stack.
If you have an EC2 account, you can easily launch an image ( ami-9129eff8 ) containing Webmin, Virtualmin, Usermin and all the dependent programs like Apache, MySQL and Postfix, all running on CentOS. This lets you bring up a web hosting server in minutes, and either try out Virtualmin or start using it for real web hosting. The steps to do this are :
ec2-describe-images -o 541491349868
You should see at least one in the available state.
ec2-add-keypair vgpl-keypair >~/.ssh/id_rsa-vgpl-keypair chmod 700 ~/.ssh/id_rsa-vgpl-keypair
ec2-run-instances ami-9129eff8 -k vgpl-keypair
This will output the new instance ID, with is like i-10a64379
ec2-describe-instances
You will need to wait until it is in the running state. You will then be able to see the public hostname, which looks like ec2-72-44-33-55.z-2.compute-1.amazonaws.com .
ec2-authorize default -p 22 ec2-authorize default -p 25 ec2-authorize default -p 10000 ec2-authorize default -p 10001 ec2-authorize default -p 10002 ec2-authorize default -p 10003 ec2-authorize default -p 10004 ec2-authorize default -p 10005 ec2-authorize default -p 10006 ec2-authorize default -p 10007 ec2-authorize default -p 10008 ec2-authorize default -p 10009 ec2-authorize default -p 20000 ec2-authorize default -p 80 ec2-authorize default -p 443 ec2-authorize default -p 21 ec2-authorize default -p 20 ec2-authorize default -p 110 ec2-authorize default -p 143 ec2-authorize default -p 53 ec2-authorize default -p 53 -P udp
ssh -i ~/.ssh/id_rsa-vgpl-keypair root@ec2-WHATEVER.compute-1.amazonaws.com
EC2 now has a separate European region, which has it's own set of machines and AMIs. To launch the Virtualmin image in Europe, follow the instructions above but use the AMI ami-bce1d1c8 instead.
Also, you will need to set the EC2_URL environment variable before using the command-line tools, with a statement like :
export EC2_URL=https://eu-west-1.ec2.amazonaws.com
An EC2 image now exists for Virtualmin GPL on Debian 6.0 (Squeeze). The instructions for starting this are exactly the same as above, but the image ID is ami-6735f30e . So the command to start it would be :
ec2-run-instances ami-6735f30e -k vgpl-keypair
Amazon now offers a free usage tier for EC2, which allows you to run a micro-sized EC2 instance for a year for free. Virtualmin offers an AMI for these micro instances with ID ami-faea4f93 - however, this AMI is built on Amazon's own Linux distribution, which is similar to Fedora or Redhat Linux. The command to start it would be :
ec2-run-instances ami-c5cd70ac -k vgpl-keypair
Amazon has recently launched a service called DevPay where commerical software like Virtualmin Pro can be purchased to run on their EC2 service. This means that instead of creating an EC2 instance and installing Virtualmin Pro on it manually, you can instead use an image that has it pre-installed, and available for immediate use. We how have an AMI available that contains Virtualmin Pro 3.87 and the full stack of related servers, like Apache, Postfix and MySQL.
The pricing per EC2 instance using the Virtualmin Pro AMI is based on the regular EC2 per-hour price, with an additional fee to cover the Virtualmin license. This works out to about $20-25 per month. The exact fees for the different instance sizes are :
| Price | Size |
|---|---|
| $0.14 / hour | Small instance |
| $0.45 / hour | Large instance |
| $0.86 / hour | Extra-large instance |
For more details on the specs of different instance sizes, see this page from Amazon. For most people, the small instance is the most cost-effective, as you can split your domains across several of them.
To use this new paid AMI, the steps to follow are :
ec2-describe-images -o 541491349868
You should see at least one in the available state.
ec2-add-keypair vgpl-keypair >~/.ssh/id_rsa-vgpl-keypair chmod 700 ~/.ssh/id_rsa-vgpl-keypair
ec2-run-instances ami-cd00c6a4 -k vgpl-keypair
This will output the new instance ID, which is like i-10a64379
ec2-describe-instances
You will need to wait until it is in the running state. You will then be able to see the public hostname, which looks like ec2-72-44-33-55.z-2.compute-1.amazonaws.com .
ec2-authorize default -p 22 ec2-authorize default -p 25 ec2-authorize default -p 10000 ec2-authorize default -p 10001 ec2-authorize default -p 10002 ec2-authorize default -p 10003 ec2-authorize default -p 10004 ec2-authorize default -p 10005 ec2-authorize default -p 10006 ec2-authorize default -p 10007 ec2-authorize default -p 10008 ec2-authorize default -p 10009 ec2-authorize default -p 20000 ec2-authorize default -p 80 ec2-authorize default -p 443 ec2-authorize default -p 21 ec2-authorize default -p 20 ec2-authorize default -p 110 ec2-authorize default -p 143 ec2-authorize default -p 53 ec2-authorize default -p 53 -P udp
ssh -i ~/.ssh/id_rsa-vgpl-keypair root@ec2-WHATEVER.compute-1.amazonaws.com
Virtualmin on EC2 works exactly the same as it would on a regular system. For full documentation, see : http://www.virtualmin.com/documentation/
How to use the documentation - Start here. It provides a brief (about one page) overview of the conventions and organization of the Cloudmin documentation.
Installation Guides - Automatic and manual installation procedures for Cloudmin.
Upgrading Cloudmin Software - Upgrading Cloudmin and related software from within Cloudmin and from the command line.
Getting Started With Cloudmin - Machine and network configuration needed to run Cloudmin.
Creating IP Pools - Defining global IP ranges for assignment to virtual systems.
Replication - Setting up backup Cloudmin masters.
Bridged Networking Setup - Creating a network bridge for sites that don't allow VMs to be directly connected, like Hetzner.
About Cloudmin - Basic introduction and feature list.
Cloudmin Glossary - Terms used in Cloudmin and its documentation.
Cloudmin GPL - Installing and using the free Xen-only version of Cloudmin.
Cloudmin Roadmap - Future plans for Cloudmin.
Introduction to Virtualization Concepts - Introductory coverage of virtualization concepts, types of virtualization, and how Cloudmin interacts with virtualized cloud servers.
Setting Up Linux Open Source Xen Virtualization - Using Cloudmin with Linux open source Xen virtualized systems.
Setting Up Citrix Xen Virtualization - Using Cloudmin with Citrix Xen virtualized systems.
Setting Up Linux OpenVZ Virtualization - Using Cloudmin with Linux OpenVZ virtual containers.
Setting Up KVM Virtualization - Using Cloudmin with Linux KVM instances.
Setting Up Linux LXC Virtualization - Using Cloudmin with Linux LXC containers.
Setting Up Solaris/OpenSolaris Zones Virtualization - Using Cloudmin with Solaris/OpenSolaris Zones.
Setting Up Linux VServer Virtualization - Using Cloudmin with Linux vserver virtual containers.
Setting Up LVM for Xen or KVM - How to store Xen or KVM disk images in LVM logical volumes
Multiple Interfaces for Xen - How to connect multiple host system interfaces to Xen systems
Xen Kernels - Booting a kernel from the virtual system with Xen
Empty Systems - Installing any operating system into an empty Xen or KVM instance
Location Groups - Simplifying host system allocation with location groups
Using Cloudmin - An introduction to various tasks in Cloudmin.
Downloading System Images - How to download Virtual Machine images for products such as Xen, VServers, and Zones.
Registering Host Systems - Preparing your server for virtualization.
Virtualmin Licenses - Setting up your Virtualmin licenses in Cloudmin.
Creating an Open Source Xen Virtual Machine - How to create a new Xen Virtual Machine.
Creating an Citrix Xen Virtual Machine - How to create a new Citrix Xen VM.
Creating a KVM Virtual Machine - How to create a new KVM Virtual Machine.
Managing Virtual Domains - Using the Cloudmin interface to create, find, and manage domains on your Virtual Machines.
Replicating Virtual Domains - Using Cloudmin to replicate Virtualmin domains and settings between systems.
Creating a VServers Virtual Machine - How to create a VServers Virtual Machine.
Creating a Solaris Zones Virtual Machine - How to create a Solaris Zones Virtual Machine.
Create FreeBSD Systems - How to create a virtual system running FreeBSD on a KVM host.
Making Your Own Images - How to create your own images for Virtual Server products such as Xen, VServers, and Zones.
Cloning Systems - How to easily duplicate an existing virtual system.
Backup and Restore - Backing up Cloudmin systems on schedule.
Automatic Failovers - Creating failover groups to handle host system failures.
Roundrobin DNS Records - Creating automatically updated DNS records that resolve to multiple systems, and web proxies that forward to multiple systems.
Command Line API - Using the command line tools for managing Cloudmin instances.
Remote API - Using the remote API for managing Cloudmin instances.
Cloudmin API and Development FAQ - Have questions about API usage and Cloudmin development?
Adding an EC2 Account - Information on Amazon's EC2, and how to setup an EC2 account.
Creating an EC2 Virtual Machine - How to create an Amazon EC2 Virtual Machine.
Creating an EC2 Image - How to create an Amazon EC2 Machine Image (AMI).
EC2 Security Groups - Creating and managing EC2 firewall security groups.
EC2 Static IP Addresses - Creating and assigning EC2 static addresses.
EC2 Volumes - Creating and assigning EC2 elastic block volumes.
Managing Virtual Disks - Creating additional disks for Xen and KVM systems.
Managing RAM Limits - Setting limits on RAM usage.
Managing CPU Limits - Setting limits on CPU usage and virtual CPU cores.
Managing Bandwidth Limits - Restricting total network traffic and bandwidth.
Managing IO Classes - Setting the IO priority of a virtual system.
Managing Network Interfaces - Adding and changing IP addresses.
System Monitoring and Alerts - Setting up email notifications when systems go down or exceed thresholds.
Auto-Scaling Groups - Automatically creating systems in response to load.
Disk Image Directories - Defining additional directories for virtual system disks.
iSCSI Storage - Storing virtual system disks on an iSCSI server.
Disk Snapshots - Saving the state of virtual systems for later rollback.
Account Plans - Defining limits on resource usage and functions.
System Owners - Accounts with limited access to Cloudmin.
Usage Accounting - Tracking total resource use by systems and owners.
Introduction and Installation - What the Cloudmin Services does, and how to install it.
Host Systems - Setting up and adding host systems.
System Owners - Creating system owner accounts for service hosting.
Client Systems - Configuring Virtualmin client systems.
Services API - Calling the services API from your own code.
Running Windows under Xen - How to install Windows into a Cloudmin-managed Xen instance, by Scott Grayban.
In Cloudmin, an account plan is a set of restrictions that can be applied to a system owner. Plans can limit the following :
All limits apply to the total usage of all systems owned by the user the plan is applied to.
Cloudmin comes with one default plan that is created when installed. To add your own plans, do the following :
To edit a plan after it is created, go to the Account Plans page and click on its name. Any changes in limits or restrictions will be immediately applied to system owners on the plan.
To delete a plan, check the box next to its name in the Account Plans list, then hit the Delete Selected Plans button.
Once a plan has been created, you can apply it to an owner as follows :
EC2 is different from other virtualization systems supported by Cloudmin, as it is a hosted service run by Amazon on their machines. They charge by the hour of machine time, and also for storage of any machine images that you create and host on their S3 service.
Cloudmin can manage virtual systems running under EC2 in almost exactly the same way as it does for other virtualized systems. The biggest difference is that they cannot be shut down without losing the contents of the system, which makes them a little risky for web hosting, as Amazon gives no guarantees of the stability of EC2 instances. Fortunately, Virtualmin makes it easy to backup hosted domains to Amazon's S3 service, which is fast and cheap when accessed from EC2 instances.
The first step in the process of using EC2 is to sign up for an account at Amazon's website, http://aws.amazon.com/ . You will need to provide credit card details for billing. If you already have an Amazon account, adding the EC2 service to it is simple.
Once you have an account, you will need to find out the account number, access key and secret key. This can be done by :
Once you have found your EC2 account number, access key and secret key, the account can be registered with Cloudmin. The steps to do this are :
Assuming that the account details are correct, you will be returned to the list of registered accounts. At the same time, Cloudmin will contact the Virtualmin webserver to grant your account access to system images containing Virtualmin Pro.
Before you can create any EC2 instances, you must create and register at least one SSH key with EC2. Fortunately, Cloudmin makes this easy - the steps to follow are :
Assuming that Cloudmin is able to contact the EC2 servers successfully, a new key will be created and registered. When an EC2 instance is created you must select an SSH key that will be used to initially login to it, and this key must be one generated using this process. Existing keys imported from some other source cannot be used.
Auto-scaling groups are Cloudmin's way of scaling up the number of systems that provide some service in response to load. They are typically used when you have multiple virtual systems with identical configurations providing the same service, such as a website, mail server or database replicas. When CPU load or some other metric exceeds a configurable threshold on some or all systems, additional systems are created to handle the load. Conversely, a group can be reduced in size when a second set of thresholds is reached.
Before creating a scaling group, you should create a virtual system that will be used as a template for the additional system that the group will create. For example, if the objective is to host a high-traffic website with variable load, this template system should have the appropriate front-end webserver and content installed and configured, so that when Cloudmin clones it the new system can accept traffic for the website immediately. This template system should be shut down, so that it can be more quickly cloned as needed.
To create a group, the steps to follow are :
${num} in the template will be replaced with a unique system number, starting from zero.Once a group has been created, you can edit its settings by clicking on the hostname template on the Auto-Scaling Groups page. You can also select one or more groups and force immediate evaluation of their rules with the Update Systems In Groups button, or add or remove a system with the Scale Up and Scale Down buttons respectively.
To see the status of systems within a group, click on it and open the Current status section. This will show for each member system whether it is exceeding the scale up or down conditions. If the conditions are being met currently but have not been active for long enough to trigger a scaling rule, the period for which they have been active will be displayed.
Groups can also be increased or decreased via the Cloudmin API with the increase-scalegroup and decrease-scalegroup API commands. Both take a host parameter which must contain the group's hostname template. Scaling via the API can be used instead of automatic scaling based on rules, driven by code in your own application that detects when additional systems are needed.
EC2 is an excellent service for use with auto-scaling groups, as it has enormous capacity and only charges for use by the hour. Cloudmin supports the use of auto-scaling on EC2 as well, but with some minor differences :
Auto-scaling groups are most useful when combined with DNS roundrobins, which automatically update a DNS record to point to multiple systems based on their status. For instructions on creating one, see the Roundrobin DNS Records page. During creation, you can use the Systems in scaling groups option to choose one or more groups' systems' IP addresses to include in the DNS record.
Each time a system is added to or deleted from an auto-scaling group, any associated DNS records will be immediately updated.
Cloudmin's automatic failover feature provides protection against host system failures, by moving virtual systems off a down host to a new host with shared storage. The running state (memory contents and network connections) of virtual systems will be lost in this case, but they will be re-started on the new host with minimal interruption.
For failovers to work, your host systems must share the storage location for virtual system disk images or filesystems. This can be done via NFS, Cluster LVM, iSCSI, or other network filesystem technologies. Cloudmin's failover feature does not yet include automatic replication of disk images between host systems, and cannot setup shared storage for you.
Currently automatic failovers are supported only for Xen, OpenVZ and KVM virtual systems.
A failover group is a collection of host systems that support some virtualization type, and share storage used for virtual systems. Some or all systems running on those hosts will be failed over to another host in the group if one goes down, assuming that there is enough free RAM available. Groups can contain an explicit list of hosts, members of some location group, or hosts in a Cloudmin system group.
The steps to create a new failover group are :
Once a group has been created, it can be edited or deleted at any time by clicking on its description on the *Host Failover Groups * page.
When automatic failovers are enabled, they will be triggered by Cloudmin's regular status collection process. When it detects that a virtual system's host is down, it will wait for the Host downtime timeout set on the failover group page, and then attempt to move the virtual system to a new host.
Upon success or failure, email will be sent to the master administrator and possibly the owner(s) of a virtual system. If the virtual system was running before its old host failure, it will be re-started on the new host after the failover completes.
The move can fail for several reasons :
If you have set a failover group to manual mode, Cloudmin will not automatically move virtual systems off down hosts in the group. However, you can force a failover at System Operations -> Force Failover. On this page you can optionally select a specific new host system, and decide if the virtual system should be started up on the new host or not.
A manual failover can also be done using the failover-system API command.
Cloudmin allows the master administrator and system owners to create backups of virtual systems running under Xen, OpenVZ, Vservers or Solaris Zones. This provides protection against accidental deletion of files within the filesystem, for example by an accidental rm * command.
Backups can be either run manually or on a regular schedule, such as once per day. When a backup is taken the virtual system can be either shut down to ensure a consistent filesystem state, or left running to avoid downtime.
As of Cloudmin 6.2, backups include all details of selected systems - this allows deleted systems to be re-created as part of the restore process. In older versions backups only include the contents of the virtual system's filesystem or disk images. For Xen systems the backup contains a compressed copy of all virtual disks, while for other virtualization types it is just a TAR file of the filesystem.
When backing up a running Xen system using LVM logical volumes to store disk images, LVM snapshots are used to take an instantaneous copy of the filesystem while it is copied. Each will consume 10% of the space in the volume group as the underlying disk images, so make sure you leave some LVM space free.
A multi-disk Xen or KVM system will have each disk stored in a separate file. Disks used for virtual memory or swap space will not be backed up, as the restore process always effectively reboots the system, meaning that memory contents do not need to be saved.
Cloudmin can backup virtual systems to a variety of different destinations - via SCP, FTP or to any system it manages. In a typical Cloudmin setup a single system with plenty of disk space is chosen as backup destination, perhaps the master system itself. Backups are taken on the host systems and then transferred to this backup machine. Alternately, you can choose to store backups on the hosts themselves, to avoid the need to transfer large backup files over the network.
Each host system defines a default backup destination for its virtual systems. You can set this as follows :
/backup.When a backup is made it will be saved to the specified directory in a file whose name is that of the virtual system with .tar.gz appended. Each subsequent backup of the same system to the same destination will overwrite that file.
Once a default destination has been set, you can schedule a backup like so :
It is possible to leave Scheduled backup enabled? set to No if you just want to define a backup that will always be run manually.
After a backup has been defined, you can edit or remove it by clicking on its entry in the System Backups list.
To kick off a backup, just click on it in the System Backups list and then hit the Backup Now button. Progress messages will be displayed as it runs, and a final summary of systems completed and backup sizes when it finishes. Depending on the sizes of the systems being backed up, it may take minutes or hours.
Testing a scheduled backup after creating it is strongly recommended. Also, you should create, backup and restore a test system that uses the same configuration and destination as your production systems to ensure that all steps in the process are working properly.
Cloudmin logs all backups it performs, including their final status, systems included, disk used and possibly the complete progress report. To view logs, go to Backup and Restore -> Backup Logs, and enter a hostname or destination path into the Find backup logs box, then click Search.
The simplest way to restore a backup is to click on its destination in the search results, which will open a restore form. You can also restore some or all systems from a scheduled backup as follows :
If the system no longer exists, the restore process will re-create it from details stored alongside the backup file. It will be re-created on the original host system with the same disk sizes, resource limits and ownership, if possible.
Normally Xen and KVM virtual systems are configured so that they appear to be directly connected to the same LAN as the host system, and so can talk to the network without having their packets routed through the host. A bridge is typically created (xenbr0 for Xen or br0 for KVM), but this operates at the Ethernet level by connecting the host's real interface eth0 with peth or tap interfaces used by virtual machines.
However, some colocation providers don't allow additional virtual systems to be directly connected to the same LAN as their hosts - Hetzner for example is one commonly used by Cloudmin customers that have this restrictions. Also, a direct connection limits the firewalling you can do to restrict or protect virtual systems. And it requires that each virtual system have an IP address that is valid on the same LAN as the host system, which is typically a real Internet IP address.
The first step to setup a network bridge is to work out the IP range that will be used by your virtual systems. Typically this is assigned by your hosting company, and includes a starting IP, ending IP and netmask. However, it is also possible to use an RFC 1918 address range like 192.168.1.1 to 192.168.1.255. In this case, you will also need to setup NAT so that your virtual systems can access the Internet.
This page uses the term "bridged networking" to describe a setup in which virtual systems are connected to an additional bridge on the host, normally named br1. It is most commonly used with KVM, but the same principals apply to open-source Xen as well.
Bridge setup is best done before any virtual systems are created. It must be repeated on each host system, after Webmin, Cloudmin or Virtualmin is installed.
If your system runs the latest Webmin, the steps to setup a bridge are :
Otherwise you can setup a bridge on Debian or Ubuntu Linux as follows :
/etc/network/interfaces and add a section like :
iface br1 inet static
address 192.168.1.1
netmask 255.255.255.0
broadcast 192.168.1.255
network 192.168.1.0
pre-up brctl addbr br1ifup br1Or on Redhat, Fedora or CentOS Linux :
/etc/sysconfig/network-scripts/ifcfg-br1 containing :
BOOTPROTO=none MACADDR="" IPV6INIT=yes TYPE=Bridge DEVICE=br1 NETMASK=255.255.255.0 MTU="" BROADCAST=192.168.1.255 IPADDR=192.168.1.1 NETWORK=192.168.1.0 ONBOOT=yes
ifup br1Once the bridge has been created, you will need to make sure that your system is configured to route traffic between it and the LAN. This can be done in Webmin on the host as follows :
If your Cloudmin master system is different from the host on which the bridge has been created, you may also need to add a static route for the bridge network with the host system as the gateway.
If your IP range is for internal use only, you should enable NAT so that virtual systems can access the Internet. Note that this will allow only outgoing connections, unless you also setup one to one destination NAT.
The steps to setup network address translation are :
eth0 being the external interface.eth0.Once a network bridge has been created, you can configure Cloudmin to use it on the host as follows :
br1.br1 as the default gateway.br1A clone is a copy of a virtual system that has the same disk contents, accounts, root password and number of network interfaces as the original. However, it is assigned a new hostname, IP address(es) and description.
Creating a clone is easier than imaging a system and then creating a new system from it, as it is done in a single operation. Cloning is also available to system owners, subject to limits on disk, RAM and CPU use, and assuming that the owner is allowed to create new systems at all.
Virtual systems using Xen, KVM, OpenVZ, Vservers, LXC and Citrix Xen can be cloned in Cloudmin versions 4.5 and later. The process is the same regardless of the virtual system type. On Cloudmin 5.5 and later, a clone can be created on a different host system to the original system's host.
The steps to follow to clone an existing system are :
Cloning is generally faster than creating a new system, as there are fewer steps involved. However, if the system being cloned has large disks, it will take proportionally longer.
Cloning will be disallowed if the host system does not have enough free RAM or disk space, or if your usage is too close to the limits set in your plan.
Cloudmin is a new cloud computing platform from the developers of Webmin, Virtualmin, and Usermin. Cloudmin enables hosting providers to offer new kinds of services, and enterprise data centers to evolve into private clouds, all from existing infrastructure.
Cloudmin offers four methods for managing your cloud infrastructure: Web, mobile device, command line, and remote API. Cloudmin is always available, no matter where you are or how you want to work. Integrate with Virtualmin, Webmin, and Usermin for management of your whole data center, from servers to users and applications.
Build your own cloud, integrate with existing clouds, and migrate existing servers into the cloud on your schedule, and do it with industry standard technology like Xen and Zones. With a comprehensive web-based UI and scriptable API, you can build the cloud services you want to use, while leveraging existing cloud services, like those provided Amazon Web Services, when needed.
We're extremely excited, and we want everyone to try it, so we're offering all of our Cloudmin products for 50% off. As with Virtualmin, we also offer a 45 day money back guarantee on Cloudmin, so there's no risk and you'll get the lowest price that we will ever offer.
The GPL version of Cloudmin is a designed to manage Xen or KVM instances on only a single host system, rather than supporting multiple hosts and virtualization types as in the full (Pro) version. It lets users try out Cloudmin and virtualization concepts without having to purchase the full package.
Cloudmin's installer can be used on CentOS, Redhat Enterprise, Debian and Ubuntu systems. It will both install Cloudmin and setup the system as a Xen host, by installing a Xen-capable kernel and associated tools.
You can download the install script for CentOS and Redhat from : http://cloudmin.virtualmin.com/gpl/scripts/cloudmin-gpl-redhat-install.sh
The install script for Debian and Ubuntu can be downloaded from : http://cloudmin.virtualmin.com/gpl/scripts/cloudmin-gpl-debian-install.sh
In either case, it needs to be copied to the system you plan to run Cloudmin on and then executed with a command like :
sh cloudmin-gpl-redhat-install.sh
Cloudmin can co-exist with Webmin or Virtualmin GPL on the same system. The installer uses YUM or APT to add the required packages, some from our repository and some from the repository provided by your distribution vendor.
Once installation is complete, you will need to reboot your system. Then go to https://yoursystem:10000 in your browser , download some system images, and type creating a Xen instance.
Cloudmin's installer can be used on CentOS, Fedora, Debian and Ubuntu systems. It will both install Cloudmin and setup the system as a KVM host, by installing KVM and related packages.
You can download the install script for CentOS and Fedora from : http://cloudmin.virtualmin.com/gpl/scripts/cloudmin-kvm-redhat-install.sh
The install script for Debian and Ubuntu can be downloaded from : http://cloudmin.virtualmin.com/gpl/scripts/cloudmin-kvm-debian-install.sh
In either case, it needs to be copied to the system you plan to run Cloudmin on and then executed with a command like :
sh cloudmin-kvm-redhat-install.sh
Cloudmin can co-exist with Webmin or Virtualmin GPL on the same system. The installer uses YUM or APT to add the required packages, some from our repository and some from the repository provided by your distribution vendor.
Once installation is complete, you will need to reboot your system. Then go to https://yoursystem:10000 in your browser , download some system images, and begin creating a KVM instance.
Features missing from the GPL version of Cloudmin include :
Cloudmin can be upgraded to the Pro version without effecting any existing settings as follows :
The full version packages will then be downloaded and installed, and your APT or YUM configuration will be updated to use the correct repositories.
Cloudmin and its documentation uses the following terms to refer to different types of systems and other objects :
System A machine with its own IP addresses, filesystems and accounts. This can either be an actual physical computer, or a virtual machine running under some virtualization technology such as Xen, OpenVZ, EC2, Vservers or Solaris Zones. Systems are the primary object managed by Cloudmin.
Virtual System A system that runs under some virtualization type, such as Xen or OpenVZ.
Real System or Physical System An actual computer with its own hardware.
Host System A real machine that can host virtual systems of some type(s).
Cloudmin Master The system on which the Cloudmin software is installed and runs. This may also be a host system, or in some rare cases a virtual system that it also controls. System images are also primarily stored here.
Server A process that provides some service, such as Apache or BIND.
Virtual Server A combination of services provided by several servers, typically associated with a domain name. Virtual servers are the object primarily managed by Virtualmin.
System Image A template from which virtual systems can be created, containing the contents of its filesystem.
System Owner An additional login to Cloudmin will access to a subset of systems and functions.
Account Plan A set of limits on disk, CPU, RAM and network use that can be applied to a system owner.
The Cloudmin Services is an add-on to Cloudmin that allows many systems running Virtualmin to create DNS zones, MySQL databases and other virtual hosting services on a set of centralized systems. It is designed to allow resource-intensive services to be offloaded from web host systems onto one or more shared systems that are dedicated to hosting those services. This reduces the RAM, CPU and disk requirements of those web hosts, which is particularly useful in an environment with many virtual systems.
When Cloudmin Services is being used there are three types of systems involved :
The Master System This system runs Cloudmin and has the services plugin installed. It keeps track of which client systems have requested which services, and which host systems they are setup on. The plugin extends the regular Cloudmin UI with additional pages and sections for provisioning systems and limits.
Client System A client is a system running Virtualmin that has been configured to offload some services to a provisioning host. It need not be managed by the master Cloudmin system. Each client is setup to connect to the services API with the login and password of a Cloudmin system owner.
Host System A host is a system managed by Cloudmin that actually hosts the DNS zones, MySQL databases and other centralized services, up to limits set on the provisioning server. It must run Webmin and be configured to run the service(s) you select to provision on it. If multiple hosts exist for a service, Cloudmin will select one randomly for each client request, based on current usage and limits.
For a client system to be able to request services from the Cloudmin master system, it must authenticate using the login and password of a Cloudmin system owner. Normally owners are people who are granted permissions to manage or create virtual systems, but when the services plugin is installed an owner can be created that can also (or only) call the Cloudmin API to request features.
Each owner must have a limit set on the number of each type of service he is allowed to create. If no limit is set (which is the default), creation of those services will be disallowed. Limits can also be defined in Cloudmin plans, which are then applied to all owners on the plan.
In a typical deployment, a customer who owns multiple real or virtual systems would have a single owner account that is used by Virtualmin on all those systems.
Because the Cloudmin Services plugin is just a single Webmin module with no dependencies, the basic installation process is simple :
root.Once it is done, you should be able to see the Cloudmin Services page under Virtualmin Settings on the left menu.
When a Virtualmin system requests the creation of a DNS zone or MySQL database, it makes an HTTP call to the Cloudmin master, using the request format documented on the Cloudmin remote API page. Even though this API was initially designed for internal use between Virtualmin products, it can also be called by other programs that want to create DNS zones or databases.
This allows the managed of a Cloudmin installation to offer services similar to Amazon's hosted DNS and MySQL products, and frees customers from having to run their own BIND or MySQL server.
The Cloudmin API requires a system owner login and password to access, which can be created as documented on the Cloudmin Services and system owners page. API caller must use the system owner login and password for HTTP authentication when making requests.
The system owner must also be granted permissions to make Cloudmin API calls, just as they would if services creation was going to be done from client systems by Virtualmin.
The Cloudmin Services client adds several new commands to the core API, which are documented on the services section of the API documentation.
For example, to create a new MySQL login and database from the Unix shell on another system, you could use the commands :
curl "http://owner:password@cloudminmaster:10000/server-manager/remote.cgi?program=provision-mysql-login&user=dblogin&pass=smeg&domain-owner=" curl "http://owner:password@cloudminmaster:10000/server-manager/remote.cgi?program=provision-mysql-database&database=junk&user=dblogin"
In these examples, owner is the system owner login, password is his password, cloudminmaster is the Cloudmin system, dblogin is the MySQL user, and junk is the MySQL database name.
When the first command is run, assuming it is successful it will return a line like :
OK: host=provisioningmachine
This tells the caller which MySQL host system the login and database have been created on. Any subsequent API calls to mange or remove the login or database must include a host URL parameter whose value is this hostname. For example, to delete the database you could use :
curl "http://owner:password@cloudminmaster:10000/server-manager/remote.cgi?program=unprovision-mysql-database&database=junk&host=provisioningmachine"
Cloudmin Services API commands that perform some action output a line that starts with OK on success, like :
OK: host=something
Or on failure, they will produce a line like :
ERROR: User dblogin is not a domain owner
If called with incorrect parameters, a summary of valid parameters is returned instead.
Some API commands return information, such as records in a DNS zone or users with access to a MySQL database. For example, the following command :
curl "http://owner:password@cloudminmaster:10000/server-manager/remote.cgi?program=list-provision-mysql-users&database=junk&host=provisioningmachine&multiline=&json="
This requests a list of users who can access the junk database. The multiline= parameter indicates that the command should provide machine-parseable output, and json= indicates that you want it in JSON format. Other formats can be selected with perl= or xml= . The output of this example would be :
{
"status" : "success",
"data" : [
{
"name" : "dblogin",
"values" : {
"hosts" : [
"193.9.101.104"
],
"password" : [
"*E474E7F197FAC1D7280FF181D07F1FA09566F5FC"
],
"databases" : [
"junk"
]
}
}
],
"command" : "list-provision-mysql-users"
}Before creating any system owner accounts for Cloudmin Services clients, you should read the general documentation on system owners , which explains how they can be added and managed.
For service creation purposes, it is not necessary for an owner to actually be able to manage or create any systems. However, if your Cloudmin server is managing virtual systems that belong to an owner, it makes sense for the same account to be used for service creation as well.
When creating or editing an owner, make sure that in the Limits and restrictions section, the Allowed operations field has at least the Call remote API box checked. Without this it will be impossible for Virtualmin on a client system to connect to the Cloudmin master to request the provisioning of features. This operation can also be granted at the plan level, which makes it available to owners on that plan.
System owners must also be granted permissions to provision features up to some limits, which are set in the Additional limits and capabilities section of the Edit System Owner page. This section also lists all features that have been created for that owner, and shows which host systems they have been created on. Once a limit is hit, requests from clients to create additional features of the limited type will fail.
Limits on features to create can also be set at the plan level, at Cloudmin Settings -> Account Plans. When creating or editing a plan, these are set in the Additional owner limits and capabilities section. However, these will only apply to system owners who have the Use services limits from plan? option set - otherwise, their individual limits will apply.
Cloudmin has commands that can be run as root from the shell on the master system to create and modify system owners, documented on the owners API page.
When the Cloudmin Services plugin is installed, the modify-owner and create-owner commands gain additional flags to set services limits. For example, you could set the number of allowed DNS zones with a command like :
cloudmin modify-owner --name bob --max-provision-dns 77
To control if an owner inherits services limits from a plan, use the --provision-from-plan flag followed by either true or false.
To see the full list of available flags, run :
cloudmin modify-owner --help
To remove access to a Cloudmin Services feature, just set the limit to 0.
This same flags can be used when the API is called remotely via HTTP, but as URL parameters.
Shell and remote API commands to create and modify plans also accept the same flags, and will apply the specified limits to system owners on the plan being changed.
Explains how to use the command-line scripts included with Cloudmin to manage users, aliases, servers, databases and resellers.
Cloudmin comes a script named cloudmin that can be run from the Unix shell to perform actions that are usually done from the web interface. In fact, almost all actions that can be done in a browser can also be done from the command line, or from shell scripts. This allows system, disk, image and owner creation and management to be done in a more automated function, such as from programs or scripts of your own creation.
The first parameter to the cloudmin command is the operation you want to perform, such as create-system. Depending on the operation, additional parameters may be needed, such as the name of the domain to create, password and so on. In almost all cases the parameters are given like --host myvps.
The cloudmin command must be run as root, as it needs access to system configuration files to create systems, copy files and so on. If you want to create and manage systems programatically as a different user (such as from your own CGI scripts), see the documentation on the Cloudmin Remote API instead.
All of the operations that make changes to the system output messages indicating their success or failure. Their exit status can also be checked to determine success - an exit status of 0 indicates that everything went OK, while a non-zero status indicates some problem.
All operations can be called with the --help command-line parameter to have them output details of the required and allowed parameters. Alternately, you can run cloudmin help to get a list of all available commands, or cloudmin help command to get information on what a particular command does.
API commands are broken down into the following categories :
Cloudmin versions 7.0 and above have the ability to fully manage virtual systems running FreeBSD under KVM. Almost all the same features that are available for Linux systems are supported, except for resizing filesystems. Older Cloudmin releases allowed you to create a FreeBSD system, but did not have the ability to set its root password or IP address, or manage network interfaces and virtual disks.
Before a host machine can host a FreeBSD system it must satisfy the following requirements :
The kernel must be compiled with read/write support for the UFS filesystem. The kernel config file option for this is CONFIG_UFS_FS_WRITE=y . To check if this is enabled in your host's running kernel, run
grep CONFIG_UFS_FS_WRITE /boot/config-$(uname -r)
The host must have the UFS tools for Linux package installed. On Debian / Ubuntu systems, this can be done with the command
apt-get install ufsutils . Unfortunately, no similar standard package appears to exist for CentOS or Redhat systems. However, we have created a TAR file of the required commands that can be installed with :
cd /usr/local/bin wget -O - http://cloudmin.virtualmin.com/gpl/ufsutils.tar.gz | tar xzf -
In version 7.0 of Cloudmin there are some functions that are not available for FreeBSD virtual systems :
When creating a system, the first disk cannot be re-sized to be larger or smaller than the default size from the image. This is due to lack of support on Linux systems for manipulating FreeBSD partition tables.
After creation a virtual disk cannot be resized from its initial size. This is due to bugs in the growfs.ufs command included with Debian Linux ( see http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=632832 )
If you plan to have more that one host machine for virtual systems (like Xen instances or OpenVZ containers), we recommend defining the IP allocation range for those systems in a single place. This way the range only has to be created once, and can be changed in a single place.
The steps to create a common IP range are :
192.168.1.1 and 192.168.1.200.255.255.255.0.Once the range has been created, it will be available when creating or editing host systems.
The starting, ending and gateway fields allow you to enter multiple addresses on separate lines, to define more than one range for this common IP pool.
If you are running Cloudmin 5.6 or later and plan to use IPv6, you can also define IPv6 allocation ranges on this page. This assumes that an IPv6 network has been allocated for your use. The steps to do so are :
2001:db8:0:f101::0 and 2001:db8:0:f101::fff. The starting and ending addresses should be the same except for the last word.64.Once the range has been created, it will be available when creating or editing host systems.
When you edit a KVM, Xen, OpenVZ or other host system under the Host Systems menu category, you can select one or more IP allocation pools that will be used for virtual systems created on that host. In a small Cloudmin deployment all your host systems will be on the same network, as thus can share the same pool - but if you have host systems in different datacenters, you may need multiple pools.
Pools are selected using the IP address allocation ranges table. For host systems that have multiple network bridges (each typically connected to a different LAN), you can choose which bridge each pool is used for.
If any IPv6 pools have been defined, you can similarly select them in the IPv6 address allocation ranges table.
When a virtual system is created, the default behavior of Cloudmin is to assign one or more IP address from the pools specified for the chosen host system. Alternately you can manually enter an IP address, netmask and gateway in the Host and networking options section of the creation form.
When creating a new network interface for a virtual system an IPv4 address can also be allocated from the range assigned to the system it is hosted on.
If any IPv6 allocation ranges have been defined you can also select at creation time to allocate a IPv6 addresses for the new virtual system, or enter one manually. By default IPv6 allocation is disabled, but can be turned on by default at Cloudmin Settings -> Cloudmin Configuration -> Virtual system settings -> Allocate an IPv6 address for new systems?.
Once you have at least one system setup to host Citrix Xen instances and registered with Cloudmin, and have downloaded at least one Citrix Xen system image, you can create your first virtual system. The steps to do this are :
root password to set for the new system into the adjacent field.Because Xen instance creation involves the copying and uncompression of large filesystem images, the creation process may take up to 5 minutes. However, Cloudmin will display each step in the process as it is run, including copying the image file, un-compressing it, modifying the Xen filesystem to set the root password and IP address, and finally starting up the instance.
Assuming that everything works, the new virtual system will be added to the left menu. You will be able to use Cloudmin to rebooting, shut it down, start it up, or create Virtualmin domains on it, just as you could for any real system. If you no longer need this Xen VM2, it can be completely removed with the Delete System link on the left menu.
Citrix Xen also allows a virtual system to be created empty, and setup to boot the installer for some Linux distribution or other operating system. This allows you to create a new VM into which you install Debian, CentOS or even Windows. The steps to do this are :
root password to set for the new system into the adjacent field.Once you have at least one system setup to host KVM instances and registered with Cloudmin, and have downloaded at least one KVM system image, you can create your first virtual system. The steps to do this are :
root password to set for the new system into the adjacent field.Because KVM instance creation involves the copying and uncompression of large filesystem images, the creation process may take 5 to 10 minutes. However, Cloudmin will display each step in the process as it is run, including copying the image file, un-compressing it, modifying the KVM filesystem to set the root password and IP address, and finally starting up the instance.
Assuming that everything works, the new virtual system will be added to the left menu. You will be able to use Cloudmin to rebooting, shut it down, start it up, or create Virtualmin domains on it, just as you could for any real system. If you no longer need this KVM instance, it can be completely removed with the Delete System link on the left menu.
Once you have at least one system setup to host Solaris Zones and registered with Cloudmin, you can create your first virtual system. The steps to do this are :
root password to set for the new system into the adjacent field.If you chose to create the zone from an image, the process will take 5 to 10 minutes, as the image needs to be transferred from the Cloudmin master and un-compressed on the host system. If you selected the base OS option it will take longer, as all packages that need to be copied from the host system. Either way, Cloudmin will display each step in the process as it is run, including copying the image file, un-compressing it, modifying the zones's filesystem to set the root password and IP address, and finally starting up the instance.
Assuming that everything works, the new virtual system will be added to the left menu. You will be able to use Cloudmin to rebooting, shut it down, start it up, or create Virtualmin domains on it, just as you could for any real system. If you no longer need this zone, it can be completely removed with the Delete System link on the left menu.
Once you have at least one system setup to host Linux VServer instances and registered with Cloudmin, you can create your first virtual system. The steps to do this are :
root password to set for the new system into the adjacent field.If you chose to create the VServer from an image, the process will take 5 to 10 minutes, as the image needs to be transferred from the Cloudmin master and un-compressed on the host system. If you selected the base OS option it will take longer, as all packages that need to be installed will be downloaded from the appropriate Linux distribution repository. Either way, Cloudmin will display each step in the process as it is run, including copying the image file, un-compressing it, modifying the VServer's filesystem to set the root password and IP address, and finally starting up the instance.
Assuming that everything works, the new virtual system will be added to the left menu. You will be able to use Cloudmin to rebooting, shut it down, start it up, or create Virtualmin domains on it, just as you could for any real system. If you no longer need this VServer instance, it can be completely removed with the Delete System link on the left menu.
Once you have at least one system setup to host Xen instances and registered with Cloudmin, and have downloaded at least one Xen system image, you can create your first virtual system. The steps to do this are :
root password to set for the new system into the adjacent field.Because Xen instance creation involves the copying and uncompression of large filesystem images, the creation process may take 5 to 10 minutes. However, Cloudmin will display each step in the process as it is run, including copying the image file, un-compressing it, modifying the Xen filesystem to set the root password and IP address, and finally starting up the instance.
Assuming that everything works, the new virtual system will be added to the left menu. You will be able to use Cloudmin to rebooting, shut it down, start it up, or create Virtualmin domains on it, just as you could for any real system. If you no longer need this Xen instance, it can be completely removed with the Delete System link on the left menu.
Unlike other virtual system types, EC2 images (called AMIs or Amazon Machine Images) are not stored on your Cloudmin master system. Instead they are stored as files inside Amazon's S3 storage service, and can be selected when creating a virtual system on EC2.
Each image has a unique ID, like ami-7c1df915, and a manifest path in S3 like centos-virtualmin-gpl-3.63/image.manifest.xml . An image can be either made available to everyone, or limited to certain EC2 accounts. Images can also be associated with production codes, indicating that customers must pay to use them.
An image is created from a virtual system running on Amazon's EC2 service. The steps to make an image are :
Once started, Cloudmin will display the progress of the image creation process. This can take up to an hour depending on the size and speed of the system.
Once creation is complete, Cloudmin will display the new image's ID. You can select this on the Create New System page to generate a new EC2 instance that will be a duplicate of the one you imaged. In additional, if you made the AMI publicly available the ID can be shared with any other EC2 users to use.
You can see all EC2 images Cloudmin knows about at Amazon EC2 -> EC2 Images. By default this includes those you created, images provided by Amazon, and public images from selected other accounts. The accounts to show are set at Cloudmin Settings -> Module Config -> EC2 accounts to display AMIs from.
To change the permissions on an image you created, just click on its ID in the list. On the page that appears you will be able to select if it is public (with the Grant access to everyone checkbox), or only available to a list of EC2 account numbers that you enter.
To remove an image, check the box next to it in the image list and hit the Delete Selected Images button at the bottom of the page. On the confirmation page that appears you will have the option of removing the associated files from S3 too, which is generally a good idea as you are charged for S3 usage by disk space and time.
Once you have at least one EC2 account registered with Cloudmin and one EC2-generated SSH key, you can create your first EC2 system. The steps to do this are :
Amazon is generally pretty fast to create new instances, and no data needs to be copied from the Cloudmin master to the new system. Typically this takes about 5 minutes, and Cloudmin will display each step taken in the system creation process.
Assuming that everything works, the new virtual system will be added to the left menu. You will be able to use Cloudmin to reboot it, update it, or create Virtualmin domains on it, just as you could for any real system. If you no longer need this zone, it can be completely removed with the Delete System link on the left menu.
By default, Cloudmin will create KVM or Xen virtual disk images in the directory or LVM volume group selected on the Host System page for the virtual system's host. All additional virtual disks will be created in the same location. Virtualization types that use a directory on the host's filesystem will always be placed in a sub-directory under the path specified for the host system.
Cloudmin versions 6.0 and later give you more flexibility in placing disk images and virtual filesystems, using the new Disk Image Directories page. This lets the master administrator define additional paths on host systems that can be selected when a virtual system is created, moved or cloned, instead of using the host system default. For example, this could be used to control if a system is created on storage local to the host, or a directory mounted from a common file server, or faster local disks.
Before adding a directory to Cloudmin, it should first be created on all the host systems that you intend to use it on. If it will only exist locally, it can either be simply created with the mkdir command, or mounted from an additional local disk, RAID device or LVM logical volume.
If you want to use NFS to share a directory between hosts, it must first be exported from a file server. This could be a dedicated device such as one sold by NetApp, or a Linux system with a suitably large and fast local disk or RAID array. In the latter case, you can use Webmin to export a directory as follows :
mkdir /shared/shared into the Directory to export field.One a directory is shared, it can be mounted on each of your host systems as follows :
/sharedOnce the directory exists on all the hosts you want to use it on, it can be added to Cloudmin as follows :
/shared) into the adjacent text box.root (master administrator) user.Once you have created a disk directory, you can select it when creating a virtual system of a supported type using the Disk image directory field in the Resource limit options section of the creation form. For Xen and KVM systems, all disk image and config files will be created in that directory instead of the host's default directory or volume group. For OpenVZ and LXC systems, the directory that contains the filesystem will be created below the selected path. However, other configuration files will remain in their regular directories.
If creating a system using the Cloudmin command-line API, you can use the --disk-directory flag follow by a path to specify the path. When creating via the remote API, use the disk-directory parameter followed by the path. In all cases, if creating a system while logged in as a system owner you can only select directories that have been made available to the owner's plan.
If you add an additional disk to a KVM or Xen system after creation, it will by default be created in the directory selected at creation time. However, this can be changed as follows :
The default can also be changed using the modify-system API command, with the --disk-directory flag.
By default when a virtual system with a non-standard disk directory is moved, Cloudmin will attempt to keep the same directory on the destination system as was used on the source. If the directory is not available on the destination, the move or clone operation will fail.
Both the forms for moving and cloning a system have a field for selecting a new disk image directory to use, similar to the field on the system creation form. Also, the clone-system and move-system API commands accept the --disk-directory flag followed by a directory to use. The --no-disk-directory flag can be used instead to revert to the default directory on the destination host.
As mentioned above, the master administrator (root) can limit access to disk directories by system owners based on their plan. For example, a directory that is mounted from faster and more expensive storage (like RAID or SSD) might be reserved for only a subset of users.
You can also control if system owners are allowed to use the default disk directory or logical volume on host systems, by editing the special Host system default path on the Disk Image Directories page. This entry cannot be renamed or deleted, but its permissions can be changed to restrict access to some system owners, or none at all.
In Cloudmin, a snapshot is a copy of the contents of all disks attached to a virtual system, taken at a point in time. After creating a snapshot you can make changes to the contents of the system's disks (such as installing or re-configuring software), and if that goes wrong you can roll back to the state when the snapshot was taken.
Snapshots do not include the contents of the virtual system's RAM - only disks. This means that a rollback will require that the system be rebooted.
System owners can be granted permission to create snapshots, either individually or at the plan level. Any disk space they consume will be counted towards the owner's disk limit.
Snapshots use "copy on write" to store differences between the virtual system disks at the time the snapshot was made and the current time. This means that the snapshot can be much smaller than the system it was made from - typically only 10 or 20%. However, once the space allocated to the snapshot has been consumed it will become unusable.
In order to create and manage snapshots, a virtual system must satisfy the following requirements :
Once you have a virtual system that meets the requirements above, you can create a snapshot as follows in the UI :
To create a snapshot using the command line API, use the create-snapshot command. For example :
cloudmin create-snapshot --host yourvm.cloudmin.com --id snapid --percent 20
To revert a system to the state it was in when the snapshot was taken, the steps are :
Reversion should be relatively fast, as only disk blocks changed since the snapshot was created need to be copied.
From the command line you can revert a snapshot with the merge-snapshot command, like so :
cloudmin merge-snapshot --host yourvm.cloudmin.com --id snapid
If a snapshot is no longer needed, it can be removed by checking the box next to it on the Disk Snapshots page and clicking the Delete button.
From the shell, you can use the delete-snapshot command. For example :
cloudmin delete-snapshot --host yourvm.cloudmin.com --id snapid
There are some limitations to take into account when using snapshots :
These are limitations of the underlying LVM snapshot system that Cloudmin uses.
A system image is effectively a file containing the entire filesystem of a virtual system, either in tar.gz or EXT3 format. When a virtual system is created by Cloudmin, it can use an image as the basis of the system's filesystem, rather than needing to download and install packages, or copy files from the host system.
Cloudmin customers have access to system images for a variety of operating systems and virtualization types, but by default none are included when it is installed. To download images that you can use to create systems, do the following :
You can now create virtual systems using the selected images, assuming that one or more host systems of the corresponding virtualization type have been registered.
If you are using Solaris Zones, only images for the architecture that matches the physical Solaris host systems will work. For Xen or VServers, I recommend selecting images of the same type as your host systems, just to keep management easier.
Some images include the full Virtualmin stack, such as Webmin, Apache, Postfix, BIND, MySQL, ProFTPd and so on. If you plan to create virtual systems for web hosting, we recommend using these images rather than manually installing Virtualmin on created systems - even though Cloudmin is capable of doing this for you.
Cloudmin does not limit you to provided images - once you have some virtual systems running, you can create your own, as documented on the Making Your Own Images page.
An EC2 security group is basically a set of firewall rules that can be applied to EC2 instances. Each rule specifies a protocol (TCP or UDP), starting and ending port numbers, and an optional network. When a group is applied to a system, only traffic matching one of the rules will be allowed through. All other traffic will be dropped.
In addition, a security group can list other groups to allow traffic from, regardless of port or address. This will then match other EC2 systems using one of the selected groups. This feature is useful for allowing arbitrary connections between your own machines, while applying stricter restrictions on other systems.
By default every EC2 account has a security group named default that allows connections on a limited number of ports. Cloudmin will create a group named virtualmin when you create a system that allows all the ports typically used for web hosting, such as 110, 80, 443 and 25.
If you want to change the rules for an existing group, the steps to take are :
To create a new group, go to the EC2 Security Groups page and click the Create group for link for the EC2 account you want to add it under. Then fill in rules form with protocols and ports to accept. Make sure you allow at least port 22 (for SSH) and port 10000 (for Webmin), or Cloudmin's access to systems using this security group may be blocked.
To delete a security group that is not in use, check the box next to it on the EC2 Security Groups page and hit the Delete Selected Security Groups button.
A security group can be selected when creating a new EC2 system, using the EC2 security groups field under Advanced options. Actually, you can choose several groups, and traffic matching rules from any of them will be allowed. If you have multiple EC2 accounts in Cloudmin, only groups for the account selected to own the new system can be used though.
If no security group is chosen, just the default group will be used. If a group is changed after system creation (such as to add a new port), it will be immediately applied to all virtual systems using that group. There is no way to select different groups for a system after it is created though.
Every EC2 instance has two IP addresses - the real one on its eth0 interface (typically in the 10.0.0.0/8 network), and an external Internet-accessible address. The Amazon using NAT to foward all traffic to the external address to the internal one, and back again for outgoing connections.
Both addresses are dynamically assigned when a system is created. Because an EC2 instance may need to be destroyed and re-created, there is no guarantee that a replacement instance will get the same IP address that a previous system did, even one under the same account.
However, Amazon does allow EC2 accounts to request static IP addresses, which they call Elastic IPs. Each static IP can be associated with a single EC2 instance at a time, and can be moved between instances. This allows you to keep your external addresses consistent in the face of virtual system creation and deletion.
To request a new static EC2 address, follow these steps :
Amazon bills for each static IP address associated with your access, so don't request too many of them!
To give back an address, check the box next to it and click the Return Selected IP Addresses button. Be careful doing this, as you will not be able to request the same address again. Only addresses not assigned to any system can be returned.
Once an address has been requested, you can assign it to an EC2 system as follows :
You can also dis-associate an address from a system on the same page, by selecting <None> from the IP address to assign menu.
EC2 Volumes (called Elastic Block Storage by Amazon) are essentially disk images that can be mounted on any system running on EC2, and continue to exist even if the system they were attached to is deleted. They are a more permanent place to store data than the filesystem of an EC2 instance, and more easily accessible than S3.
Each volume is typically formatted with a filesystem like EXT3, and is mapped to a device like /dev/sdb1 on the system it is connected to. It can then be mounted with the standard Linux mount command. The size of a volume is typically several GB, and is chosen at creation time. Amazon charges for volumes based on their size and the amount of time they exist.
An EC2 volume snapshot is a copy of a volume taken at some point in time, and stored in S3. Once a snapshot has been created, additional volumes can be created from the data in that snapshot. They can be used for backup purposes, or to duplicate or fork the contents of a volume.
Snapshots are differential backups, meaning that only the blocks on the device that have changed since your last snapshot will be incrementally saved. This means that if you have a device with 100 GBs of data, but only 5 GBs of data has changed since your last snapshot, only the 5 additional GBs of snapshot data will be stored back to Amazon S3.
To create an EC2 volume in Cloudmin, do the following :
Once a volume has been created, it will appear in the list on the EC2 Volumes page. To remove it, check the box next to it's ID and click the Delete Selected Volumes button. Be careful, as the data on the volume will be lost forever (unless you made a snapshot first).
Once you have at least one EC2 volume, Cloudmin will allow you to create a snapshot of it as follows :
Once a snapshot has been created, it can be used to create new volumes as explained above. Snapshots can be deleted on the EBS Snapshots* tab by checking the boxes next to their names and clicking the Delete Selected Snapshots button.
Once a volume has been created, it can be attached to an EC2 instance as a block device, and typically mounted a filesystem. This can be done within Cloudmin like so :
/mnt/disk2 or /home.Once a volume has been attached and mounted, you can use it on your EC2 system however you wish. To detach a volume, go to the ttached EC2 Volumes page, check the box next to its ID and click the Detach Selected Volumes.
Cloudmin uses the term "empty system" to refer to one that is created without any operating system initially installed on its virtual disk. Empty systems are always connected to a CD image or physical CD-ROM drive, from which any operating system can be installed. Once the install is complete, the formerly empty system can be managed like any other Cloudmin virtual machine.
The open-source Xen, KVM and Citrix Xen virtualization types all support the creation of systems that are initially empty. In the case of Xen, full hardware virtualization (HVM) is used, which has a performance overhead as compared to para-virtualization. However, HVM allows any operating system to be run inside the virtual system, such as OpenBSD, Windows or other Linux distributions.
Cloudmin will not be able to fully manage non-Linux virtual systems though, as it cannot access files inside their filesystems. This prevents Cloudmin from editing network interfaces unless the system is up and running Webmin, and from fully managing virtual disks.
Before creating an empty system, you should add the CD image that you plan to install it from to Cloudmin's system images list. This can be done as follows :
root and go to Cloudmin Settings -> New System Images..iso file for the CD image.xen-debian5-cd.Depending on where the image file has to be fetched from and whether it is initially compressed or not, the creation process may take from seconds to minutes. Once it is complete, you should see it appear on the New System Images page.
When Cloudmin creates an empty virtual system, the IP address that it selects for that system cannot actually be inserted into the appropriate configuration files until after the OS install is complete. Because the OS install is done manually, it is possible that the virtual system might be assigned a different IP address to what Cloudmin expects it to have, which will cause the status to be falsely shown as "Ping failed". This prevents the system from being fully managed by Cloudmin.
The best solution to this issue is to setup a DHCP server on your Cloudmin master system, which will then be automatically configured for each new virtual system so that systems can obtain the correct IP address. The steps to do this are :
root , and go to Webmin -> Servers -> DHCP Serverdhcpd or dhcp-server action, and click the Start on Boot button.Once this is done, Cloudmin will add a DHCP host entry for each new virtual system it creates. However, this will only be actually used if your master system and Xen or HVM hosts are on the same subnet. If not, you will need to setup the appropriate firewall rules or router configurations to forward DHCP packets from other networks to your Cloudmin master.
The process of creating a new empty virtual system is mostly similar to that for creating a full system. The steps to follow are :
gentoobox.Gentoo Linux install.Creation should take less time than in would for a Cloudmin system created from an image. At the end of the process, you will have a virtual system whose status is Ping failed, which indicates that Cloudmin could not contact it on the assigned IP address. This is expected, as the system will be waiting for you to complete the OS install process as follows :
root password that you select.If the new system is not contactable by Cloudmin after rebooting, use the Graphical Console page to ensure that it has fully booted from the hard disk, and has the correct IP address.
Once an empty system has been fully installed, it can be managed by Cloudmin like any other virtual machine. However, Xen instances created this way will always use HVM virtualization, as will any clones created from them. If you create an image of an initially empty Xen instance and then create a new virtual system from that image, it will also use HVM.
Open source Xen systems that were initially created empty will use virtual disks that are in whole-disk format, rather than single-partition format. This generally has no impact on the user, but if the disk has more than one partition it may be impossible to expand its size if both partitions are mounted.
Techically you can run Cloudmin on just a single system, which will be both the master that runs the UI and the host for your virtual systems. However, a more common setup has multiple host systems, one of which is typically also the Cloudmin master on which the install script is run.
If you have a choice of operating systems and are planning to host Xen or OpenVZ instances, we recommend running the latest version of CentOS if possible. The CentOS YUM repository includes a kernel with Xen support and all the needed Xen tools. For more details on how to setup each host system, see the Xen documentation.
If you plan to host OpenVZ containers, a kernel for CentOS that supports them is available from the OpenVZ website. The same website has a kernel that can run both Xen and OpenVZ on the same host, which is fully supported by Cloudmin.
Regardless of the virtualization type you choose, your host systems should have plenty of RAM - a typical Xen instance will consume at least 512MB of RAM, while OpenVZ containers are usually assigned 256MB or more. For Xen hosts, we recommend 4-8 GB RAM and plenty of CPU cores. Running a 64-bit distribution is not generally needed for systems with less than 4GB of RAM, and can actually be counter-productive due to the increased RAM use.
Once Cloudmin is installed, the first thing you should do is add an SSH key that can be used to login to your host systems as root. The steps to do this are :
/root/.ssh/id_rsaAlternately, you can have Cloudmin generate a new key or use one that you paste in on that same form.
Cloudmin adds all newly created virtual systems to a DNS zone hosted on the master system. If your company's domain is example.com, you might name this xen.example.com, and add an NS record to the example.com zone for this sub-domain.
To create this DNS zone on your Cloudmin master, do the following :
xen.example.com.cloudmin.example.com.Before you can use a real system to host virtual systems (like Xen or OpenVZ containers), it must be added to Cloudmin. For a host other than the Cloudmin master, the steps to follow are :
To enable this system for hosting virtual machines, you should first ensure that it has the kernel and tools installed for the virtualization type you are using. Then follow these steps :
If Cloudmin does not detect any problems with the host system, it can now be used to host new virtual instances.
Cloudmin comes with pre-created images for creating virtual systems of all the supported types. However, they must be first downloaded to your master system before they can be used, as follows :
For each virtualization type (such as Xen and OpenVZ), images are available with CentOS and either Debian or Ubuntu Linux, plus possibly other distributions. For each Linux variant, an image containing just the base operating system is available, plus images containing Virtualmin GPL and Pro.
Once all the steps above are complete, you can create a new virtual system as follows :
myvps.Documentation is divided into a few categories, such as "Virtualization", "Installation", and "Administrative and User Accounts", which covers the common types of service you'll be managing with your Cloudmin installation. Within each category you'll find a few types of document, such as "FAQ", "Troubleshooting", and specific task guides.
Pages labeled "FAQ" or "Frequently Asked Questions" are intended primarily for common questions new users, or potential users, ask about Cloudmin and the machines it manages. For example, the FAQ for Xen includes a brief, non-technical, description of the Xen virtualization layer and how Cloudmin interacts with it. The FAQs are generally non-technical in nature, and do not generally provide solutions to problems. They are conceptual and broad, merely to describe the way Cloudmin does things.
Pages labeled "Troubleshooting" are intended to help you solve specific problems. If you are receiving an error message from a service or Cloudmin, the troubleshooting section for that particular area may have solutions. Troubleshooting pages are specific and technical, and are intended to help you solve problems.
You can also search just the documentation by opening the search form and using the Advanced Search form to search within content "Only of the type(s)" and choosing "Book page".
The search page, by default, searches all of the content on Virtualmin.com, including forums, issues, and documentation. This may, or may not, be what you want, depending on the questions you have.
Cloudmin can be installed in a number of ways, including an automated install script which uses the standard package management features of your OS, and software repositories containing our software in native package formats. We strongly recommend that you use the automated install script to install Virtualmin, if at all possible.
Automated Cloudmin Installation - Installation of the full Cloudmin stack using our automated install script. This is the recommended way to install Cloudmin.
Manual Cloudmin Installation - Installation of Cloudmin and related packages manually. This is the method recommends for systems that are not currently supported by the automated install script.
Installation Troubleshooting - Troubleshooting common problems encountered during installation.
Uninstalling Cloudmin - Uninstallation of Cloudmin and selective removal of packages.
The simplest way to install Cloudmin is to use the install script on the serial numbers page that matches your system. The steps to follow are :
From this point on, installation should be fully automated. Cloudmin packages, Webmin and other tools will be download from the appropriate repositories using APT or YUM.
Once the installation is complete, you can login via the URL https://mastersystem:10000/ . See the Getting Started with Cloudmin page for what to do next.
At the time of writing, Cloudmin does not have an automated installation process for very many platforms like Virtualmin. However, it is relatively simple to install, as it has far fewer dependencies. A yum repository is provided for RPM-based distributions, as well as a Webmin compatible wbm repository for updates via the Webmin update system.
To install on a CentOS, Redhat Enterprise or Fedora Core system, the steps to follow are :
Assuming that all of the above steps succeeded, you are done! Open a web browser, and go to http://yourserver:10000/ to login (replace yourserver in the URL with the IP address or hostname of the Cloudmin master system). If your system has a root password, you will be able to login as root - if not, you can typically login as a user who has permissions to sudo to root).
Once you are logged in, see the Getting Started with Cloudmin page for what to do next.
Since Cloudmin is built on top of Webmin, un-installing it is simply a matter of removing Webmin and some additional modules. The commands for this on CentOS, Fedora or Redhat Enterprise are :
rpm -e webmin wbm-server-manager wbt-virtual-server-theme wbt-virtual-server-mobile wbm-security-updates
rm /etc/yum.repos.d/cloudmin
Or on Debian or Ubuntu, run :
dpkg --remove webmin-server-manager webmin-virtual-server-theme webmin-virtual-server-mobile webmin-security-updates
grep -v cloudmin.virtualmin.com /etc/apt/sources.list >/etc/apt/sources.list.tmp && mv /etc/apt/sources.list.tmp /etc/apt/sources.list
In both cases, any virtual systems created by Cloudmin will continue to run un-changed.
If you ever decide to re-install, systems that it used to manage can be re-imported using links under Add System on the left menu.
This page lists common installation issues and recommended solutions :
Install script fails The most common cause of installation failures is problems downloading packages. If this happens, check the following :
cloudmin.virtualmin.com to download packages via HTTP? If it is blocked by a firewall, the install will fail./etc/yum.repos.d is missing files or /etc/apt/sources.list is in-complete, some required packages may not be found.Cannot Login as root This can happen if your system doesn't have a root password set, perhaps because authentication is done via an SSH key. To set a password on CentOS, Fedora or Redhat Enterprise, use the command :
/usr/libexec/webmin/changepass.pl /etc/webmin root mynewpassword
Or on Debian or Ubuntu, run :
/usr/share/webmin/changepass.pl /etc/webmin root mynewpassword
Perl module install fails If the install script reports that a Perl module has failed to install, try it manually from the shell with a command like :
perl -MCPAN -e 'install Net::SSLeay'
Assuming Net::SSLeay was the module that failed. The cause may be missing dependencies such as C development libraries that Cloudmin cannot automatically install.
In Cloudmin, virtualization refers to running a virtual system that appears from the inside to be a real computer, but is actually being emulated on a real machine. The terms "virtual machine" and "VPS" are also used to refer to these, as are type-specific terms like "Xen guest", "OpenVZ container" and "EC2 instance". There are several different technologies that can be used to implement virtualization, which varying support for different operating systems, resource isolation and resource overheads.
The most common case is to provide customers or users with what appears to be their own system on which they have full root access and control of all services, but without the overhead of maintaining an actual physical machine. For example, a hosting company might sell virtual systems to customers which in turn use them for web hosting, database hosting or email.
A single physical machine can host multiple virtual systems, each of which is granted a slice of its memory, disk space and CPU time. Each virtual system is protected from others on the same host system. Because many applications or customers do not require the full CPU, RAM or disk capacity of a real systems, virtualization can be used to safely host several on a single physical system, thus saving resources.
Another advantage of Virtualization is the ability to easily move virtual systems between hosts without interruption or the need to re-install applications. If a hardware problem is detected on a host system, all virtual machines on it can be moved to a new host without changing their IP addresses or other settings, and possibly without even interrupting running processes.
Not all virtualization technologies are created equal - some (like Xen) provide more isolation between systems but at the cost of additional CPU and RAM overhead, while others (like OpenVZ) can be used to host more virtual systems per physical system, but with more chance of cross-system disruption.
Virtualization types can be generally separated into two categories :
Separate Kernels Examples : Xen, KVM, Amazon EC2 These types run a separate kernel for each virtual system, and typically store system files within a disk image or logical volume instead of on the host system's filesystem. RAM used is higher due to the need to run a copy of the kernel for each system, and free disk space and RAM cannot be used by other systems. However they provide more protection and isolation between systems, allow different kernels to be used, and provide more flexibility in filesystem and disk usage within the virtual systems.
Shared Kernel Examples : OpenVZ, LXC, Vservers, Solaris Zones These types run under the host system's kernel, which provides filesystem and process isolation between systems. Typically each system's files are stored under some directory on the host, possibly with common files like binaries being shared. They offer less isolation and force use of the same kernel, but the per-virtual-system RAM, CPU and disk overhead is lower. Also, RAM and disk space can potentially be over-committed to make better use of host system resources.
If you are running Solaris systems, you really only have one choice - Solaris Zones.
On Linux, your choice depends on the level of isolation you want and how much RAM and CPU overhead you are willing to tolerate. Given the ample CPU and RAM on most modern systems, we recommend using Xen as the overhead is usually tolerable unless you plan to run a large number of small virtual systems. In that case, OpenVZ is the best solution. KVM is similar to Xen in its resource use, but tends to have more overhead as it does not support paravirtualization.
Cloudmin also supports Linux Vservers, but this appears to be poorly maintained and offers no advantages over OpenVZ. As of Cloudmin 5.4, LXC is also supported on Linux. It has the advantage of being a standard part of recent Linux kernels, but lacks many features of OpenVZ such a live migration and disk space limits.
Amazon EC2 is different from other virtualization types in that the virtual systems don't actually run on your own machines - instead, they are hosted by Amazon for an hourly cost. It is worth using if your needs are highly variable, for example if you plan to run a hundred systems for a few hours a day then shut them down.
A location group contains a set of host systems, typically in the same physical location. When a virtual system is created you can select a location group instead of a specific host, and Cloudmin will choose a host from that group based on some selection method. The selection may be random, or based on free memory or disk space.
Location groups are most useful when you have a large number of host systems in different locations, and want to avoid selecting an appropriate one manually for each new virtual system. It is quite possible to have just a single location group if all your host systems are in the same datacenter and treated equally for allocation purposes.
To add a new location group, do the following :
Once a group has been created, you can assign a host system to it as follows :
Once at least one running host system is in a group, you will be able to select it on the Create System page.
A Cloudmin image is really just a compressed copy of the contents of a virtual system's filesystem, which means that it is quite possible to create your own images to supplement those that are available for download. This can be useful if you want to create multiple systems with your own customized configuration or special software installed, or if you just want to clone an existing server.
The first step to creating an image is getting a virtual system (running on Xen, VServers or Zones) setup the way you want. We recommend againsts creating any Virtualmin domains on a system to image though, as they would be duplicated on all new systems you create from it, which is likely to cause confusion or clashes. Also, configuration files that contain the IP address of the system will not be updated when a new system is created from the image, except for /etc/hosts and network config files like /etc/sysconfig/network-scripts/ifcfg-eth0 .
Once your source system has been prepared, the steps to create an image from it are :
Image creation can take several minutes, but Cloudmin will show you the progress as it proceeds. If the virtual system was running before you started imaging, it will be shut down (so that the filesystem can be safely copied), and then started up again after the process is complete.
If the source system has Virtualmin Pro installed, any licence information in /etc/virtualmin-license or other repository-related files will be replaced before the image is created. When a new system is created from the image, the correct Virtualmin serial number and key will be put back into those files.
Images are by default stored on the Cloudmin master system in the /var/webmin/server-manager directory. Make sure that this is on a filesystem with plenty of disk space, as an image with the full Virtualmin stack can consume up to 500 MB. Each image is stored in a 2 or more files whose names start with the ID you entered, and you can copy images to other Cloudmin master systems simply by transferring those files.
Cloudmin allows you to customize the locations in which images are stored, instead of just using the default directory on the master system. This can be useful if the master is low on disk space, or if you have geographically distributed host systems and want to avoid copying every image across the country when creating new virtual systems.
To change the default image storage location, the steps to follow are :
Amazon's EC2 service also supports images, also know as AMIs. Unlike images for virtual system types such as Xen, these are not stored on your Cloudmin master system - instead, they are stored in the Amazon S3 file storage space for one of your EC2 accounts.
Cloudmin supports the creation and management of EC2 images just as it does for regular images, but with a few small differences. To create an image, you must first have a running EC2 instance that has been setup the way you want, from which the image will be made.
Once your source system has been prepared, the steps to create an image from it are :
Image creation can take several minutes, but Cloudmin will show you the progress as it proceeds. The source EC2 system will not be shut down during imaging, but you should minimise use of it in order to avoid inconsistencies in the filesystem state.
If the source system has Virtualmin Pro installed, any licence information in /etc/virtualmin-license or other repository-related files will be replaced before the image is created. When a new EC2 system is created from the image, the correct Virtualmin serial number and key will be put back into those files.
Xen, KVM, OpenVZ and Vserver virtual systems can have limits imposed that restrict the amount of CPU they can consume on the host system. This limit is typically expressed as a percentage, where 100% means the right to use a full CPU core. On a multi-core host system, a limit could thus be set to more than 100%. It is also possible to turn off the CPU limit for a virtual system completely, which allows it to consume as much of the host's resources as it wants.
CPU limits can be used to prevent a single virtual system from overwhelming others on the same host. For example, you might want each customer to be limited to 50% CPU, meaning that 8 such systems could run on a 4-core host without impacting each other. CPU can also be over-committed, which is typically safe as most systems use CPU in bursts.
When using KVM virtualization, CPU limits can only be set when the cgroups tools are installed on the host system and the kernel supports cgroups.
The CPU limit for a new system can be set on the creation form, in the Resource limit options section. After creation it can be modified at Resources -> Resource Limits, and takes effect immediately without the need for a reboot.
Xen systems also support setting a CPU weighting, which determines how much CPU it is granted when the host system is over-committed. A system with a weight of 200 will get twice as much CPU as one with a weight of 100, but only if the total CPU percentages granted to running systems exceeds the host's capacity.
Xen also supports multiple virtual CPU cores within a system, each of which can be mapped to a core on the host. This can be configured at Resources -> Manage Virtual CPUs. It can be useful for separating Xen systems by assigning each to a different core on the host, so that there is no possibility of contention.
KVM just supports setting the number of virtual CPUs a system has, but doesn't allow each to be pinned to a real CPU on the host. The CPU count can also be set at Resources -> Manage Virtual CPUs.
Account plans can be used to define a total CPU limit for system owners, which applies to the sum of all limits applied to systems belonging to the owner. For example, if an owner has a limit of 80% CPU he could assign 40% to one system, and 40% to another. Or he could create just a single system with a 80% limit. In no case will he be allowed to set a virtual system to unlimited CPU though.
KVM and OpenVZ virtual systems can have an IO class set that controls their relative priority when accessing the disk on the host system. The class is a number that ranges from 0 to 7, and VMs with a lower class number have a higher priority when accessing local disk. IO priority also effects contention with other processes on the host system in the same way, such as webservers or databases.
The class for an existing system can be changed on the Resources Limits page, under the Resources category on the left menu. The Disk IO class field is a simple drop-down menu, for selecting a class ranging from 0 (best priority) to 7 (worst). When the Save button is clicked, the IO class will be immediately changed.
The IO class can also be set when creating a KVM or OpenVZ virtual system, in the Resource limit options section. The default class for new systems can be set at Cloudmin Settings -> Cloudmin Configuration -> KVM settings (or the section for OpenVZ).
By default, only the master administrator (root) in Cloudmin can manage the IO classes of virtual systems. However, this can be adjusted on a per-owner or per-plan basis. On the Edit System Owner or Edit Account Plan page, you can check the Change IO class box in the Allowed actions for system owners section to grant access to this feature.
Be careful allowing system owners to modify the IO class though, as Cloudmin doesn't prevent an owner from granting all his systems the highest priority, which may come at the expense of other VMs on processes on the host system.
The API command modify-limits can also be used to set the IO class for a virtual system, using the --ioclass parameter. For example, from the shell you could run :
# cloudmin modify-limits --host kvmioclass.home --ioclass 7 Setting IO class on KVM system kvmioclass.home to 7 .. .. done
The same parameter can be used when calling the API remotely.
Each virtual system managed by Cloudmin has at least one network interface / IP address, which the system's hostname typically resolved to in DNS. On the virtual machine this usually appears as eth0 - how it appears on the host system differs depending on the type of virtualization being used.
It is possible for virtual system to have multiple network interfaces. For Xen and KVM instances on host systems with more than one bridge, the virtual machines can have one ethN interface per bridge. Typically each is connected to a different physical network or VLAN on the host system.
Cloudmin lets you add extra IP addresses to a virtual system, although these will usually be virtual interfaces like eth0:5. This is useful if you want a VPS to host multiple SSL-protected websites, each of which needs its own IP address.
System owners can be either completely denied access to page for managing network interfaces, or limited in how many IP addresses they can use across all their virtual machines. This can be done either at the plan level, or on an owner-by-owner basis.
Cloudmin can fully manage network interfaces on any system running Webmin, or with a Debian-based or Redhat-based Linux distribution installed. It can even manage interfaces on a down system, assuming it is running Debian, Ubuntu, RHEL, Fedora or CentOS. This allows you to fix networking errors even if a system is in-accessible, by first shutting it down and then using Cloudmin to edit interfaces.
On systems running Windows, BSD or an un-supported Linux distribution without Webmin, Cloudmin cannot manage the IP addresses assigned to network interfaces - instead, these must be set within the virtual system. However, it can configure the MAC address and network bridges assigned to each interface.
To create a new network interface, the steps to follow are :
The new IP address should be immediately activated and pingable, and will be added to both the networking configuration files on the virtual system, and any virtualization config files on the host system.
Xen and KVM virtual systems also support creation of non-virtual interfaces, which appear like eth1 on the virtual machine. If the host system has multiple network bridges you can select which bridge each new real interface is connected to - it is also possible to have multiple real interfaces bridged to the same real interface on the host.
To create a new real network interface, the steps to follow are :
ethN device on the virtual system.The new IP address should be immediately activated and pingable, and will be added to both the networking configuration files on the virtual system, and any virtualization config files on the host system.
To change or remove an interface, do the following :
eth0:5) or a real interface other than the first, you can click the Delete button to remove it.Again, all changes will be activated immediately with the exception of a change in the MAC address. That will only take effect when the virtual system is shut down and started up again. Only Xen and KVM systems can have their MAC addresses changed, and only for non-virtual interfaces.
Cloudmin can edit the default router on a running system with Webmin installed, or a down system with a support Linux distribution (Redhat or Debian based). The steps to do this are :
Be careful doing this on a running virtual system though, as you may cut off access to the Cloudmin master.
If the virtual system supports IPv6, you can also set a default gateway for IPv6 routing using this same form.
Cloudmin can be configured to setup the DHCP server on your master system to supply virtual machines with IP addresses. This can be useful if you want to use system images for operating systems that Cloudmin cannot configure the network on directly, such as Windows or FreeBSD.
The steps to setup a DHCP server are as follows :
yum install dhcp
On Debian or Ubuntu, the command is :
apt-get install dhcp3-serverWhen managing KVM, Xen or real systems running Linux with Cloudmin 5.6 or later, you can also enter IPv6 addresses for non-virtual network interfaces. However, only systems running Debian, Ubuntu, CentOS, Redhat or Fedora Linux are supported currently. IPv6 addresses can be added as follows :
eth0.2001:db8:0:f101::77 and a netmask like 64 into the IPv6 addresses table. Make sure it is within a range that has been routed to your network.Even though Cloudmin assigns IP addresses to virtual systems, it is possible under some virtualization types for a user with root access to the system to bring up an additional network interface with an IP that hasn't been officially assigned. Or he could change the IP address or MAC address of the eth0 interface. This could be used to evade bandwidth collection, and could cause IP clashes with other virtual or real systems.
Cloudmin version 6.5 and later can block this type of address spoofing by automatically setting up an EBtables firewall that only allows IP and MAC addresses assigned to the system. This requires that ebtables be installed on the host system, which fortunately is distributed as a standard package in most Linux distributions.
To enable firewalling of unassigned IPs for an existing system, do the following :
Blocking of un-assigned addresses will be activated immediate for running systems, and at the next boot for down systems. To undo this, select All addresses in step 2 instead. If the option is missing, double-check that the ebtables command is installed on the host system.
Firewalling can also be enabled at system creation time, via an option in the Advanced options section of the creation form. You can also enable it by default for new systems at Cloudmin Settings -> Cloudmin Configuration -> KVM Settings -> Block spoofed IPs and MACs by default? .
For Xen, KVM, LXC, OpenVZ and Vserver virtual systems, Cloudmin can define a limit on the amount of RAM the virtual system can consume. This prevents a single system from consuming all the RAM on the host, and allows you to parcel out memory based on how much a customer pays or what an application requires.
OpenVZ, LXC and Vserver systems can also be configured with no RAM limit, which allows them to potentially consume all RAM on the host. Memory that is not actually used by processes running within the system is potentially available to other virtual systems or processes on the host, which means that RAM can potentially be over-committed.
Xen systems always have a fix RAM limit, and do not allow that block to be shared with other systems while the Xen instance is running. Thus there is no possibility of over-committing RAM.
When you create a virtual system, the initial RAM limit can be set in the Resource limit options section of the creation form. After creation, it can be adjusted at Resources -> Resource Limits. In most cases, RAM available can be changed without needing to reboot the virtual system. However, setting it lower than the amount actually consumed by the kernel and running processes may cause the system to crash.
In all cases the new RAM limit will be saved in the appropriate config file for the virtual system, and re-applied if it is rebooted.
OpenVZ supports separate maximum and guaranteed RAM limits. By default these are the same, but you can use the Resource Limits page to set the guaranteed RAM to a lower value. The container will be guaranteed to be able to use RAM up to this limit, and may be able to allocate RAM up to the maximum limit. This can be useful when you have non-critical virtual systems whose RAM may need to occasionally burst above regular usage levels.
We discourage the use of non-guaranteed RAM limits for production systems though, as this can cause unexpected memory allocation failures.
By default Cloudmin will not even allow over-committing of the maximum RAM limit, but you can allow this via an option on the Edit OpenVZ Host page. However, guaranteed RAM can never be over-committed.
Account plans can be used to define a total RAM limit for system owners, which applies to the sum of all limits applied to systems belonging to the owner. For example, if an owner has a limit of 1GB RAM he could assign 512M to one system, and 512M to another. Or he could create just a single system with a 1GB limit. In no case will he be allowed to set a virtual system to unlimited RAM though.
Cloudmin currently only supports management of virtual disk images for Xen and KVM systems, as other virtualization types use a directory on the host filesystem to store files instead of images.
Each open source Xen system has one or more files or devices on the host system (like /xen/mysystem.img mapped to devices on the virtual system (like /dev/sda1). The disks on the host can be regular files, LVM logical volumes, or actual disk partitions. In the virtual system, these are typically mapped to partitions, but can be an entire disk.
When Cloudmin creates a new Xen system, it will also build at least one virtual disk whose contents are a copy of the selected system image. If you select to enable swap as well, another disk will be created for the swap file. These will be mapped to /dev/sda1 and /dev/sda2 on the virtual system respectively.
For KVM, files or devices on the host system (like /kvm/mysystem.img) are mapped to entire disks on the virtual system (like /dev/hda). This disk image then contains one or more partitions, which can be mounted as filesystems on the virtual machine, or used for LVM or RAID.
When Cloudmin creates a new KVM system, it will create a disk image typically with a single partition. This is then mounted as the root filesystem on the virtual machine. In some cases, there may be an additional partition that is used for the /boot filesystem.
Citrix Xen virtual systems also use whole-disk images, on which Cloudmin creates partitions. However, the underlying storage is managed entirely by the Citrix Xen API, so you never need to select a filename or LVM volume group for a new disk.
The most common operation to perform on a disk image is expanding it when the filesystem is full. The steps to do this are :
This process is identical for disk images stored in regular files or logical volumes. In both cases, the size increase will fail if the underlying host filesystem or volume group does not have enough free space.
This same procedure can be used to shrink a disk, assuming that the filesystem on is not using more space than the new disk size. However, Citrix Xen does not support the shrinking of disk images.
For KVM and Citrix Xen whole-disk images, expansion of a disk is only possible if there is a single partition or if the final partition contains the filesystem being expanded.
Cloudmin attempts to work out what filesystem is on a virtual disk by looking at the /etc/fstab file on the virtual system. It then uses this information to properly expand the filesystem.
However, if the filesystem type cannot be worked out then Cloudmin will warn you about possible data loss before resizing a disk. After expanding a disk you will need to login to the virtual system and possibly expand partitions and filesystems on the disk, or create a new partition in the empty space. Disks used for RAID, LVM or by un-supported operating systems like Windows or BSD cannot have their filesystems expanded by Cloudmin.
Because expanding the size of a disk typically requires a virtual system be shut down, you may want to schedule this for a time when the system is not being heavily used, like 3 AM. This can be done as follows :
When the selected time arrives, the system will be shut down if needed, the selected disk resized, and then the system started up again. Only one scheduled change can be created at a time for each disk on each system. Once created, a change can be cancelled before it takes effect on the same page.
You might want to add a disk to a system for use as virtual memory, or to move some files onto. The steps to do this are :
A reboot of the virtual system will be needed before the new disk is available.
If a virtual system no longer needs a disk, you can remove it as follows. All data on the disk will be lost though! Removal of the disk for the system's root filesystem is not possible.
OpenVZ virtual systems can limit disk usage in a different way - instead of using fixed-size virtual disks, each system can have an optional limit on the amount of disk space its filesystem can consume. This can be set on the Create New System page in the Resource limit options section, or modified later on the Resource Limits page.
Account plans can be used to define a total disk limit for system owners, which applies to the sum of all disks on all systems belonging to the owner. For example, if an owner has a limit of 10GB of disk he could create a virtual system with two 3GB disks, and other with 1 2GB disk.
For OpenVZ systems, the disk space limit is counted towards the owner's total disk space. If an owner has a disk limit, he will not be allowed to create an OpenVZ system without a limit.
Once you have systems registered with Cloudmin that run Virtualmin, you can use the Cloudmin interface to create, find and manage domains on those systems. In a company with many real and virtual systems, this makes domain management much easier than logging into every one of your Virtualmin hosts individually to find a domain.
Cloudmin can create new domains, with some restrictions - it only supports new top-level domains (not sub-servers), using the default template on the target system. In addition, many of the lesser-used options on the regular virtual domain creation page are not available.
To create a domain, the steps to follow are :
If there are no mistakes on the form, Cloudmin will contact the selected Virtualmin system to begin the domain creation. Any errors or progress output from the remote system will be displayed.
When creating domains on systems running under VServers or Solaris Zones, the allocate automatically option tells Cloudmin to select a virtual IP address from the range specified for the virtual system's host. It will also add a virtual interface with that IP, as these virtualization types do not allow systems to manage their own network interfaces.
Similarly, the IP entered when with address is selected will be activated by Cloudmin. Make sure you enter an IP on the same network as the Virtualmin system, or else it is unlikely to be reachable.
When creating on a real system or one running under Xen, virtual IP creation is done by the virtual system itself. In this case, the options to allocate or specify a private IP address are passed directly to Virtualmin on the selected system.
If you have many systems running Virtualmin, finding a domain that might be hosted on any one of them could be a slow process - unless you are using Cloudmin, which fetches the list of domains from each managed system as part of its automatic status check. To search for and manage domains, follow these steps :
Another way to find domains is to select a system from Cloudmin's left frame, then click on the Domains link below the menu. This will open a page with all its hosted domains listed, on which you can click on a domain name to manage it. Domains can also be disabled, deleted and moved from this page just as they can be from the global domain search results.
As well as creating domains, Cloudmin can be used to delete, disable and enable them. The steps to do this are :
When deleting a domain with a virtual IP interface that was created by Cloudmin (on a Zones or VServers system), the interface will be automatically shut down as part of the deletion process.
Disabling and enabling domains is similar, except that you use the Disable Selected and Enable Selected buttons respectively. Domains that are already disabled are shown in italics in the domain list.
Cloudmin has the ability to move a Virtualmin domain between systems, which can be useful if you are planning to retire an old system, or want to move a high-load domain to a more powerful server. Moving is done using Virtualmin's backup and restore features - the domain is backed up on the source machine, transferred to the Cloudmin master and then to the destination, deleted from the source, and finally restored from the backup file.
We recommend moving domains between systems running the same OS and software versions where possible, as in some cases a domain may contain files or configuration options that are specific to a particular OS. The most common example of this is PHP scripts - if the domain has installed scripts that require PHP 4 but the destination does not support this version, then they are almost certain to fail.
To move a domain or domains, the steps to follow are :
In almost all cases, you will need to make some DNS changes once a domain has been moved, as it will now be on a new IP address (the shared IP of the new host system). If the DNS domain is hosted by Virtualmin, the upstream registrar will need to be updated with the new system's DNS server IP address. If DNS hosting for the domain is done on a completely different system, any records for the domain that use the old system's IP will need to be changed to the new one.
When a domain with a private IP address is moved, Virtualmin will use the same IP on the new system. This will generally work fine, as long as both systems are on the same network. However, you should choose the delete the domain from the source machine when moving, as it is not generally possible to have to systems with the same IP address active at once.
By default when creating a domain, Cloudmin will have features available by default on any managed Virtualmin system checked. If you want more control over which features are active by default, the steps to follow are :
On a simple Xen or KVM host system there is only one network interface (such as eth0), typically connected to the Internet. All Xen systems have their own virtual eth0 interface which is bridged to the host system via Xen's xenbr0 interface. Similarly, KVM systems bridge eth0 to the br0 interface on the host.
However, you may want to configure host systems with two interfaces, one connected to the Internet and one on a private network for transfers between host or virtual systems. This involves adding an additional bridge (usually xenbr0) to the Xen configuration on the host, and configuring Cloudmin to create new Xen systems with a second interface this is connected to the bridge.
This configuration must be done manually, as Cloudmin does not yet support managing the xend configuration file on a host. The steps to follow are :
/etc/xen/scripts/multiple-bridge with the following contents :
#!/bin/sh dir=$(dirname "$0") "$dir/network-bridge" "$@" vifnum=0 netdev=eth0 bridge=xenbr0 "$dir/network-bridge" "$@" vifnum=1 netdev=eth1 bridge=xenbr1
chmod +x /etc/xen/scripts/multiple-bridge/etc/xen/xend-config.sxp and find the line like (network-script network-bridge) line, and change it to (network-script multiple-bridge)/etc/init.d/xend restartifconfig -a command.If you have multiple host systems, these steps must be performed on each of them.
This can be done by logging into Webmin on the host, and going to Networking -> Network Interfaces -> Activated at boot. Create a new bridge interface named br1 that is connected to an un-used ethernet interface (like eth1) , and then save and apply the configuration.
Once the additional bridge is active on the Xen host, you can configure Cloudmin to use it as follows :
xenbr0 and xenbr1.xenbr1 bridge in the For interface column.How you can create a new Xen virtual system, and it should be configured with two network interfaces, with eth1 connected to eth1 on the host system, and an IP assigned from the 192.168.1 range.
In Cloudmin 5.8 and later, you can select on the creation form which bridges to connect the virtual system's network interfaces to. This can be used to create a VM that is only on your internal network, for example.
When adding a network interface to a Xen instance, you can also select which network bridge the new interface will be connected to.
A Cloudmin Services client must run Virtualmin version 3.83 or later - either the GPL or Pro version. It must not have any firewall blocking access to ports 10000 to 10010 on the Cloudmin master, and to port 3306 on any MySQL provisioning host, or port 53 on any DNS host.
It is not necessary for the client to be managed by Cloudmin, although this will help the system owner better control it, especially if it is a virtual machine.
If you plan to create MySQL databases, none should exist yet on the client system. Because of the way Webmin is configured to connect to a remote MySQL database, it cannot manage both local and remotely created databases at the same time. Also, this would defeat the purpose of creating services remotely, as you would still need to run resource-intensive local MySQL server. Ideally the Virtualmin provisioning client will have no virtual servers at all before connection to a master system is enabled.
For DNS services it is quite possible to my both remote and locally hosted DNS zones. However, this is not recommended, as the client system will still have to incur the load of running a BIND server.
The steps to configure a Virtualmin system as a client for DNS are :
root and go to System Settings -> Cloudmin Services Client.Assuming that the client system can connect to and login to the Cloudmin master, any new virtual servers with the DNS feature enabled will have their DNS zone setup on a services host. Assuming that this works successfully, you can disable the BIND DNS server on the client system as follows :
bind or named action, and click the Disable Now and On Boot button at the bottom of the page.There is no need to actually un-install BIND unless your system is really low on disk space, as the BIND packages often contain other useful utilities like dig and rndc.
The steps to setup a system as a MYSQL client are basically the same as for DNS :
root and go to System Settings -> Cloudmin Services Client.From then on, any new virtual servers with the MySQL feature enabled will be created on a services host. All logins and databases for this client system will be on the same host, as Webmin is unable to manage multiple remote MySQL hosts.
Assuming that this works successfully, you can disable the MySQL server on the client system as follows :
mysql or mysqld action, and click the Disable Now and On Boot button at the bottom of the page.Once a domain has a remotely created database, any scripts installed using Virtualmin Pro will also be configured to connect to the remote MySQL host. Accounts for domain owners and mailboxes will be created on the host system, which may increase the chance of name collisions if multiple clients are sharing the same host.
The process for setting up a Virtualmin system to use a central server for span or virus scanning is relatively simple, as once enabled it applies to all new and existing domains. The steps are :
root and go to System Settings -> Cloudmin Services Client.This will disable the locally running clamd and spamd servers if active, and configure all domains to use clamd-stream-client or spamc to forward virus and spam filtering requests to a Cloudmin Services host system.
If Virtualmin complains that clamd-stream-client is not installed, the simplest way to install it is from the source code with the commands :
cd /tmp wget --no-check-certificate "https://downloads.sourceforge.net/project/clamd-stream-cl/clamd-stream-client/1.3/clamd-stream-client-1.3.tar.gz" tar xvzf clamd-stream-client-1.3.tar.gz cd clamd-stream-client-1.3 make ./configure make install
For a system to host some Cloudmin Services feature (such as MySQL databases or DNS zones), it must meet the following requirements :
Because a host system may run databases or serve zones for multiple clients, it must have sufficient CPU, RAM and disk to handle the load. MySQL hosting in particular can be very resource intensive, as all the work of executing database queries is done within the database server. For this reason we recommend that capable physical systems be used.
Once a host system has been setup, it can be brought under Cloudmin's control as follows :
Assuming the IP address, login and password you entered are correct, Cloudmin will successfully add the system for management, and it will appear in the list of hosts on the left menu. If it does not have have Webmin installed, you can go to System Operations -> Install Webmin to add it now.
Once a system has Webmin (or Virtualmin) installed and is under Cloudmin's control, you can register it for use as a services host as follows :
Once a system has been added, it will show up on the Cloudmin Services page. Settings can be edited by clicking on its hostname, and you can stop a system from being used for hosting in future by checking the box next to its name and clicking Remove Selected Systems.
When a system is registered for MySQL hosting, Virtualmin server owners and mailboxes with MySQL access will be created in its mysql permissions database. Databases belonging to virtual servers will be created and granted to those users, used the same permission settings if they were created on a dedicated Virtualmin system. However, the list of allowed hosts for each user and database will include the client system, so that it can connect and manage the DBs.
Due to limitations in Webmin's support for managing a remote MySQL database, all logins and databases for a single client system must be created on the same host. However, multiple clients belonging to the same system owner can have their MySQL databases created on different host systems.
A system that hosts DNS zones will have them added to its BIND configuration, just like zones that were created on the system via Webmin. NS records will be automatically set to point to the host system and any slaves setup as part of the provisioning service, but all other address records will point to the IP address of the client system that requested the zone.
If you have multiple host systems running BIND, Cloudmin can also automatically configure systems other than the one a master zone was created on as slaves for that zone. This is highly recommended, as it means the zone will still be resolvable even if one of the DNS servers is down. Any system that is hosting DNS zones can be configured to host both master and slave zones - this means that if you have two or more, each new master zone will be created on one of them, and the others will be setup as slaves for it.
Unlike the MySQL feature, every DNS zone created by a Cloudmin services client can potentially be hosted on a different services host.
Clamd is a ClamAV's virus scanning server, which accepts email messages from remote systems and returns information about what viruses they contain, if any. Because it is fairly RAM and CPU intensive, running a single central install of Clamd that serves multiple Virtualmin systems can save significant resources on those machines.
The simplest way to setup a system to host Clamd is to install Virtualmin GPL or Pro on it and then use Virtualmin's built-in support for configuring and starting Clamd. This can be found at Email Messages -> Spam and Virus Scanning , or can be enabled using the command virtualmin set-spam --enable-clamd
Spamd is SpamAssassin's spam filtering server, which accepts email messages from remote systems and computes a spam score for them. It is also fairly RAM and CPU intensive, so running a central spamd server can reduce the load on Virtualmin client systems - although not as much as you would gain by offloading virus scanning.
The simplest way to setup a system to host Clamd is to install Virtualmin GPL or Pro on it and then use Virtualmin's built-in support for configuring and starting Clamd. This can be found at Email Messages -> Spam and Virus Scanning , or can be enabled using the command virtualmin set-spam --enable-spamd
Once clients start to create features, you will be able to see what has been created on each host by clicking on a hostname on the Cloudmin Services page, and opening the Services history section. Each feature that is currently active will be listed - if a client removes a feature (such as by deleting a Virtualmin virtual server), it will be removed from this list.
You can manually manage a feature by clicking on the link in the Actions column, such as Edit DNS Zone or Manage Database. This will open Webmin on the host system via Cloudmin, and allow you to edit DNS records or tables. This ability is only available to the root user though.
To forcibly remove a provisioned feature, click the Remove link. This is not typically recommended unless the original client system has been unexpectedly shut down, as it will remove the DNS zone or MySQL database without notifying the original client.
Features can also be found by searching across host systems, using the Search history box on the Cloudmin Services page. You can search by host name, database name, zone name or owner. The same links to manage or delete features are available on the search results page.
Before a system can be used to host Xen or KVM instances, OpenVZ containers, Solaris Zones or Linux VServers, Cloudmin must be informed that is will be used for this purpose, and must verify that needed software and kernel support is installed. The steps to do this are similar for the various virtualization types, but they all start with the registration of the host system itself, documented on the Using Cloudmin page.
When a virtual system is created by Cloudmin, it will be assigned an IP address and a hostname. To allow this hostname to be used by other systems, it must be added to the DNS so that it can be resolved - otherwise, only the IP can be used to connect.
Fortunately, Cloudmin can make use of Webmin's BIND DNS Server module to add these DNS records automatically. For this to work, the Cloudmin master system must be running a name server, and it must have at least one DNS domain configured, as explained below :
Unless the Cloudmin master system is already the primary nameserver for the yourcompany.com domain, you will need to add an NS record in that domain for xen.yourcompany.com with the hostnmae of the Cloudmin master system. Using Webmin, the steps to do this are :
The steps to add a system for Xen hosting are :
Once at least one system has been registered, you will be able to create Xen instances using Cloudmin.
Once at least one system has been registered, you will be able to create KVM instances using Cloudmin.
The steps to add a system for Linux VServers hosting are :
Once at least one system has been registered, you will be able to create VServers instances using Cloudmin.
The steps to add a system for Zones hosting are :
Once at least one system has been registered, you will be able to create Solaris Zones using Cloudmin.
Even though a command-line API exists for managing Cloudmin objects such as systems, domains and interfaces, this may not be appropriate or usable in all circumstances. Because the commands need to be run as root, they cannot be called from PHP or CGI scripts invoked by a web server, which typically run as a less-privileged Apache user. Also, they must be run on the server running VM2, which makes them difficult to call from another system.
For this reason, an alternate method exists for running these programs via HTTP requests. A special URL in the Cloudmin web interface exists to be called by other programs, and to then pass its parameters on to one of the command-line scripts. This URL can be requested from any system, and by processes running as any Unix user.
Before reading this documentation, you should be familiar with the Cloudmin Command Line API documentation, even if you never use those commands directly.
All remote calls must be made through the CGI /server-manager/remote.cgi . The full URL for this will be https://yourserver:10000/server-manager/remote.cgi , where 'yourserver' is the full hostname or IP address of the system running the VM2 master.
This URL must be provided with at least one parameter named 'program', whose value must be the name of the command-line program to invoke, without the .pl extension. So a possible URL to request would be :
https://yourserver:10000/server-manager/remote.cgi?program=list-systems
Because most command-line programs require additional parameters, these must be included in the URL. Every CGI parameter is converted to a command-line parameter, with the value of the parameter appended if given. For example, to create a mail alias, you could invoke the URL :
https://yourserver:10000/server-manager/remote.cgi?program=reboot-system&host=xencentos.home
To specify a parameter that does not have anything after it, just add a CGI parameter with no value. For example, to list systems in detailed form, you could call :
https://yourserver:10000/virtual-server/remote.cgi?program=list-systems&multiline=
Both GET and POST format HTTP requests can be used. If your VM2 master server is not running in SSL mode, use http:// instead of https:// in the URL.
The page returned by the remote.cgi URL will always be plain text, and will contain the output produced by the command-line program. One additional line will be appended though - the words 'Exit status:' followed by the numeric Unix exit status of the command. A status of 0 means that the program was successful, while a non-zero status indicates some error. The cause of the error can be determined from the command's output.
If you would prefer JSON format output, add the json=1 parameter to the remote API call. Alternately, you can select XML format with the xml=1 parameter. Finally, Perl format can be selected with the perl=1 parameter.
Because the remote API is part of the Cloudmin web interface, it is password-protected using the same authentication system as you would normally use to login via a web browser. Any Webmin user with access to the module can also access the API. As of Cloudmin 4.1, system owners can also be granted access to the API with the same permissions and capabilities as they would have when using the web UI.
When calling the remote API from your own programs, the HTTP request must have the necessary HTTP authentication headers. All HTTP libraries and programs have options to set the username and password - for example, the wget command uses --http-user and --http-passwd , so you could fetch a list of domains from a remote VM2 server with a command like :
wget --http-user=root --http-passwd=smeg 'https://yourserver:10000/server-manager/remote.cgi?program=list-systems'
If you use Cloudmin to manage one or more systems running Virtualmin, you can have it replication domains and global Virtualmin settings (like plans and templates) from a source system to multiple destinations. This can be useful for :
Domain replication is most useful when the systems share home directories via NFS and possibly connect to a remote MySQL database, so that dynamic content is always up to date. In this case, Cloudmin should be configured to not replicate home directory and database content.
To limit replication to just some Virtualmin features, open the Advanced replication settings section when adding or editing and select them from the Virtualmin features to replicate field. For example, you may want to select everything except home directory content and MySQL databases if they are stored on a separate system used by both the source and destinations.
To configure Cloudmin to replicate one or more virtual servers from a source system to one or more destinations, follow these steps :
One replication has been setup, you can change what gets copied and to where by clicking on an entry in the Virtual Server Replication list. Replication configurations can also be deleted and started manually on the same page.
To instead copy global settings like plans between systems running Virtualmin, follow these steps :
Cloudmin replication allows you to setup one or more additional systems as backup replicas, which can take over management of all your other systems if the primary master fails. It is only available in Cloudmin 4.0 or later, and each replica must also be running Cloudmin 4.0 or above.
When replication is enabled, Cloudmin will copy the following to all replicas :
Replication is done by default every 5 minutes, just after the status of all managed systems is collected. It is always done in the background, so any delay sending changes to replicas does not effect the Cloudmin user interface.
Replication does not include the status of the Cloudmin master system itself, as it makes no sense to replicate this to backup masters which will be collecting their own status. It also does not include any system images that are not stored on the master.
If the Cloudmin master is also acting as a host for virtual systems, they will not be included in replication - except for their status.
The process for setting up a new Cloudmin replica is :
From this point on, the system will be switched to a read-only replica state, and will wait for replication connections from the master you setup in the next section. You can still use Cloudmin on the replica to view the details of all managed systems and global settings, but will not be able to change anything.
To configure a system to copy settings to one or more Cloudmin replicas, the steps to follow are :
After saving, all replicas will be checked to ensure that they are reachable and are setup as replicas. An initial replication of all settings will then be done - this may take several minutes or more if the current master has a large number of system images stored locally, as they will need to be sent to all replicas.
If your original Cloudmin master system fails and you have a single replica, it can be switched to become the new master as follows :
The system should now be a fully usable Cloudmin replica, with all global settings and system state from the last replication sync from the old master.
If the old master is still reachable, replication from it can be turned off by :
If you had multiple replicas to start with, in the case of master failure the steps are :
Cloudmin's DNS roundrobins feature allows you to create and manage DNS entries that are automatically updated to resolve to the IP addresses of multiple systems, selected based on their health or other criteria. These can be used to balance web traffic between several servers, while automatically removing those systems that have failed. They can be used with both physical systems managed by Cloudmin, or virtual machines.
As of Cloudmin version 5.9, this feature also supports the automatic configuration of a proxy balancer like Apache or Nginx to forward web requests to backend systems based on their availability. This has the advantage over DNS-based balancing that updates are immediate from the point of view of web clients. See the Proxy Balancing section below for more details.
In order to automatically update a DNS record, its zone must be hosted on the Cloudmin master system. When Cloudmin is used to manage virtual systems the master machine is typically already setup as a DNS server, so that records can be created for virtual machines.
If you typically host DNS zones on a separate system, it could be setup as DNS slave for the zone that will contain the dynamically update record, with the Cloudmin system as the master. Only the slave would need to be registered, and so would receive all queries from outside users. If BIND record change notification is enabled, this will not lead to any significant increase in update latency.
Another alternative is to use the new Cloudmin Services product, which allows a master system to manage remotely hosted DNS zones, among other features. The DNS roundrobin feature is also capable of updating any zone created using the provisioning service.
The steps to create a new roundrobin are :
root , and go to System Monitoring -> Roundrobin DNS Records.Once a record has been created, you can view its status and change settings on the DNS Roundrobins page. A record can be edited by clicking on the hostname, or removed with the Delete Selected Roundrobins button. Cloudmin's background status monitoring will update DNS records every 5 minutes by default, but you can force an immediate refresh with the Refresh Roundrobins button.
To see exactly which systems were or were not include in a record, click on its domain name and then open the Status from check section on the Edit DNS Roundrobin page. This will list all systems that could be included, and the reason why not if any were left out.
By default Cloudmin will create a DNS A record for the IP address of each usable system that it finds. However, you can limited the number of addresses with the Address records to include field. This can be useful if setting up failover between a master and backup systems - in that case, you would set it to 1. Systems are tried in the order they are selected in the Systems to include section.
If you have a system running Virtualmin that is under Cloudmin's control, a domain on that system can be used as a proxy for multiple backend webservers. This method is superior to DNS-based roundrobin load balancing, as changes do not need to propagate out to DNS clients. However, it requires that an additional system be used as a web load balancer, which will forward all requests on to active backend serving systems.
To setup a proxy balancer, create or edit an DNS roundrobin as explained above. Then do the following :
example.comAfter every system status update, Cloudmin will then create or modify a web proxy balancer in the specified domain to forward HTTP requests to the systems that match the conditions for inclusion in the DNS record.
When a proxy like this in use, the DNS roundrobin record may no longer be needed at all, as clients will access the backend webservers via the domain name that you entered. The DNS record must still be defined though, and will still be maintained by Cloudmin.
When a DNS roundrobin that uses a proxy balancer is deleted, the proxy will be deleted from the Virtualmin system as well.
This documentation was contributed by Scott Grayban ( sgrayban @ gmail.com ). They are specific to Debian, and may need modification for other Linux distributions :
Pre-Requisites for Installing a Windows Xen Guest
A XEN kernel must be installed and running at boot time.
Make sure you have HVM/VMX enabled in the bios - if you don't have this you can't run windows
In console type
xm dmesg | grep VMX
You should see...
(XEN) HVM: VMX enabled
If you don't you will need to restart the server and get into the BIOS and look for an option related to virtualization support.
If your BIOS does not have this you can not run any HVM guests, that means you can not run any version of Windows.
Turn off VNC for all xen linux guests and restart them.
Run vi /etc/xen/scripts/qemu-ifup and enter :
#!/bin/sh echo -c 'config qemu network with xen bridge for ' echo $* ifconfig $1 0.0.0.0 up brctl addif eth0(your bridge) $1
Change to the xen directory for the rest of the steps with cd /xen/
Create blank 80GB disk image with :
dd if=/dev/zero of=xenwin.img bs=1024k seek=81920 count=0
apt-get install libcdio-utils
Get cd/dvd info and make sure its the right one
cd-info /dev/(s|h)da
Create the WindowsXP ISO
dd if=/dev/(s|h)da of=Windows.iso
Run vi xenwin.cfg and enter :
kernel = "/usr/lib/xen-default/boot/hvmloader" builder = 'hvm' vif = [ 'type=ioemu,bridge=eth0,ip=assigned-ip,mac=22:61:34:00:00:01' ] MAC address has to start with 22:61:34 or 00:16:3e address = 'assigned-ip' netmask = '255.255.255.XXX' memory = 1024 shadow_memory = 8 name = "xenhvm" # domain prefix name cdrom = 'file:/xen/Windows.iso' # name of iso image you created above disk = [ 'file:/xen/xenwin.img,hdc,w', 'file:/xen/Windows.iso,hdb:cdrom,r' ] device_model = '/usr/lib/xen-default/bin/qemu-dm' # boot on floppy (a), hard disk (c) or CD-ROM (d) # default: hard disk, cd-rom, floppy #### boot must be dc to install windows after that you change it to c or cd boot = "dc" #boot = "c" vnc = 1 # use VNC to insall and setup windows after that is done you can disable this vncconsole = 0 vncpasswd = 'password' vncviewer = 1 vncunused = 1 vnclisten = 'Domain-0 IP' vcpus = 2 # number of cpu's to assign stdvga = 0 serial = 'pty' usbdevice = 'tablet' # Required for USB mouse on_reboot = 'restart' on_crash = 'restart'
Run the next 2 commands at the console
xm create xenwin.cfg
brctl show
Make sure that the tapX interface is assign to ethX you set in bridge= vif setting
Type the next command at the console :
vncviewer assigned-ip
and continue with the windows install and setup
Setup your windows networking using the correct IP/mask/gateway/dns Setup remote desktop access if you need/want it
Turn VNC off in the xenwin.cfg file by setting vnc = 0
This step has to be done because XEN/qemu-dm will force the port to be 5900 and it will interfere with the other xen linux vnc guests.
Re-enable vnc for the xen linux guests if you turned them off in Step 2 and restart the guests.
Import the windows instance into Cloudmin at Add System -> Add Xen instance
You're done.
You should be able to access the windows server via RDP(remote desktop) as Administrator and start/stop/reboot and manage the windows guest as a normal windows server.
That means you can run the updates or install any windows apps that you might need.
Note - The default passwords for Administrator and new user is temp1234 if you are using the paid version of my WindowsXP img file that is fully functional and ready to use.
YOU MUST HAVE already bought WindowsXP and have a valid license to get the XEN img file, at order time you will have to electronically sign that agreement. Cloudmin might offer a free Windows ISO at some point.
For information above pricing of Xen Windows images, see http://www.borgnet.net/clients/knowledgebase/13/Debian-Lenny-WindowsXP-H...
Citrix Xen (formerly from XenSource) is a commercial variant of Xen that uses the same underlying concepts and kernel as open source Xen, but a completely different set of command-line tools. Cloudmin supports Citrix Xen as a virtualization type, but treats it differently from regular Xen due to differences in the disk format used, API and capabilities.
Citrix provides an ISO image for a Linux installer that can setup a new system as a Xen host, which can be downloaded from http://www.xensource.com/ . As far as I know, they do not have an installer which works on existing Linux systems, so you will need to dedicate one or more physical systems to Xen hosting.
Once a host system has been setup for Citrix Xen, you can configure Cloudmin to manage it as follows :
If you are already using Citrix Xen on your network, you can have Cloudmin take over management of existing VMs as follows :
KVM virtualization is included in the 2.6 Linux kernel, so all recent distributions support it without the need to install a custom kernel. However, it depends on the CPU supporting either the Intel VT or AMD-V virtualization extensions in order to run virtual systems at a reasonable speed.
On some systems, these extensions are disabled in the BIOS by default. Enabling them requires booting the system from the console, entering the BIOS menu and finding the option to turn on virtualization extensions. In some cases the system must then be fully shut down and started up again for this change to take effect.
For KVM instances to access the host system's network, you must setup a network bridge. These instructions assume that your host system has only one network interface, and it is eth0 .
If your host system is running Webmin 1.554 or later, the network bridge can be created using the Webmin UI as follows :
eth0 and change the IPv4 address to No address configured. Remember the current IP address and netmask, as they will be needed in the next step. Click the Save button.eth0.eth0, then click Create.br0 selected as the interface.To setup a Redhat-based system to host KVM instances, the steps to follow are :
yum install kvm qemu qemu-img parted/etc/sysconfig/network-scripts directory, copy ifcfg-eth0 to ifcfg-br0.DEVICE line to DEVICE=br0.HWADDR line, and change the TYPE line to TYPE=Bridgeifcfg-eth0 file, and at the bottom add the line BRIDGE=br0service network restart . This should be done at the console, as it will break network access to the host system if anything goes wrong.yum install libcgroup /etc/init.d/cgconfig start chkconfig cgconfig on
yum install ebtablesNote that the eth0 device will no longer have an IP address; the br0 device has the IP after bridging is operational.
apt-get install kvm qemu parted/etc/network/interfaces file and change it to be like : auto eth0 lo br0 iface lo inet loopback iface eth0 inet manual iface br0 inet static address 192.168.1.1 netmask 255.255.255.0 broadcast 192.168.1.255 network 192.168.1.0 gateway 192.168.1.10 bridge_ports eth0 bridge_fd 9 bridge_hello 2 bridge_maxage 12 bridge_stp off
/etc/init.d/networking restart or by rebooting . This should be done at the console, as it will break network access to the host system if anything goes wrong.apt-get install cgroup-bin /etc/init.d/cgconfig start update-rc.d cgconfig defaults
apt-get install ebtables/kvm . This can be located anywhere on the system though.Cloudmin supports storing Xen and KVM disk images in LVM logical volumes, instead of regular files. This has the speed advantage of avoiding the overhead of going through the filesystem layer on the host system, and can also make adding disk space for virtual systems easier. However, the downside is increased management complexity, as disk images in LVs cannot be easily managed with Linux tools like mv and scp.
For a Xen or KVM host system to use LVM, it must either have been installed with its filesystems on LVM already, or have free disks that can be used to create an LVM volume group. If a volume group already exists, it must have some free space for new logical volumes.
For increased reliability, we recommend running LVM on top of RAID. For example, a system with 4 disks could have them combined into a Linux software RAID 5 group, which is then used as the underlying physical volume for an LVM volume group. If this ever fills up, 4 more disks could be installed as another RAID 5 set and then added to the volume group as other physical volume.
For Cloudmin to make use of LVM on a host system, it must have Webmin installed. The simplest way to do this is to select the host from the left menu, then go to System Operations -> Install Webmin. Once Webmin is installed on the host, you can use its LVM and RAID modules under the Hardware category to setup volume group.
In the simplest case where you have two extra empty disks and want to add them to a new volume group, you could do the following in Webmin on the host system :
Once a volume group has been created, you can configure Cloudmin to use it as follows :
LXC virtualization is included in the 2.6.29 Linux kernel, so many recent distributions support it without the need to install a custom kernel. In particular Debian Squeeze and Ubuntu 10 and later include an LXC-capable kernel and tools.
LXC is a kernel-level virtualization type, in which each virtual system's files are stored under a directory on the host system, typically under /var/lib/lxc . All virtual systems share the same kernel with the host and each other, which reduces per-system overhead.
For LXC containers to access the host system's network, you must setup a network bridge. These instructions assume that your host system has only one network interface, and it is eth0 .
To setup a Fedora 12 or later system to host KVM instances, the steps to follow are :
yum install lxc bridge-utils/etc/sysconfig/network-scripts directory, copy ifcfg-eth0 to ifcfg-br0.DEVICE line to DEVICE=br0.ifcfg-eth0 file, and at the bottom add the line BRIDGE=br0service network restart . This should be done at the console, as it will break network access to the host system if anything goes wrong.apt-get lxc bridge-utils/etc/network/interfaces file and change it to be like : auto eth0 lo br0 iface lo inet loopback iface eth0 inet manual iface br0 inet static address 192.168.1.1 netmask 255.255.255.0 broadcast 192.168.1.255 network 192.168.1.0 gateway 192.168.1.10 bridge_ports eth0 bridge_fd 9 bridge_hello 2 bridge_maxage 12 bridge_stp off
/etc/init.d/networking restart or by rebooting . This should be done at the console, as it will break network access to the host system if anything goes wrong.While many different Linux distributions include packages for Xen, this page focuses on CentOS 5 and Redhat Enterprise 5, which we have found to be well supported and easy to setup. To make full use of Xen, you should be running one of these distributions on a machine with plenty of RAM (2 GB or more), enough disk space for all the filesystems of instances you want to host, and a CPU that supports either Intel's VTI extensions or AMD Pacifica.
This documentation relates to the open source version of Xen only - the commercial variant supported by Citrix is treated separately by Cloudmin, and is covered on the Citrix Xen page.
The Cloudmin GPL install script should install a Xen-capable kernel and all other required packages
on the system it is run on, so none of the steps here are needed. All you need to do is reboot the system
after running the installer, and then verify that the kernel includes Xen support by running uname -r .
Once you have a freshly installed system running CentOS 5, the steps to set it up for Xen hosting are :
root via SSH or at the console.yum install kernel-xen kernel-xen-devel
/boot/grub/menu.lst like : title CentOS (2.6.18-8.1.4.el5xen)
root (hd0,2)
kernel /xen.gz-2.6.18-8.1.4.el5
module /vmlinuz-2.6.18-8.1.4.el5xen ro root=/dev/VolGroup00/LogVol00 rhgb quiet
module /initrd-2.6.18-8.1.4.el5xen.img
/boot/grub/menu.lst and change the default= line to use the newly added Xen kernel, which will typically be the first one in the file (numbered 0).yum install xen parted
cat /dev/null >/etc/libvirt/qemu/networks/default.xml
reboot command. If you are at the console, you should be able to see Xen-related messages during the kernel boot process.xm list
If you see a line starting with Domain-0, then all is good.
/xen directory, which Cloudmin uses by default for Xen system images, with the command mkdir /xen
And that's it! You can now register this system as a Xen host in Cloudmin.
If your RHEL 5 system has the yum command installed and working, you can follow the exact same steps above. If not, use Redhat's up2date command instead :
root via SSH or at the console.up2date -u
up2date kernel-xen kernel-xen-devel
/boot/grub/menu.lst like : title Redhat Enterprise (2.6.18-8.1.4.el5xen)
root (hd0,2)
kernel /xen.gz-2.6.18-8.1.4.el5
module /vmlinuz-2.6.18-8.1.4.el5xen ro root=/dev/VolGroup00/LogVol00 rhgb quiet
module /initrd-2.6.18-8.1.4.el5xen.img
/boot/grub/menu.lst and change the default= line to use the newly added Xen kernel, which will typically be the first one in the file (numbered 0).up2date xen
cat /dev/null >/etc/libvirt/qemu/networks/default.xml
reboot command. If you are at the console, you should be able to see Xen-related messages during the kernel boot process.xm list
If you see a line starting with Domain-0, then all is good.
/xen directory, which Cloudmin uses by default for Xen system images, with the command mkdir /xen
root via SSH or at the console.apt-get update
apt-get install ubuntu-xen-server libc6-xen xen-tools xen-utils-3.2 xen-hypervisor-3.2 parted
/boot/grub/menu.lst and change the default= line to use the newly added Xen kernel, which will typically be the first one in the file (numbered 0).reboot command. If you are at the console, you should be able to see Xen-related messages during the kernel boot process.xm list
If you see a line starting with Domain-0, then all is good.
/xen directory, which Cloudmin uses by default for Xen system images, with the command mkdir /xen
root via SSH or at the console.apt-get update
apt-get install xen-linux-system libc6-xen xen-tools xen-utils-3.2-1 xen-hypervisor-3.2-1-i386 parted
On a 64-bit system, replace the xen-hypervisor-3.2-1-i386 package above with xen-hypervisor-3.2-1-amd64.
/boot/grub/menu.lst and change the default= line to use the newly added Xen kernel, which will typically be the first one in the file (numbered 0).reboot command. If you are at the console, you should be able to see Xen-related messages during the kernel boot process.xm list
If you see a line starting with Domain-0, then all is good.
/xen directory, which Cloudmin uses by default for Xen system images, with the command mkdir /xen
root via SSH or at the console.apt-get update
apt-get install xen-linux-system parted
mv -i /etc/grub.d/10_linux /etc/grub.d/21_linux ; upgrade-grub/etc/xen/xend-config.sxp and un-commenting the line (network-script network-bridge)reboot command. If you are at the console, you should be able to see Xen-related messages during the kernel boot process.xm list
If you see a line starting with Domain-0, then all is good.
/xen directory, which Cloudmin uses by default for Xen system images, with the command mkdir /xen
The simplest Linux distribution to setup OpenVZ hosting support for is CentOS, as a kernel and packages are supplied by the OpenVZ developers at http://wiki.openvz.org/Main_Page . The steps to install the kernel are on a CentOS 5 system are :
cd /etc/yum.repos.d wget "http://download.openvz.org/openvz.repo" rpm --import "http://download.openvz.org/RPM-GPG-Key-OpenVZ"
yum install ovzkernel . Or if you want a kernel that can host both Xen and OpenVZ, use yum install ovzkernel-xen .default= line refers to the new OpenVZ-capable kernel section - typically this will need to be set to default=0# On Hardware Node we generally need # packet forwarding enabled and proxy arp disabled net.ipv4.ip_forward = 1 net.ipv6.conf.default.forwarding = 1 net.ipv6.conf.all.forwarding = 1 net.ipv4.conf.default.proxy_arp = 0 # Enables source route verification net.ipv4.conf.all.rp_filter = 1 # Enables the magic-sysrq key kernel.sysrq = 1 # We do not want all our interfaces to send redirects net.ipv4.conf.default.send_redirects = 1 net.ipv4.conf.all.send_redirects = 0
SELINUX= line to SELINUX=disabledOnce you have the kernel on the host system, other needed utilities can be installed as follows :
yum install vzctl vzquota/etc/init.d/vz startvzlist -a to verify that the tools are working and kernel support is usable.Once this is done, you can add this system as an OpenVZ host in Cloudmin at Host Systems -> OpenVZ Host Systems .
Linux VServers require kernel support in the host system that can only be provided by a kernel patch. Unfortunately this does not appear to be included in any of the kernels available from mainstream distribution vendors. However, a pre-compiled kernel package for Fedora Core 5 is available, and can be installed by following the steps below :
/etc/selinux/config and changing the SELINUX line to : SELINUX=disabled
yum upgrade
/etc/yum.repos.d/fedora-updates.repo and in the updates-released section add the line exclude=kernel kernel-smp yum . The section should end up looking something like : [updates-released] name=Fedora Core $releasever - $basearch - Released Updates #baseurl=http://download.fedora.redhat.com/pub/fedora/linux/core/updates/$releasever/$basearch/ mirrorlist=http://fedora.redhat.com/download/mirrors/updates-released-fc$releasever enabled=1 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora exclude=kernel kernel-smp yum
/etc/yum.repos.d/dhozac.repo containing : [dhozac-vserver] name=Daniel Hokka Zakrisson's packages for Fedora $releasever - $basearch - vserver baseurl=http://rpm.hozac.com/dhozac/fedora/$releasever/vserver/$basearch http://muh.at/dhozac/fedora/$releasever/vserver/$basearch gpgkey=http://rpm.hozac.com/fedora/conf/keys/RPM-DHOZAC-GPG-KEY enabled=1
yum install kernel , or if you are using an SMP system yum install kernel-smp . The reboot with the reboot command./proc/virtual/info exists. It should contain something like VCIVersion: 0002:0001 VCISyscall: 273 VCIKernel: 03000016
yum install util-vserver util-vserver-core util-vserver-lib util-vserver-sysv util-vserver-build
Use URPMI
urpmi kernel-vserver-latest kernel-vserver-source-latest util-vserver util-vserver-build util-vserver-core util-vserver-sysv util-vserver-lib
For other distributions, you will almost certainly need to compile a patched kernel manually. The official VServers website at http://linux-vserver.org/Documentation has more details.
One limitation of VServers network is that a server listening on some port on all interfaces on the host will prevent that port from being used within VServer instances. For example, if Apache is using port 80 on all interfaces (as it does by default), then no systems running within VServers will be able to run Apache!
The suggested solution to this problem is to run only a minimal set of services on the host system, such as SSH and Webmin. All others like Apache, Sendmail, Postfix, BIND and ProFTPd should be shut down or un-installed.
To use Webmin to configure itself and SSH to listen only on the host system's primary interface, follow these steps :
eth0. For the sake of these instructions, let's say it is 192.168.10.10.To use Webmin to shut down other services that may use ports needed by Virtualmin in VServers, do the following :
apache , httpd , sendmail , postfix , named , proftpd , vsftpd , dovecot and mysql .Solaris versions 10 and above on both X86 and Sparc hardware come with support for Zones installed as standard. Therefore, the steps to configure a system as a Zones host for use by Cloudmin are relatively simple :
cd /tmp wget http://www.webmin.com/download/webmin-current.pkg.gz gunzip webmin-current.pkg.gz pkgadd -d webmin-current.pkg WSwebmin
http://yourserver:10000/ as root with your system's root password, to make sure that it is running.mkdir /zones
A Cloudmin system alert monitors one or more managed systems, and checks if variables such as free memory, CPU load or free disk space are above or below some threshold. If so, it can send email to the master administrator, system owners or other addresses.
Alerts can be used to detect overloaded systems, lack of resources, or system crashes. They can be limited to a sub-set of the hosts managed by Cloudmin, either selected explicitly or by group membership, virtualization type or owner. This allows alert thresholds to be tailored based on the systems be monitored.
Alerts can be found under the System Monitoring category on the left menu, on the System Alerts page. They are only available in Cloudmin versions 3.7 and later though.
Before you create a new alert, you need to decide which system variable(s) it is going to monitor, what thresholds it will trigger at, and for how long it must be exceeded. For example, you might want to check if CPU load exceeds 1.0 for 30 minutes, or free memory is under 64M for 1 hour.
To create an alert, follow these steps :
Once the alert is created, it will appear in the list of alerts, with its current status shown in the right-hand column.
When creating an alert rule that matches if a system is down (using the System up variable), the comparison should be set to Under and the value to 1. Cloudmin uses the value 0 to indicate a system is completely down, 0.5 when it is up by not contactable via SSH, and 1 for a fully operational host.
To edit an alert, just click on it in the System Alerts page. All the same settings that you entered when creating it originally can be modified.
To remove one or more alerts, check the boxes next to them on the System Alerts page, and click the Delete Selected Alerts button.
When any rule on any alert matches at least one system, it will be displayed in the Firing alerts section of the System Alerts page - even if not enough systems or rules match to cause the alert to email. You can view the history of the variable that caused it to fire by clicking the Graph link in the right-most column.
To stop an alert from sending email without actually deleting it, check the box next to it on the System Alerts page, and click the Silence Alerts button. Similarly, to remove the silence use the Un-Silence Alerts button. This can be useful when you are creating or debugging a new alert and don't want it sending out spurious email notifications.
A system owner in Cloudmin is an additional account who is granted limited access to some virtual systems. They are typically created for customers of a VPS hosting business, and given permission to manage only their own systems. Owner accounts can also be granted the right to expand, delete and move virtual systems, up to limits defined by a plan.
Cloudmin also supports the creation of new virtual systems by owners, if enabled on their plans. You can define an upper limit on the number of systems each owner can create, and any additional disk, RAM or CPU use will count towards plan limits. A VPS hosting company can then create an owner account for each customer and leave the actual creation and deletion of systems up to the owners.
To create a new system owner account, do the following :
Once an owner has been created, he will appear in the list on the System Owners page. Click on his name to edit him, or check the box next to his username and click Delete Selected Owners to remove him.
Owner accounts can also be temporarily disabled or enabled on the same page, such as for non-payment. To disable, check the boxes next to the names of accounts to turn off and click the Disable Selected Owners button. Use the Enable button to turn the accounts back on. Disabling an owner has no effect on his running virtual systems.
Cloudmin has backup and restore capabilities to save the filesystem contents of virtual systems. System owners can also be allowed to create their own backups, either to a central storage location defined by the master administrator or remote SSH and FTP servers.
To allow owners to create their own backups, do the following :
System owners will now see the backup and restore category on the left menu when they login.
When backing up to the destination defined by the host system, a sub-directory will be created for each owner to avoid over-writing of each others files. Each owner can create his own scheduled backups for his systems, and will be notified via email if they fail. Owners can also find, restore and delete old backups using the Backup Logs page.
Cloudmin keeps track of the uptime, CPU and RAM used by each virtual system over time, and can summarize it for the current accounting period (such as the current week or month). For example, if an owner had two systems with 512MB RAM and 1GB of disk each that were up for 2 and 3 days respectively over the week and used 10% CPU on average, his usage would be :
To see usage for an owner, click on his name in the System Owners list and open the Usage by all owned systems section. This is also available from the list-owners API command. How you use this information is up to you, but it could be used for usage-based billing for VPS hosting customers.
The accounting period is the same as that set for Bandwidth Monitoring, at Cloudmin Settings -> Bandwidth Monitoring.
If the Call remote API action is allowed for a system owner or his plan, the owner will be able to call the Cloudmin API via HTTP to manage his systems. Owners will only be able to perform the same actions on the same systems via the API that they would be able to do via the web interface, so there is no additional security risk to enabling this. In Cloudmin 4.1 and later, it is turned on by default.
For more documentation on the API, see http://www.virtualmin.com/documentation/cloudmin/devel/remote
In a standard install of Cloudmin using our scripts, upgrades are typically done using APT or YUM. When a new version is available, you will see a message on the System Information page after logging in like :
Other packages may be listed too, depending on what is available to be updated. To install, just click the Install All Updates Now button.
Alternately, you can install the same packages from the command line on the master system as root. On CentOS or Redhat Enterprise, the command to use will be like :
yum install wbm-server-manager
On Debian or Ubuntu, you could use :
apt-get install webmin-server-manager
Cloudmin checks the state of all virtual systems every 5 minutes and collects their status (up or down), assigned RAM, CPU limit, CPU load and disk space. Each sample is recorded in an internal database, and can be used to generate usage totals over an accounting period (such as a week or month). This can then be used to charge customers based on the actual resources used by their system or systems.
The accounting period over which usage is display is the same one used for bandwidth monitoring, set at Cloudmin Settings -> Bandwidth Monitoring. The default is the current month, but it can be changed to the current day, week, or any number of days in the past. In the latter case, the period is actually a sliding window of time instead of fixed non-overlapping blocks.
Imagine a virtual system that has 512MB of RAM, 1 GB of disk and a CPU limit of 50%, which has been up for 1 hour a day over the last month, and used an average of 10% CPU during that time. Cloudmin would calculate its resource usage as follows :
Note that disk use is still counted even when the system is down, as the space is still consumed on the host system. For Xen systems Cloudmin considers the disk space assigned and used to be the same, as free space on a disk image cannot be used by other systems. For OpenVZ containers it tracks the disk limit and disk usage separately.
The simplest place to see usage for a virtual system is on the Edit System page, in the Resource usage section. If you need to extract this for billing purposes, you can use the list-systems API call with the multiline parameter, which will include the current accounting period's usage in the output. To select a previous period, use the period-ago parameter following the a number of weeks or months in the past.
To get individual usage samples for a system, use the list-usage API command. For example, you could call this from the command line like so :
# vm2 list-usage --host xencentos.home xencentos.home Start End Up? Memory CPU Load Disk 17/Oct/2009 23:50 18/Oct/2009 00:40 Yes 768 MB 100% 8% 11 GB 18/Oct/2009 00:40 18/Oct/2009 00:45 Yes 768.17 MB 100% 40% 11 GB 18/Oct/2009 00:45 18/Oct/2009 11:00 No - - - - 18/Oct/2009 11:00 18/Oct/2009 11:50 Yes 768 MB 100% 21% 11 GB
It takes start and end parameters to select a specific date range to display samples for. Sample are aggregated by Cloudmin where possible, so a long period of downtime or consistent CPU load will appear as a single row possibly spanning many hours.
Cloudmin combines the usage for all virtual systems each owner manages and computes a total usage for each owner. For example, if an owner had two systems with 512MB RAM and 1GB disk each that were up for 2 and 3 days respectively over the week and used 10% CPU on average, his usage would be :
To see usage for an owner, click on his name in the System Owners list and open the Usage by all owned systems section. This is also available from the list-owners API command. How you use this information is up to you, but it could be used for usage-based billing for VPS hosting customers.
Once Cloudmin is installed, you can login to it by opening a web browser and going to the URL http://mastersystem:10000/ , where mastersystem is the hostname or IP address of the machine on which it is installed. This should bring up a web page with a menu on the left frame, and a display of information about the master system on the right.
The Cloudmin interface is in many ways similar to Virtualmin - managed systems can be selected from a drop-down menu on the left, below which is a list of links for performing various operations on those systems. Below this are menu categories labelled Create System, Add System and Cloudmin Settings. These contain further links for creating new virtual systems, bringing existing virtual or real systems under Cloudmin's control, and editing settings that apply to all managed machines.
At the bottom is the List Managed Systems link, which opens a list of all systems under Cloudmin's control, showing details such as their hostname, current status and virtualization system type. By default, the only registered system will be the machine you are running Cloudmin on.
Every system managed by Cloudmin has a status, which is determined from either an automatic check (done every 5 minutes), or a manual check triggered by the Refresh Status link. The status can be seen on the left menu directly under the hostname. Possible statuses are :
The master system will most likely have the status Webmin but no Virtualmin, unless you are also using it to host domains with Virtualmin.
If you have several running physical systems on your network and want to control them using Cloudmin, they can be added to its list of managed systems as follows :
root password and root logins via SSH are allowed, in the Root login mode section select Using password and enter the password into the adjacent textbox.Once a system has been added, it can be used to host Virtualmin domains, or virtual systems using Xen or VServers if it has the needed software installed.
To view the full details of a managed system, click on the Edit System link below its hostname on the left menu. This will bring up a page showing the software versions it runs, current status and login details. If it runs Virtualmin, hosted domains and more detailed system status will also be shown in collapsed sections. If it is a virtual system that Cloudmin can manage network interfaces on, a section listing interfaces will also be available.
For systems that are currently up, you can use the Reboot System and Shutdown System links on the left menu to reboot or turn them off, respectively. Similarly, a virtual system that is down can be started up using the Startup System link. If a system has been rebooted or changed manually since the last Cloudmin automatic check, you can use the Refresh Status link to have Cloudmin fetch the current status.
If a managed system has Webmin installed and running, you can connect to it using the Open Webmin link on the left menu. This will open a new browser window which will be automatically logged into the system, with all HTTP requests tunnelled through the Cloudmin master. This is a little slower that connecting directly (by opening the URL for Webmin on that system in your browser), but is more convenient and avoids any connectivity issues that may block access to the system.
Managed systems that are up and can be contacted via SSH can have commands executed on them via the Cloudmin interface by clicking on the Run Commands link on the left menu. This will open a page for entering a shell command, which will display the output from that command when it is run. However, only non-interactive programs can be run - you cannot invoke something like vi or yum which expects user input.
To update the root password for SSH or Webmin on a managed system, you can use the Change Password link on the left menu. This will open a form for entering one or both new passwords, which when submitted will update /etc/shadow and /etc/webmin/miniserv.users on the selected machine to make the changes. Cloudmin's authentication information for the system will also be updated to match.
If you have created a virtual system for a customer, changing the root password when you are ready to hand it over is a good idea. Be aware that for Xen systems, if the password is changed on the system directly (perhaps using the passwd command), Cloudmin will be no longer able to login via SSH to change it, or even to check the system's status.
Once you have several systems registered, it becomes convenient to perform operations on more than one at once. This can be done as follows :
Before you can use Cloudmin to create a virtual system with Virtualmin installed, you must have at least once license that can be used for Virtualmin on that system. Fortunately, Cloudmin has a built-in license management and registration tool, which makes it easy to add and use the licenses you have purchased.
To aquire a new Virtualmin license and add it to Cloudmin, follow these steps :
If you need to add many licenses at once, they can be pasted into the text box at the bottom of the Virtualmin Licenses page. Each should be on a separate line, with the serial number and key separated by a space.
Once a license has been registered, it can be used when creating a virtual system from an image with Virtualmin, or when installing Virtualmin on a managed system. This is done in the Virtualmin options section of the creation form, using the License for Virtualmin from image field. Assuming that you have at least one registered license with free systems, you can select the Allocate from license pool option to make use of it.
In some cases, your Cloudmin license may also include the rights to be used on one or more Virtualmin installs. In this case, you can select Same as Cloudmin license on the system creation or Virtualmin installation form.
In a default Cloudmin install, all Xen virtual systems are setup to boot from a kernel file on the host system, typically in the /xen directory and named like vmlinuz-vm2-xenU. However, you may want to use a kernel from within the virtual system instead - this allows different systems to run different kernels, and for the kernel to be upgraded from within the Xen instance.
Xen uses with PyGrub or Pv-Grub to run grub , which in turn reads the /boot/grub/menu.lst file from within the Xen system. The Grub config file contains the path the kernel and other related files, which is then booted when the system is started.
Cloudmin will configure a Xen system to use the newer Pv-Grub bootloader if available, and fall back to PyGrub otherwise. Pv-Grub is recommended as it runs entirely within the virtual system, while PyGrub runs on the host system and thus is considered less secure.
To create a new Xen virtual system that boots from its own kernel, you will first need a system image that contains a kernel and Grub configuration file. The latest CentOS and Debian images provided by Virtualmin include these - if you have already downloaded images for those distributions, make sure you have version 1.7 or later, and if not re-download them.
Once you have an image that includes a kernel, you can create a system that uses it as follows :
If all goes well, you will see a line in the creation output like setup to boot Xen system's kernel with PyGrub .
If you are creating a system from using the API and want to use the virtual system's kernel, add the --xen-pygrub true command line flag, or xen-pygrub=true URL parameter.
If you want Cloudmin to always setup virtual systems to boot from their own kernels without having to select this at creation time, do the following :
This will also effect systems created using the API. You can force the host kernel to be used instead with the --xen-pygrub false command line flag.
iSCSI is a protocol that allows disks to be accessed at the block level over the network. An iSCSI target or server system can share regular files, LVM logical volumes, or disk partitions to multiple clients (also called initiators) on the same network.
iSCSI differs from protocols like NFS and CIFS in that it works at the block level, rather than with files and directories. This means it is more efficient when using for virtual system hosting, as the filesystem overhead is removed.
Almost all Linux systems include software required to act as an iSCSI client or server, although this may be in packages that need to be installed separately. Ideally the client and server should be on the same LAN with a high-speed (gigabit or better) connection between them.
Cloudmin 6.6 and later supports the creation of KVM and Xen virtual systems whose disks are stored on a remote iSCSI server. When the system is created, Cloudmin will create a file or logical volume on the iSCSI server, export it, and then configure the host system to connect to the exported disks. From then on the virtual system behaves exactly like one whose disks are stored in local files, but with the advantage that very little disk space is required on the host system. The VM can also be moved to another host that uses the same iSCSI server without needing to copy and data.
Cloudmin supports multiple iSCSI servers, which can be any physical system that is already under its management. Each host system can select an iSCSI server to use for new virtual systems - typically all hosts would share a single server, but in a large deployment you may choose to have multiple iSCSI servers in different locations.
Before a host system can be used as an iSCSI client (or initiator), you must install the Linux initiator package. The command to do this on a Debian or Ubuntu system is:
apt-get install open-iscsi
Or on a Redhat, Fedora or CentOS system :
yum install iscsi-initiator-utils
The host system must also be running Webmin version 1.610 or later, which includes the iSCSI Client module required by Cloudmin.
Any physical system managed by Cloudmin (including the master) can be used as an iSCSI server, although we recommend a system with large fast disks and good network connectivity due to the IO load involved. Unfortunately there is no single iSCSI server (target) implementation that is used by all Linux distributions. However, Webmin 1.610 and above supports the two most common variants via the iSCSI Target and iSCSI Server modules.
To setup a Debian or Ubuntu system as an iSCSI server, run the command :
apt-get install iscsitarget
After installation, visit the iSCSI Target module in Webmin under the Hardware category to ensure that the server software is detected, and that it is enabled to start at boot time.
For a CentOS or Redhat Enterprise system, run :
yum install netbsd-iscsi
After installation, visit the iSCSI Server module in Webmin under the Hardware category to ensure that the server software is detected, and that it is enabled to start at boot time.
Once the required server software is installed, you can register a system as an iSCSI server in Cloudmin as follows :
Once at last one iSCSI server has been registered, you can configure a host system to use it as follows :
Once a host has been configured as an iSCSI client, any virtual systems created on it from then on will have their disks created on the iSCSI server and exported to the host. The behavior of the system should be identical to one with local disks, assuming that your LAN is fast enough. The only noticeable difference in the Cloudmin UI is the option to connect or disconnect a disk from the iSCSI server, on the Manage Disks page.
Moving or cloning a virtual system to another host is only supported if the new host uses the same iSCSI server as the original. However, moving should take only seconds, especially if Xen live migration is configured.
All Virtualmin virtual servers with database features enabled can have several MySQL and PostgreSQL databases associated with them. These can be created and deleted from the web interface, or using the following programs.
Command Line API - Command line tools for managing Virtualmin.
Remote API - Remote access to the Virtualmin API.
Pre and Post Domain Modification Scripts - Writing your own scripts to be run when a virtual server is changed.
Writing Virtualmin Plugins - Building Webmin modules that interact with Virtualmin.
Creating Install Scripts - Making applications easily installable with the Virtualmin Install Scripts interface.
Creating New Content Styles - Creating new content styles for the Virtualmin website editor, or converting existing templates for use in Virtualmin.
Command Line API - Command line tools for managing Cloudmin.
Remote API - Remote access to the Cloudmin API.
Contributing -- Contributing documentation and patches.
Explains how to use the command-line scripts included with Virtualmin to manage users, aliases, servers, databases and resellers.
Virtualmin comes a script named virtualmin that can be run from the Unix shell to perform actions that are usually done from the web interface. In fact, almost all actions that can be done in a browser can also be done from the command line, or from shell scripts. This allows virtual server, user and alias creation and management to be done in a more automated function, such as from programs or scripts of your own creation.
The first parameter to the virtualmin command is the operation you want to perform, such as create-domain. Depending on the operation, additional parameters may be needed, such as the name of the domain to create, password and so on. In almost all cases the parameters are given like --domain foo.com.
The virtualmin command must be run as root, as it needs access to system configuration files to create users, set up web sites and so on. If you want to create servers, users and aliases programatically as a different user (such as from your own CGI scripts), see the documentation on the Virtualmin Remote API instead.
All of the operations that make changes to the system output messages indicating their success or failure. Their exit status can also be checked to determine success - an exit status of 0 indicates that everything went OK, while a non-zero status indicates some problem.
All operations can be called with the --help command-line parameter to have them output details of the required and allowed parameters. Alternately, you can run virtualmin help to get a list of all available commands, or virtualmin help command to get information on what a particular command does.
API commands are broken down into the following categories :
A Virtualmin script installer is a small program that contains the information needed to install a web application into a virtual server's home directory, and configure it to run with that server's permissions and using its database. Most script installers are for PHP programs like phpMyAdmin, Drupal and SugarCRM, but it is possible to write an installer for Perl, Python or Ruby or Rails applications too.
Virtualmin Pro ships with a large number of built-in installers, which domain owners can add to their websites using the Install Scripts link on the left menu. However, there are many applications that are not covered yet, simply because we don't have time to implement installers for them or they are judged too rarely used or too specific. For this reason, Virtualmin provides an API for adding your own script installers.
Each script installer is a single file containing a set of Perl functions. Those that ship with Virtualmin Pro can be found in the virtual-server/scripts directory under the Webmin root, which is usually /usr/libexec/webmin or /usr/share/webmin . If you open up one of those files (such as phpbb.pl) in a text editor, you will see a series of funtions like :
sub script_phpbb_desc
{
return "phpBB";
}
sub script_phpbb_uses
{
return ( "php" );
}
sub script_phpbb_longdesc
{
return "A high powered, fully scalable, and highly customizable Open Source bulletin board package.";
}
Your own script installers will be in files if a similar format - the major difference will be the script ID, which appears in each function name after the word script_ .
Script installers that are local to your Virtualmin installation are stored in the /etc/webmin/virtual-server/scripts directory. In most cases, each script is just a single .pl file, but it is possible for other source or support files to be part of the script too. In general though, most script installers download the files they need from the website of the application that they are installing.
Every script installer has a unique ID, which must consist of only letters, numbers and the underscore character. The ID determines both the installer filename (which must be scriptid.pl), and the names of functions within the script (which must be like script_scriptid_desc).
The same ID cannot be used by two different installers on the same system, even if one is built-in to Virtualmin and one is custom. For this reason, when writing an installer you should select an ID that is unlikely to clash with any that might be included in Virtualmin in the future. Starting it with the first part of your company's domain name (like foocorp_billingapp) would be a good way to ensure this.
Virtualmin allows multiple instances of a single script to be installed, either on different domains or in different directories of the same domain. The installer defines the steps that must be taken to setup a script in some directory - in object-oriented coding parlance, it is like a class, while installed scripts are objects.
When a script is installed via the web interface, Virtualmin performs the following steps :
In this section, the functions that each script installer must implement will be covered. Not all functions are mandatory - some deal with PHP dependencies that make no sense if your script does not use PHP, or if it has no non-core module or Pear dependencies. The example code for each function is taken from the Wordpress Blog installer, in wordpress.pl. This is a PHP application whose installation process is relatively simple, yet common to many other PHP programs.
In your own script, you would of course replace scriptname with the script ID you have selected.
Also, just like a Perl module -- make sure your Install Script file ends with the line:
1;
This function must return a short name for the script, usually a couple of words at most.
sub script_wordpress_desc
{
return "WordPress";
}
This must return a list of the languages the script uses. Supported language codes are php, perl and ruby. Most scripts will return only one.
sub script_wordpress_uses
{
return ( "php" );
}
Must return a list of versions of the script that the installer supports. Most can only install one, but in some cases you may want to offer the user the ability to install development and stable versions of some application. The version the user chooses will be passed to many other functions as a parameter.
sub script_wordpress_versions
{
return ( "2.2.1" );
}
This function should return a category for the script, which controls how it is categorized in Virtualmin's list of those available to install. At the time of writing, available categories were Blog, Calendar, Commerce, Community, Content Management System, Database, Development, Email, Guestbook, Helpdesk, Horde, Photos, Project Management, Survey, Tracker and Wiki.
sub script_wordpress_category
{
return "Blog";
}
Scripts that use PHP must implement this function, which should return a list of versions the installed application can run under. At the time of writing, Virtualmin only supports PHP versions 4 and 5. On systems that have more than one version of PHP installed, Virtualmin will configure the website to use the correct version for the path the script is installed to.
sub script_wordpress_php_vers
{
return ( 4, 5 );
}
If the application being installed is written in PHP and requires any non-core PHP modules, this function should return them as a list. Any script that talks to a MySQL database will need the mysql module, or pgsql if it uses PostgreSQL. Virtualmin will attempt to install the required modules if they are missing from the system.
sub script_wordpress_php_modules
{
return ("mysql");
}
Pear is a repository of additional modules for PHP, which some Virtualmin scripts make use of. If the application you are installing requires some Pear modules, this function can be implemented to return a list of module names. At installation time, Virtualmin will check for and try to automatically install the needed modules.
sub script_horde_pear_modules
{
return ("Log", "Mail", "Mail_Mime", "DB");
}
For scripts written in Perl that require modules that are not part of the standard Perl distribution, you should implement this function to return a list of additional modules required. Virtualmin will try to automatically install them from YUM, APT or CPAN where possible, and will prevent the script from being installed if they are missing.
sub script_twiki_perl_modules
{
return ( "CGI::Session", "Net::SMTP" );
}
For scripts written in Python that require modules that are not part of the standard distribution, you should implement this function to return a list of additional modules required. Virtualmin will try to automatically install them from YUM or APT where possible, and will prevent the script from being installed if they are missing.
sub script_django_python_modules
{
return ( "setuptools", "MySQLdb" );
}
This function must check for any dependencies the script has before it can be installed, such as a MySQL database or virtual server features. It is given two parameters - the domain hash containing details of the virtual server being installed into, and the version number selected.
sub script_wordpress_depends
{
local ($d, $ver) = @_;
&has_domain_databases($d, [ "mysql" ]) ||
return "WordPress requires a MySQL database" if (!@dbs);
&require_mysql();
if (&mysql::get_mysql_version() < 4) {
return "WordPress requires MySQL version 4 or higher";
}
return undef;
}
As of Virtualmin 3.57, this function can return a list of missing dependency error messages instead of a single string, which is more user-friendly as they are all reported to users at once.
If defined, this function should return a list of database types that the script can use. At least one of these types must be enabled in the virtual server the script is being installed into.
sub script_wordpress_dbs
{
local ($d, $ver) = @_;
return ("mysql");
}
Only Virtualmin 3.57 and above make use of this function.
This function is responsible for generating the installation form inputs, such as the destination directory and target database. When upgrading (indicated by the upgrade hash being non-null) these are fixed and should just be displayed to the user. Otherwise, it must return inputs for selecting them. The functions return value must be HTML for form fields, generated using the ui_table_row and other ui_ functions.
The example below from Wordpress is a good source to copy from, as most PHP scripts that you would want to install will need a target directory and a database. The ui_database_select function can be used to generate a menu of databases in the domain, with an option to have a new one created automatically just for this script.
sub script_wordpress_params
{
local ($d, $ver, $upgrade) = @_;
local $rv;
local $hdir = &public_html_dir($d, 1);
if ($upgrade) {
# Options are fixed when upgrading
local ($dbtype, $dbname) = split(/_/, $upgrade->{'opts'}->{'db'}, 2);
$rv .= &ui_table_row("Database for WordPress tables", $dbname);
local $dir = $upgrade->{'opts'}->{'dir'};
$dir =~ s/^$d->{'home'}\///;
$rv .= &ui_table_row("Install directory", $dir);
}
else {
# Show editable install options
local @dbs = &domain_databases($d, [ "mysql" ]);
$rv .= &ui_table_row("Database for WordPress tables",
&ui_database_select("db", undef, \@dbs, $d, "wordpress"));
$rv .= &ui_table_row("Install sub-directory under <tt>$hdir</tt>",
&ui_opt_textbox("dir", "wordpress", 30,
"At top level"));
}
return $rv;
}
This function takes the inputs from the form generated by script_scriptname_params, parses them an returns an object containing options that will be used when the installation actually happens. If it detects any errors in the input, it should return an error message string instead.
As in the example below, when upgrading the options are almost never changed, so it should return just $upgrade→{'opts'}, which are the options it was originally installed with. Otherwise, it should look at the hash reference in which will contain all CGI form variables, and use that to construct a hash of options. The most important keys in the hash are dir (the installation target directory) and path (the URL path under the domain's root).
sub script_wordpress_parse
{
local ($d, $ver, $in, $upgrade) = @_;
if ($upgrade) {
# Options are always the same
return $upgrade->{'opts'};
}
else {
local $hdir = &public_html_dir($d, 0);
$in{'dir_def'} || $in{'dir'} =~ /\S/ && $in{'dir'} !~ /\.\./ ||
return "Missing or invalid installation directory";
local $dir = $in{'dir_def'} ? $hdir : "$hdir/$in{'dir'}";
local ($newdb) = ($in->{'db'} =~ s/^\*//);
return { 'db' => $in->{'db'},
'newdb' => $newdb,
'multi' => $in->{'multi'},
'dir' => $dir,
'path' => $in{'dir_def'} ? "/" : "/$in{'dir'}", };
}
}
This function must verify the installation options in the opts hash, and return an error message if any are invalid (or undef if they all look OK). Possible problems include a missing or invalid install directory, a clash with an existing install of the same script in the directory, or a clash of tables in the selected database. As the example below shows, the find_database_table function provides a convenient way to search for tables by name or regular expression - for most applications, all tables used will be prefixed by a short code, like wp_ in the case of WordPress.
If you are wondering why these checks are not performed in script_scriptname_parse, the reason is that when a script is installed from the command line, that function is never called. Instead, install options are generated using a different method, and then validated by this function.
sub script_wordpress_check
{
local ($d, $ver, $opts, $upgrade) = @_;
$opts->{'dir'} =~ /^\// || return "Missing or invalid install directory";
$opts->{'db'} || return "Missing database";
if (-r "$opts->{'dir'}/wp-login.php") {
return "WordPress appears to be already installed in the selected directory";
}
local ($dbtype, $dbname) = split(/_/, $opts->{'db'}, 2);
local $clash = &find_database_table($dbtype, $dbname, "wp_.*");
$clash && return "WordPress appears to be already using the selected database (table $clash)";
return undef;
}
This is the function where the script installer indicates to Virtualmin what files need to be downloaded for the installation to go ahead. Most scripts need only one, which contains the source code - but it is possible to request any number, even zero.
The function must return a list of hash references, each of which should contain the following keys :
name A unique name for this file, used later by the script_scriptname_install function.file A short filename for the file, to which it will be saved in /tmp/.webmin after being downloaded.url The URL that it can be downloaded from.nocache Optional, but can be to 1 to force a download even if the URL is cached by Virtualmin.
In most cases, the ver parameter is used in the URL and filename to get the correct source archive. WordPress (shown below) is an exception, as it has only a single download URL which always serves up the latest version.
sub script_wordpress_files
{
local ($d, $ver, $opts, $upgrade) = @_;
local @files = ( { 'name' => "source",
'file' => "latest.tar.gz",
'url' => "http://wordpress.org/latest.zip",
'nocache' => 1 } );
return @files;
}
If your script installer requires any commands to do its job that may not be available on a typical Unix system, this function should return a list of them. In most cases, it just returns the programs needed to un-compress the tar.gz or zip file containing the source.
sub script_wordpress_commands
{
return ("unzip");
}
This function is where the real work of installing a script actually happens. It is responsible for setting up the database, un-compressing the downloaded source, copying it to the correct directory, modifying configuration files to match the domain and database, and returning a URL that can be used to login. If anything goes wrong, it must return an array whose first element is zero, and the second is an error message.
Upon success, it must return an an array containing the following elements :
If given, the username and password parameters should be used to set the initial administrative login for the script. If not, it should default to the domain's login and password.
The code snippets below show each step of the install process, taken from the standard WordPress installer. The first part simply parses the database connection options and creates a new DB for the script, if one was requested :
sub script_wordpress_install
{
local ($d, $version, $opts, $files, $upgrade) = @_;
local ($out, $ex);
if ($opts->{'newdb'} && !$upgrade) {
local $err = &create_script_database($d, $opts->{'db'});
return (0, "Database creation failed : $err") if ($err);
}
local ($dbtype, $dbname) = split(/_/, $opts->{'db'}, 2);
local $dbuser = $dbtype eq "mysql" ? &mysql_user($d) : &postgres_user($d);
local $dbpass = $dbtype eq "mysql" ? &mysql_pass($d) : &postgres_pass($d, 1);
local $dbphptype = $dbtype eq "mysql" ? "mysql" : "psql";
local $dbhost = &get_database_host($dbtype);
local $dberr = &check_script_db_connection($dbtype, $dbname, $dbuser, $dbpass);
return (0, "Database connection failed : $dberr") if ($dberr);
}
The next step is to extract the downloaded source code, and then copy it to the created destination directory. This is done by calling the unzip and cp commands as the Virtualmin domain owner, so that there is no risk of files that he is not supposed to have access to being over-written. The source code temporary file can be found from the files hash reference in the source key, which was defined by the script_scriptname_files function.
Note how the code checks for expected files after extracting and copying the source, to make sure that the commands called actually succeeded.
# Create target dir
if (!-d $opts->{'dir'}) {
$out = &run_as_domain_user($d, "mkdir -p ".quotemeta($opts->{'dir'}));
-d $opts->{'dir'} ||
return (0, "Failed to create directory : <tt>$out</tt>.");
}
# Extract tar file to temp dir
local $temp = &transname();
mkdir($temp, 0755);
chown($d->{'uid'}, $d->{'gid'}, $temp);
$out = &run_as_domain_user($d, "cd ".quotemeta($temp).
" && unzip $files->{'source'}");
local $verdir = "wordpress";
-r "$temp/$verdir/wp-login.php" ||
return (0, "Failed to extract source : <tt>$out</tt>.");
# Move html dir to target
$out = &run_as_domain_user($d, "cp -rp ".quotemeta($temp)."/$verdir/* ".
quotemeta($opts->{'dir'}));
local $cfileorig = "$opts->{'dir'}/wp-config-sample.php";
local $cfile = "$opts->{'dir'}/wp-config.php";
-r $cfileorig || return (0, "Failed to copy source : <tt>$out</tt>.");
Most scripts or applications have a configuration file of some kind that defines where to access the database, what domain they are running under, the URL path, and possibly an initial login and password. The script installers is responsible for creating or modifying this file to use the database connection details supplied by the opts paramater, as shown in the code snippet below.
Be careful when upgrading, as in general the existing configuration file will be valid for the new version. This means that it doesn't need to be re-created, and should be preserved during the upgrade process if necessary.
# Copy and update the config file
if (!-r $cfile) {
&run_as_domain_user($d, "cp ".quotemeta($cfileorig)." ".
quotemeta($cfile));
local $lref = &read_file_lines($cfile);
local $l;
foreach $l (@$lref) {
if ($l =~ /^define\('DB_NAME',/) {
$l = "define('DB_NAME', '$dbname');";
}
if ($l =~ /^define\('DB_USER',/) {
$l = "define('DB_USER', '$dbuser');";
}
if ($l =~ /^define\('DB_HOST',/) {
$l = "define('DB_HOST', '$dbhost');";
}
if ($l =~ /^define\('DB_PASSWORD',/) {
$l = "define('DB_PASSWORD', '$dbpass');";
}
if ($opts->{'multi'}) {
if ($l =~ /^define\('VHOST',/) {
$l = "define('VHOST', '');";
}
if ($l =~ /^\$base\s*=/) {
$l = "\$base = '$opts->{'path'}/';";
}
}
}
&flush_file_lines($cfile);
}
In some cases, a script will come with a file of SQL statements that can be used to create and populate tables in its database. Others like WordPress do this automatically when they are first accessed. If the application you are installing needs SQL to be run as part of its setup process, you can use code like the fragment below, which was taken from the WebCalendar installer :
if (!$upgrade) {
# Run the SQL setup script
if ($dbtype eq "mysql") {
local $sqlfile = "$opts->{'dir'}/tables-mysql.sql";
&require_mysql();
($ex, $out) = &mysql::execute_sql_file($dbname, $sqlfile, $dbuser, $dbpass);
$ex && return (0, "Failed to run database setup script : <tt>$out</tt>.");
}
The final part of the script_scriptname_install function is returning information to Virtualmin about how to access the new script, and where it is installed. In some cases, a script will have two URLs - the one for administration (which should be references in the second element of the returned array), and the one for general use (which should be in the 4th element).
local $url = &script_path_url($d, $opts).
($upgrade ? "wp-admin/upgrade.php" : "wp-admin/install.php");
local $userurl = &script_path_url($d, $opts);
local $rp = $opts->{'dir'};
$rp =~ s/^$d->{'home'}\///;
return (1, "WordPress installation complete. It can be accessed at <a href='$url'>$url</a>.", "Under $rp using $dbphptype database $dbname", $userurl);
}
This function is responsible for cleaning up all files and database tables created by the install code. It is only called when the user deletes a script from a domain, not when upgrading. If most cases, determining which tables to remove is simple, as they all start with some prefix (like wp_ in the case of WordPress). But if a script has created a tables that cannot be automatically identified, your installer will need to have this list hard-coded. See the oscommerce.pl installer for an example.
If the installer has created any cron jobs, server processes, custom Apache configuration entries or email aliases, they must also be removed by this function. On success, it should return a two-element array whose first element is 1, and the second a message to display to the user. On failure, it should return 0 and an error message explaining what went wrong.
sub script_wordpress_uninstall
{
local ($d, $version, $opts) = @_;
# Remove the contents of the target directory
local $derr = &delete_script_install_directory($d, $opts);
return (0, $derr) if ($derr);
# Remove all wp_ tables from the database
local ($dbtype, $dbname) = split(/_/, $opts->{'db'}, 2);
if ($dbtype eq "mysql") {
# Delete from MySQL
&require_mysql();
foreach $t (&mysql::list_tables($dbname)) {
if ($t =~ /^wp_/) {
&mysql::execute_sql_logged($dbname,
"drop table ".&mysql::quotestr($t));
}
}
}
else {
# Delete from PostgreSQL
&require_postgres();
foreach $t (&postgresql::list_tables($dbname)) {
if ($t =~ /^wp_/) {
&postgresql::execute_sql_logged($dbname,
"drop table $t");
}
}
}
# Take out the DB
if ($opts->{'newdb'}) {
&delete_script_database($d, $opts->{'db'});
}
return (1, "WordPress directory and tables deleted.");
}
Most scripts that setup an initial login and password use those from the virtual server the script is being added to. However, Virtualmin can prompt the user for alternative authentication details if you implement this function. All it has to do is return one of the following numeric codes :
The custom login and password entered by the user will be passed to the script_scriptname_install function. If your script installer doesn't setup an initial login at all, you can either omit this function or have it return 0.
sub script_wordpress_passmode
{
return 1;
}
The style of installation code above will work for most scripts that you want to install, but in some cases a slightly different approach is needed. This section covers two of them - scripts with their own configuration generators that cannot be easily replaced by creating the config file yourself, and installers for Ruby On Rails apps, which use a separate server process.
Many PHP applications come with a script that asks the user a series of questions, like the database login and name, domain name, and initial administration username and password. The script then uses this information to create a config file and perhaps populated the database.
Ideally, Virtualmin script installers should create any needed config files directly - but in some cases this is too difficult due to their complexity. Similarly, it may not be possible to create and populate all the needed database tables if no SQL file is provided for doing this. In cases like this, it is simpler for a script installer to invoke the application's install code directly, by making an HTTP request to the correct URL.
To figure out the installation URL and the CGI parameters it needs, you will need to install the application manually and run through its install process in a browser. The View source feature can then be used to find the names and meanings of all form fields, which can then be used to construct code to call the script the form would submit to.
The following code fragment from the script_phpbb_install function of the phpbb.pl installer gives an example of this :
# Make config.php writable
&make_file_php_writable($d, $cfile);
# Trigger the installation PHP script
local @params = (
[ "lang", "english" ],
[ "dbms", $dbtype eq "mysql" ? "mysql4" : "postgres" ],
[ "upgrade", 0 ],
[ "dbhost", $dbhost ],
[ "dbname", $dbname ],
[ "dbuser", $dbuser ],
[ "dbpasswd", $dbpass ],
[ "prefix", "phpbb_" ],
[ "board_email", $d->{'emailto'} ],
[ "server_name", "www.".$d->{'dom'} ],
[ "server_port", $d->{'web_port'} ],
[ "script_path", $opts->{'path'}."/" ],
[ "admin_name", $d->{'user'} ],
[ "admin_pass1", $d->{'pass'} ],
[ "admin_pass2", $d->{'pass'} ],
[ "install_step", 1 ],
[ "current_lang", "english" ],
);
local $params = join("&", map { $_->[0]."=".&urlize($_->[1]) } @params);
local $ipage = $opts->{'path'}."/install/install.php";
# Make an HTTP post to the installer page
local ($iout, $ierror);
&post_http_connection("www.$d->{'dom'}", $d->{'web_port'},
$ipage, $params, \$iout, \$ierror);
if ($ierror) {
return (0, "phpBB post-install configuration failed : $ierror");
}
elsif ($iout !~ /Finish Installation/i) {
return (0, "phpBB post-install configuration failed");
}
As you can see, it makes use of the post_http_connection function provided by Virtualmin which makes an HTTP POST request, which is expected by most applications. If the form is submitted using a GET, you could use Webmin's http_download function instead.
In some cases, the installation process is a multi-step wizard, which means that you will need to make several POST requests with different parameters, and possibly parse the output from each. In the worst case, the application may set cookies to track the progress of the wizard - see the SugarCRM installer in sugarcrm.pl for an example of this.
Most Rails applications installed by Virtualmin are actually run by a separate server process, typically a Mongrel webserver. To link them up to the domain's actual website, Apache proxy directives are added that pass all requests to a path like /typo to a local webserver at a URL like http://localhost:3001/typo. Starting and maintaining this server process and configuring Apache to use it requires a fair bit of work, but fortunately Virtualmin Pro version 3.44 and above include functions that make it easier.
Some Ruby applications are available from the Ruby Gems package installation service, while others must be downloaded and extracted like PHP applications. For example, typo.pl does installation entirely from a Gem, and so has a script_typo_files function that returns nothing. It then makes use of the install_ruby_gem function to Install gems for Mongrel and Typo itself.
The code fragment below is the first part of the script_typo_install function. As you can see, it checks for the gem command, and then calls functions to install those Gems that it needs.
sub script_typo_install
{
local ($d, $version, $opts, $files, $upgrade) = @_;
local ($out, $ex);
# Check for the gem command (here instead of earlier, as it may have been
# automatically installed).
&has_command("gem") || return (0, "The Ruby gem command is not installed");
# Create target dir
if (!-d $opts->{'dir'}) {
$out = &run_as_domain_user($d, "mkdir -p ".quotemeta($opts->{'dir'}));
-d $opts->{'dir'} ||
return (0, "Failed to create directory : <tt>$out</tt>.");
}
# Install mongrel first
local $err = &install_ruby_gem("mongrel");
if ($err) {
return (0, "Mongrel GEM install failed : <pre>$err</pre>");
}
# Install typo itself
local $err = &install_ruby_gem("typo");
if ($err) {
return (0, "Typo GEM install failed : <pre>$err</pre>");
}
if (!&has_command("typo")) {
return (0, "Install appear to succeed, but the <tt>typo</tt> command ".
"could not be found");
}
Just installing the Gem is not enough - the code for Typo needs to be somehow copied into the virtual server's directory. Fortunately, Typo provides a command to do this, shown in the code below. Other Ruby applications are distributed in tar.gz files, and need to be extracted and copied into place.
$out = &run_as_domain_user($d, "cd ".quotemeta($opts->{'dir'})." && ".
"typo install .");
if ($?) {
return (0, "Typo setup failed : <pre>$out</pre>");
}
Because Rails applications use a separate server process, your installer must find a free port for it to run on, and then start it. Virtualmin provides the allocate_mongrel_port function to do the former, and the mongrel_rails_start_cmd function to build a command for the latter. Some Rails applications (like Typo) provide their own server startup scripts, so check the documentation to see which commands they recommend.
$out = &run_as_domain_user($d, "cd ".quotemeta($opts->{'dir'})." && ".
"typo start .");
if ($?) {
return (0, "Failed to start Typo server : <pre>$out</pre>");
}
All Rails applications will need an Apache proxy configuration to direct requests from the Apache webserver to their Mongrel server. Virtualmin provides a simple function to set this up, shown in the code below. Be aware that many Rails apps don't like being run in a sub-directory, and most don't automatically support it. Your installer may need to modify configuration files and perhaps even application code to support this.
&setup_mongrel_proxy($d, $opts->{'path'}, $opts->{'port'},
$opts->{'path'} eq '/' ? undef : $opts->{'path'});
The server process that runs the Rails application must be running all the time - but what happens if the system gets rebooted? To handle this, Virtualmin makes it easy to create either an @reboot crontab entry or /etc/init.d script to start the server, as shown in the following code. The init script will only be added if the domain has the new Bootup Actions plugin installed and made available.
if (!$upgrade) {
# Configure server to start at boot
local $typo = &has_command("typo");
local $startcmd = "cd ".quotemeta($opts->{'dir'})."; ".
"$typo start . 2>&1 </dev/null";
local $stopcmd = "kill `cat ".quotemeta($pidfile)."`";
&setup_mongrel_startup($d, $startcmd, $stopcmd, $opts,
1, "typo-".$opts->{'port'}, "Typo Blog Engine");
}
Just as special code is required to install Rails applications, your script must also implement the script_scriptname_uninstall function to clean up all server processes, boot scripts and Apache config entries. This is made easier by several convenience functions provided by Virtualmin, the use of which is show in the code below:
sub script_typo_uninstall
{
local ($d, $version, $opts) = @_;
# Shut down the server process
local $pidfile = "$opts->{'dir'}/tmp/pid.txt";
local $pid = &check_pid_file($pidfile);
if ($pid) {
kill('KILL', $pid);
}
# Remove bootup script
&delete_mongrel_startup($d, $opts, "typo start .");
# Remove the contents of the target directory
local $derr = &delete_script_install_directory($d, $opts);
return (0, $derr) if ($derr);
# Remove proxy Apache config entry for /typo
&delete_mongrel_proxy($d, $opts->{'path'});
®ister_post_action(\&restart_apache);
return (1, "Typo directory deleted.");
}
When Virtualmin deletes a domain, it does not call the uninstall functions for any installed scripts, as this would generally be a waste of time - their directories and databases are going to be removed anyway. In the case of Rails applications, this is not true - their installers start server processes and create boot scripts that must be cleaned up.
To ensure that this happens, your script installer must implement the script_scriptname_stop function, which only has to shut down any server processes and prevent them from being run at boot time. This function is only called at virtual server deletion time, and is optional for installers that don't require it.
sub script_typo_stop
{
local ($d, $sinfo) = @_;
local $pidfile = "$sinfo->{'opts'}->{'dir'}/tmp/pid.txt";
local $pid = &check_pid_file($pidfile);
if ($pid) {
kill('KILL', $pid);
}
&delete_mongrel_startup($d, $sinfo->{'opts'}, "typo start .");
}
Virtualmin Professional includes a fast website creator that allows users to build websites from templates with just a couple of clicks. Once built, the end user can edit the resulting website using a built-in WYSIWYG editor (or using other tools).
Virtualmin includes a few styles that are royalty free and usable for any purpose, commercial or otherwise. Adding new styles is easy, and we encourage web designers to create their own templates for sale - making an existing template into a Virtualmin Content Style is a very simple process.
The content styles included with Virtualmin are located in the virtual-server/styles directory under the Webmin root. This may be /usr/libexec/webmin/virtual-server/styles (RHEL/CentOS/Fedora/SuSE/Mandriva) or /usr/share/webmin/virtual-server (Debian/Ubuntu). Styles you create yourself should go in /etc/webmin/virtual-server/styles - you may need to create that directory if it doesn't exist yet. Each style should have its own directory, named similarly to the name of the style. Style names should be unique. Including a STYLE-LICENCE.txt file is optional, but recommended if your style is not freely re-distributable.
Here is an example directory and file tree for a simple but complete style with three pages (index.html, sales.html, contact.html):
newstyle/ newstyle/css newstyle/css/style.css newstyle/index.html newstyle/sales.html newstyle/STYLE-LICENCE.txt newstyle/template.html newstyle/thumb.png newstyle/images newstyle/images/footer.jpg newstyle/images/header.jpg newstyle/contact.html newstyle/style.info
Create the sub-directories under styles, each of which contains the template HTML and image files for your own style. The only other special file that needs to go in a style directory is style.info, which should contain lines like:
desc=My Custom Theme name=newstyle
The desc= line specifies the description of the style as it appears in Virtualmin, while the name= line defines the directory it will be stored in under /etc/webmin/virtual-server/themes when installed on another system. No two styles should have the same name.
The other bit you'll want to create is a thumbnail image of the style. The format of this is PNG at 500x375 pixels. Call this file thumb.png. If you will be contributing your style for inclusion in Virtualmin Professional, you'll also want to include an HTML file called template.html which is a version of your index.html with suitable example content included instead of the variables mentioned below.
Within the .html files you can use variables ${CONTENT}, ${OWNER}, ${DOM} to tell Virtualmin where to put the user data (which can all be edited later in the WYSIWYG editor).
Just like all other types of packages for Virtualmin, Webmin and Usermin, Content Styles can be bundled into tarballs, optionally gzipped. They can also be zipped, if you're more comfortable with zip format files.
To create a Content Style package, at the directory styles within the Virtualmin virtual-server directory, execute a command like the following:
cd /etc/webmin/virtual-server/styles/newstyle tar czvf /tmp/newstyle.tar.gz .
This can then be easily installed using the System Settings → Content Styles page in Virtualmin. If you have the rights necessary to distribute the work (e.g. if you created the style, or if it is based on a Creative Commons licensed redistributable template), feel free to post a link in the forums so others can enjoy it. We also encourage commercial template developers to get involved. If you've already got a stable of templates, converting them for us in Virtualmin is simple, and could provide an additional source of revenue for your existing work. Let us know if you've built commercial Virtualmin Content Styles, and we'll provide a free link to your website.
Virtualmin provides a method for you to have your own scripts (typically shell scripts, but Perl and Python also work) run before or after a virtual server is created, modified or deleted.
This can be useful if you want to have some setup performed for each new domain that is beyond Virtualmin's built-in capabilities. They can also be used to validate changes made by a user before they happen, such as creation of a domain with settings that are inappropriate for your system.
Virtualmin lets you specify a script to be run before any action is performed, and a separate script to be run after. If the pre-change script fails (by returning a non-zero exit status), whatever action was going to happen will be blocked.
Let's imagine you wanted each new virtual server to have a file it is home directory downloaded from some website. A post-creation script to implement this would look like :
#!/bin/sh if [ "$VIRTUALSERVER_ACTION" = "CREATE_DOMAIN" ]; then cd $VIRTUALSERVER_HOME wget -O somefile.tar.gz "http://yourdomain.com/somefile.tar.gz" chown $VIRTUALSERVER_USER:$VIRTUALSERVER_GROUP somefile.tar.gz fi
If you had some external database that you wanted each new domain user to have an account in, you could automate this with a script like :
#!/bin/sh
if [ "$VIRTUALSERVER_PARENT" = "" ]; then
if [ "$VIRTUALSERVER_ACTION" = "CREATE_DOMAIN" ]; then
/usr/bin/add-to-database.pl $VIRTUALSERVER_USER $VIRTUALSERVER_PASS
fi
if [ "$VIRTUALSERVER_ACTION" = "DELETE_DOMAIN" ]; then
/usr/bin/remove-from-database.pl $VIRTUALSERVER_USER
fi
fiOnce you have written a script, you can tell Virtualmin which scripts to run before or after some action is performed as follows :
root and go to System Settings -> Virtualmin Configuration.Make sure the script(s) are executable, or else Virtualmin will not be able to run them.
Every attribute of a virtual server is available via environment variables, all of which start with the $VIRTUALSERVER_ prefix. These are the same variables that can be used in email and other templates, as documented on the Template Variable Listing page. However, all script variables have $VIRTUALSERVER_ at the start, like $VIRTUALSERVER_DOM or $VIRTUALSERVER_PASS.
The action being performed can be determined by looking at the $VIRTUALSERVER_ACTION environment variable, which will be set to one of :
CREATE_DOMAIN A new virtual server is being created MODIFY_DOMAIN Some attribute of a virtual server is being changed DELETE_DOMAIN A virtual server has been deleted DISABLE_DOMAIN The virtual server is being temporarily disabled ENABLE_DOMAIN The virtual server is being re-enabled DBNAME_DOMAIN The database login for a virtual server is being changed DBPASS_DOMAIN The database password for a virtual server is being changed RESTORE_DOMAIN A virtual server is being restored from a backup
Explains how to manage Virtualmin servers, users, databases and other features remotely from other programs.
Even though a command-line API exists for managing Virtualmin objects such as servers, users and databases, this may not be appropriate or usable in all circumstances. Because the commands need to be run as root, they cannot be called from PHP or CGI scripts invoked by a web server, which typically run as a less-privileged Apache user. Also, they must be run on the server running Virtualmin, which makes them difficult to call from another system.
For this reason, an alternate method exists for running these programs via HTTP requests. A special URL in the Virtualmin web interface exists to be called by other programs, and to then pass its parameters on to one of the command-line scripts. This URL can be requested from any system, and by processes running as any Unix user.
Before reading this documentation, you should be familiar with the Virtualmin Command Line Programs documentation, even if you never use those commands directly.
All remote calls must be made through the CGI /virtual-server/remote.cgi . The full URL for this will be https://yourserver:10000/virtual-server/remote.cgi , where 'yourserver' is the full hostname or IP address of the system running Virtualmin.
This URL must be provided with at least one parameter named 'program', whose value must be the name of the command-line program to invoke, without the .pl extension. So a possible URL to request would be :
https://yourserver:10000/virtual-server/remote.cgi?program=list-domains
Because most command-line programs require additional parameters, these must be included in the URL. Every CGI parameter is converted to a command-line parameter, with the value of the parameter appended if given. For example, to create a mail alias, you could invoke the URL :
To specify a parameter that does not have anything after it, just add a CGI parameter with no value. For example, to list databases in detailed form, you could call :
https://yourserver:10000/virtual-server/remote.cgi?program=list-databases&domain=foo.com&multiline=
Both GET and POST format HTTP requests can be used. If your Virtualmin server is not running in SSL mode, use http:// instead of https:// in the URL.
The page returned by the remote.cgi URL will always be plain text, and will contain the output produced by the command-line program. One additional line will be appended though - the words 'Exit status:' followed by the numeric Unix exit status of the command. A status of 0 means that the program was successful, while a non-zero status indicates some error. The cause of the error can be determined from the command's output.
If you would prefer JSON format output, add the json=1 parameter to the remote API call. Alternately, you can select XML format with the xml=1 parameter. Finally, Perl format can be selected with the perl=1 parameter. Make sure you also add the multiline= parameter to any list-* API calls, or else conversion to JSON or XML will not happen.
Because the remote API is part of the Virtualmin web interface, it is password-protected using the same authentication system as you would normally use to login via a web browser. Only the master administrator can access the remote API though, as it can be used to perform almost any action in Virtualmin, and thus would be unsafe for server owners or resellers to use.
When calling the remote API from your own programs, the HTTP request must have the necessary HTTP authentication headers. All HTTP libraries and programs have options to set the username and password - for example, the wget command uses --http-user and --http-passwd , so you could fetch a list of domains from a remote Virtualmin server with a command like :
wget--http-user=root --http-passwd=smeg 'https://yourserver:10000/virtual-server/remote.cgi?program=list-domains'
PHP Example
<?php $result = shell_exec("wget -O - --quiet --http-user=root --http-passwd=pass --no-check-certificate 'https://localhost:10000/virtual-server/remote.cgi?program=list-domains'"); echo $result; ?>
Perl Example
#!/usr/bin/perl -w $result = `wget -O - --quiet --http-user=root --http-passwd=pass --no-check-certificate 'https://localhost:10000/virtual-server/remote.cgi?program=list-domains'`; print "$result\n";
Perl LWP Example
#!/usr/bin/perl -w
use strict;
use LWP;
my $browser = LWP::UserAgent->new( );
$browser->credentials("localhost:10000", "Webmin Server", "root" => "pass");
my $result = $browser->get( "https://localhost:10000/virtual-server/remote.cgi?program=list-domains" );
print $result->content;
Before starting on a plugin, we suggest that you first read the Webmin module developers guide at http://doxfer.com/Webmin/ModuleDevelopment .
A Virtualmin plugin is simply a Webmin module that can provide additional features to Virtualmin virtual servers or users. To do this, it must contain a Perl script called virtual_feature.pl which defines certain functions. The plugin module can then be registered by Virtualmin, and the feature it offers will then be available when creating new virtual domains.
A plugin typically adds a new possible to virtual servers, in addition to the standard features built into Virtualmin (website, DNS domain and so on). For example, it may enable reporting using some new statistics generator, or activate some game server in the virtual domain. Virtualmin will add options to the Create Server and Edit Server pages for enabling the plugin's feature, and call functions in its virtual_feature.pl when the feature is activated, de-activated or changed.
The steps to start writing your own plugin are similar to those for creating a new Webmin module :
/usr/libexec/webmin on Redhat-derived systems, /usr/share/webmin on Debian and Ubuntu, or /opt/webmin on Solaris.virtualmin- - so for the purposes of this documentation, we will assume that yours is going to be called virtualmin-yourname .help and lang sub-directories.module.info. This should contain lines like :desc=A description of your plugin version=1.0 hidden=1
Naturally, the desc= line should be changed to something more meaningful. If you want the plugin to appear in Webmin's menu of modules, remove the hidden=1 line. This is not typically the case, as most plugins are accessed entirely via Virtualmin.
virtualmin-yourname-lib.pl. Initially, it can contain the following code :
use WebminCore;
&init_config();
&foreign_require("virtual-server", "virtual-server-lib.pl");
1;
virtual_feature.pl, containing the following initial code :
do 'virtualmin-yourname-lib.pl';
sub feature_name
{
return "A description of your plugin";
}
/etc/webmin/module.infos.cache to clear Webmin's cache of installed modules.With this done, you can now start work on expanding the capabilities of the plugin by implementing the API documented below.
Since a plugin is just a Webmin module, the usual process for packaging it still applies. The commands to do this are :
cd /usr/libexec/webmin tar cvzf /tmp/virtualmin-yourname.wbm.gz virtualmin-yourname
As you can see, a module or plugin is just a tar file of the directory. These can then be installed using the Webmin Configuration module, on the Webmin Modules page.
If you prefer to package your plugin as an RPM, this can be done using the makemodulerpm.pl script, available from http://www.webmin.com/makemodulerpm.pl . It must be run as root as shown below :
cd /usr/libexec/webmin /usr/local/bin/makemodulerpm.pl --target-dir /tmp virtualmin-yourname
This will create a file named wbm-virtualmin-yourname-1.0-1.noarch.rpm in the /tmp directory.
A similar script exists for Debian and Ubuntu systems, available from http://www.webmin.com/makemoduledeb.pl .
Because a plugin is just a Webmin module, it can contain .cgi scripts like any other module. These can be useful for displaying additional information about the feature that the plugin manages, or for managing objects within that feature (such as mailing lists or user accounts). Most plugins will not need to include any CGI scripts, as their functionality is provided entirely by implementing the API functions described below.
You can see some examples of this by looking at the Mailman and Oracle plugins. The former includes several CGIs for managing mailing lists in a domain, while the Oracle plugin has CGIs for creating and viewing tables within databases created by Virtualmin.
The meat of a plugin is it's implementation of an API that is called by Virtualmin when performing tasks like enabling or disabling the plugin's feature for a domain. These must all be defined in the file virtual_feature.pl under the plugin's directory. Most are optional, depending on which functionality your plugin is implementing.
For each function the name, supplied parameters, description and an example implementation are shown.
Many functions are passed a domain object as a parameter. This is simply a hash reference that is used internally by Virtualmin to store information about a virtual server. Some of the useful keys in the hash are :
dom - the domain name, like foo.comuser - the administration username for the domainhome - the server's home directoryip - the server's IP address (which may be virtual or shared)
In addition, for each feature the domain has enabled, the code for that feature will be set to 1 in the hash. For example, a domain with a website has web set to 1, for email the code is mail, and for a Webmin login the code is webmin. Virtualmin will add an entry for your plugin when its feature is enabled for the domain, the code for which will be the same as the plugin's directory.
Functions in this section must be implemented by all plugins.
This must return a short name for the feature, like My plugin.
sub feature_name
{
return "My plugin name";
}
The most common use for plugins is to add a new feature that can be selected when a virtual server is created or modified. The functions listed in this section should be implemented in this case, although not all are mandatory.
This must return a longer name for the feature, for display in the server creation and editing pages. The edit-form parameter can be used to determine which page is calling the function.
sub feature_label
{
return "Enable my plugin";
}
This optional function will be called when the plugin is registered by Virtualmin, to check that all of its dependencies are met. It must return undef if everything is OK, or an error message if some program or service that the plugin depends upon is missing. If not implemented, Virtualmin will assume that the plugin has no dependencies.
sub feature_check
{
if (! &has_command("someprogram")) {
return "The commmand someprogram required by this plugin is not installed";
}
else {
return undef;
}
}
This should return text to be displayed when this feature is being removed from a domain. The domain parameter is the Virtualmin domain hash reference for the server the feature is being removed from.
sub feature_losing
{
return "My plugin for this virtual server will be disabled";
}
This optional function should return a description of what will be done when this feature is temporarily disabled. It is only needed if your plugin implements the feature_disable function, indicating that it can be disabled.
sub feature_disname
{
return "My plugin will be temporarily de-activated";
}
If activating this plugin feature in the given domain would clash with something already on the system, this function must return an error message. Otherwise, it can just return undef.
sub feature_clash
{
my ($d) = @_;
if (-r "/etc/someprogram/$d->{'dom'}") {
return "Some program is already enabled for this domain";
}
else {
return undef;
}
}
If implemented, this function should check if the given domain object has all the features enabled that would be required by this plugin. For example, if your plugin implements something that is accessible via the web, the domain must have the web feature set. If a dependency is missing it must return an error message explaining this, or undef if everything is OK.
sub feature_depends
{
my ($d) = @_;
if ($d->{'web'}) {
return undef;
}
else {
return "My plugin requires a website";
}
}
This function should check the given parent domain, alias target domain and super-domain objects, to ensure that they are suitable for this feature. It can be useful for preventing the plugin from being enabled in sub-domains or alias domains, where it may not be appropriate. It must return 1 if the feature can be used, or 0 if not. If not implemented, Virtualmin will not allow use of your plugin.
sub feature_suitable
{
my ($parent, $alias, $super) = @_;
if ($parent && !$parent->{'web'}) {
return 0;
}
else {
return 1;
}
}
This function will be called when the plugin feature is being enabled for some server, either at creation time or when the server is subsequently modified. It must perform whatever actions are needed, such as modifying config files, running commands and so on. It should notify the user of the features activation by calling the functions &$virtual_server::first_print and &$virtual_server::second_print, like so :
sub feature_setup
{
my ($d) = @_;
&$virtual_server::first_print("Setting up My plugin..");
my $ex = system("somecommand --add $d->{'dom'} >/dev/null 2>&1");
if ($ex) {
&$virtual_server::second_print(".. failed!");
return 1;
}
else {
&$virtual_server::second_print(".. done");
return 1;
}
}
This function is called when the feature is removed for some server, either at deletion time or when the server is modified. It must perform whatever config file changes or run whatever commands are needed to turn the feature off, and should use the &$virtual_server::first_print and &$virtual_server::second_print functions to notify the user about what it is doing.
sub feature_delete
{
my ($d) = @_;
&$virtual_server::first_print("Turning off up My plugin..");
system("somecommand --remove $d->{'dom'} >/dev/null 2>&1");
&$virtual_server::second_print(".. done");
}
Whenever a virtual server is modified, this function will be called in all plugins. It should check if some attribute of the server that the plugin uses has changed (like dom or user), and update the appropriate config files. For example, if your feature configures some program that needs to know the virtual server's domain name, this function must compare $domain→{'dom'} and $olddomain→{'dom'} , and if they differ perform whatever updates are needed. It should only produce output when it actually does something though.
sub feature_modify
{
my ($d, $oldd) = @_;
if ($d->{'dom'} ne $oldd->{'dom'}) {
&$virtual_server::first_print("Changing domain for My plugin ..");
rename("/etc/someprogram/$oldd->{'dom'}", "/etc/someprogram/$d->{'dom'}");
&$virtual_server::second_print(".. done");
}
}
If this function is defined, it will be called when a virtual server with the plugin feature active is disabled. It should temporarily turn off access to the feature in a non-destructive way, so that it can be fixed later by a call to feature_enable.
sub feature_disable
{
my ($d) = @_;
&$virtual_server::first_print("Temporariliy disabling My plugin ..");
rename("/etc/someprogram/$d->{'dom'}", "/etc/someprogram/$d->{'dom'}.disabled");
&$virtual_server::second_print(".. done");
}
This function will be called when a virtual server with the plugin's feature is re-enabled. It should undo whatever changes were made by the feature_disable function. It only needs to be implemented if feature_disable is.
sub feature_enable
{
my ($d) = @_;
&$virtual_server::first_print("Re-enabling My plugin ..");
rename("/etc/someprogram/$d->{'dom'}.disabled", "/etc/someprogram/$d->{'dom'}");
&$virtual_server::second_print(".. done");
}
If defined, this function should report to Virtualmin the amount of bandwidth used by some virtual server since the given start Unix time. Bandwidth is the total number of bytes uploaded and downloaded, broken down by day. This function should scan whatever log file is available for the feature, extract upload and download counts for the domain, and add to the values in the bwhash hash reference.
Because bandwidth is accumulated by day, the bwhash hash is index by the number of days since 1st Jan 1970 GMT, which is simply a Unix time divided by 86400.
If you want your plugin to provide access to a Webmin module to the owners of virtual servers that have its feature enabled, this function can be used tell Virtualmin which modules access should be granted to. Typically, a plugin will grant access to its own module, which will have standard CGI scripts for use in further configuring whatever service the plugin enables.
This function must return a list of array references, each of which has two values :
$module_name)The domain parameter is the virtual server object that this feature is enabled in, and other-domains is an array reference of other virtual servers that are owned by the same user as domain, and which have the plugin's feature enabled. This latter parameter should be taken into account in order to grant access to configure all of the user's servers.
sub feature_webmin
{
local ($d, $all) = @_;
my @fdoms = grep { $_->{$module_name} } @$all;
if (@fdoms) {
return ( [ $module_name, { 'doms' => join(" ", @fdoms) } ] );
}
else {
return ( );
}
}
This function is called when an existing virtual server is being imported into Virtualmin. It should return 1 if the service configured by the plugin is already active for the given domain, perhaps because it was set up manually.
sub feature_import
{
my ($dname, $user, $db) = @_;
if (-r "/etc/someprogram/$dname") {
return 1;
}
else {
return 0;
}
}
This optional function allows the plugin to provide additional links on the left menu of framed Virtualmin themes when a domain with the feature enabled is selected. It must return a list of hash references, each containing the following keys :
mod - The module the link is to, typically $module_name .desc - The text of the link.page - The CGI within the module that the link is to.cat - The left-side menu category that this link should appear under, such as services or logs.
A link to a module that the current Webmin user does not have access to will not be displayed. This means that you should almost always define feature_webmin as well, and make sure it returns the plugin's module.
sub feature_links
{
local ($d) = @_;
return ( { 'mod' => $module_name,
'desc' => "Manage My plugin",
'page' => 'index.cgi?dom='.$d->{'dom'},
'cat' => 'services',
} );
}
This function is similar to feature_links, but is called regardless of which domain is selected. It can be used when you have a page that can be used even for virtual servers that don't have the plugin's feature active.
This function is optional, and is used by Virtualmin domain validation page. If implemented, it should check to ensure that all configuration files and other settings specific to the domain are setup properly. If any problems are found it should return an error message string, otherwise undef.
sub feature_validate
{
my ($d) = @_;
if (!-r "/etc/someprogram/$d->{'dom'}") {
return "Missing someprogram configuration file";
}
else {
return undef;
}
}
This optional function should be implemented by plugins that add and manage email aliases to a domain - for example, one that deals with mailing lists or autoresponders. Because you don't generally want these aliases showing up in the general list of those in the domain, it should return a list of full addresses to hide from the list.
sub virtusers_ignore
{
my ($d) = @_;
return ( "myplugin\@$d->{'dom'}" );
}
Plugins can define fields that will appear on the owner limits page for a virtual server, and in server templates. Limits are useful if your plugin uses up resources of some kind, such as disk space for databases or memory for server processes. You can then allow the master administrator to define limits on these resources, via functions documented here.
Virtualmin templates are the location of most configuration settings that are used when creating new virtual servers. If your plugin has some adjustable settings that might be used when it is enabled, you can implement the functions below to add new input fields to templates. These can then be fetched in your plugin's feature_setup function with the get_template call.
This optional function should return a HTML inputs for limits specific to this plugin's feature. The initial values of those limits should be take from the domain object, where they must be stored in keys starting with the plugin's name (to avoid clashes). The HTML returned must make use of the ui_table_row function to format table columns.
sub feature_limits_input
{
my ($d) = @_;
if ($d->{$module_name}) {
return &ui_table_row("Maximum My plugin databases",
&ui_opt_textbox($module_name."limit", $d->{$module_name."limit"},
4, "Unlimited", "At most"));
}
}
This function parses the HTML form inputs generated by feature_limits_input. It should examine the in hash reference and update the domain object to set or clear limits based on the user's selections. If any errors are found it should return an error message string, or undef if all is OK.
sub feature_limits_parse
{
my($d, $in) = @_;
if (!$d->{$module_name}) {
# Do nothing
}
elsif ($in->{$module_name."limit_def"}) {
delete($d->{$module_name."limit"});
}
else {
$in->{$module_name."limit"} =~ /^\d+$/ || return "Limit must be a number";
$d->{$module_name."limit"} = $in->{$module_name."limit"};
}
return undef;
}
This optional function must return HTML for editing template settings specific to this plugin. The template parameter is a hash reference to a template object, which contains settings for all features and plugins. Yours should only show and edit keys that start with the plugin's module name, so that they are properly merged when a non-default template is edited. HTML returned must make use of the ui_table_row function to format table columns.
sub template_input
{
my ($tmpl) = @_;
return &ui_table_row("Default My plugin database size",
&ui_opt_textbox($module_name."dbsize", $tmpl->{$module_name."dbsize"}, 5, "Default").
"MB");
}
This function must check in for selections made by the user in the fields created by template_input, and then update the template hash reference. If there are any errors in the user's input it should return an error string, or undef if everything is OK. Template keys must start with the plugin's module name, so that they are properly merged when a non-default template is edited.
sub template_parse
{
my ($tmpl, $in) = @_;
if ($in->{$module_name."dbsize_def"}) {
delete($tmpl->{$module_name."dbsize"});
}
else {
$in->{$module_name."dbsize"} =~ /^\d+$/ || return "Database size must be a number";
$tmpl->{$module_name."dbsize"} = $in->{$module_name."dbsize"};
}
}
In the Virtualmin architecture, each feature and plugin is responsible for backing up and restoring configuration files associated with a domain, but which are stored outside the virtual server's home directory. If your plugin adds a feature to Virtualmin which stores data in some location that won't be included in a domain's regular back, you should implement the functions in this section to ensure that it is backed up and restored.
This function should copy configuration files associated with the virtual server object domain and copy them to the path given by file. If there is just a single file then it can be copied directly - otherwise, your code should create a tar file of all required files and write it to that path.
The &$virtual_server::first_print and second_print functions should be called to tell the user that the backup is starting, and if it has succeeded or failed. If the copy was successful the function should return 1, or 0 on failure.
sub feature_backup
{
my ($d, $file) = @_;
&$virtual_server::first_print("Copying My plugin configuration file ..");
my $ok = ©_source_dest("/etc/someprogram/$d->{'dom'}", $file);
if ($ok) {
&$virtual_server::second_print(".. done");
return 1;
}
else {
&$virtual_server::second_print(".. copy failed!");
return 0;
}
}
This function is the opposite of feature_backup - it should take the data in the file passed in with the file parameter, and update local config files or databases for the virtual server defined in domain to restore those settings. The format of file will be exactly the same as whatever your plugin created in the feature_backup function, although it may be in a different location.
The &$virtual_server::first_print and second_print functions should be called to tell the user that the restore is starting, and if it has succeeded or failed. If the process was successful the function should return 1, or 0 on failure.
sub feature_restore
{
my ($d, $file) = @_;
&$virtual_server::first_print("Restoring My plugin configuration file ..");
my $ok = ©_source_dest($file, "/etc/someprogram/$d->{'dom'}");
if ($ok) {
&$virtual_server::second_print(".. done");
return 1;
}
else {
&$virtual_server::second_print(".. copy failed!");
return 0;
}
}
These functions aren't really related to any feature or capability that the plugin provides - instead, the allow it to add elements to the Virtualmin user interface.
If implemented, this function should return a list of hash references, each of which defines a new link under the System Settings menus on Virtualmin's left frame. These are only accessible to the master administrator, and appear regardless of which domain is selected. They typically link to global configuration pages for the plugin.
Each hash must contain the following keys :
setting or email or ip.
sub settings_links
{
return ( { 'link' => "/$module_name/edit_config.cgi",
'title' => "My plugin configuration",
'icon' => "/$module_name/images/config.gif",
'cat' => 'setting' } );
}
The Virtualmin framed theme displays various information on the right-hand system information page after you login, such as the status of servers, available updates and comparative quota use. This function allows your plugin to add sections of its own, typically to display global status information.
If defined, it must return a list of hash references, each containing the following keys :
title - The title of the sectionhtml - The HTML to appear within the section when it is opened. Forms that submit to CGIs within the plugin are perfectly OK.status - Set to 1 if you want the section to be open by default, 0 if not.for_master - This must be set to 1 if the section should be visible to the master administrator.for_reseller - Set to 1 if it should be visible to resellers.for_owner - Set to 1 if it should be visible to individual domain owners.
sub theme_sections
{
return ( { 'title' => 'My plugin status',
'html' => &is_server_running() ? 'Some program is running OK'
: 'Some program is down!',
'status' => 0,
'for_master' => 1 } );
}
A Virtualmin plugin can also provide extra capabilities to virtual server users. This is done by implementing additional functions in the virtual_feature.pl file, similar to those used for adding a new server feature. This can be used for granting users access to some new service, like a game server or database, which is not supported natively by Virtualmin.
When a plugin adds capabilities to a user, additional inputs will typically appear on the user editing page. In additional, the plugin can define extra columns to appear in the user list, to display the status of the new user capabilities.
Most of the functions above take a user details hash reference as a parameter. Some of the useful keys in this hash are :
user - The full Unix username of the user, which may have the domain name appended, like jcameron-foo.real - The real name of the user, such as Jamie Cameron.home - The user's home directory, which is typically under the virtual server's home.pass - The user's encrypted Unix password.plainpass - If the user's password has just been changed or set, this field will contain the plain text password. It is not always available though, for example when editing a user without changing the password.
The functions that can be added to virtual_feature.pl to support user capabilities are :
This function is called when the page for editing a virtual server user is displayed. The user parameter is a hash reference of user details, such as the login name, real name and home directory. The new parameter will be set to 1 if this is a new user, or 0 if editing an existing user. The domain parameter is a hash reference of virtual server information, as used in the plugin functions documented above.
This function must return HTML for the additional inputs to display, formatted to fit inside a 2-column table. This is best done with functions from ui-lib.pl, like:
sub mailbox_inputs
{
my ($user, $new, $d) = @_;
my $access = &check_user_access($user);
return &ui_table_row("Allow access to My plugin?",
&ui_yesno_radio("myplugin", $access));
}
It should detect the current state of the user, and use this information to determine the values of the inputs.
This function is called when the user form is saved, but before any changes are actually committed. It should check the form inputs in the in hash reference to make sure they are valid, and return either undef on success, or an error message if there is some problem.
This function must save the actual settings selected for this user, by updating whatever configuration files are needed for this capability. The user parameter is the update user details hash, containing his new username, password, real name and other attributes. The olduser parameter is the user hash from before the changes were made, and can be compared with user to detect username and other changes. in is the form inputs hash, new is a flag indicating if this is a new or edited user, and domain is the details of the virtual server this user is in.
sub mailbox_save
{
my ($user, $olduser, $in, $new, $d) = @_;
if ($user->{'user'} ne $olduser->{'user'}) {
&set_user_access($olduser, 0);
}
&set_user_access($user, $in->{'myplug'} ? 1 : 0);
}
This function is called when a user is deleted. It should check to see if he has the capability managed by this plugin enabled, and if so perform whatever tasks are needed to remove it. The parameters are the same as those for the mailbox_save function.
sub mailbox_save
{
my ($user, $d) = @_;
&set_user_access($user, 0);
}
This function gets called when a user is modified by some part of Virtualmin other than the Edit User page, for example by the modify-user.pl command-line script. It should compare the old and new user objects to see if anything that this plugin uses has changed, such as the username or password. If so, it must update whatever configuration files the plugin uses.
sub mailbox_modify
{
my ($user, $olduser, $d) = @_;
if ($user->{'user'} ne $olduser->{'user'}) {
my $oldaccess = &get_user_access($olduser);
&set_user_access($olduser, 0);
&set_user_access($user, $oldaccess);
}
}
If you want an additional column to appear in the user list indicating the state of this plugin's capability for users, this function should return the title for the column. Otherwise, it should just return undef. If you don't need to define any extra column, then you don't even need to implement it.
sub mailbox_header
{
return "Plugin access";
}
When a column exists for this plugin in the user list, this function will be called once for each user. It must return the text to display, such as Enabled or Disabled. If mailbox_header is not implemented, then this function doesn't need to be either.
sub mailbox_column
{
local ($user, $d) = @_;
return &check_user_access($user) ? "Yes" : "No";
}
Virtualmin Pro allows users to define various defaults for new users added to domains, on a per-domain basis. If your plugin wants to be able to add to these defaults, you can implement this function. The defs parameters is a hash reference for a user object containing the defaults, which should be checked to find the current status for your settings.
sub mailbox_defaults_inputs
{
my ($defs, $d) = @_;
return &ui_table_row("Allow access to My plugin by default?",
&ui_yesno_radio("myplugin", $defs->{'myplugin'}));
}
This function is the counterpart to mailbox_defaults_inputs. It should check form inputs in in and use them to update the default settings object defs.
sub mailbox_defaults_parse
{
my ($defs, $d, $in) = @_;
$defs->{'myplugin'} = $in->{'myplugin'};
}
In the core package, Virtualmin supports MySQL and PostgreSQL databases. However, the plugin architecture allows developers to add new database types which can then be associated with virtual servers. Typically a plugin that adds databases will also implement the feature_ functions, so that the new database type can be enabled for new or existing virtual servers - just as is the case for MySQL and PostgreSQL.
Because Virtualmin allows mailbox users to have access to some database types, the plugin can also include support for creating, listing and managing additional users associated with each database. Because not all database systems support granting a user full access to a database, implementation of the user-related functions is optional.
This function must return the name of the database type.
sub database_name
{
return "FooSQL";
}
This function must return a list of the names of databases owned by the given domain object, each of which is a hash reference containing the following keys :
name - The unique database name.type - The database type code, typically set to $module_name.desc - A description of the database type, usually the same as returned by database_name.users - A flag, set to 1 if the database supports multiple users, 0 if not.link - A URL path for managing the database's contents. If you have not implemented this, it this key can be left out.
Typically the list of databases for a domain will be stored in the domain hash itself, in a key named db_$module_name. This removes the need for the plugin to store the domain → database mapping separately.
sub database_list
{
my ($d) = @_;
my @rv;
foreach my $db (split(/\s+/, $d->{'db_'.$module_name})) {
push(@rv, { 'name' => $db,
'type' => $module_name,
'desc' => &database_name(),
'link' => "/$module_name/edit_dbase.cgi?db=$db" });
}
return @rv;
}
This function should return a list of all databases known to the database server the plugin manages, even those not associated with any domain. Its return format should be the same as database_list.
sub databases_all
{
my @rv;
foreach my $dbname (&list_foosql_databases()) {
push(@rv, { 'name' => $dbname,
'type' => $module_name,
'desc' => &database_name() });
}
return @rv;
}
This function must check if a database of the type managed by the plugin with the given name already exists, and if so return 1. It is used by Virtualmin to prevent database name collisions at creation time. If no clash exists, it must return 0.
sub database_clash
{
my ($d, $name) = @_;
foreach my $db (&list_foosql_databases()) {
return 1 if ($db eq $name);
}
return 0;
}
This function is where the real work of creating a new database should happen. It must perform all the work needed to add a database and associate it with the virtual server, typically by adding it to the db_$module_name key in the domain hash reference. It should use &$virtual_server::first_print to output a message before creation starts, and second_print to display success or failure when done. It should return 1 if creation was successful, 0 if not.
Access to the new database must be granted to the virtual server's owner. For databases managed by some kind of server (like MySQL and PostgreSQL), the domain's username and password must be able to login to access the new database. These can be found in the domain hash in the user and pass keys.
sub database_create
{
my ($d, $name) = @_;
&$virtual_server::first_print("Creating FooSQL database $name ..");
local $err = &create_foosql_database($name);
if ($err) {
&$virtual_server::second_print(".. failed : $err");
return 0;
}
else {
&$virtual_server::second_print(".. done");
$d->{'db_'.$module_name} .= " ".$name;
return 1;
}
}
This function must delete a database of the type managed by this plugin, and remove access to it from the virtual server. Like database_create, it should use the print functions to display progress and status to the user.
sub database_delete
{
my ($d, $name) = @_;
&$virtual_server::first_print("Deleting FooSQL database $name ..");
local $err = &delete_foosql_database($name);
if ($err) {
&$virtual_server::second_print(".. failed : $err");
return 0;
}
else {
&$virtual_server::second_print(".. done");
$d->{'db_'.$module_name} =~ s/\s+\Q$name\E//g;
return 1;
}
}
This function is called by Virtualmin when a user displays information about a database, and when computing a virtual server's total disk usage. It must return two numbers :
sub database_size
{
my ($d, $name) = @_;
my $size = &disk_usage_kb("/var/foosql/$name");
my @tables = &list_foosql_tables($name);
return ( $size*1024, scalar(@tables) );
}
If the plugin's database type supports multiple logins, this function can be implemented to return a list of array references, each of which contains a login and password. Only users associated with domain and with access to the database specified by the name parameter need to be returned. If the password is encrypted, it is fine to use that as the second element of each array ref.
sub database_users
{
my ($d, $name) = @_;
return &execute_foosql_sql($name, "select login,password from users where db = '$name'");
}
This function must create a new database with with access to the database specified by the database parameter, which is a hash reference returned by database_list. The new user must have the login set by the user parameter, and password specified by password. If something goes wrong, it should called error.
sub database_create_user
{
my ($d, $db, $user, $pass) = @_;
&execute_foosql_sql($db->{'name'}, "create user '$user' with password '$pass'");
}
This function must modify the user in the database specified by the old-database parameter and named old-user, changing his login to user and password to password (if provided). If the modification fails, it should call error.
sub database_modify_user
{
my ($db, $olddb, $db, $olduser, $user, $pass) = @_;
if ($user ne $olduser) {
&execute_foosql_sql($olddb->{'name'}, "rename user '$olduser' to '$user'");
}
if (defined($pass)) {
&execute_foosql_sql($olddb->{'name'}, "alter user '$user' password '$pass'");
}
}
This function should delete the database user specified by the user parameter from all databases owned by the virtual server in domain.
sub database_delete_user
{
my ($d, $user) = @_;
foreach my $name (&list_foosql_databases()) {
&execute_foosql_sql($name, "delete user '$user'");
}
}
Some database servers impose limits on the length or allowed characters in database logins. This function should check if the given name exceeds any such restrictions, and if so truncate or modify it to be valid. It should then return the modified version.
sub database_user
{
my ($name) = @_;
if (length($name) > 16) {
$name = substr($name, 0, 16);
}
return $name;
}
Automatic DNS Slave Configuration - Configuration of automatic DNS slave creation and management.
DNS FAQ - Frequently asked questions about DNS.
Domain Name Server Troubleshooting - Troubleshooting common problems with domain name service.
Domain Registration With Virtualmin - Use of the Virtualmin Registrar plugin, which allows users and administrators to register domains from within Virtualmin using one of several DNS registrars.
A quick guide to assist administrators who want to use Virtualmin's automatic DNS slave configuration features. This allows for DNS server redundancy.
Virtualmin can automatically manage any number of DNS slave servers for you. Once configured, it will create slave zones on other servers and configure them to automatically update when changes are made on your Virtualmin server. For this to work, you need Virtualmin on your primary server and Webmin (a free download) on your slave server(s). Henceforth, all references will refer to the primary server as the "Virtualmin server" and the DNS slave server as the "slave server".
If you don't have Virtualmin installed on your slave server(s), you'll need to install Webmin. Webmin is available for nearly every UNIX and Linux variant available, and is free to download and use.
You can download Webmin from webmin.com. It is available in .rpm, .deb, Solaris .pkg, .zip, and .tar.gz formats. Be sure to choose the appropriate package type for your slave server. Some Linux versions provide a package of Webmin via their package management system.
Install Webmin according to the instructions for your OS, found on the Downloading and Installing page at Webmin.com.
Login and confirm that the Webmin installation is working correctly and a firewall is not blocking access.
A supported version of BIND is also required on your slave server. Installation of BIND is beyond the scope of this document, as it is different on every operating system. But, on most systems it is very easy, and requires only one or two commands.
For example, installing BIND on CentOS, RHEL, and Fedora systems can be done with the following command:
yum install bind bind-config
The bind-config package is optional, but saves a few steps of configuration that you'd need to do, otherwise.
On some systems, BIND will not have the necessary minimal configuration to start up immediately after installation. Webmin can usually perform the necessary initial steps for you, and it can usually detect if such steps are needed before starting and using BIND.
Browse to Servers:BIND DNS Server.
If BIND needs configuration, Webmin will offer to perform the configuration for you. It is probably most wise to choose the option that includes downloading the latest root zone file, rather than using the included root zone file (though either will work for our purposes, if you rely on the DNS server for regular DNS services there is a small possibility you'll run into stale data with the included zone file).
After Webmin has performed the initial configuration, you'll likely see a button labeled Start Name Server. Click it.
Don't forget to also enable starting BIND on boot, using the Bootup and Shutdown module. It's beyond the scope of this guide, but the Webmin documentation covers it in some detail in http://doxfer.com/Webmin/BootupAndShutdown|Bootup and Shutdown
Once you have the necessary software installed and running on the slave, login to Webmin on your Virtualmin system, and browse open the Webmin menu by clicking on the Webmin link in the upper right corner of the left-hand menu.
Before doing this, make sure that the slave system does not have a firewall blocking ports 10001-10010, as they are used by Webmin's RPC calls. The best way to check this and open them up is with the Linux Firewall module, on the slave system. Or you can use the BSD Firewall or IPFW Firewall modules for non-Linux systems.
Click on the Webmin Servers Index link in the Webmin dropdown menu.
Click Register a new server.
Enter the hostname of your slave server.
Select the type of OS running on the slave.
If you installed the Perl Net SSLeay module and Webmin is using SSL on the slave server, set the SSL server? option to Yes. Otherwise leave it on No.
Select a Link type of Login via Webmin with username ... password ..., and enter the authentication details for an admin level user (usually root).
Change Make fast RPC calls? to Yes.
Click Save.
There should now be an icon representing the server you created in the Webmin Servers page.
Now that you've added the server, you can configure the local name server to automatically manage slave zones on the remote server.
Browse to Servers:BIND DNS Server and click on the Cluster Slave Servers icon.
In the Add server dropdown, select your slave server (if it's the only server you've added, you won't have to select it, as it will already be selected).
Set the Create secondary on slave when creating locally? option to Yes.
If you have already created any domains on your Virtualmin server, set the Create all existing master zones on slave? option to Yes.
If you want to use some name other than the name of the slave server for the NS record (for example, if you wanted it to be ns1.domain.tld, keeping with the convention of naming name servers nsN.domain.tld), you can enter it in the Name for NS record field. Note that you'll actually have to create an A record matching that name pointing to the slave server, if you haven't already created one.
Click Add server.
By default, Virtualmin will use the IP address that the master server's hostname resolves to as the IP that the slaves should contact to transfer records. However, on some systems this IP is 127.0.0.1, which will not work.
To make sure the correct IP is used, do the following on the master system :
Now Virtualmin will automatically include your slave server in the NS records for each new domain.
NOTE: If, for some reason, you don't like the default name of the first NS record (taken from the hostname of your server), you can change it in the Server Template(s) that you use, in the BIND DNS domain section. The field is labeled Master DNS server hostname. Just like with the slave servers, this name must be valid and point to the correct IP address, otherwise name service will not work, or will be unreliable.
Domain Registration With Virtualmin
Virtualmin now includes a plugin that can be used to automate the process of registering DNS domains. This means that you can full create a new virtual server with a website and domain, and have it visible on the Internet pretty much immediately - there is no need to manually register the domain separately.
The latest version of the plugin supports the NameCheap, Register.com, Gandi and Distribute.IT APIs, but others will follow in future releases. You can use either your existing account with those registrars, or create a new Register.com account using the Virtualmin web interface.
Installing the Domain Registration Plugin
If you are using a standard install of Virtualmin Pro on a Redhat, CentOS or Fedora system, the plugin can be installed with the command :
yum install wbm-virtualmin-registrar
On a Debian or Ubuntu system, the command is :
apt-get install webmin-virtualmin-registrar
You must be running at least version 3.47 Virtualmin to install it. At the time of writing, this plugin is not included in the standard Virtualmin install, but this will soon change.
Once it is installed, login to Virtualmin as the master administrator. Open the System Settings section on the left menu, and click on Features And Plugins. In the list of features and plugins, check the box next to DNS Domain Registration and click Save at the bottom of the page.
If you want new Virtualmin domains to be registered in DNS by default, check the box in the Default column - if not, leave it un-checked. Since registration costs money, it is probably best to leave this off by default.
Now that it is installed and active, refresh the page and then open the Addresses and Networking category on the left menu, then click on DNS Domain Registrars. This will bring you to a list of known registrar accounts - which will be initially empty.
If you already have an API account with Register.com or any other supported registrar, select the registrar from the Add an existing account menu and click Start Adding. This will bring you to a page for entering details of your account - the most important are the login ID and password.
If you don't yet have a registrar account, one can be created at :
Registrar New Account URL
Register.com <a href="https://secure.rconnection.com/sign-up.asp?resell=VIRTUALMIN-TPP" class="urlextern" title="https://secure.rconnection.com/sign-up.asp?resell=VIRTUALMIN-TPP" rel="nofollow">https://secure.rconnection.com/sign-up.asp?resell=VIRTUALMIN-TPP</a>
Gandi <a href="http://www.gandi.net/reseller/" class="urlextern" title="http://www.gandi.net/reseller/" rel="nofollow">http://www.gandi.net/reseller/</a>
Distribute.IT <a href="http://www.distributeit.com.au/rs_signup.html" class="urlextern" title="http://www.distributeit.com.au/rs_signup.html" rel="nofollow">http://www.distributeit.com.au/rs_signup.html</a>
Enter a description for this account (such as Foo Corp's registrar account) and your login and password with the registrar, then click Create. If you only want this account to be used for certain TLDs, enter them in the Additionally limit to top-level domains field.
When the form is submitted, Virtualmin will validate the login details, and display an error message if they are incorrect. If all is OK, you will be returned to the list of accounts, which will now show the one you just added. To edit its details, click on the description, and the same form used for adding will be displayed so that you can change the settings.
Some registrars allow you to create a new account online using this Virtualmin, which you can then use to register domains. To do this, select the registrar from the Create a new account menu, and click Start Creating. The details that you have to enter differ between registrars, but for the purposes of this documentation we will concentrate on Register.com as it is the first registrar supported by the plugin.
The Account description should be set to a short text of your choice to described the account, while the New account login and password must be set to a username and password that will identify the account. If you select a login that is already in use by someone else, Virtualmin will tell you when you try to create the account.
The first part of the form (starting with the Organization name field) is for entering your personal details. The second section (starting with Address) is for your location and contact information. The last section (starting with Credit card type) is for billing details. The costs of domain registration will be charged to the card entered - see the registrar's website for details on how much they charge for different top-level domains.
When you click Create, the new account details will be sent to the registrar. If all the fields have been filled in correctly and the credit card details are valid, Virtualmin will display the ID for the new account. If not, the error message from the registrar will be shown. Depending on the registrar, you may or may not be able to use the account right away - in the case of Register.com, they must first add your IP address to a whitelist of those allowed to access the account, which may take several hours.
When you have create one or more registrar accounts, they will be listed on the DNS Domain Registrars page. Each account can be either enabled or disabled - only those that are marked as enabled will be used by Virtualmin when registering domains. To change the enabled status, check the box next to an account and click either the Enable Selected or Disable Selected button.
If you want to edit an account's details, click on its description in the list to bring up a form for changing the login, password, description and allowed top-level domains. Be careful changing the login details, as switching to another account with the registrar may make it impossible to renew or de-register your existing domains.
To remove an account you are no longer planning to use, check the box next to it and hit the Remove Selected button. This will NOT cancel the account with the registrar - just take it out of Virtualmin's list of usable accounts. You cannot do this if any virtual servers exist that were registered with the account, as it would make their future management impossible.
When a domain is registered, at least one and often two nameservers must be supplied to the registrar. Virtualmin determines these by looking at the NS records in the DNS zone file, which are in turn set by default from the hostnames of your primary and any secondary nameservers. Alternately, when adding or editing a registrar account, you can enter the specific nameservers that should be used.
Either way, these nameservers must first be registered with the registrar that you created THEIR top-level domain with. So if your company is called myhosting.com and your nameservers are webhost.myhosting.com and ns2.myhosting.com, you must first use your original registrar's website to add those two hostnames (and their IP addresses) as registrars. If not, new domain registration using Virtualmin will fail.
For many top-level domains, you must have at least two separate nameservers - for example, .de is one that enforces this. Fortunately this is relatively easy to set up, and documented on the DNS Slave Auto-Configuration Quickstart page.
Once you have at least one enabled account, you will be able to use Virtualmin to register domains when they are created, or add registration for existing domains. To do this, just select the Register DNS domain? feature on the Create Virtual Server or Edit Virtual Server forms.
If the domain is available according to your registrar, it will be registered under your account and the nameservers set to your Virtualmin system. If it isn't available, creation of the entire virtual server will be blocked. As the creation process progresses, you will see a message starting with Registering DNS domain, followed by a line showing the success or failure of the registration.
Naturally, you must also select the DNS domain enabled? feature when creating the server, or else there will not be an actual nameserver configuration entry to serve the domain. If creating using the command-line create-domain.pl script, the --virtualmin-registrar flag enables registration.
De-registering a domain is as simple as un-checking the Register DNS domain? box on the Edit Virtual Server page. Or you can just delete the server using Virtualmin. Either way, the registrar used to create the domain will be told to remove the registration, which will make it no longer visible from the rest of the Internet unless you re-register it with a different registrar.
Once a virtual server's domain has been registered using Virtualmin, several options will show up under the Domain Registration category in the left-side menu. Some are only available to the master administrator though.
Every registered domain has several contact persons associated with it - the billing contact, administrative contact and technical contact. When the domain is first registered, the contact details will be either set from the parent server's contacts (if any), or from the contact information you provided when creating the registrar account. For domains that are owned by your customers, you may want to change these though.
Depending on the registrar, some or all of the contacts can be edited using the Edit Domain Contacts link under Domain Registration on the left menu. This will bring up a form with several collapsible sections, one for each contact. Edit the details as you see fit, and click the Save button at the bottom of the page. If anything goes wrong updating the registrar, an error message will be displayed.
Because all contacts are the same in most cases, you can use the Same as the first contact? option in contacts after the first to have their details duplicated from the first one. This will be set to Yes automatically (and the section collapsed) if the details are currently the same.
Domains are registered only for a limited period, typically measured in years. When a domain approaches its expiry date, your registrar will typically contact you via email to the administrative or billing contact's address, asking you to renew. This can be done entirely from within Virtualmin, using the Renew Domain link under Domain Registration on the left menu.
Clicking on this link brings up a simple form showing the current expiry date, with a field for entering an additional number of years to renew for. When the Renew Domain Now button is clicked, your registrar will be notified of the request, and your account charged the appropriate renewal fee.
Associating an Existing Domain
If you have already registered a domain manually with a registrar and added the same account for use by Virtualmin, you can inform Virtualmin about the domain using the Associate Domain link on the left menu, under Domain Registration. This will allow you to edit the domain's contacts, renew it, and remove the registration when the virtual server is deleted.
When that link is clicked on, all you should need to do is select the account used to create it originally from the Registered under account menu. If the registrar gave you an ID number or code when the domain was created, enter it into the ID with registrar field - although this is not usually needed. If you want the domain's nameservers modified to match your Virtualmin system, change Update nameservers to Yes. Finally, hit Associate Domain and the success or failure of the association will be displayed.
If you no longer want Virtualmin to manage a domain registration but do not want to actually re-register it, open the Domain Registration category on the left menu and click on Dis-Associate Domain. The click the button on the confirmation form that appears.
If you change your mind, the Associate Domain feature can be used to bring the domain back under Virtualmin's control.
It's pretty safe to say that a majority of problems in any virtual hosting system will be DNS related, because DNS requires cooperation of numerous systems, rather than just one, and DNS problems can cause trouble with nearly every service on a hosting system.
For DNS to work, it must have correct glue records at your registrar, as well as correct records on your Virtualmin system (or whatever system you choose to use for DNS, if not the Virtualmin server). Also, any slaves must also have correct records, or you will experience intermittent resolution failures.
Checking your glue records can be done using the whois command.
whois example.com
Look for the "domain servers" or "name servers" section of the output. The resulting names must resolve to your DNS servers.
Glue records must be configured at your name service registrar. Virtualmin and Webmin have no control over records at your registrar, so problems must be corrected using whatever interface your registrar provides.
The NS records on your Virtualmin server should match those found in the glue records discussed previously, or intermittent problems may result.
You can find the NS records for a given zone using the host command on your server:
host -t NS example.com
Address records, or A records, are the basic building block of DNS zones. They map names to IP addresses.
To check an A record, use the host command:
host example.com
You can also specify the name server used to resolve queries by adding the name or IP of the server you wish to query to the end of the command:
host example.com ns1.example.com
Or, if you aren't sure about the nameserver IP address resolving correctly, you can use an IP:
host example.com 192.168.1.1
Mail exchanger records, or MX records, provide mail servers the information they need to know how to deliver mail for a particular domain.
You can check an MX record with the host command:
host -t MX example.com
The Webmin documentation provides additional information on the topic of troubleshooting name service, as well as the BIND DNS Server module documentation.
POP3 and IMAP Configuration - How to configure common mail clients to download mail using POP3 and IMAP.
Spam and Anti-Virus Scanning - Explanation of Spam and Virus scanning features in Virtualmin.
Email Frequently Asked Questions - Frequently asked and answered questions about email service in Virtualmin systems.
Email Troubleshooting - Troubleshooting common email problems.
SMTPS and Submission Configuration - Configuring Postfix to accept secure SMTP connections for outgoing mail from mail clients.
Hold and Forward Backup Server - Configuration of a hold and forward backup SMTP server, using a second Virtualmin server.
Email Tutorials - Our step-by-step tutorials related to email.
All Documentation Pages tagged "Email" - A predefined search of pages that have been tagged "email".
Virtualmin configures the Dovecot POP3 and IMAP server for usage with all common mail clients, and Cyrus saslauthd for SMTP authentication on outgoing mail.
You can always find the username for a user by looking on the Edit Users page for the virtual server in which the user exists. It will be displayed in the IMAP/FTP login field. With the exception of users with @ in them, the username will be the same for all services (mail, ssh, FTP, Usermin, etc.).
Virtualmin, by default, creates system login names by combining the username and the first part of the domain name, separated by a configurable separator ("." by default). Thus, a user named joe within the virtualmin.com domain would use the login name joe.virtualmin.
This is, of course, completely configurable. To choose the username format used, browse to System Settings:Server Templates and select the Mail for domain section, and locate the Format for usernames that include domain field at the bottom of the page.
Virtualmin also supports user@domain.tld style usernames, though there are some caveats in this configuration. Specifically, Postfix does not support delivery to users with @ in them, and so Virtualmin creates two users (one that Postfix will deliver to, and one with @).
In order for SMTP authentication to work with users in this format, saslauthd also needs to be configured to include domain information.
On Red Hat, Fedora, and CentOS systems, edit /etc/sysconfig/saslauthd and add "-r" to the FLAGS= line, save it and restart the saslauthd service.
On Debian and Ubuntu, edit /etc/defaults/saslauthd and add the "-r" flag to the PARAMS= line, save it, and restart the saslauthd service.
Open the Account Settings dialog. Click the Add Account button in the lower right corner of the window. Select Email account and click Next.
Fill in your name and the email address for this account.
Select POP or IMAP, fill in the hostname of the Virtualmin server in the Incoming Server, and then click Next.
On the next page, fill in the username. Click Next.
Give the account a name (the default will be the email address associated with the account).
DomainKeys Identified Mail or DKIM is a standard for signing email messages so that the recipient can verify the sender's email address. This allows recipient mail servers to detect sender address forgery, which is often used by spammers to avoid sender domain blacklists. Signing is done with a private key on the senders server, which matches a public key added to in the sender's DNS domain. The recipient can lookup this key at the domain in the From address, and use it to ensure that the email signature was created using the corresponding private key, which proves that the message was really sent from that domain.
Virtualmin uses a milter to implement DKIM signing and verification. This is background process that the Postfix or Sendmail mail server sends messages to for modification before they are sent to their final destination. Any email relayed through the Virtualmin system (either from a web-based mail read or a client like Outlook or Thunderbird) will have a signature added by the DKIM milter, as long as it is from a domain for which DKIM is enabled.
Only Virtualmin versions 3.81 and later support DKIM.
Virtualmin supports the configuration of DKIM on Debian, Ubuntu, Fedora, CentOS and Redhat Enterprise systems, as these distributions provide the required DKIM milter package. The simplest way to install this is as follows :
root and go to Email Messages -> *DomainKeys Identified Mail**.Installation can also be done from the command line. On Debian or Ubuntu, the command is :
apt-get install dkim-filter
while on CentOS, Fedora or Redhat Enterprise you will need to run :
yum install dkim-milter
To enable DKIM signing of outgoing email messages, follow these steps :
root and go to Email Messages -> DomainKeys Identified Mail2010. Do NOT enter default, as this can trigger a bug in the current Virtualmin release which deletes the /etc/default directory!Assuming all goes well, Virtualmin will report the steps taken to configure and enable DKIM.
Only virtual servers that have both the DNS and email features enabled will have DKIM activated, as the mail server needs to be setup to use a private signing key whose corresponding public key is added to DNS.
By default, Virtualmin will also configure the DKIM milter to verify incoming email that has the proper signatures. DKIM-signed messages where the signature is incorrect or cannot be checked with a DNS lookup will be bounced or delayed. If you want to disable verification, set the Verify DKIM signatures on incoming email? option to No.
To turn off DKIM signing completely, just do the following :
root and go to Email Messages -> DomainKeys Identified MailThis will remove the public key from all domains, and stop your mail server from signing messages with the DKIM milter.
To "turn off" the automatic email bouncing, simply delete this catch-all email alias.
That can occur if your hostname gets out of sync with what's setup in your server's config files. To check for this problem, log into your server as root over SSH, and run the command "hostname". Then, verify that the resulting hostname exists next to your external facing IP address in /etc/hosts, as well as on the "mydestination" line of /etc/postfix/main.cf. After making those changes, restart Postfix.
It's a bad idea, according to Wietse Venema in this post on the Postfix mailing list: http://archives.neohapsis.com/archives/postfix/2000-02/0892.html
Virtualmin has several clever hacks to workaround this particular feature of Postfix, revolving around the creation of a second user with the same UID and paths, which Postfix can deliver to. This has many potential problems and might confuse other software that isn't smart enough to deal with multiple usernames with the same UID (this is perfectly legitimate, and ought to work, but it is a common failing and even some of our stuff has had some bugs uncovered, but now fixed, by this hack).
On recent operating systems (Fedora Core 5+, CentOS 5, Debian 4.0+, and Ubuntu 8.04LTS are all confirmed to have this issue) the Cyrus saslauthd version defaults to dropping the "@domain.tld" portion of the username before attempting authentication. This, obviously, won't work. The solution is to add the "-r" flag to the saslauthd command. On Red Hat based systems, additional flags can be added in the "FLAGS=" section of the file /etc/sysconfig/saslauthd. On Debian-based systems, the file to edit is /etc/default/saslauthd and the directive to modify is "PARAMS=". This is an orthogonal issue to the Postfix issues, and will occur whether you use Sendmail or Postfix as your mail server.
We don't recommend using @ in the username for mailbox users (for the same reasons that Wietse removed support for them in Postfix), but if you must it can be done. Any problems you run into should be brought up in the Bug Tracker, so we can get them resolved. Just because it's a hack doesn't mean we won't make it work as well as any othe naming convention.
Also note that this trick is incompatible with mbox style mail spools (because mail will be delivered to the "wrong" mailbox: user-domain.tld, instead of user@domain.tld). Maildir format mail spools are not subject to this problem, and are the default in Virtualmin if you have used our automated installation script.
If you really do want to use this type of username, edit the Server Template(s) for which you'd like this type of username. Browse to the "Mail for domain" section (select it in the dropdown, if using the Virtualmin theme, or scroll to this section if using any non-menu-ized theme). Find the option labeled "Format for usernames that include domain", and select "user@domain", and save your changes.
Configuring a secondary MX server to provide hold and forward mail service in the event your primary mail server is offline. Virtualmin Professional is required on the primary server, and Virtualmin Professional or Virtualmin GPL is required on the secondary server.
Mail service is, for many users, the most important internet service. While always-on reliability on virtual hosting systems is impossible (kernel upgrades for security updates, at the very least, require system reboots), the DNS and mail standards provide mechanisms to allow mail to flow successfully even if the primary mail server is temporarily off-line.
Configuration of a secondary mail server is relatively simple, but can be made completely automatic with Virtualmin Professional. To use this automatic backup mail server configuration feature, you must have Virtualmin Professional on the primary server. On the backup server, either Virtualmin Professional or Virtualmin GPL will work.
For this process to work, the following components are needed:
Virtualmin 3.87 and later can configure secondary mail servers to only accept email for addresses that exist on the primary server. This prevents spammers from sending email with faked from addresses to invalid addresses on the secondary server, which are then relayed to the primary and bounced back to the fake address.
The steps to configure Postfix on the secondary to support this are :
/etc/postfix/main.cf and add the line relay_recipient_maps = hash:/etc/postfix/relay_recipientstouch /etc/postfix/relay_recipients ; postmap hash:/etc/postfix/relay_recipients/etc/init.d/postfix restartTo configure Sendmail on the secondary, the steps are :
The first step in this process is to add your secondary server to the list of available Webmin servers. To do this, click on the Webmin link in the upper right corner of the left menu pane to activate the Webmin menu. Then, open the Webmin menu category and click on ''Webmin Servers Index''.
Click the ''Register a new server'' link, and then fill in the form, providing the hostname of the secondary and the port on which Webmin is running. In the Link Type section, select ''Login via Webmin with username ... password ...'' and enter an administrative level username and password.
Once the form is filled out, click ''Save''. Assuming there are no errors, you should now see an icon representing your secondary server in the Webmin Servers Index page.
Once the server has been added as a Webmin server, you just need to enable it as a secondary server in Virtualmin. In the left-hand menu, re-activate the Virtualmin menu by clicking on the Virtualmin link in the upper left corner. Now open the ''Addresses and Networking'' menu item, and click on ''Secondary Mail Servers''.
The server you've just configured in the Webmin Servers Index should appear in the list with an empty checkbox beside it. Click the checkbox to activate it. If you already have domains on your server that you want to setup with secondary mail service, also check the ''Add all existing mail domains to secondary MX servers?''. Finally, click ''Save''.
That's it, you're done!
The simplest way to test if allowed addresses are being sent to secondary mail servers to prevent backscatter spam is to SSH into the primary system as root and run the command :
virtualmin syncmx-domain --all-domains
This will all send valid addresses in all mail domains on the primary system to all secondaries. If you have just added a new secondary or upgraded Virtualmin to version 3.87 (in which this feature was added), you should also run this command at least once.
Note: If you just want it to work and don't care how, you can stop reading at this point. This is merely for those folks who like to understand what's happening behind the scenes.
This Virtualmin Professional feature makes use of a couple of features of the mail RFCs. First up, it creates an additional MX record, with a lower priority (higher number, but lower priority in the sense that it won't be contacted unless the primary isn't responding) than the primary. Second, it adds an entry on the secondary server to the list of domains that the server will relay for. This causes the secondary to accept mail for the domain, despite not having a local mailbox to place it in.
Since the mail RFCs have well-defined rules about what to do in the event a server is down, this has the effect of causing the secondary to simply accept the mail and hold it in its queue until the primary comes back online. It will automatically attempt to resend the mail periodically, and will only bounce the mail back to the sender if the primary stays off-line for an extended period of time.
SMTPS and Submission are email protocols for encrypted authentication for outgoing email. By default, they use ports 465 and 587.
To set them up, you'd first need to add an SSL certificate for one of your Virtual Servers. Virtualmin can then copy that SSL certificate into Postfix for SMTPS and Submission.
To generate a self-signed SSL certificate, you can simply go into Edit Virtual Server for the domain in question, and set SSL Website Enabled.
Then, click Server Configuration -> Manage SSL Certificate. From there, you can click Copy to Postfix in order to enable SMTPS and Submission with your newly generated self-signed SSL certificate.
This will of course work just fine with a commercial SSL certificate. For instructions on setting up a commercial SSL certificate, see these instructions:
http://www.virtualmin.com/documentation/tutorial/how-to-add-an-ssl-certi...
By default, when your mail server sends out email the SMTP connection will come from the system's default IP address, typically that assigned to eth0 . Even if the email is from a domain that has its own private IP, that address will not be used when sending email.
This behavior can be changed on systems running Postfix version 2.7 and Virtualmin 3.94 or later, so that outgoing email from a domain with a private IP address appears to come from that address. This can be useful for separating email from multiple domains as seen by other mail servers, or for setting up per-domain reverse DNS records.
This feature requires Postfix 2.7 (seen on most modern Linux distributions), Virtualmin 3.93 and ideally Webmin 1.600. The steps to set it up are as follows :
root, and edit the /etc/postfix/main.cf file.sender_dependent_default_transport_maps . If it already exists, your system is already ready.sender_dependent_default_transport_maps = hash:/etc/postfix/dependenttouch /etc/postfix/dependentpostmap hash:/etc/postfix/dependentTo enable use of a domain's IP address for outgoing SMTP connections in Virtualmin, simply go to Server Configuration -> Email Settings , and change Send outgoing email for domain from IP to Virtual server's address . Then click the Save button.
You can also enable this feature using the API command modify-mail , with the --outgoing-ip flag.
Virtualmin allows you to enable spam and virus scanning on a per-virtual-server basis, and to configure what happens to email classifies as spam or virus-laden. Under the hood, it uses the popular SpamAssassin http://spamassassin.apache.org/ package for spam detection, and ClamAV http://www.clamav.net/ for viruses.
SpamAssassin assigns each message it scans a score indicating how spammy it is, based on the content and servers it was sent from. Typically, anything with a score above 5 is regarded as most likely spam. ClamAV however just compares the message contents with a database of know virus signatures, and reports if any were found or not.
In a typical Virtualmin installation, you can enable filtering for a new or existing virtual server by just selecting the Spam filtering enabled? and Virus filtering enabled? checkboxes in the features section of the Create or Edit Virtual Server page.
If they do not appear, make sure that these features are enabled globally on your system. This can be done as follows :
root, open the System Settings category on the left menu, and click on Features and Plugins.Internally, Virtualmin creates an /etc/procmailrc file that in turn runs a Procmail include file under /etc/webmin/virtual-server/procmail, depending on the domain to which each email received is sent. This then invokes the spamassassin and clamscan commands, then uses their output to decide if email should be delivered to a special folder or deleted.
SpamAsssassin is run with command-line parameters that tell it to use configuration files under /etc/webmin/virtual-server/spam, which can be different for each domain. This way, domain owners can customize their own SpamAssassin rules, spam levels and message modification settings.
By default, email classified as spam as delivered to the ~/Maildir/.spam file under each user's home directory. This shows up as a folder named spam in users' mail clients, and in Usermin. Email that is detected as containing viruses is deleted by default, as virus detection is almost 100% accurate.
However, you can change these destinations on a per-domain basis using Virtualmin. Some users may prefer that spam be deleted outright, or delivered normally so that it can be filtered by their mail clients. To change the delivery rules, the steps to follow are :
root or as the domain owner.In Virtualmin versions 3.54 and above, you can select to have email whose virus score is above some threshold deleted instead of being delivered to a spam folder. This can be used to stop the delivery of messages that are obviously spam, saving on disk spam and the bandwidth used to download them.
To delete high-scoring spam, just follow the steps above and set the Delete spam if score is above field to some number like 10.
If you have spam and virus delivery destinations that you want used for all new domains, you can set them as follows :
root.To make changes for all existing domains, use the modify-spam.pl command-line API script.
If Virtualmin is configured to deliver spam to a separate folder for each user, this can end up consuming a lot of disk space and disk quotas. To keep usage down, it is possible have Virtualmin automatically delete users' spam that is more than a certain number of days old, or is taking up more than some amount of disk space.
To set this up for a single domain, the steps to follow are :
If you prefer to delete based on disk usage, select Yes, when mailbox exceeds instead and enter a maximum size for the spam folder. When this is exceeded, messages will be deleted oldest first until it is smaller than the specified size.
The default setting for new virtual servers can be set on the Module Config page in the Spam filtering options section. To make changes for all existing domains, use the modify-spam.pl command-line API script.
By default, Debian 4.0 (Etch) comes with ClamAV packages that are out of date and buggy.
The most common symptom of this is very slow virus scanning, and high CPU load from clamscan or clamd. However, there is a fix - you can update to a newer ClamAV version from the Debian volatile repository, at http://www.debian.org/volatile/
To use the volatile repository, SSH into your system as root and edit /etc/apt/sources.list. At the bottom, add the line :
deb http://volatile.debian.org/debian-volatile etch/volatile main contrib non-free
Then update ClamAV packages with the commands:
apt-get update
apt-get install clamav clamav-base clamav-daemon clamav-freshclam
In the default Virtualmin configuration, each email received is processed with the clamscan command to check if it contains viruses. Unfortunately, this can take anywhere from seconds to minutes to run, particularly on VPS systems that have limited IO bandwidth or CPU resources. Most of this time is spent loading the virus database, which is continually growing as new viruses are found by the ClamAV authors.
Slowness running clamscan can cause email delivery to be delayed by several minutes, during which messages stay in the Postfix mail queue. It can also lead to high CPU load on the system, which then slows down other services like Apache or MySQL.
Fortunately, there is a fix - the clamd server process, which loads the virus database just once and then stays running. When email arrives, the clamdscan command connects to it, passes over the message to be scanned, then reads back the results. This typically only takes a seconds, even on a system with limited resources.
If your system is receiving a large amount of email, I recommend the use of clamd. It probably isn't worth running on a system used primarily as a web server though, as it consumes about 64M of RAM at all times.
To enable the use of the ClamAV server process, follow these steps :
root.clamd on your operating system, and you will need to do it manually.Virtualmin will check if clamd and clamdscan are working properly, and if so configure all virtual servers to use it for virus classification from now on.
If Virtualmin reports that the clamscan command is not working on your system, here are some things to try :
freshclam to download the virus database. On some systems, the standard ClamAV packages do not include any virus data files, so clamscan cannot run.Example line from /etc/freshclam.conf. On some systems this line exists by default, to intentionally prevent freshclam from running!/etc/clamd.conf matches the directory updated by freshclam. If not, clamd will not start due to the lack of data files.SpamAssassin and ClamAV can use up a lot of CPU time, which on a system that receives a lot of email can significantly slow down email processing. However, it is possible to move some of this load to a separate system, by making use of spamd and clamd, the SpamAssassin and ClamAV server processes.
These can be run on one or two other systems on your network, and Virtualmin on the master system that actually receives email configured to offload scanning to them.
In the instructions below, serverip is the IP address of the system that will be running spamd, and virtualminip is the IP of the Virtualmin machine.
spamd on as rootyum install spamassassin/etc/sysconfig/spamassassin and add the following to the SPAMDOPTIONS line : -i serverip -A virtualmin-ipAn example file would look like : # Options to spamd SPAMDOPTIONS="-d -c -m5 -H -i 193.9.101.242 -A 193.9.101.104"
spamd : /etc/init.d/spamassassin restart chkconfig spamassassin on
spamd on as rootapt-get install spamassassin/etc/default/spamassassin , and change the line ENABLED=0 to ENABLED=1.OPTIONS line : -i serverip -A virtualmin-ipAn example completed line would look like : OPTIONS="--create-prefs --max-children 5 --helper-home-dir -i 193.9.101.120 -A 193.9.101.104"spamd : /etc/init.d/spamassassin restart update-rc.d -f spamassassin defaults
Once spamd is running on the remote system, you can configure Virtualmin to use it as follows. Note that this will prevent domains and mailboxes from having their own SpamAssassin rules, unless you setup spam to fetch them from a MySQL or LDAP database .
root, and go to Email Messages -> Spam and Virus Scanning.Now try sending email to a mailbox in one of the domains with spam filtering enabled on your Virtualmin server, and check if SpamAssassin X-Spam headers are added. If not, check /var/log/mail* on both the Virtualmin and spam scanning systems for error messages, and /var/log/procmail.log.
The easiest way to setup clamd is to use Virtualmin's built-in support for configuring it. The steps to do this are :
clamd. You don't need to create any domains, or run any other servers like MySQL or Postfix.root, and edit the file /etc/clamd.conf and make sure the line TCPSocket 3310 exists and is not commented out.TCPAddr 127.0.0.1 does not exist or is commented out./etc/init.d/clamd-virtualmin restart or /etc/init.d/clamd restart to apply the configuration changes.Unfortunately, the executables provided as part of the ClamAV package do not seem to support connecting to a remote server. However, the clamd-stream-client program can do this, and can be used by Virtualmin versions 3.63 and later. You can download it from : https://sourceforge.net/projects/clamd-stream-cl/
Once you have the clamd-stream-client-1.3.tar.gz file on your Virtualmin system, it can be compiled and installed with the commands :
tar xvzf clamd-stream-client-1.3.tar.gz cd clamd-stream-client-1.3 ./configure make make install
You can now configure Virtualmin 3.63 or later to use it as follows :
root, and go to Email Messages -> Spam and Virus Scanning.Assuming that clamd-stream-client works and can contact the remote system, it will be enabled and used for virus scanning for all domains.
Mail is perhaps the most complex component in a Virtualmin system, combining a mail transfer agent (usually Postfix, but optionally Sendmail or qmail), a mail delivery agent (usually procmail), POP3/IMAP retrieval (usually Dovecot), anti-virus (ClamAV), anti-spam (SpamAssassin), and mail log analysis (Virtualmin's built-in mail log analysis tools, and optionally logwatch and others). If any one of these components fails, mail may be completely broken for some or all tasks.
The first place to look for information about a mail problem is the relevant logs. On Red Hat, Fedora, CentOS, SUSE, and Mandriva systems, the majority of mail related logging is directed to /var/log/maillog. Thus, you should check the contents of this log while attempting whatever action is giving you trouble. Most failed actions will result in a log action, possibly a very helpful one. The log /var/log/secure may also contain information about failed login attempts, possibly including a reason.
On Debian and Ubuntu systems the mail log is called /var/log/mail.log and will contain similar information as that found in the /var/log/maillog mentioned previously. Debian/Ubuntu also has a /var/log/mail.err and /var/log/mail.info which may or may not contain information, depending on the MTA in use and the configuration of syslog.
Many issues with mail can be traced back to incorrect DNS configuration. Check to be sure DNS works for the problem domain, and returns valid records. In particular, check the MX record and the name it points to to be sure other hosts can correctly look up the address of your server.
To test DNS resolution you can use the host and dig commands.
For example, here's and example interaction checking the MX record for virtualmin.com:
# host -t mx virtualmin.com virtualmin.com mail is handled by 5 mail.virtualmin.com. # host mail.virtualmin.com mail.virtualmin.com has address 70.86.4.226
This first checks for a MX (mail exchange) record, and then checks to see what address that name resolves to. Mail servers must also reverse resolve in order to be able to deliver to a large number of mail servers on the Internet, as reverse resolution is used as a simple tool to reduce spam by ruling out many classes of dynamic address (like some dialup accounts). Reverse resolution can also be tested with host:
# host 70.86.4.226
226.4.86.70.in-addr.arpa domain name pointer e2.4.5646.static.theplanet.com.Note that it doesn't matter what the server reverse resolves to. It just matters that it does resolve.
Note also that if you run these commands on your Virtualmin server, you aren't necessarily getting a complete picture of DNS. If your glue records at your registrar are incorrect, hosts other than the Virtualmin server will get completely different results from these commands (and they will also be unable to talk to your server, since they're looking for name information in the wrong place). You can use whois to check your glue records, but that's beyond the scope of simple email troubleshooting. See the Webmin BIND documentation, particularly the http://doxfer.com/Webmin/BINDTroubleshootingTools|BIND Troubleshooting Tools section.
Sometimes it can seem like you've hooked right into the firehose that is the Internet and spam is spewing directly into your mailbox without any limit. It may be, if SpamAssassin isn't configured correctly or procmail is broken in some way. To find out if your mail is being processed by the spam filter, look in the headers of a message received on your server. In Usermin or the Webmin Read Mail module, you can see the headers on a message by clicking the View Full Headers link in the upper right corner of the email. Most mail clients have some sort of option to allow you to see the raw message or the full headers.
If spam filtering is happening correctly, there will be one or more X-Spam-* headers within the header. If no such message appears, procmail or SpamAssassin may be disabled for domain or the user, or mis-configured.
This one is even easier to test. Write yourself an email with an attachment containing the EICAR test string. If it makes it to your mailbox, then AV scanning isn't working. If it doesn't, things are working fine.
The EICAR test string and information about it, can be found on the http://www.eicar.org/anti_virus_test_file.htm|EICAR home page.
Many mail servers in the wild will reject email from a server without correct reverse resolution.
Reverse is different than forward resolution. The authoritative server is defined by the owner of the IP address (i.e. your hosting provider or network service provider). Usually, this is just setup to whatever the provider likes, and that's fine. It doesn't matter what name it resolves to, as long as it resolves to something.
Webmin handles reverse DNS zones--but it's out of the scope of Virtualmin, because Virtualmin would end up assigning a new name every time you created a new virtual server on a shared IP. By that, I mean that you create one reverse entry for every IP address--not one for every virtual host that lives on it. It's also not something we can automate away--it requires cooperation from your hosting or network provider, or whoever is authoritative for your IP addresses.
So, to add reverse DNS, you'll first have to figure out who is authoritative for your IP address(es), and ask them to do one of the following:
Provide a reverse entry for all of your IPs in their DNS servers.
Delegate the zone to your DNS servers. everydns.net probably does not provide reverse resolution services, so you'll need to point them to your Virtualmin server, fire up BIND, and create those entries.
You definitely want reverse lookups on your IP to work, as it's considered "spammy" by most spam filters and mail servers when it doesn't.
You can find out what name servers are currently responsible for a zone with:
whois 192.168.1.1
Replacing 192.168.1.1 with your servers IP address, it will list lots of details about the IP, including the servers for the PTR records.
In most cases, if Usermin webmail does not include the correct From: address, it is incorrectly configured. The default was not being set correctly in our automated installer until recently due to a bug.
The old default would default to a From: address of the form "user-domain@hostingco.tld", when it should instead be "user@domain.tld".
To correct this problem:
Browse to Webmin:Usermin Configuration:Usermin Module Configuration:Read Mail page
Locate the option labeled From: address mapping file, and set it to /etc/postfix/virtual
Locate the option labeled Address mapping file format, and set it to Address to username (virtusertable)
Save it.
A particularly tricky problem with mail processing, delivery, and retrieval may be seen on systems that use disk quotas. Specifically, it will manifest as errors about disk space, even on a disk with plenty of free space.
Because mail processing with SpamAssassin and ClamAV can be temporarily very disk space intensive, it can run into disk quotas while it will appear that disk usage is still well below the limit you've imposed.
The solution to this problem is to mount the /tmp directory that clamav or clamd are configured to use on a partition separate from /home. This will allow clam to use as much space as it needs in order to decompress files and process them.
We now recommend all installations that will use disk quotas to use an independent /home partition--that is separate from /, /tmp/, and /var directories.
This is caused by the inability of Dovecot to manage its index files on a "full" disk. Dovecot can be configured to place indexes in a different location from the mailbox, which resolves this problem (though it does mean users can use slightly more than their disk quota on the system, but indexes are generally pretty small, so this shouldn't be a big concern).
To configure Dovecot to use an alternate location for index files, you can set the following in the dovecot.conf:
default_mail_env = maildir:%h/Maildir:INDEX=/var/cache/dovecot/index/%u:CONTROL=/var/cache/dovecot/control/%u
Or (depending on the Dovecot version):
mail_location = maildir:%h/Maildir:INDEX=/var/cache/dovecot/index/%u:CONTROL=/var/cache/dovecot/control/%u
This will tell Dovecot to use a different filesystem for those control and index files that it is having trouble writing to. Just make sure you create /var/cache/dovecot/index and /var/cache/dovecot/control first, and make them mode 6777.
Then re-start the Dovecot server.
If you don't have multiple filesystems to place the Dovecot files on, you can always create a loopback filesystem.
To do that, first create an image file using 'dd'. The following example will create a 100MB image file:
dd if=/dev/zero of=/virtualfs bs=1024 count=100000
Then, type the following to attach the first Linux loopback device (/dev/loop0) with the image file you created above:
losetup /dev/loop0 /virtualfs
You can then proceed to create a filesystem on the image:
mke2fs -j /dev/loop0
Then, assuming you wish to mount it at "/var/cache/dovecot", you can mount it with the following command:
mount -t ext3 /dev/loop0 /var/cache/dovecot
You'll also want to add an entry for this into your /etc/fstab file.
The Webmin wiki covers the following topics in some detail:
Documentation is divided into a few categories, such as "Email", "DNS", and "Database", which covers the common types of service you'll be managing with your Virtualmin installation. Within each category you'll find a few types of document, such as "FAQ", "Troubleshooting", and specific task guides.
Pages labeled "FAQ" or "Frequently Asked Questions" are intended primarily for common questions new users, or potential users, ask about Virtualmin and the services it manages. For example, the FAQ for Email includes a brief, non-technical, description of the email processing stack in a default Virtualmin system. The FAQs are generally non-technical in nature, and do not generally provide solutions to problems. They are conceptual and broad, merely to describe the way Virtualmin does things.
Pages labeled "Troubleshooting" are intended to help you solve specific problems. If you are receiving an error message from a service or Virtualmin, the troubleshooting section for that particular service may have solutions. For example, the Web troubleshooting guide includes solutions to many problems relating to problems running applications, error conditions, and VirtualHost related anomalies (such as the wrong site showing up, or confusion about "default" websites). Troubleshooting pages are specific and technical, and are intended to help you solve problems.
Documentation is tagged with the projects or products to which it applies. A few features in Virtualmin and Cloudmin only apply to the Professional version of the product, and they will be tagged with "Virtualmin Pro" or "Cloudmin Pro". Features that apply to both products will be also be tagged "Virtualmin GPL" or "Cloudmin GPL".
You can also search just the documentation by opening the search form and using the Advanced Search form to search within content "Only of the type(s)" and choosing "Book page".
The search page, by default, searches all of the content on Virtualmin.com, including forums, issues, and documentation. This may, or may not, be what you want, depending on the questions you have.
Virtualmin can be installed in a number of ways, including an automated install script which uses the standard package management features of your OS, and software repositories containing our software in native package formats. We strongly recommend that you use the automated install script to install Virtualmin, if at all possible.
Automated Installation - Installation of the full Virtualmin stack using our automated install script. This is the recommended way to install Virtualmin.
Manual Installation - Installation of Virtualmin and related packages manually. This method is time-consuming, and requires a high level of technical experience. This is not recommended, except in cases where the automated installation is inappropriate or impossible.
Installation Troubleshooting - Troubleshooting common problems encountered during installation.
Uninstalling Virtualmin - Uninstallation, downgrading from Virtualmin Professional to Virtualmin GPL, and selective removal of packages.
There are two methods for installing Virtualmin: a fully automated shell script and package-based install, as documented here, and a manual installation using either native packages or .wbm Webmin packages, as documented in the Manual Virtualmin Installation page. When possible, the automated installation is recommended, as it removes many possible errors during configuration and insures that all applications are built with appropriate options for virtual hosting within the Virtualmin system.
Installation involves first installing a basic install of your preferred Operating System, according to the documentation provided by your OS vendor. If the vendor provides a "server" version of the system, it is generally recommended you use it, as it will include fewer extraneous packages. A list of supported Operating Systems is provided at the OS Support page. There are a few simple guidelines for your system that must be met for proper operation of all Virtualmin features, which are detailed in the rest of this section.
The partitions on your Virtualmin server should be allocated in one of the the following two ways, depending on your requirements and preference. Either partition scheme is supported by the Virtualmin Professional Installer. Other partition layouts may lead to incorrect configuration of filesystem quotas, but can be corrected after installation is completed if other partitioning schemes are preferred.
In this partition layout, you will only have one system partition plus a swap partition and /boot partition. The system partition contains /home for users, /var for logs and databases, as well as all of the normal system executable files, documentation and libraries. It is often simpler to deploy. Traditionally, "one big partition" was considered problematic from an administration standpoint, but most such issues have been resolved by modern filesystems, backup utilities, and improved hardware reliability. If you are unsure what to choose for your needs, this is probably the right option.
swap: The swap partition should be at least twice the size of RAM on the system.
/boot: The /boot partition should be large enough to accomodate a few system kernels and initrd images. Your OS vendor probably knows best what size this should be.
/: The remainder of the disk(s) should be devoted to /. This is where all system and user data will go.
This layout spreads files across a few partitions, in order to facilitate usage of some types of backup utility as well as making some types of administrative task easier (for example, installing larger disks for some partitions at a later time). Historically, multiple partitions were considered wise administrative policy, but most modern systems and backup utilities eliminate the reasons for utilizing multiple partitions. Unless you know why you are dividing your disks into lots of partitions and can't achieve your goals any other way, you probably shouldn't.
/: This partition is used for all of the operating system files, executables, and configuration files. This partition should be at least 3.5 GB for most operating systems.
/boot: The /boot partition should be large enough to accommodate a few system kernels and initrd images. Your OS vendor probably knows best what size this should be.
swap: The swap partition should be at least twice the size of RAM on the system.
/var: The /var partition is where system logs, various changing data, and MySQL and PostgreSQL databases are stored. Depending on whether you will allow your domain users to use the database features, this partition may be between 2 GB and 10 or more GB. If users are expected to be heavy database users, you may opt to divide the remaining disk space between /var and /home.
/home: The home partition is where all of your domain users data, email, CGI scripts, logs etc. will be stored. Pretty much anything that belongs to your users, except for MySQL and PostgreSQL databases, will reside on /home. Devote the remainder of your disk to /home, as usage will likely grow rapidly if you have many users.
In order for the install.sh installation method to work, your system must have a working package management system. Supported systems are yum and up2date on RPM-based systems, and apt-get on Debian and Ubuntu systems. The FreeBSD ports and pkg system is used, when possible, though limitations of package management on FreeBSD only allows system packages to be installed via these means, while the Virtualmin packages are installed from our own wbm package repository. The Virtualmin Professional installer uses the native package manager in order to cleanly and safely install all of the appropriate software dependencies. The installer will then install the Virtualmin-provided packages, including some custom versions of packages that include features necessary for all features of Virtualmin to operate. If your native package management tool requires configuration to operate correctly, this step should be done before running the Virtualmin install script. Most distributions come with a working package management system; CentOS and RHEL will use yum, Debian and Ubuntu will use apt, and FreeBSD will use the ports system and the remote installation capability of pkg_add.
Packages in Virtualmin depend on a lot of OS-standard packages in addition to the packages our repositories provide. And most package managers are a bit temperamental about dependencies; sometimes they'll refuse to install a package because an older version of one of its dependencies is installed. So, in order to avoid dependency problems of this sort it is best to fully update your system using your native package manager prior to running the install script.
The Virtualmin installer requires network connectivity, including DNS resolution. The speed of your connection may impact the speed of installation, as up to 200 MB of packages will be downloaded and installed (if your system already has the majority of the dependencies installed, the download size will be reduced). Latency and bandwidth usage can be reduced significantly for multiple system installations by running a local caching proxy server like Squid, or by operating a mirror of the Operating System being used. It is also possible to pre-install most of the packages during OS installation, and only updates will need to be downloaded over the network.
So, let's boil down all of those preliminaries into a simple checklist. These are the things you need to do before running the install.sh:
Note: If you are installing on a low memory system, the package manager (both yum and apt-get/dpkg) can be very memory intensive during installation. A possible solution is to disable all but the necessary repositories (the OS standard repositories and the Virtualmin repositories. This is generally a good idea, anyway, as packages from non-OS sources may conflict with the Virtualmin packages and lead to unpredictable results.
Installation is performed automatically by the OS-neutral Virtualmin install.sh script. This script sets up the license key in /etc/virtualmin-license and configures the appropriate package management and installation tool for use with the password-protected Virtualmin software repository. It will then install the virtualmin-base package, which performs the remainder of the installation, appropriate for your OS and version.
Download the file from the Software Registrations page at [[http://www.virtualmin.com/serial/]]. All of your purchased products will be available for download throughout the life of your license period. Copy the file on to the server to be installed, using scp on Linux or Mac OS X client machines or WinSCP or PSCP on Windows.
Note: A frequent source of trouble is the use of FTP to make the transfer to your server. Because Windows uses different line endings than UNIX and Linux systems, the script can become corrupted if care is not taken to insure a "binary" mode transfer. scp and FTP over SSH are not generally subject to this problem, and so using the scp protocol for the transfer avoids many possible troubles.
Then, as root, run this:
# sh ./install.sh
Depending on your OS and the state of your system, the install.sh script may ask one or more questions.
If your system does not have a fully qualified domain name (FQDN), the installer will stop and ask you to choose one. This is mandatory because many services rely on having a fully qualified domain name in order to function. Mail, in particular, but some Apache configurations and many of the Virtualmin-created configuration files, also require a valid fully qualified domain name to function correctly. A fully qualified domain name is one of the form "www.virtualmin.com", or simply "virtualmin.com". We recommend you choose a name that is not one for which you will be receiving mail, in order to simplify later configuration. A good choice is to use a name server designator, such as "ns1.virtualmin.com". Some customers also choose something like "host1.virtualmin.com" or "primary.virtualmin.com". Any of these would be valid and would satisfy the install script and the services that rely on this option. The install script will add this name to /etc/hosts, which will satisfy all local services. It is even better if this name resolves correctly when looked up from outside of the system--this requires the name be added to your DNS zone for the second level domain. If the Virtualmin server you are installing will be the authoritative name server for this zone, you can later use Webmin to add a record for this name to the zone.
Once the necessary questions have been answered, installation will proceed automatically. After 15-45 minutes, depending on the speed of your network connection, your system will be configured for Virtualmin and ready to login to. You can then login to Virtualmin. Virtualmin runs on port 10000 and is encrypted using SSL. Thus, you can connect to your system with an address of the form:
https://example.com:10000
Or:
https://192.168.1.1:10000
And then log in as the "root" user, or any user with sudo access.
The final step in the installation is to perform the configuration check, by clicking the Check Configuration button at the top of the Virtualmin System Information page.
If your system does not have a password set for the root user, you will need to set a Virtualmin root password before you can login on port 10000. This can be the case when installing on an EC2 instance that uses an SSH key to login as root, or an Ubuntu system that uses sudo.
To set a root password for Virtualmin, run the command :
/usr/{share,libexec}/webmin/changepass.pl /etc/webmin root XYZ
where XYZ is the password you want to use. Make sure it is strong, as an attacker who guesses this password would have full control over your system.
Unlike the Automated Virtualmin Installation, to make use of this installation type, your OS does not need to be freshly installed, nor does it need to be a supported operating system. This method, however, requires significantly more knowledge on the part of the person doing the installation, and a much larger time investment to insure that all necessary configuration is performed and all Virtualmin managed services are working correctly.
If you are not extremely comfortable with your operating system, the services used in a hosting system, and performing various configuration tasks from the command line, you are advised to use the automatic installation on a Grade A supported operating system.
The partitions on your Virtualmin server should be allocated in one of the the following two ways, depending on your requirements and preference. Either partition scheme is supported by the Virtualmin Professional Installer. Other partition layouts may lead to incorrect configuration of filesystem quotas, but can be corrected after installation is completed if other partitioning schemes are preferred.
In this partition layout, you will only have one system partition plus a swap partition and /boot partition. The system partition contains /home for users, /var for logs and databases, as well as all of the normal system executable files, documentation and libraries. It is often simpler to deploy. Traditionally, "one big partition" was considered problematic from an administration standpoint, but most such issues have been resolved by modern filesystems, backup utilities, and improved hardware reliability.
swap: The swap partition should be at least twice the size of RAM on the system.
/boot: The /boot partition should be large enough to accomodate a few system kernels and initrd images. Your OS vendor probably knows best what size this should be.
/: The remainder of the disk(s) should be devoted to /. This is where all system and user data will go.
Note If you plan to use disk quotas, you should be aware of a few potential gotchas with this type of deployment. Quotas apply to all files on a given partition, regardless of the directory. In the case of mail delivery and processing, there are several very sneaky ways for this to cause failures of various types. Because of this, if you are using disk quotas, you probably want to make /home its own very large partition.
This layout spreads files across a few partitions, in order to facilitate usage some types of backup utility as well as making some types of administrative task easier (for example, installing larger disks for some partitions at a later time). Historically, multiple partitions were considered wise administrative policy, but most modern systems and backup utilities eliminate the reasons for utilizing multiple partitions.
/: This partition is used for all of the operating system files, executables, and configuration files. This partition should be at least 3.5 GB for most operating systems.
/boot: The /boot partition should be large enough to accommodate a few system kernels and initrd images. Your OS vendor probably knows best what size this should be.
swap: The swap partition should be at least twice the size of RAM on the system.
/var: The /var partition is where system logs, various changing data, and MySQL and PostgreSQL databases are stored. Depending on whether you will allow your domain users to use the database features, this partition may be between 2 GB and 10 or more GB. If users are expected to be heavy database users, you may opt to divide the remaining disk space between /var and /home.
/home: The home partition is where all of your domain users data, email, CGI scripts, logs etc. will be stored. Pretty much anything that belongs to your users, except for MySQL and PostgreSQL databases, will reside on /home. Devote the remainder of your disk to /home, as usage will likely grow rapidly if you have many users.
Install the following applications, using whatever method is appropriate for your operating system:
With the exception of Apache, standard versions of these applications are usually sufficient, as long as they are reasonably modern and have all security patches applied.
Additionally, if your system supports disk quotas, and you will be using them with Virtualmin, you need the management tools for disk quotas. Webmin also provides support for firewall management on most UNIX and Linux platforms, assuming the appropriate command line tools are available.
Note The Apache web server package provided with most operating systems requires customization to be suitable for use in a virtual hosting system, specifically it must be rebuilt with suexec_docroot set to /home. The standard OS Apache package will not work with applications in home directories, and thus is not suitable for virtual hosting usage. A custom build of Apache is not optional. This configuration cannot be done without a rebuild of the suexec binary, for security reasons. Debian and Ubuntu provide an apache-suexec-custom package that can be used, instead of rebuilding the binary; it must be installed and configured appropriately for executing scripts in /home (but, Debian and Ubuntu LTS are both Grade A supported operating systems by our install script, and so there should rarely, if ever, be a need to perform a manual install on these operating systems).
Download and install Webmin and Usermin, from http://www.webmin.com Webmin.com. There are multiple package types of available, so choose the most appropriate one for your OS. Installation instructions can be found on the Webmin site.
Once Webmin is operational you can download and install the Virtualmin modules and theme in either RPM format (for RPM-based Linux distributions), deb format (for deb-based Linux distributions), or wbm format (for any other UNIX or Linux system), and install them using the Webmin Modules module found in Webmin:Webmin Configuration.
The modules and themes can be found in the following locations:
http://software.virtualmin.com/wbm - wbm format modules
http://software.virtualmin.com/universal - RPM format modules for all RPM-based Linux distributions
http://software.virtualmin.com/debian/dists/virtualmin-universal/main/ - Debian module packages
http://software.virtualmin.com/ubuntu/dists/virtualmin-hardy/main/ - Ubuntu Hardy Heron (8.04 LTS) packages
http://software.virtualmin.com/ubuntu/dists/virtualmin-universal/main/ - Ubuntu Lucid Lynx (10.04 LTS) packages
You will need to make a note of your serial number and license key, found on the http://www.virtualmin.com/serial/|Serial Numbers page at Virtualmin.com, so that you can login using the serial number as the username and the license key as the password.
http://software.virtualmin.com/gpl/wbm - wbm format modules
http://software.virtualmin.com/gpl/universal - RPM format modules
http://software.virtualmin.com/gpl/debian/dists/virtualmin-universal/main/ - Debian module packages
http://software.virtualmin.com/gpl/ubuntu/dists/virtualmin-hardy/main/bi... - Ubuntu Hardy Heron (8.04LTS) packages
http://software.virtualmin.com/gpl/ubuntu/dists/virtualmin-universal/main/ - Ubuntu Lucid Lynx (10.04 LTS) packages
On most platforms Apache must be built with suexec_docroot set to /home. This requires a recompile of Apache. We provide packages for the most popular operating systems in our GPL repositories at http://software.virtualmin.com/gpl/. For other systems, you will need to download a source package from your OS vendor and rebuild it with the necessary change.
On Debian and Ubuntu systems, you can instead use the apache2-suexec-custom package. This option requires no rebuild of Apache. Configuring the custom suexec package is performed in /etc/apache2/suexec/www-data, and is as simple as changing the first line from /var/www to /home.
If installing on Ubuntu, you'll need to edit /etc/apache2/conf.d/php5.conf, and comment out the two SetHandler lines.
BIND needs to be installed, and configured to accept queries from any address. Also, it is recommended that you configure the system to query the local name server by adding 127.0.0.1 to /etc/resolv.conf.
Postfix should be installed, and configured for virtual hosting. The best way to do this for the vast majority of deployments is to use a simple map file.
Edit main.cf and add the following line:
virtual_alias_maps = hash:/etc/postfix/virtual
Also, make sure that home_mailbox is set to Maildir/.
Save it, and restart Postfix.
Procmail is necessary if you plan to make use of the spam and anti-virus filtering capabilities in Virtualmin. A reasonable starting procmailrc might be:
LOGFILE=/var/log/procmail.log TRAP=/usr/libexec/webmin/virtual-server/procmail-logger.pl VERBOSE=true :0wi VIRTUALMIN=|/etc/webmin/virtual-server/lookup-domain.pl $LOGNAME :0 * ?test "$VIRTUALMIN" != "" { INCLUDERC=/etc/webmin/virtual-server/procmail/$VIRTUALMIN } DROPPRIVS=yes DEFAULT=$HOME/Maildir/ ORGMAIL=$HOME/Maildir/
The procmail-wrapper program is necessary for for mail to work properly, and in particular, spam and virus processing.
First, put the following code into a file named procmail-wrapper.c:
#include <stdio.h>
#ifndef REAL_PROCMAIL
#define REAL_PROCMAIL "/usr/bin/procmail"
#endif
int main(int argc, char **argv)
{
setuid(geteuid());
setgid(getegid());
execv(REAL_PROCMAIL, argv);
}Then, run the following commands to compile the code, install it into /usr/bin, and give it the proper permissions:
gcc -o /usr/bin/procmail-wrapper procmail-wrapper.c chmod 6755 /usr/bin/procmail-wrapper
Lastly, edit /etc/postfix/main.cf, and set mailbox_command to the following:
mailbox_command = /usr/bin/procmail-wrapper -o -a $DOMAIN -d $LOGNAME
SpamAssassin should be installed if you will be using the spam filtering features of Virtualmin.
ClamAV should be installed if you will be using the anti-virus features of Virtualmin.
Dovecot should be installed and configured for use with Maildir mail spools.
PAM or shadow authentication should be used.
ProFTPd should be installed.
PAM or shadow authentication should be used.
If you plan to use MySQL, or any of the Install Scripts in Virtualmin Professional that rely on MySQL, it should be installed, and accessible to localhost. The root account should have a password set. Once Webmin is installed, you will need to configure the MySQL module to know the root MySQL password.
Note - Virtualmin does not require MySQL, and no Virtualmin-related user data is stored in MySQL. If you've read setup guides on the web for virtual mail hosting that require MySQL, we strongly recommend you ignore them. This is a very common source of confusion for new users, and there's simply no reason to introduce the complexity of this kind of deployment.
If you plan to use PostgreSQL or any of the Install Scripts in Virtualmin Professional that rely on PostgreSQL, it should be installed, and accessible to localhost.
If users will be sending email through your server, you will need to configure saslauthd. This requires interaction with your MTA (probably Postfix), and it should be configured to use PAM or shadow authentication.
When enabled, Virtualmin can allow your users to create and manage Mailman mailing lists.
Most installation problems are related to network connectivity, package management, or attempting to run the install script on an unsupported operating system or architecture.
Check the virtualmin-install.log. It is possible that your package manager is configured to use a local CD ROM device for packages, and the disk is unavailable. Another possibility is that connections to one or more repositories are timing out, and causing the system to install packages very slowly.
If your system has low memory (512MB or less), things may take much longer to install than normal, as the package manager (yum or apt) may grow larger than physical memory and push the process into swap memory. So, installation on small VPS systems may take an hour or more.
If your package manager is configured to use non-OS package repositories, or if you have installed alternative versions of packages before installation, conflicts are likely to occur during installation. If you plan to use non-OS standard packages (other than those provided by Virtualmin repositories), they should be installed after installation of Virtualmin, and you should add an exclude directive to the yum or apt-get configuration in order to insure similar conflicts do not happen in the future.
Also note that if you are using non-OS standard packages, you may need to configure the relevant Webmin module to make it aware of the location of the configuration files.
Note that if your Linux distribution was installed by your ISP (such as with a VPS image), you may want to verify that no additional repositories were setup.
If you have run any so-called "hardening scripts" on your system before running install.sh, your /tmp directory may be mounted noexec. It is always best to run the install script on a freshly installed supported Operating System, though this particular issue can be resolved. The install script cannot complete if this is the case, and /tmp will need to be remounted to allow executables.
To do that:
# mount -o remount,exec /tmp
If you wish to switch back to your original settings after installation, you can use this command to reset the noexec option:
# mount -o remount,noexec /tmp
ClamAV is updated frequently by the upstream developers. Your OS repository may not have the latest version, which causes ClamAV to issue very scary warnings. These warnings are non-fatal, and can generally be safely ignored.
If you are using CentOS, the ClamAV packages come from our repositories, and are updated every few weeks, as time and testing schedules allow. So, if you see this error, it will go away with the next update.
If you are using Debian, you may consider enabling the "volatile" apt-get repository, as it includes newer versions of ClamAV and SpamAssassin, which are both rapidly moving targets and worth running recent versions of.
Virtualmin Professional customers receive free installation service if the automated installation process fails to work correctly on any Grade A or B supported operating system listed on the OS Support page. Open a ticket in the issue tracker with a description of your problem and the relevant portion of the virtualmin-installation.log, and we will try to walk you through to a solution, or log into your system and complete the installation free of charge.
Virtualmin GPL users can make use of the forums to ask for assistance with any problems that arise during installation.
There are many levels of "uninstalling" Virtualmin, but the most common is simply that you don't want the Virtualmin GUI or any of its plugins installed. The simplest way to accomplish this, assuming you used the automated installation process (install.sh), is to re-run install.sh with the - -uninstall flag:
sh install.sh --uninstall
This is a rather haphazard uninstall routine, but it will remove pretty much everything Virtualmin-specific while leaving behind the services that it manages (like Apache and BIND).
Note This will remove Virtualmin related meta-data. This should never be used to allow you to "reinstall" Virtualmin on a production system. If you have Virtualmin running on a production system with accounts, you should not try to install Virtualmin again. If there are any problems with your running installation, let us know and we'll help you fix the problems. However, it can be used to cleanup after a prior failed install--perhaps after we've fixed a bug or something in the installer and you'd like to run it again but run into conflicts (perhaps virtualmin-release is in the way).
If you no longer need the features of Virtualmin Professional, but wish to continue to use Virtualmin on your system, you can downgrade quite easily.
In its simplest form, you merely install the Virtualmin GPL module over the Virtualmin Professional module. How that is done depends on your OS and how Virtualmin was initially installed.
On RPM-based distributions, like CentOS or RHEL, download the latest Virtualmin GPL RPM from http://software.virtualmin.com/gpl/universal/
Then install it using RPM with the --oldpackage option. For example:
rpm -Uvh --oldpackage wbm-virtual-server-3.64.gpl-2.noarch.rpm
If you were also using our yum repository (which is true if you used install.sh to install Virtualmin), you will need to switch the the GPL repository. To do that, install the latest version of the virtualmin-release package for your operating system and version. For example, for CentOS 5, you could run the following command:
rpm -Uvh --oldpackage http://software.virtualmin.com/gpl/centos/5/i386/virtualmin-release-latest.noarch.rpm
On Debian and Ubuntu systems update /etc/apt/sources.list to point to the GPL version of the Virtualmin repository for your OS (merely insert gpl into the path just after the domain name).
Once apt has been reconfigured, you can use apt-get to install the GPL version of the webmin-virtual-server module.
If you didn't use packages, and instead used the .wbm format of module, download the latest version of the virtual-server module from http://software.virtualmin.com/gpl/wbm and install it using the Webmin modules module, found in the Webmin menu under Webmin:Webmin Configuration:Webmin Modules.
Once you've downgraded the virtual-server module to the GPL version, you can change the /etc/virtualmin-license file to :
SerialNumber=GPL LicenseKey=GPL
Then remove the /etc/webmin/virtual-server/licence.pl , sendratings.pl and fcgiclear.pl cron jobs. You can use the Webmin System:Schedule Cron Jobs module to locate and delete that job, if you like.
In a standard install of Virtualmin using our scripts, upgrades are typically done using APT or YUM. When a new version is available, you will see a message on the System Information page after logging in like :
Other packages may be listed too, depending on what is available to be updated. To install, just click the Install All Updates Now button.
Alternately, you can install the same packages from the command line as root. On CentOS or Redhat Enterprise, the command to use will be like :
yum install wbm-virtual-server bind perl python
On Debian or Ubuntu, you could use :
apt-get install webmin-virtual-server bind perl python
When upgrading Virtualmin Professional licenses, it is never necessary to re-install or perform any changes to your license on your system. Once a license upgrade has been applied on our server (usually immediately after confirmation of your purchase, but if there is any delay, you can open an issue identifying the serial number and your order number, and we will manually process it), you can click the "Re-check Virtualmin License" in the System Information page to immediately update the license details on your system.
(Make some Reseller and Mailbox/FTP User-specific docs)
This tutorial covers the various kinds of accounts available in Virtualmin.
Master Administrator -- this is the root user of the system. The root user has rights to manage any aspect of the server.
Reseller -- this user is created by the Master Administrator. They have rights to create Virtual Servers accounts for other users. Reseller accounts are a feature only available in Virtualmin Pro.
Virtual Server Owner -- a Virtual Server owner is the administrative user of a Virtual Server and any of it's Sub-Servers and Aliases. This user is created by either the Master Administrator or a Reseller.
Mail/FTP Users -- these users belong to a particular Virtual Server, and are setup to have Email access, FTP access, or both. These users are generally created by the Virtual Server Owner, though they can also be created by Resellers and the Master Administrator.
This tutorial covers how to add an SSL certificate to a Virtual server.
You will need an IP address dedicated to this purpose -- you can obtain IP addresses from the ISP hosting your server.
This tutorial assumes you have first logged into Virtualmin.
Choose the domain for which you would like to add the SSL Certificate. You can do that by selecting the domain name from the drop-down box on the top-left.
Click 'Server Configuration' -> 'Change IP Address'.
Click the radio button next to 'Use private address' in the 'New IP address' section.
Enter your Virtual Server's new private IP address you obtained for this SSL certificate in the 'Use private address' field.
Click 'Change now'.
Click Edit Virtual Server.
Click Enabled features.
Check the 'SSL website enabled?' checkbox.
Click Save Virtual Server.
At this point, you have a self-signed SSL Certificate. That means your communications are secured, but since this certificate wasn't generated by a certificate authority, your users will receive a security warning every time they access the site.
It's recommended that you get a commercial certificate -- the following steps detail how to obtain and install one.
Click Server Configuration.
Click Manage SSL Certificate.
Click Signing Request.
Enter the domain name you wish to use for SSL in the Server Name field.
Enter your email address in the Email Address field.
Enter your business name or organization in the Organisation field.
Click Generate CSR Now
This next step you have to do on your own. Take the resulting "CSR", and take it to one of the many companies able to create SSL certificates. Have them use the CSR you made to generate your SSL Certificate.
Click New Certificate.
Paste in the contents of the SSL Certificate you received into the Signed SSL certificate field.
Keep the Matching private key provided by Virtualmin.
Click Install Now.
Optional: If your SSL provider gave you a CA Bundle, or Intermediate Certificate, you can install that using the CA Certificate tab.
You should now be able to access your site securely by using https://example.com, where example.com is the domain name you used while generating your SSL Certificate.
This tutorial will cover how to backup a single Virtual Server.
It assumes you have first logged into Virtualmin.
Click Backup and Restore.
Click Backup Virtual Servers.
In Backup destination, select Download to browser
Click Backup Now.
A backup of your Virtual Server will begin, and will download to your PC.
This tutorial covers how to change a Mailbox or FTP user's from within Virtualmin.
It assumes you have first logged into Virtualmin.
Choose the domain for which you would like to change the user's password. You can do that by selecting the domain name from the drop-down box on the top-left.
Click Edit Email and FTP User's.
Click the name of the user who's password you would like to change.
Next to Password, click the Set to radio button.
In the textbox next to Set to, enter the new password.
Click Save.
This tutorial covers how to change a Virtual Server Owner's password from within Virtualmin.
It assumes you have first logged into Virtualmin.
Choose the domain for which you would like to change the password. You can do that by selecting the domain name from the drop-down box on the top-left.
Click Edit Virtual Server.
Click Configurable Settings
Next to Administration password, click the radio button marked Set to.
In the text area next to Set to, enter the new password.
Click Save Virtual Server.
This tutorial covers how to change your password from within Usermin.
It assumes you have logged into Usermin Webmail.
Click the Change Password link, towards the bottom on the left.
Enter your current password in the Current password field.
Enter your new password in the New Password field.
Enter your new password a second time in the New Password again field.
Click Change now.
This tutorial will cover how to setup a catch-all email account. Once finished, it will be the default destination for any email arriving at your domain, unless overridden by another email account or alias.
It assumes you have logged into Virtualmin as the root user.
You can make any email account the default (or catch-all) account for a given domain.
Choose the domain for which you would like to setup a catch-all address. You can do that by selecting the domain name from the drop-down box on the top-left.
Click Edit Email and FTP Users.
Click the name of the email account you would like to make a catch-all account.
Click Email Settings.
In Additional email addresses, type @example.com, where example.com is the name of your domain name.
Click Save, and this account will now be the default email address for this domain.
This tutorial covers how you can create a MySQL or PostgreSQL database.
It assumes you have first logged into Virtualmin.
Choose the domain for which you would like to add the database. You can do that by selecting the domain name from the drop-down box on the top-left.
Click Edit Databases.
Click Create a new database.
Choose a name for your database, and enter it in the Database name field.
In Database server type, select either MySQL or PostgreSQL. If unsure, use MySQL.
Click Create.
This tutorial will cover how to create a sub-server, allowing for a second domain to be setup within a given Virtual Server account.
It assumes you have first logged into Virtualmin.
Choose the domain for which you would like to add the sub-server. You can do that by selecting the domain name from the drop-down box on the top-left.
Click Create Virtual Server.
Click Sub-server.
Enter the Domain Name and Description for the Sub-server.
Click Create Server.
This tutorial covers how to create an alias for an existing Virtual Server.
If you have a Virtual Server such as example.com, setting up an alias would allow you to have example.net point to the same website, and share the same email addresses.
It assumes you have first logged into Virtualmin.
First, choose the domain you for which you would like to add the Virtual Server Alias. You can do that by selecting the domain name from the drop-down box on the top-left.
Click Create Virtual Server.
Click Alias of example.com, where example.com is the domain for which you are setting up the alias.
Enter the domain name for the alias in the Domain name field. This will be something like example.com.
Enter a description for the alias in the Description field.
Click Create Server.
This tutorial will cover how to create an FTP account for a Virtual Server.
It assumes you have first logged into Virtualmin.
Choose the domain you would like to add the FTP account to. You can do that by selecting the domain name from the drop-down box on the top-left.
Click Edit Email and FTP Users.
Click Add a website FTP access user (on the far-right).
In the Email Address, enter the name for the new FTP account.
Enter the FTP user's name in the Real Name field.
You can enter a password in the Password field if you wish to override Virtualmin's random password that it puts there by default.
Click Create.
This tutorial will cover how to create an email auto-responder for a user within Virtualmin.
An email auto-responder is an automated reply that will be sent to anyone sending an email to the account.
It assumes you have first logged into Virtualmin.
Choose the domain you would like to add the email account to. You can do that by selecting the domain name from the drop-down box on the top-left.
Choose Edit Users.
Click the name of the account you would like to add the auto-responder to.
Click Mail forwarding settings to view the auto-responder text area.
Click the checkbox next to Send automatic reply
In the text area beneath Send automatic reply, you can now enter the text that will be included in the auto-responder.
Click Save.
The above auto-responder will be used until you un-check "Send automatic reply".
This tutorial will cover how to create an email auto-responder for your email account within Usermin.
An email auto-responder is an automated reply that will be sent to anyone sending an email to your address.
It assumes you have logged into Usermin Webmail.
Click the Automatic Reply link, towards the bottom on the left.
Click the checkbox next to Automatic Response Enabled
In the text area next to Reply Message, you can now enter the text that will be included in the auto-responder.
Click Save.
The above auto-responder will be used until you un-check "Send automatic reply".
This tutorial will cover how to create an email account that can be accessed via POP, IMAP, or web-mail.
It assumes you have first logged into Virtualmin.
Choose the domain you would like to add the email account to. You can do that by selecting the domain name from the drop-down box on the top-left.
Click Edit Users.
Click Add a user to this server.
You can now enter the email address, full name, and password to use for this email account.
Click Create, and Virtualmin will add the email account to your server.
This tutorial will cover how to create an email filter from within Usermin.
Email filters allow you to sort incoming emails based on criteria such as who sent them and what the subject is.
It assumes you have logged into Usermin Webmail.
Click the Email Filters link, towards the bottom on the left.
Click Add a new email filter.
Under Condition for filter, click the radio button next to Based on header.
Click the dropdown next to Header, and change it from From to Subject.
In the textbox at the end of that line, enter the text test email filter.
Under Action if condition is matched, click the radio button next to Save to Folder.
Click the dropdown box next to Save to Folder, and change it from Inbox to Trash.
Now, any time you receive an email message with a subject of test email filter, it will end up in the Trash folder!
Go ahead and send yourself an email with the subject test email filter in order to test the filter.
This tutorial will cover how to permit one or more users read access to other user directories.
It assumes you have first logged into Virtualmin.
Choose the domain for which you would like to permit FTP shared directories in the domain selection dropdown.
Click Edit Email and FTP Users.
Create the users you want, making sure their 'Login permisisons' include FTP access.
In the Limits and Validation menu, click FTP Directory Restrictions.
Create a new access rule by checking the Active checkbx in the last rule in the list (which is a "blank" rule), and selecting the virtual server to which the rule should apply.
Choose Virtual server's home directory in the Restrict to directory.
Click Save.
Users will then have read access to all directories within the virtual server home directory, and upload access within their home directory.
Virtualmin is the administrative interface, or control panel, you will use for most of the administrative functions you'd like to accomplish. You can open your account using any browser (modern browsers like Firefox, Safari, and Opera are recommended), by browsing to port 10000 on the server address using the HTTPS protocol.
For example, if your domain were virtualmin.com, you could access it on the URL: https://virtualmin.com:10000
Enter your username and password, as provided by your system administrator.
In this tutorial, we will go over how to log into the Virtualmin control panel.
Open your web browser, such as Firefox or Internet Explorer.
In the address bar at the top of your browser, browse to the following address:
https://example.com:10000
Where example.com is your server's domain name.
Once you have entered the address above, hit enter to go to the Virtualmin Login screen.
Enter the username you were given in the Username field. If you're logging in as the master administrator, use root as the username.
Enter your password in the password field.
Click Login, and you will be logged into Virtualmin.
You can see available tasks you can perform within Virtualmin on the navigation bar on your left.
On the right, you can see the System Information screen, giving you a system overview of resource usage and other server details.
In this tutorial, we will go over how to log into the Usermin Webmail interface.
Open your web browser, such as Firefox or Internet Explorer.
In the address bar at the top of your browser, browse to the following address:
https://webmail.example.com
Where example.com is your server's domain name.
Once you have entered the address above, hit enter to go to the Usermin Login screen.
Enter the username you were given in the Username field.
Enter your password in the password field.
Click Login, and you will be logged into Usermin.
You can see a list of mail folders, as well as other options, on the left.
The contents of the current folder (your Inbox, by default) will be displayed on the right.
In this tutorial, we will go over how to log into the Usermin Webmail interface.
Open your web browser, such as Firefox or Internet Explorer.
In the address bar at the top of your browser, browse to the following address:
https://webmail.example.com
Where example.com is your server's domain name.
Once you have entered the address above, hit enter to go to the Usermin Login screen.
Enter the username you were given in the Username field.
Enter your password in the password field.
Click Login, and you will be logged into Usermin.
You can see a list of mail folders, as well as other options, on the left.
The contents of the current folder (your Inbox, by default) will be displayed on the right.
This tutorial will cover how to setup URL redirects. A URL redirect allows you to make one URL redirect to another of your choice.
It assumes you have first logged into Virtualmin.
Choose the domain for which you would like to add the URL redirect. You can do that by selecting the domain name from the drop-down box on the top-left.
Click Server Configuration.
Click Website Redirects.
Click Add a new website redirect..
What URL do you want redirected? Enter the path in the Source URL path field. A URL path is something like /</code, <code>/foo, or /foo/bar.
In the Destination field, enter the full URL it should redirect to. That would look something like http://www.example.com/redirect_here/
Click Create.
This tutorial covers how to password protect a directory within a website. Users browsing to that directory in a web browser will be prompted for a password prior to being able to view it's contents.
It assumes you have first logged into Virtualmin.
Choose the domain you would like to add the protected directory account to. You can do that by selecting the domain name from the drop-down box on the top-left.
Click Services.
Click Protected Directories.
Choose whether the password protection should be for the entire website, a sub-directory, or part of cgi-bin.
If you choose a sub-directory or cgi-bin, enter the directory name you are protecting, relative to public_html or cgi-bin. For example, if the password protection should be on http://example.com/secret/, then enter secret into the textbox.
Enter the Authentication Realm. This is the text that the user will see when being prompted for a password.
Click Create
Now go into 'Edit Users' -> USERNAME -> Other User Permissions
In the selectbox next to Allow access to web directories, select the directories this user should have permission to access.
This tutorial will cover how the administrative user can schedule a backup for all Virtual Servers.
It assumes you have logged into Virtualmin as the root user.
Click Backup and Restore.
Click Scheduled Backups.
Click Add a new backup schedule.
Make sure Local file or directory is selected, and enter /root/backups/ into the textbox as the location to store the backups.
Click Schedule and reporting.
In Scheduled backup time, choose Simple Schedule.
Select Daily in the select list next to Simple Schedule.
Click Create Schedule.
A backup of all Virtual Servers will now be performed every day at midnight.
This tutorial covers how to setup a Cron job. Cron is a service for executing scheduled commands.
It assumes you have first logged into Virtualmin.
Click Webmin on the top-left.
Click System.
Click Scheduled Cron Jobs.
Click Create a new scheduled cron job.
Choose the user to run as, and input the username in Execute cron job as. To run as the administrative user, input root .
Enter the command to run into the Command field. For example, if you want to receive a list of all running processes, enter ps auxw for the command.
Normally, you can skip Input to command. That's only used if your command requires input after it begins running.
Choose how frequently to run your command. By default, it will execute Hourly, meaning it will execute at the top of the hour, every hour.
To enable the Cron job, click Create.
Any output will be emailed to the root user.
This tutorial will cover how to setup email forwarding for a user from within Virtualmin.
It assumes you have first logged into Virtualmin.
Choose the domain for which you would like to setup forwarding. You can do that by selecting the domain name from the drop-down box on the top-left.
Choose Edit Users.
Click the name of the account for which you would like to add forwarding.
Click Mail forwarding settings to view the forwarding text area.
Click the checkbox next to Forward to other addresses
In the text area beneath Forward to other addresses, enter any number of email addresses -- one per line -- for which you would like the email forwarded.
Click Save.
This tutorial will offer some tips how to use the Usermin webmail system. Usermin allows users to check their email from a web browser, such as Firefox, Internet Explorer, and Safari.
First, you'll want to log into Usermin.
Using Email
To compose a new message, you can click the Compose button at the top of the page.
To read a message, click the senders name in the From field.
Once you're reading a message, you can reply, forward, or delete it by clicking the Reply, Forward, or Deletebuttons.
You can use Usermin to mark email as spam, better training the anti-spam system in the future. To do that, when you're reading a spam email, click the Report Spam button.
Other Email Features
You can use Usermin to change your password.
If you're going on vacation, or will otherwise be out of the office for an extended period of time, you can setup an auto-responder.
If you want certain email to automatically go into a specific folder, or perhaps be deleted by default, you can setup an email filter.
This tutorial will cover how you can view the access and error logs for a website,
It assumes you have first logged into Virtualmin.
First, choose the domain for which you would like to view the logs. You can do that by selecting the domain name from the drop-down box on the top-left.
Click Logs and Reports.
To view the Access log, click Apache Access Log.
To view the Error log, click Apache Error Log.
This tutorial will cover how you can install scripts in Virtualmin.
Virtualmin's Script Installer can be used to install and manage any one of over 75 web applications (or "scripts").
It assumes you have first logged into Virtualmin.
Choose the domain for which you would like to install a script.. You can do that by selecting the domain name from the drop-down box on the top-left.
Click Install Scripts.
Click the radio button next to the script you would like to install. In this example, let's install Wordpress -- which is near the top in the Blog section.
Scroll down to the bottom of the page, and click Show Install Options.
The defaults here are fine. Click Install Now.
You will be given a URL you can use in order to manage your Wordpress install. Follow the URL, and tweak away!
This tutorial will cover how a user can manage MySQL databases.
It assumes you have first logged into Virtualmin.
Choose the domain for which you would like to manage the database. You can do that by selecting the domain name from the drop-down box on the top-left.
Click Edit Databases.
Click the Manage link next to the name of the database that you would like to manage.
At this screen, you will see all the tables in your database, and you can perform a number of functions on them:
To view the table structure or data, click the table name.
You can drop a table or tables by clicking the checkbox next to the database name, and choosing Drop.
You can create a new table by clicking the Create button.
This tutorial will cover some basics on how to navigate Virtualmin.
It assumes you have first logged into Virtualmin.
TODO: Grab a compass, point it at Joe, and make him do this one.
This tutorial covers the basics of the web-based file manager included with Virtualmin.
Using the file manager, the administrative user can view and manage any of the files located on the server.
It assumes you have first logged into Virtualmin.
Click Webmin on the top-left.
Click Others.
Click File Manager.
After a few moments, the File Manager will appear.
From here, you can begin using the file manager, performing tasks including:
Click a directory to view it's contents
You can make changes to a text file by single-clicking a filename, and clicking Edit.
You can create files by clicking New, and delete files by clicking Delete.
This tutorial will cover how to use the System Statistics.
It assumes you have first logged into Virtualmin.
System Statistics are a Virtualmin Pro feature that gives you the ability to display graphs regarding the function and performance of your server.
Click 'System Statistics' on the bottom-left of the navigation menu.
This tutorial will cover how to use the Upload and Download module.
The Upload and Download module assists you in getting files to your server -- either by downloading files from the Internet onto your server, or by allowing you to upload them from your PC to the server.
It assumes you have first logged into Virtualmin.
Click Webmin on the top-left.
Click Others.
Click Upload and Download.
To download a file from the Web onto your server:
Input the URL to the file in the URLs to download textarea. This would be something like http://example.com/downloads/myfile.tar.gz.
Choose the directory where you would like to store the file. To save it in the root users home directory, enter /root in the Download to file or directory field.
Click Download URL's.
To upload a file from your PC to your server:
Click the Upload to server tab.
Click Browse next to Files to upload, and select the file to upload to the server.
Choose the directory where you would like to store the file. To save it in the root users home directory, enter /root in the File or directory to upload to field.
Click Upload.
This tutorial covers Virtual Servers, Sub-Servers, and Aliases.
Virtual Server -- a Virtual Server is an account in Virtualmin, that includes a website, email, and FTP access all associated with a domain name. Virtual Servers have an administrator account called the Virtual Server Owner. The Virtual Server Owner can create additional email addresses, ftp accounts, and websites, subject to the limits set by the Reseller or Master Administrator who created the Virtual Server.
Sub-Server -- Generally created by a Virtual Server Owner, a Sub-Server is a a secondary domain name setup within a Virtual Server, with it's own domain name and set of email addresses and FTP accounts. A Virtual Server can have as many Sub-Servers as the Reseller or Master Administrator allow.
Alias -- an alias is a way of making a domain name act exactly like another. If you have two domains, example.com and example.net, and you want both to have the same website, you would set example.net to be an alias of example.com.
System Configuration and Maintenance Frequently Asked Questions
Backup and Restoration - Backing up and restoring Virtualmin virtual servers.
Virtualmin on Low Memory Systems - Configuration tips for running Virtualmin on systems with 256MB or less memory.
Mobile Devices and Virtualmin - Using Virtualmin on iPhone, Android, Palm Pre, or any other mobile device with a web browser.
Bleeding Edge Package Repository for CentOS 5 - Optional bleeding edge repository for newer PHP versions, as well as other frequently updated packages.
Support Requests and Remote Login Access - Using the Virtualmin Support module to file tickets from within Virtualmin and get hands-on support for Virtualmin Professional and Cloudmin products.
OS Notes - Notes and caveats about specific operating systems. While Virtualmin and Webmin are generally fully functional on most modern Linux and UNIX systems, there are some known issues with some operating systems and versions.
Virtualmin for Recovering cPanel Administrators - Tips for users who are familiar with cPanel, but not the underlying webserver terminology. Virtualmin uses Apache terminology for most functionality, and has a few other differences in how it presents options to the end user, which can be confusing for users migrating from cPanel. This guide covers the most common pitfalls and causes of confusion.
Virtualmin provides multiple tools to help you keep good backups automatically. The first step after any installation of Virtualmin should probably be thinking about your backup procedures and setting up Virtualmin to automate those procedures for you.
The simplest way to backup your virtual servers is to use the backup feature built into the Virtualmin UI, which can save them to local or remote files domain by domain. This allows you to restore the state of an entire virtual server (including all databases, users and aliases), without effecting other parts of the system.
Each virtual server's backup is typically a single file in tar.gz format. This contains one or more files per Virtualmin feature that is included in the backup, such as the contents of databases, DNS records, Apache directives or the virtual server's home directory. It is also possible for a single backup file to contain multiple servers, although this format is generally not as easy to work with.
By default, only the master administrator (typically root or admin) can perform backups, but it is possible to grant backup and restore rights to resellers and domain owners too. Only the master admin can restore all virtual server settings though, as some (such as the Apache configuration) could harm other system functions if a corrupt or malicious backup was restored.
Before you can backup anything, you need to decide where your backups are going to be stored. The simplest destination is a directory on the system running Virtualmin, such as /backup, but clearly this isn't going to be useful if the whole system dies. If you do want to backup to local files, at least make sure they are on a different hard drive than the home containing your /home directory.
A better alternative is to backup to another system, perhaps owned by your or maybe provided by your colocation company. The backup files can be transferred either via FTP or SSH, depending on which protocol the destination system supports. Almost all Unix systems will allow SSH logins, but some network attached storage devices will only support FTP.
Another option is to use Amazon's S3 storage service, which charges you by the megabyte for data stored on their systems. This is probably the safest option as S3 presumably uses RAID and has backups of their own, but is more costly and slower to transfer backups to over the Internet. For more information about signing up for S3, see http://aws.amazon.com/s3 .
S3 uses slightly odd terminology to refer to files that they store - instead of directories, they have 'buckets', whose names must be unique across all S3 users. A backup can contain multiple files, such as individual domain backups, and backups can be placed into sub-directories under buckets.
Alternately, in Virtualmin 3.94 or later you can backup to Rackspace's Cloud Files service. This is similar to S3, in that your backups are saved to storage managed by another company. For more info, see http://www.rackspace.com/cloud/public/files/. Rackspace uses the term 'container' to refer to a directory, which only needs to be unique for each user. Containers can contain multiple backup files and sub-directories. If you have an account with Rackspace UK, make sure Virtualmin is configured to use the UK API endpoint, as documented below.
The best way to have your system backed up is to have Virtualmin do it automatically on a regular schedule, such as once per day. The steps to set this up are :
root/backup. For the Backup format, select One file per server.Once this is done, your virtual servers will be safely backed up every night. To force an immediate backup for testing purposes, go to the Scheduled Backups page and click on the Backup link next to your new schedule.
Sometimes you just want to backup a few virtual servers to a different destination a single time, rather than one a regular schedule. To do this, click on the Backup Virtual Servers link on the left menu, and fill in the backup form as described above. When you click the Backup Now button then selected domains will be immediately backed up, and their progress displayed in your browser.
If a virtual server has been accidentally deleted, or lost files, database content or users, you can restore some or all of it's data from a backup. In the case where the whole domain is gone, Virtualmin will re-create it for you as part of the restore process.
The steps to restore a domain are :
/backup/example.com.tar.gzAfter this step, the backup will be downloaded from it's source FTP or SSH server and a confirmation page displayed showing which domains and features will be restored. Be careful when restoring existing domains, as any aliases, databases or mailboxes that they have will be removed and replaced with those in the backup.
If everything looks OK, click the Restore Now to begin the restore process. As it runs, the progress of each domain and feature will be displayed by Virtualmin.
Individual virtual server owners can backup their own top-level domains and sub-servers, if granted permission on the Edit Owner Limits page in the Allowed capabilities and features section. They can even be given the rights to run scheduled backups, although that right should not be granted to users you don't trust not to abuse it, as a large number of scheduled backups could overwhelm the system.
The UI for server owner backups is almost identical to that for the master administrator, with the exception that local backups can only be made to the .virtualmin-backup directory under their top-level server's home directory. There are no limits on remote FTP, SSH and S3 backups though.
When allowed, restored by domain owners are even more limited - to prevent configuration file corruption or hacking attempts by corrupt backups, only home directory and database contents can be restored. And local restores can only be from the .virtualmin-backup directory, not any file on the system.
If your system hosts virtual servers that contain a large amount of content in their home directories which does not change often (such as images, PDFs or video files), backing them up daily will be both slow and wasteful. Almost all the contents of each backup will be identical to the previous run, so most of the data transferred is not really necessary.
Fortunately, Virtualmin has a solution - incremental backups. These contain only files that have changed or been added since the last full (non-incremental) backup, and are thus much faster. Typically you should schedule a full backup for once a week, and an incremental backup for the same domains every night - but to a different directory.
Enabling incremental mode for a scheduled backup is as simple as changing the Backup level option to Incremental. This will only apply to home directory contents - Virtualmin does not support detection of incremental changes to databases, so if your virtual servers have a large amount of data in MySQL, the saving will probably be minimal.
When restoring, the latest full backup must be restored first, followed by the latest incremental. This ensures that all files are returned to their state at the time the incremental backup was made.
If you have enough disk space, keeping backups made over several days or months is a good idea, as it allows you to return virtual servers to their state before some disaster occurred, which may not have been immediately noticed. The standard way to do this in Virtualmin is to use a backup path that contains special tokens that vary based on the current date and time.
For example, the path /backup/%d-%m-%Y would be converted to /backup/16-09-2008 on 16th Semptember 2008. All tokens supported by the Unix strftime function can be used in backup paths, but the most useful are :
%d - Day of the month, padded to 2 digits%m - Month of the year, padded to 2 digits%Y - Year, as a 4 digit number%H - Hour of the day, padded to 2 digits%M - Minute of the hour, 2 digits%a - The short weekday name, like SatTo use these tokens in backup paths, you must check both the Do strftime-style time substitutions on file or directory name and Create destination directory boxes on the backup form.
The only problem with keeping old backups around using date-based paths is the amount of disk space consumed. However, removing those older than some number of days is relatively easy to setup in Virtualmin. When creating or editing a scheduled backup, use the Delete old backups field to enter a maximum age in days before backups are removed.
This can only be used if your backup path contains date substitution tokens, like /backup/virtualmin-%d-%m-%Y. If not, Virtualmin will not be able to work out which files and directories are backups that it made in order to safely delete them.
In addition, I recommend against using the same directory to store backups made using other programs, as if their filenames are similar to Virtualmin backups they may be deleted as well if too old.
If you have more than one system running Virtualmin, backups and restores can be used to transfer domains between them easily. The restore process will even re-create the virtual servers on the target system, and adjust the backups to match the target's mailbox format, mail server, home directory base and other system-specific settings.
The steps to transfer a virtual server between systems are :
While every effort is made in Virtualmin to convert backups as necessary when restoring on a system with a different configuration to the original, in some cases this cannot be done 100% correctly. For example, if the new system uses a different base for home directories (like /virtualmin instead of /home), paths in PHP, Python or Ruby application configuration files may no longer be correct.
For this reason, I recommend moving domains between systems running identical operating systems where possible, such as CentOS 5.2. However, the underlying CPU architecture, disk partitioning scheme or amount of RAM does not matter, so it is perfectly save to move domains between old and new hardware running the same OS.
In addition to virtual servers, backups made by the master administrator can also contain Virtualmin settings that apply to the whole system, such as templates and custom fields. If you have created your own templates or heavily customized the module configuration, you should back these settings up too as follows :
tar.gz file which will contain all the global settings, or a directory. In the latter case, a file named virtualmin.tar.gz will be created in the target directory to store the global configuration backup.It is also possible to include global Virtualmin settings in your backups of virtual servers, by selecting the ones to include in the Virtualmin settings to also backup field.
The various global Virtualmin configuration settings can be restored in exactly the same way as you would restore domains. Just select the virtualmin.tar.gz file as the source to restore from, and in the Virtualmin settings to restore section check the types of global settings to include.
This can even be used to migrate templates, custom fields, script installers, content styles , resellers and email messages to a new system. Be careful when migrating the Module configuration though, as it may not be compatible with the new system if running a different operating system or Linux distribution. Instead, it is safer to configure the target the way you want it, then restore domains and possibly other global settings.
If you prefer to work at the command line, backups and restores can be done using the tools listed on the Backup and Restore API page. These allow you to create your own scripts for backing up on complex schedules, emailing backups to somewhere, using rsync to transfer home directory contents, or whatever you can come up with.
Here's what we do at Virtualmin.com:
Weekly full backup, and daily incremental backup, using the Webmin:System:Filesystem Backup module. This insures we have a copy of everything on the system, in the event of a problem. Keep in mind that this is a filesystem dump, using the dump command by default (though tar is also an option), so it won't jump file systems. If you have multiple partitions, you'll need to make a backup of each. It takes two scheduled backups to get weekly full and daily incremental backups.
Daily backups of all virtual servers on the system using Virtualmin's Backup feature. We do a full backup, including Virtualmin meta-data and Webmin stuff, but if the data will be moving over a slow pipe, you may consider using the incremental backup feature.
If we had a problem that required a restoration, here's what I'd do, assuming it is one of my remote systems, rather than in a local data center:
Get a new system running whatever OS I had before (though I might be tempted to upgrade during the process...I'd have to assume that would take longer to get back in service).
Install Virtualmin.
Restore the virtual server backups from the Virtualmin backups. Test. If something is broken (because of customizations I did outside of Virtualmin to non-Virtualmin related services), install the necessary packages (assuming I installed everything from packages, as I generally do), and restore the configuration (if necessary) by selectively pulling stuff out of the filesystem dump...or creating a whole new filesystem and restoring the dump completely into it, if I thought I'd be doing a lot of this (since restoring single files from a dump is somewhat time-consuming).
If it were a local system, and I'd replaced the disk, or something, I would do something pretty dramatically different:
Boot from a rescue disk for the OS in question (don't go newer, as you might get slightly incompatible Ext3 filesystem versions--Fedora, in particular, makes use of new attributes that confuse older kernels).
Create the necessary filesystems (swap and /, probably, though you might also have /home), and restore the dump directly into /. This will completely restore your machine exactly as it was before the catastrophe. This is probably faster than the above method--unless you happen to have a machine laying around with a fresh OS install of exactly the right kind and version you can start with--and will get you a system identical to the previous one.
There is one quirk to be aware of in this latter case:
Backups of databases in a dumped filesystem are almost certainly not trustworthy, unless you shut down your database during the dump. So, you'll still need to plan to restore databases from the dumps found in your Virtualmin backups, which use the database dump feature to dump a safe and sane text file that can reproduce the database exactly as it was at the time of the backup.
Obviously, you want to test your backups occasionally to be sure they are working correctly and can be restored.
Virtualmin Pro versions 3.92 and later support the encryption and signing of backups with GPG keys. This can be used to protect the contents of a sensitive backup from prying eyes or modification if stored on an un-trusted remote system, such as S3 or an FTP server managed by another company.
Before a backup can be encrypted, you must create or import at least one key at Backup and Restore -> Backup Encryption Keys. A key can either be generated by Virtualmin, or imported from an existing GPG secret key file in ASCII format.
Once a key has been created, it can be selected on the one-time or scheduled backup form using the Encrypt backup with key field. When the backup is restored, the same key must also be selected using the field with the same name on the restore form.
WARNING - If a backup key is lost, any backups made using it will not be recoverable! For this reason, you should save the ASCII format key text separately. This can be found on the Backup Encryption Keys page, by clicking on a key. This way if your Virtualmin system fails and you need to restore backups onto a new system, the key can be imported first.
Virtualmin has several account-related configuration settings that apply to all backups, which can be set by the root user at System Settings -> Virutalmin Configuration -> Backup and restore. They are :
Virtualmin Bleeding Edge Packages
Virtualmin, Inc. provides a set of yum repositories for CentOS/RHEL 5 that includes bleeding edge versions of several common web service related packages, including PHP.
We do not recommend using third party packages, including ours, unless you must have the bleeding edge versions of the provided packages. They are very likely not as stable or reliable as packages provided by the RHEL OS repository.
We get a lot of support queries, several per week, about third party repositories that are incompatible with the OS-standard packages, causing breakage in various ways. Thus, we're providing these packages which are known not to cause those kinds of issues. While we test and support these packages as best we can, and we use them on our own servers, they are still bleeding edge packages with dramatically less testing than standard CentOS/RHEL packages, however, and should be treated accordingly.
In short, if you don't need a newer version than what comes with CentOS, we recommend you stick with the standard package. If you do need a newer version, we recommend you use our packages rather than those from other third party repositories. We are not suggesting that any specific third party repository is poor quality, or poorly maintained. Merely that there are many subtle differences in the way various maintainers package things, and those small differences can cause hard to diagnose issues. We, obviously, also cannot support packages not provided by us. We have no control over them, and thus cannot fix bugs, and we don't use them and so we don't know anything about them. Issues relating to third party packages will generally be closed with little to no comment, as there's nothing we can do to help.
You can use the yum includepkgs options to select which packages you wish to use from these repositories. We recommend you do this to only use the packages you really need to be bleeding edge versions. New packages will be rolled into this repository occasionally, and it could potentially be a rude surprise to have your MySQL or Ruby or other major package upgraded without proper planning. I cannot stress this strongly enough. Use only the packages you must have from the bleeding edge repository, and choose those packages explicitly in your virtualmin-bleed.repo file.
For example, if you are simply looking to use the PHP packages from this repository, you can edit /etc/yum.repos.d/virtualmin-bleed.repo, and add a line which looks like this:
includepkgs=php*
That tells yum to only pull down the PHP packages from that particular repository.
That repository URLs are:
i386: http://software.virtualmin.com/bleed/centos/5/i386/
x86_64: http://software.virtualmin.com/bleed/centos/5/x86_64/
There is also a release package to automatically configure yum to use these repositories, which can be installed with the following command:
rpm -ivh http://software.virtualmin.com/bleed/centos/5/i386/virtualmin-bleed-release-1.0-1.rhel.noarch.rpm
For the purposes of Virtualmin, a mobile device is one that has a small screen and a limited web browser. Some examples would be a Treo, Sidekick, some cellphones, PDA or the iPhone. Because the browsers on these devices typically do not support Javascript, DHTML or complex CSS, the standard Virtualmin user interface does not work well. For this reason, a separate theme has been developed that optimized the UI for use from such devices.
Unlike most Webmin themes, this one is not typically selected by the user explicitly. Instead it is used either when Virtualmin is accessed via a browser on a mobile device (identified by the user agent), or when the URL starts with a specific suffix like m or mobile.
The mobile device theme for Virtualmin allows you to access all the same features that you could via a regular browser, including all Webmin modules. However, some modules that are not part of Webmin have not been fully converted to a mobile-friendly UI, and so will not be as usable. But core Virtualmin operations like creating domains, managing users and installing scripts are fully supported.
To install the theme package on a Redhat, Fedora or CentOS system, use the command :
yum install wbt-virtual-server-mobile
or on Debian or CentOS, use :
apt-get install webmin-virtual-server-mobile
Alternately, you can install it using the Virtualmin Package Updates module.
Once the theme is installed, you probably want to enable it for mobile browsers. This can be done as follows :
Once the theme is enabled, just go to the Virtualmin administration URL (like https://yourserver:10000/) using your mobile browser. As long as the browser's user agent is detected correctly, you should see a text-only page with links to list all servers, edit a specific server, manage system settings and so on.
Unlike the regular framed theme, to manage a server you must first either select it from the List virtual servers page, or enter the domain name into the Edit server box. This will bring up a page with links for all the possible actions for that server, such as editing features, users, aliases, scripts and databases.
The same theme that lets you access Virtualmin can also be used with the Usermin webmail interface on port 20000. However, this requires at least version 1.310 of Usermin and the 1.5 version of the mobile theme.
Again, all webmail and Usermin functions are available, except for the HTML editor for composing rich-text email. Also, all popup windows for selecting things like email addresses are disabled, as both the Javascript needed to invoke them and the ability to actually open a new window are unlikely to work.
The installation procedure is the same as the theme for Webmin, but the package is named ubt-virtual-server-mobile on Redhat-based systems, and usermin-virtual-server-mobile on Debian and Ubuntu. To enable it, use the Mobile Device Options page in the Usermin Configuration module, with the same selections.
If that page is missing on your system (because you have an older Webmin release), you can instead run the following commands :
echo mobile_preroot=virtual-server-mobile >>/etc/usermin/miniserv.conf echo mobile_prefixes=m. >>/etc/usermin/miniserv.conf echo mobile_theme=virtual-server-mobile >>/etc/usermin/config /etc/usermin/restart
To use the new mobile theme, just login to Usermin at the regular URL using a mobile device like a Treo or cellphone. Instead of the regular UI, you should see a text-only page with links for your mail folders, a search form and links for folder management, editing your addressbook and other mail-related settings.
When viewing the contents of a folder a slightly different text-only layout is used, which avoids wide tables that don't render well on mobile browsers. Also, the design of the address book page has been changed to make it more mobile-friendly. However, almost all mail reading functionality has been preserved - although some features are not supported, such as uploading attachments and the HTML editor when composing mail.
Every Operating System is a little bit different, even when Virtualmin puts a common UI on top of it. This is a collection of observations about various operating systems, and common pitfalls.
A common cause of installation/update errors on CentOS is due to having third party repositories installed. If the installer is having trouble installing packages, verify that there aren't any third party repositories conflicting with your primary repositories.
Upgrading Debian etch to lenny with distupgrade
Upgrading Debian Lenny to Squeeze with distupgrade
Upgrading Ubuntu 8.04 LTS to 10.04 LTS with distupgrade
On Ubuntu 10.04, "hostname -f" needs to resolve to your full hostname, or the installation may not work correctly.
Upgrading Ubuntu 10.04 LTS to 12.04 LTS
FreeBSD Username and Group Limits
FreeBSD has much shorter username limits than Linux, by default, and thus it is usually impossible to use the full domain name as the unique suffix for usernames. A full world rebuild is required to work around this issue, in order to insure that the kernel and all support tools agree on the longer username length.
FreeBSD has a limit of 16 secondary groups, and so permissions on homes can never be tighter than 751 (which makes directories list-able by all users that have a shell), because Apache must be able to access the public_html directory. As long as suexec is used for all web applications, files containing sensitive data can, and should, have 750 or tighter permissions. It is not known if a world rebuild with a higher limit is safe or feasible.
pkg_add and ports lack transactional installation capabilities, and thus it is impossible for an automated process like install.sh to insure that packages are all installed successfully, or that a failure is predictable (in the sense that a failed install results in nothing rather than the appearance of an installation). Compounding this issue, pkg_add currently has at least two bugs. The first bug leads to occasional "fatal" errors being reported, even when the package was successfully installed. The second is merely a segmentation fault, apparently triggered by a race condition, which is intermittent and difficult to reproduce. Thus, it is not only likely that problems may occur during installation, install.sh cannot accurately detect it when they do. So, install.sh may complete without error on FreeBSD, even if the installation of some or all packages failed. There is no good workaround for this problem, aside from fixing the failed package installations manually once they are identified. The virtualmin-install.log usually provides the clues you need to correct these problems.
Plan for some down time (sorry, it's gotta happen with a distribution upgrade, regardless of Virtualmin being involved).
Convert your apt Virtualmin source to point to the virtualmin-lenny repo, instead of virtualmin-etch. Also add a virtualmin-universal source (this is new for lenny and will make upgrades and some other stuff easier/faster in the future; both on my side as the maintainer of the repos and on your side as the user). The virtualmin-universal source line looks like:
deb http://SERIAL:KEY@software.virtualmin.com/debian/ virtualmin-universal
Or, if using Virtualmin GPL:
deb http://software.virtualmin.com/gpl/debian/ virtualmin-universal
apt-get install apache2
apt-get install virtualmin-base
This will probably (hopefully) install apache2-suexec-custom. Configure it in /etc/apache2/suexec/www-data to point to /home instead of /var/www (this is the first line in the file).
Assuming upgrading virtualmin-base worked, you can then probably safely dist-upgrade. Let us know about any weird dependency issues that seem Virtualmin related by filing a ticket in the issue tracker.
This document will guide you through upgrading an Ubuntu 10.04 (Lucid) server to an Ubuntu 12.04 (Precise) server.
We highly recommend that you perform all of these steps on a test system before making changes to your production server -- that way, you can minimize downtime by knowing what to expect.
You should plan for some downtime -- there are big differences between the two distributions, and things don't always go as smoothly as we would hope.
Note that Ubuntu recommends waiting for the first dot release before performing an upgrade:
"Upgrades between LTS releases are not enabled by default until the first point release, 12.04.1, scheduled for July. It is recommended that most LTS users wait until then before upgrading to 12.04."
You can see the full release notes here (we'd recommend reading these before performing an upgrade):
https://wiki.ubuntu.com/PrecisePangolin/ReleaseNotes/UbuntuServer
For those wishing to upgrade, the following steps will guide you through the process --
Backups
Make sure you have full backups of everything on your server that is important to you. At the very least, you should generate full backups of all your Virtual Servers. You may also want to make a backup of everything in /etc.
Package Updates
Make sure your system is fully up to date by running these commands:
sudo apt-get update sudo apt-get upgrade
resolv.conf tweak
Make sure your resolv.conf file is not marked as immutable. That can be done with this command:
chattr -i /etc/resolv.conf
Reset Dependency Flags
These packages are already installed, but the following command will tell apt not include them anytime "apt-get autoremove" is run:
apt-get install bind9 spamassassin spamc procmail libnet-ssleay-perl libpg-perl libdbd-pg-perl libdbd-mysql-perl quota iptables openssl python mailman subversion ruby irb rdoc ri mysql-server mysql-client mysql-common postgresql postgresql-client awstats webalizer dovecot-common dovecot-imapd dovecot-pop3d proftpd webmin usermin webmin-virtual-server libcrypt-ssleay-perl webmin-virtual-server-theme webmin-virtualmin-dav webmin-virtualmin-svn webmin-virtualmin-awstats webmin-virtualmin-mailman webmin-virtualmin-htpasswd clamav-base clamav-daemon clamav clamav-data clamav-freshclam clamav-docs clamav-testfiles libapache2-mod-fcgid scponly apache2 apache2-doc libapache2-svn libsasl2-2 libsasl2-modules sasl2-bin usermin-virtual-server-theme procmail-wrapper php-pear php5 php5-cgi webmin-security-updates libgd2-xpm
Update Manager
Make sure you have the update manager core by running this command:
sudo apt-get install update-manager-core
Begin Upgrade
Run the following command to begin the upgrade process. Ubuntu suggests running this from the console, though it should also work from SSH:
do-release-upgrade -d
And then follow the on-screen instructions.
In general, if you are prompted about whether to replace a config file with a new one, or keep your existing one -- we would suggest keeping your existing config.
Coffee
Now is an excellent time to go get some coffee or another beverage of choice, while the packages are downloaded and installed :-)
Reboot
When the upgrade completes, it will prompt you to reboot your system. Perform the reboot, and when your system comes back online, there's just a few more things to change.
Change apt config
Edit /etc/apt/sources.list, and uncomment the Virtualmin repositories. Then change any references of "lucid" in those repositories to "precise".
Run this command, and make sure the new apt config works properly:
apt-get update
PHP Config
Edit /etc/apache2/mods-enabled/php5.conf, and comment out the lines that begin with SetHandler.
Then restart Apache:
/etc/init.d/apache2 restart
DNS Settings
Ubuntu 12.04 changes the way DNS setup is handled. Rather than adding nameservers to /etc/resolv.conf, they need to be added to /etc/network/interfaces.
Edit /etc/network/interfaces, look for your primary ethernet device (such as eth0), and add this line under your primary ethernet device:
dns-nameservers 127.0.0.1
And then restart your networking:
/etc/init.d/networking restart
Test
That's it for configuring your updated system. Now it's time to test your services and websites!
Notes
Dovecot
If you see these Dovecot errors:
Error: service(pop3-login): listen(::, 110) failed: Address family not supported by protocol Error: socket() failed: Address family not supported by protocol Error: service(pop3-login): listen(::, 995) failed: Address family not supported by protocol Error: socket() failed: Address family not supported by protocol Error: service(imap-login): listen(::, 143) failed: Address family not supported by protocol Error: socket() failed: Address family not supported by protocol Error: service(imap-login): listen(::, 993) failed: Address family not supported by protocol Fatal: Failed to start listeners
That means that Dovecot is trying to listen on an IPv6 interface, but that doing so isn't supported on your server.
That can be solved by editing /etc/dovecot/dovecot.conf, and setting the following at the top of the file:
listen = *
Then restart Dovecot:
/etc/init.d/dovecot restart
Note: Before upgrading, please beware that PHP 5.3, provided with Ubuntu 10.04, is not supported by several of the Virtualmin Professional Install Scripts. Since we have no control over those applications, the timeline for when they will work with PHP 5.3 is not under out control. We strongly recommend you check all of the applications you use, to be sure they will survive the upgrade, before moving from 8.04 to 10.04.
Plan for some down time (sorry, it's gotta happen with a distribution upgrade, regardless of Virtualmin being involved).
Convert your apt Virtualmin source in /etc/apt/sources.list to point to the virtualmin-lucid repo, instead of virtualmin-hardy. Also add a virtualmin-universal source (this is new for lenny and will make upgrades and some other stuff easier/faster in the future; both on my side as the maintainer of the repos and on your side as the user). The virtualmin-universal source line looks like:
deb http://SERIAL:KEY@software.virtualmin.com/ubuntu/ virtualmin-universal
Or, if using Virtualmin GPL:
deb http://software.virtualmin.com/gpl/ubuntu/ virtualmin-universal
apt-get install apache2
apt-get install virtualmin-base
This will probably (hopefully) install apache2-suexec-custom. Configure it in /etc/apache2/suexec/www-data to point to /home instead of /var/www (this is the first line in the file).
Assuming upgrading virtualmin-base worked, you can then probably safely dist-upgrade. Let us know about any weird dependency issues that seem Virtualmin related by filing a ticket in the issue tracker.
Virtualmin has an optional module that can be used to easily file support requests or grant remote login access to developers from within the Virtualmin UI. Before you can use it, you must install it on your system as follows :
rootvirtualmin-support package, then click the Install Selected Packages button.Alternately, it can be installed from the command line on CentOS, Redhat or Fedora systems with the command :
yum install wbm-virtualmin-support
On Debian or Ubuntu, the command to install is :
apt-get install webmin-virtualmin-support
If you run into a bug in Virtualmin and want to report it, this is best done using the support feature within Virtualmin. It ensures that the bug is properly associated with your license, and that it contains important information like the OS, version and system configuration.
The steps to submit a bug are :
rootAssuming all the needed fields have been filled in, a page will be displayed containing a link to the newly submitted bug report at http://www.virtualmin.com/bugs/ . All future followup will be done via the bug tracker, and you will receive email updates when additional questions or solutions are posted to the bug.
In some cases, resolving a problem on your system may require the Virtualmin developers to login via SSH as root to run debugging commands or examine configuration files. However, you probably don't want to give out your root password or grant access to us forever.
To avoid this, the Virtualmin support module can grant limited time access using SSH keys added to the root user's authorized_keys file. To enable this, the steps to follow are :
rootIf you entered an end date, access will be automatically removed at the end of that day. However, you can turn if off early by clicking on the Support Login Privileges link and then hitting the Disable Remote Logins button.
Yes for some services, no for others.
It is possible to use LDAP for mail user configuration, though this is not a comprehensive solution. Many of the features of Virtualmin can be re-implemented manually on the mail server, using Webmin and Usermin, but per-domain spam/AV configuration is not possible in this setup. The other option is to use Virtualmins ability to run commands before or after creation/update/delete of user accounts. One could write a custom command that makes use of ssh to perform actions on a remote mail server. Finally, a combination of Webmin user synchronization and a shared Postfix configuration directory would allow for configuration to occur on both servers. In this last case, a wrapper script would have to be written to allow Postfix to be stopped/started/restarted on the remote machine. Distributed mail support is high on our todo list, and should be available in the near future. So, if you don't need this capability urgently, waiting until it is fully supported by Virtualmin is strongly recommended.
Virtualmin does provide excellent support for automatic secondary mail server configuration, which sets up and manages a secondary mail relay that can step in and hold mail in the event the primary is unavailable. This is often the best method of provided redundancy for mail services, though it does not provide mail retrieval or MTA services for your users while the primary MTA is unavailable.
Database servers can be run on other hosts, and Virtualmin supports this fully. To make use of this feature, use the relevant Webmin module (MySQL and/or PostgreSQL) Module Config to configure it to connect to a remote database instead of a local one. All functions, except starting and stopping, are supported on remote database servers.
Web service must currently be on the Virtualmin server, and this is unlikely to change in the very near future. Replication of web content for use on a "hot spare" is relatively trivial using the remote virtual server backup feature, though restoring the backup periodically would need to be implemented using the command line API on the receiving server.
Spam and AV scanning can be run on the local machine or on a remote machine. Setting up the daemons on other hosts is not automated, though it can mostly be done within Webmin, if you like having a UI. Some customers choose to run a single dedicated mail proxy for spam and AV scanning, and then relay mail to the specific Virtualmin servers for the correct domains. This would be relatively easy to automate, using the pre/post commands feature in Virtualmin. Cloudmin also has the ability to automate this process across Virtualmin servers.
In short, DNS and both databases are very easy to setup on other hosts and well-supported by Virtualmin and Webmin, while everything else is either unsupported, incomplete, or not easy to setup. As the popularity of Virtualmin in larger hosting providers has increased, the demand for these kinds of features has increased remarkably, and we've begun focusing on this aspect of the system. Almost all major new features for the foreseeable future will be related to addressing scalability issues.
Central management, and replication, of Virtualmin servers is available in our Cloudmin product, which also provides management of virtualized systems.
See also: Combining Virtualmin and LDAP
Each Virtualmin Pro version contains the most recent of all the Install Scripts. But if there is a security update for a web application, it's not always desirable to wait for a Virtualmin Pro release to update to perform the security update for your web application.
To obtain the current version of Install Scripts, before they're released in Virtualmin Pro, you can go to System Settings -> Script Installers -> Installer Updates, and set "Download script updates" to "Yes".
It depends :-)
Processes running on a 64 bit system require more RAM; in many cases it may be twice as much RAM as on a 32 bit server.
If your server is at all memory constrained, you may really want to use a 32 bit operating system. We certainly wouldn't recommend going 64 bit with less than 3-4GB of RAM.
The benefit of a 64 bit operating system is that many tasks do run faster.
In December of 2009, the folks over at Phoronix put together some benchmarks using Ubuntu, comparing 32 bit, 32 bit PAE, and 64 bit architectures. You can see their results here:
http://www.phoronix.com/scan.php?page=article&item=ubuntu_32_pae&num=1
Their summary is:
By far though exhibiting the best performance was the Ubuntu 64-bit kernel that often ended up being leaps and bounds better than the 32-bit kernel.
If RAM is plentiful, then running a 64 bit operating system on your server may be worthwhile.
We've seen some folks receive errors such as these when performing a yum update:
Transaction Check Error: file /usr/lib/perl5/5.8.8/CGI.pm from install of perl-5.8.8-32.el5_7.6.x86_64 conflicts with file from package perl-5.8.8-32.el5_6.3.i386
The problem is that the distribution is 64 bit, but the version of Perl installed is 32 bit. However, some package is asking yum to pull down the 64 bit version of Perl, and that's causing the conflict seen here.
Karanbir Singh, one of the CentOS developers, describes the issue in this blog post:
http://www.karan.org/blog/index.php/2010/06/17/why-is-there-a-perl-i386-...
The fix is simple though -- you can run these two commands:
yum remove perl.i386 yum install perl
That will remove the 32 bit Perl version, and install the correct 64 bit version.
If you continue to see a problem with 64 bit CentOS trying to pull in 32 bit packages, it means one of two things:
Your system has 32 bit packages on it already that are generating dependencies for other 32 bit packages.
The CentOS mirrors you are using have a mix of 32 bit and 64 bit packages in the repository.
To test whether you have 32 bit packages installed, you can use this command:
rpm -qa --qf "%{n}-%{arch}\n" | grep -v noarch | grep -v x86_64
cPanel is an old, but still very popular, webserver administration tool. Since many new Virtualmin users have only experienced system administration through cPanel, they may find some terms and concepts in Virtualmin new or confusing. This short guide will attempt to point out a few of the gotchas that we've found most commonly trip up former cPanel users trying out Virtualmin for the first time.
cPanel refers to accounts as "Domains", while Virtualmin uses the term "Virtual Servers". cPanel also provides numerous types of domains, like "sub-domains", "parked domains", and "add-on domains". Each of these types of accounts can be replicated in Virtualmin, of course, but we think of them in different terms and the way they are created is moderately different. Virtualmin creates them with fewer steps, in most cases, and with more flexibility in all cases, but if you've only experienced cPanel it may be intimidating at first.
cPanel has a type of domain account called a "sub-domain", which creates a new virtual host that only provides web service and puts the content into a subdirectory of the document root of the parent domain.
In Virtualmin, to create a "sub-server" that uses a sub-domain name, select the virtual server account that you would like to own the domain (usually the one that has the parent domain name, but it doesn't have to be) in the Virtualmin left-hand menu, and click "Create Virtual Server". On the creation form, click the "Sub-server" link in the "New virtual server type:" menu at the top of the page.
Then fill in the form, with the new name and description, and click "Create Server". You can also select a different Server Template, include initial website content either using our templates based site builder, or just by typing in some initial text in the text field (you can use the website creator at any time after creation of the domain, so you don't have to do it right now).
Sub-server data is stored in the domains directory of the parent server home directory. So, if creating a new sub-server named example.webdomain.com the website document root would be /home/webdomain/domains/example/public_html.
Sub-servers in Virtualmin are more advanced than cPanel sub-domains, in numerous ways. They can have their own PHP configuration and execution mode (mod_php, suexec+mod_fcgid, or suexec+CGI), their own logs directory and logging options, and even their own mailboxes (if desired). But, they can also be used in very simple ways; there's no need to take advantage of the greater flexibility if you don't need it.
Parked domains in cPanel are domains that point to, or are aliases of existing domains. Virtualmin calls these by their technically accurate term, alias. This is the term used by Apache and its documentation, as well as most other web servers.
To create an alias server in Virtualmin, select the virtual server you'd like to alias, or point to, in the dropdown list in the left-hand Virtualmin menu and click "Create Virtual Server". On the resulting form, click the "Alias of..." link in the New virtual server type: at the top of the page.
Fill in the form with domain name to alias to the selected virtual server, and a description, and click Create Server.
Virtualmin alias servers are more advanced than cPanel "parked domains" because Virtualmin alias servers can accept mail for the domain (automatically mapping users to those of existing users within the parent).
Virtualmin can import accounts from a cPanel backup file, including all mailboxes, databases, and web data. This can make the migration process much faster and easier, though there may still be some aspects of the account that cannot be directly translated to Virtualmin policies and practices. For example, Virtualmin features far more advanced mechanisms for executing PHP in different ways in the same Apache, which cannot be directly mapped from the old-style cPanel suPHP or mod_php configurations. Generally, migrations will result in working websites, but some Virtualmin features may need to be enabled (with care and testing) in order to take full advantage of the advanced capabilities of Virtualmin.
To migrate all services from a cPanel server to a Virtualmin server, you'll need a full backup. To generate a full backup in cPanel, click on the Backup icon, and then click the Generate/Download a Full Backup link. Fill in the form, and click *Generate Backup*. Wait until you receive confirmation that the backup has completed, and then copy the file to your Virtualmin server.
If your backup is small, you can use the cPanel download full backup page to download it to your PC right in your browser, and you can then use the upload form in Vitualmin.
If your backup is larger than a few megabytes, you'll want to copy the file using a reliable transfer mechanism, like SCP. All Linux systems have scp built in, and so can easily be used to copy the file to your new Virtualmin server.
An example of scp usage:
scp backup.tar.gz root@virtualmin.server.com:/root
Which will then prompt for your root password on the destination server.
Once you have the backup available on the Virtualmin server (or on your local PC if it is small enough), you can then browse to the Migrate Virtual Server form by clicking on the Add Virtual Servers menu to expand it, and then clicking the Migrate Virtual Server link.
Fill in the form, selecting either to upload your backup file, or select the path to the file on your server.
Select a Backup file type of cPanel
Fill in the Domain name to migrate. This should match the domain you've backed up on the cPanel server.
Fill in Username for domain. This can be any valid username, but for ease of use, you may wish to use the same name used under cPanel. Virtualmin has fewer restrictions on usernames than cPanel (it allows long usernames for example, so I could name our user virtualmin rather than virtualm).
Choose a Password for administrator.
The remaining options can be left to their defaults, but it may be useful to you to change one or more of them, depending on features you'd like to use. If you will be using SSL or anonymous FTP virtual hosting, you will need to assign a new IP address just for this domain--SSL and FTP virtual hosting does not support name-based virtual servers. Realistically, anonymous FTP is almost never needed, but SSL is often required.
If you will be creating many servers via this mechanism, and have specific requirements for quotas, enabled features, etc. you may find that creating a new Server Template just for imported domains is useful and speeds up the task of getting cPanel users up and running under Virtualmin.
Both cPanel and Virtualmin allow creation of MySQL databases, but Virtualmin simplifies the common use case, while perhaps making less common cases less obvious. In Virtualmin, if MySQL is enabled for a virtual server, a single user and database is automatically created, both with the same name as the administration user of the virtual server ("virtualmin", for example, for a domain named "virtualmin.com"). This database will be the default for Install Scripts that require a database. If the script in question is incapable of using a prefix or suffix for database table names, this may restrict which applications can be installed into the default database.
If the virtual server owner has been granted database creation privileges, the Install Scripts form will include an option to create a new database for scripts. This is generally the recommended way to deal with running more than one script within a virtual server, particularly with applications that don't support table prefixes or suffixes to insure uniqueness.
A default installation of Virtualmin is configured to maximize performance, rather than minimize memory usage. Thus, on a system with 512MB of RAM and less, or systems running on a VPS with no swap available, problems can arise if steps aren't taken to reduce usage. These steps will not hurt performance on a low memory system, as running out of memory is a far greater performance problem than having to load a few libraries on each pageview in Virtualmin. Note also that Virtualmin, even at 100MB, is not the largest process on a full-featured webserver. Apache will be about 150-250MB once all of the modules are loaded, depending on which modules you use and whether everything runs under mod_fcgid or you use the individual mod_php, mod_perl, mod_ruby, etc. BIND can also grow to 100MB or much more, depending on the number of zones you're hosting and whether it is providing recursive DNS service. Postfix always stays pretty small, but the spam and anti-virus tools are unavoidably quite memory and CPU intensive.
If you have less than 3GB of RAM, we'd recommend using a 32bit operating system. And this is especially true if you have 1GB or less of RAM. Processes can require significantly more memory on a 64 bit architecture, and if you have any RAM constraints, any performance benefits that one might gain from a 64 bit operating system would be undone by having less memory available for buffers and caching.
To disable preloading of Webmin libraries, follow these steps :
root.Alternately, you can do the same thing from the command line by editing
/etc/webmin/miniserv.conf
Find this line:
preload=virtual-server=virtual-server/virtual-server-lib-funcs.pl virtual-server=virtual-server/feature-dir.pl virtual-server=virtual-server/feature-unix.pl...
This line is much longer than this on most systems. Insert a # mark at the beginning of the line (before "preload"), to comment it out, and then restart Webmin with the following command:
# /etc/webmin/restart
Then edit /etc/webmin/virtual-server/config, and change the preload_mode line to :
preload_mode=0
This will reduce Virtualmin memory usage from ~90MB (~120MB+ on a 64 bit system) to ~10MB. This option determines which Webmin libraries are preloaded on Webmin startup. This library pre-loading makes Virtualmin faster if there's plenty of memory, particularly if you have many simultaneous Virtualmin users, but on low memory systems avoiding swapping is far more important to performance of all components.
SpamAssassin and ClamAV combine to use a lot of memory. You can reduce their memory usage by going into System Settings - Spam and Virus Scanning, set these two options:
CentOS:
vi /etc/httpd/conf/httpd.conf
Debian/Ubuntu:
vi /etc/apache2/apache2.conf
KeepAlive On
KeepAliveTimeout 3 <Module prefork.c>
StartServers 2
MinSpareServers 2
MaxSpareServers 5
ServerLimit 10
MaxClients 10
MaxRequestsPerChild 100
</Module> <Module worker.c>
StartServers 2
MaxClients 10
MinSpareThreads 2
MaxSpareThreads 10
ThreadsPerChild 5
MaxRequestsPerChild 100
</Module>Optionally, remove any modules you aren't using. This actually will reduce memory usage more than anything else--but it's hard to guess what modules you'll want/need to do your job. mod_perl is needed for the Google Analytics module in Virtualmin, but otherwise everything can be run under cgi or fcgid...and if memory is a real problem, you may have to give up on Google Analytics (or set it up manually without our mod_perl filter). So, disabling mod_php4 or mod_php5 is cool (but if you've been using it for PHP scripts, you'll need to make the switch to fcgid first, and reset permissions and ownership up your PHP scripts in domain homes) and will shave quite a bit off the process size. Other possibilities for disabling: auth_dbm, disk_cache, proxy (but this removes quite a bit of functionality, including some needed for a number of Virtualmin features), include (removes Server Side Include functionality), status.
Because Apache is probably the biggest process on any hosting system...if you're dealing with a VERY small memory system (under 256M), then you'll have to cut it down a lot, and removing modules that are not absolutely vital becomes more important.
Note: On very small systems, under 256MB, you may consider using nginx instead of Apache. nginx is not as capable as Apache, but is famous for how little memory it uses. Consult the Using Nginx with Virtualmin documentation for more.
The actual mail services are tiny. The spam and anti-virus filtering services are not. You may want to consider simply forwarding mail on to a free Gmail account or something that has good spam/AV filtering. This is limiting...but it means your mail service can be provided in a few MB. In such a case, you'd turn off dovecot, and would never have to spawn SpamAssassin or clamav. If you do have to deliver mail locally, don't use clamd or spamc, as those have processes that always run...unless you get enough mail to keep them respawning every minute or more (because the memory is effectively made unavailable anyway--might as well get the mail processed faster and give away a little memory).
Virtualmin also supports running ClamAV and SpamAssassin service remotely, allowing many Virtualmin servers to share a single large spam/virus scanning server on your local network, which is documented on the Spam and Anti-Virus Scanning page.
Shut down postgresql or mysql or both. If you're not using databases, don't run them.
Most users do not need Mailman. If you need to send out newsletters, look into something like phplist, which is more lightweight.
Shut down proftpd, if you can convince yourself and/or your users to use the Webmin Upload/Download and File Manager modules or ssh/scp for file transfers. ssh/scp is more secure, anyway, though it does not support directory restrictions of the kind some hosts like in FTP.
Don't even think about running X. You don't want to run X on any server, but this is particularly true for low-memory systems.
Make sure you have a swap file or swap partition configured. Swapping out infrequently used processes and data leaves more memory for active processes.
I use these configs on my 256MB CentOs 5.2 VPS Server. It works good for me, but mileage may vary for you. This is in no way a replacement to a larger server.
Editors Note: Don't use LDAP on a low-memory system. Flat-files are dramatically less resource intensive and much faster than LDAP under pretty much all circumstances and especially in low-memory systems. But, if you must use LDAP, this may be helpful in reducing some of the resources required.
vi /etc/openldap/DB_CONFIG
set_cachesize 0 26843545 1
cachesize 1000
set_lg_regionmax 26214
set_lg_bsize 209715vi /etc/my.cnf
[mysqld]
port = 3306
socket = /var/lib/mysql/mysql.sock
skip-locking
key_buffer = 16K
max_allowed_packet = 1M
table_cache = 4
sort_buffer_size = 64K
read_buffer_size = 256K
read_rnd_buffer_size = 256K
net_buffer_length = 2K
thread_stack = 64KNo. The install script runs best on a freshly installed Grade A supported Operating System.
No. The install script runs best on a freshly installed Grade A supported Operating System.
If you installed from the standard package type for your system downloaded from Webmin.com or Virtualmin.com, everything should be fine. Running install.sh should work without any trouble.
If you installed from a third party source, or you don't know where it came from (like it was provided on a dedicated server you've rented from your hosting provider), you should uninstall it, and make sure whatever software repository it came from has been disabled.
If you installed from the OS standard repository for your OS, everything should be fine. If you installed from any third party sources, or from source, the installation will fail and things will go badly. The install script cannot accommodate packages installed from non-standard sources. It just isn't that smart.
If you can re-install your OS, it is recommended that you start with a freshly installed Grade A supported Operating System.
The Apache suexec command on your system is misconfigured for use in a virtual hosting environment, and needs to be recompiled or configured (on systems that provide a configurable suexec command) with the docroot set to /home. On Debian/Ubuntu systems, you can install the apache2-suexec-custom package, and modify /etc/apache2/www-data to include /home. On other systems, you will need to recompile the Apache package or the suexec binary.
Or, you can use our automated install script, which insures a correctly configured suexec binary is installed.
Web Development Ruby on Rails support in Virtualmin - Installing and managing a Ruby on Rails environment under Virtualmin. PHP support in Virtualmin - Working with PHP in a Virtualmin environment.
Virtualmin Professional includes a complete application deployment stack for both PHP version 4 (note that PHP 4 has been End-of-Lifed by the PHP developers, and should be used only as a last resort, or when the package is provided by your OS vendor, as in the case of CentOS/RHEL 4) and PHP version 5. Through the use of mod_fcgid, suexec, and php-cgi, it is possible to execute scripts compatible with either or both versions of PHP.
Virtualmin, by default, configures all scripts, including PHP, to execute as the owner of the virtual server account via the usage of suexec. This precludes the use of mod_php, and takes the place of hacks like suphp. Because execution of PHP as a CGI script can be slower than mod_php, Virtualmin makes use of mod_fcgid which allows PHP scripts to exist as long-running processes. This leads to PHP execution speed on par with running under mod_php while still providing a level of security only available to scripts running under suexec.
One pleasant feature of executing PHP scripts under mod_fcgid and CGI is that each user has their own private php.ini, which can be configured in any way that makes sense for the scripts the user is executing. Given that many scripts have requirements that can adversely effect security, it is of great value in a virtual hosting environment, but it also imposes additional complexity on the system and administrator. In general, Virtualmin maintains the php.ini files and the administrator need never think of them, but there are instances where manual configuration is required.
Individual php.ini files are stored in $HOME/etc/php.ini, and can be administered using the PHP Configuration module found under the Services menu under each domain within Virtualmin. As with all configuration files under Virtualmin, it is also safe to modify the files directly using your favorite text editor.
Note: Changing /etc/php.ini will not effect changes in the php.ini of individual virtual servers, e.g. /home/mydomain.com/etc/php.ini. The php.ini of individual virtual servers have to be modified by hand, or via sed or similar command line editing tools, if required. There is no safe way of implementing global changes to all php.ini files. On some systems, there is an /etc/php.d directory, where files that are automatically included by the default php.ini. Thus, you may be able to make system-wide changes by creating a new ini file in this directory containing your directives.
As mentioned, since the php.ini files are all independently maintained when using mod_fcgid and CGI, updating the whole system to use some new php.ini directive can be a time-consuming process. The Virtualmin command line tools can make that process painless.
A common change is to increase the memory_limit from the default 8M to something a bit more reasonable like 32M. To do that using the Virtualmin command line tools, for all virtual servers, you could execute:
virtualmin modify-php-ini --all-domains --ini-name memory_limit --ini-value 32M
You have to get a little fancier to append whole sections to php.ini. One way to do that is using the cat command and what is known as a here document.
For example, to append a Zend section to all top-level (e.g. /home/domain/etc/php.ini) php.ini files, one could execute something like the follow:
cat <<EOF >> /home/*/etc/php.ini [Zend] zend_extension_manager.optimizer=/usr/local/Zend/lib/Optimizer-3.2.6 zend_extension_manager.optimizer_ts=/usr/local/Zend/lib/Optimizer_TS-3.2.6 zend_optimizer.version=3.2.6 zend_extension=/usr/local/Zend/lib/ZendExtensionManager.so zend_extension_ts=/usr/local/Zend/lib/ZendExtensionManager_TS.so
Note: The Zend section is very specific to your environment and version. Do not copy this verbatim, as it will be wrong for your system and Zend!
Virtualmin, Inc. maintains an unsupported repository of bleeding edge versions of some software that is occasionally version dependent, PHP among them. If you'd like to use the latest released version of PHP, on your system, and understand the risks involved in running software that is dramatically less well-tested and vetted (for security, stability, and performance) than the version provided by your OS, and a repository for your OS is available, it can be used to get the latest features of PHP.
We do not recommend use of the Virtualmin bleeding edge repository, for PHP or otherwise. But, if you need the latest version of anything, we recommend you get it from our repository rather than building from source or obtaining it from other sources (which are likely to be even less well-tested, compatible, and concerned with security).
Read more about the Virtualmin Bleeding Edge Packages.
Ruby on Rails is an open-source web development framework that is optimized for programmer productivity and rapid development. If you are not already familiar with it, check out its website at http://www.rubyonrails.org/ .
Virtualmin includes support for setting up Ruby on Rails in a virtual server, either to run applications developed in Ruby by the server's owner, or for running freely available application like Blogs and Wikis. Because Rails is typically run using a separate server process the setup can be quite complex, but almost all of it is automated by Virtualmin.
These instructions related to Virtualmin versions 3.48 and above. If you have an older version, we recommend upgrading first before continuing.
Most web applications are written in PHP or Perl, which are run either within the Apache webserver process, or as CGI scripts started by Apache. Ruby on Rails apps instead almost always use a separate webserver called Mongrel, which must run on a different TCP port. In order to make the application visible as part of a virtual server's website running on the standard web port 80, Apache must be configured to forward requests to the Mongrel webserver. Fortunately, Virtualmin can take care of this for you.
Because there is a limit on the number of concurrent requests a single Mongrel can handle, for high-load applications the solution is often to run multiple instances of Mongrel, and balance requests to a single URL path between them. As long as they all talk to the same database or files, there will be no problem of data consistency between the instances.
However, only Apache versions 2.2 and above with the mod_proxy_balancer module support this configuration. But if you do have that Apache version and module installed, Virtualmin can setup the Mongrel instances and web server configuration for you automatically.
Because installing Rails applications involves the installation of Ruby packages (called Gems) containing database drivers and libraries, several dependencies must be installed on your system before using it. Many Gems compile code that links against libraries like MySQL, SQLite and glibc, which requires that a C compiler and headers for those libraries be installed. This section explains the steps you need to take on CentOS and Debian-based systems.
To install required packages on CentOS (and Fedora Linux), the command to run is :
yum install ruby ruby-devel gcc make mysql-devel sqlite sqlite-devel
Assuming that your YUM repository is set up correctly, this will download and install all needed packages that are not already on the system.
On Debian and Ubuntu systems, the command to install dependencies is :
apt-get install ruby1.8 ruby1.8-dev gcc make rake libc6-dev libmysqlclient15-dev libsqlite3-0
Because Debian-based systems do not have all required Apache modules enabled by default, you need to enable them by following these steps :
proxy, proxy_balancer and proxy_http are selected, and click Save. If your system doesn't include the proxy_balancer module, don't worry.
Installing Rails For a Virtual Server
Ruby on Rails applications are installed in Virtualmin using the Script Installers page, just as you would install PHP-based applications such as WordPress and SugarCRM. As with other scripts, they require a virtual server with a website and in most cases a MySQL database.
To install the Rails framework so that you can develop your own applications in Ruby, follow these steps :
If this is the first install of Rails on this system, the install process may take several minutes due to the need to download, compile and install several Ruby libraries. If anything goes wrong, an error message from the Ruby program that triggered it will be displayed - most are due to missing dependencies, so check the list above to make sure they are all installed.
Assuming all goes well, you will now be able to access Rails via the URL path you selected at install time (which will also be displayed by Virtualmin). Actual development of your own Ruby application that uses this environment is beyond the scope of this documentation.
Installing Other Ruby Applications
Virtualmin also includes installers for several other Blogging, Wiki and CMS applications based on Ruby on Rails. The procedure for adding these is identical to other scripts, with the exception of the Number of Rails server processes field on the installation form, on systems where Apache supports it.
Some Rails applications are installed by download and extracting a source file (as is the case with most PHP scripts), while others are done using Ruby's Gems system, which can perform the required downloads itself.
For all Rails scripts, Virtualmin will setup an Apache proxy that forwards requests from the domain's website to the Mongrel server(s) that actually run the application. You can see this proxy in the Proxy Paths page - but don't delete or change it though, as doing so will stop the script from working.
All Ruby on Rails scripts installed by Virtualmin can be removed or upgraded in the same way as other scripts. Deleting a Rails application will also stop its Mongrel server processes and remove the Apache proxy configuration.
You can also stop, start and restart the Mongrel processes for a Ruby script from within Virtualmin. This can be done by going to the Script Installers page, clicking on the script name, and using the buttons at the bottom of the form (which also shows the status of the servers and the port(s) they use). When developing your own Rails applications, it may be necessary to restart the Mongrel servers to pick up changes you have made to the code, which can be done easily with the Restart Rails Server button.
Git is a source-code control system that allows multiple developers to work on the same project. Each developer has a copy of the repository on his workstation, and can check in changes to that repository and synchronize it with a central server. Other developers can then fetch those changes by synchronizing their local repository with the central one.
This documentation assumes that you already have a basic understanding of Git and source code control systems. Rather than explaining how Git works, it focuses on setting up repositories using Virtualmin.
Before you can use Git with Virtualmin, you must first enable the plugin at System Settings -> Features and Plugins. Just check the box next to Git repositories , then click the Save button. If this plugin does not appear, you may need to first install it. On a Redhat, Fedora or CentOS system, this is easiest done with the following commands, run as root :
On CentOS or RHEL, the install command is :
yum install wbm-virtualmin-git
on Debian or Ubuntu, the command is :
apt-get install webmin-virtualmin-git
If activating the plugin fails due to Git not being installed on your Virtualmin system, you will need to install it first. On Redhat, Fedora or CentOS the commands for this are :
rpm -Uvh http://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-4.noarc... yum install git gitweb sed -e 's/^/#/' -i /etc/httpd/conf.d/git.conf apachectl graceful
while on Debian or Ubuntu, the command is :
apt-get install git gitweb
If neither of those work, you can install the plugin from a Webmin module package as follows :
Once the plugin is installed, you can enable it in Virtualmin as follows :
Once the plugin is installed, you can allow a virtual server to create Git repositories as follows :
This will perform the setup needed for repositories to be accessed under the /git URL path on this domain, but will not yet create any Git repositories.
Once a domain has Git enabled, you can add a repository to it like so :
myproject into the Repository name field.My cool program into the Repository description field.Once this is done your new repository will appear in the list on the Git Repositories page. It can then be accessed using the Git client with a URL like http://yourdomain.com/git/myproject.git . For more information on exactly which commands to use, click the Repository Commands button.
All Git repositories created using Virtualmin allow write access only to authenticated users. Accounts can be created in the same way that you would create mailbox or FTP users, and existing users can be granted access to Git repositories.
When creating or editing a user, the Other user permissions section of the Edit Mailbox page will have a field named Git login enabled?. Just select Yes, and in the Read/write access to repositories field select one or more repos to grant full access to. As soon as the user is saved or created his login and password will be able to checkin to and checkout from the selected repositories.
When logging in you only need to use the user's short username, which is the part to the left of the @ in his email address. For example, if the address was bob@webmin.com he would be able to login to Git as just bob , even though his IMAP and FTP is bob-webmin.
Once a repository has been created you can manage it using buttons on the Git Repositories page. These are :
SSL is an encryption protocol that protects data sent to and from websites from snooping or modification when they are accessed using https URLs. In addition, it allows browsers to be sure they are connecting to the correct web server, and not one setup by an attacker that is intercepting network traffic.
A critical component of the SSL protocol is the certificate, which web servers present to browsers to prove their ownership of a domain name. They are typically issued by Certificate Authorities (CAs), following the submission of a certificate request and validation of the submitter's ownership of a domain. Thanks to the magic of public-key cryptography, browsers can check that the certificate presented by a web server was actually signed by one of the CAs that it knows about.
If you want to setup an SSL website that will be visited by customers or users, obtaining a valid certificate is important. Although Virtualmin will allow you to use a self-signed certificate that costs nothing and can be generated immediately, users accessing your website will see a warning message in their browsers. And they will have no real assurance that they are accessing your webserver, rather than that of an attacker.
However, a certificate signed by a CA costs time and money to obtain. You can find out how much by looking at the websites of some major CAs : http://www.google.com/search?hl=en&q=ssl+certificate+authority
Enabling SSL For a Virtual Server
An SSL website can be enabled for a virtual server either when it is first created, or later using the Edit Virtual Server page.
In most cases, each SSL website needs to have its own IP address that is not shared with any other domain using SSL. This is due to the nature of the SSL protocol, which conflicts with name-based web virtual hosting. There are some exceptions though, as documented below.
Every Virtualmin system has at least one default shared IP address, and so can host at least one SSL website. However, to host more than one you will need to activate another IP on your system. For a typical system at a colo/hosting facility you will have several addresses available.
When creating a virtual server with SSL enabled, specify the new IP address as follows :
This is not necessary when creating your first SSL website though, as it can use the default shared IP address.
To actually have an SSL website created for a new virtual server, you need to check the Setup SSL website too? box under Enabled features. Fill in all the other details of your new virtual server, then click Create Server to begin the process. However, if Virtualmin detects any errors (such as another SSL website using the same IP), an error message will be displayed.
As part of the SSL setup process, a self-signed certificate will be generated for your domain. When you access https://example.com/ in your browser, a warning about the self-signed cert will be displayed - but once you get past that, the website contents should appear as normal.
Unless your SSL website is for use on an internal or personal network only, getting a real SSL certificate is a good idea. This is a two step process, most of which can be performed within Virtualmin.
A Certificate Signing Request or CSR contains information about your company and domain name for verification by a CA. To create one using Virtualmin, do the following :
This will create both a CSR and an SSL private key, and display them in Virtualmin. The CSR is just a block of text starting with —--BEGIN CERTIFICATE REQUEST—--, and must be send to the CA of your choice using whatever means they require.
Do NOT generate a new CSR after this point, as this will over-write your private key. The key and certificate must match for them to be used by Apache!
After the CA verifies your request, you will receive back from them a signed certificate. This just a file starting with —--BEGIN CERTIFICATE—--. followed by several lines of base-64 encoded data. To use the new certificate, do the following :
Now try accessing your website at https://example.com/ in a browser, and make sure that its SSL certificate is recognized as valid.
In Virtualmin version 3.64 and later, more than one SSL website can share the same IP address. This can be very useful if IP addresses are hard to get - however, most of the same SSL protocol restrictions still apply.
Older Virtualmin releases would display an error message when trying to enable SSL for a virtual server on the same IP as an existing website. New versions instead check if the certificate for the existing site can also cover the new domain, and if so allow the SSL setup to process. If not, a warning message is displayed indicating that SSL certificate errors may occur - but you can click past it if desired.
When Virtualmin detects that multiple virtual servers are sharing the same certificate, the Manage SSL Certificate page will only be available for the first server. And any changes such as the creation of a new certificate will be applied to all domains that share it.
A wildcard cert is one that matches any sub-domain under some top-level domain, like *.example.com . Browsers will not complain if this certificate is used for www.example.com , office.example.com and so on. This means that all those virtual server websites can share the same IP address.
Using wildcard certificates in Virtualmin is simple - all you need to do is enter *.example.com as the Server name when generating the CSR. Once the certificate has been installed, you will be able to create sub-domain virtual servers on the same IP address with no warnings.
Unified Communications Certificates (UCC) are like regular certs, but contain more than one domain name that they are considered valid for. This allows the same certificate to be used for several websites on the same IP address, such as example.com , example.net and example.org . Internally, these additional domain names are stored in the certificate's subjectAltName field.
Requesting a UCC certificate in Virtualmin is easy - just enter all the extra domain names in the Alternate hostnames field when creating a CSR. Make sure your registrar knows about and can handle UCC requests though, as they are relatively new.
Once a UCC certificate is installed, you can create SSL virtual servers for the additional domain names on the same IP address as the primary domain name. Virtualmin will detect this, and will not display any warnings.
One catch with UCC certificates is that not all web browsers recognize the additional domain names. For example, the wget command will complain about a certificate mismatch.
Subversion (also known as SVN) is a source-code control system that allows multiple developers to work on the same project. Each developer has a copy of some or all of the source code of the project on his workstation, and can check in changes to that repository which are then uploaded to a central server. Other developers can then fetch those changes by synchronizing their files with the repository.
This documentation assumes that you already have a basic understanding of SVN and source code control systems. Rather than explaining how SVN works, it focuses on setting up repositories using Virtualmin.
Before you can use SVN with Virtualmin, you must first enable the plugin at System Settings -> Features and Plugins. Just check the box next to Subversion repositories , then click the Save button. If this plugin does not appear, you may need to first install it. On a Redhat, Fedora or CentOS system, this is easiest done with the following command, run as root :
yum install wbm-virtualmin-svn
on Debian or Ubuntu, the command is :
apt-get install webmin-virtualmin-svn
If activating the plugin fails due to SVN not being installed on your Virtualmin system, you will need to install it first. On Redhat, Fedora or CentOS the command for this is :
yum install subversion
while on Debian or Ubuntu, the command is :
apt-get install subversion
Once the plugin is installed, you can allow a virtual server to create SVN repositories as follows :
This will perform the setup needed for repositories to be accessed under the /svn URL path on this domain, but will not yet create any SVN repositories.
Once a domain has SVN enabled, you can add a repository to it like so :
myproject into the Repository name field.Once this is done your new repository will appear in the list on the Subversion Repositories page. It can then be accessed using any SVN client with a URL like http://yourdomain.com/svn/myproject .
All SVN repositories created using Virtualmin allow write access only to authenticated users. Accounts can be created in the same way that you would create mailbox or FTP users, and existing users can be granted access to SVN repositories.
When creating or editing a user, the Other user permissions section of the Edit Mailbox page will have a field named Subversion login enabled?. Just select Yes, and in the Read/write access to repositories field select one or more repos to grant full access to. As soon as the user is saved or created his login and password will be able to checkin to and checkout from the selected repositories.
When logging in you only need to use the user's short username, which is the part to the left of the @ in his email address. For example, if the address was bob@webmin.com he would be able to login to SVN as just bob , even though his IMAP and FTP is bob-webmin.
Users can also be given permissions to read from selected repositories, using the Read-only access to repositories field on the Edit Mailbox page.
Once a repository has been created you can manage it using buttons on the Subversion Repositories page. These are :
Nginx is a lightweight webserver that supports most of the functionality of Apache, but is faster and uses less memory. It is suited to websites that have a large amount of static content, or virtual machines with limited memory. For more information, see http://wiki.nginx.org/Main
Switching a system from the Apache webserver (installed by default by Virtualmin) to Nginx should only be done if no virtual servers with websites have been created yet. Ideally the change should be done on a freshly installed system, running RHEL 6.0, CentOS 6.0 or Debian 6.0 or later. Virtualmin version 3.89 or above is also required.
The steps to remove Apache and install Nginx are :
/etc/init.d/httpd stop ; service httpd off (on RHEL or CentOS), or /etc/init.d/apache2 stop ; update-rc.d apache2 remove (on Debian).yum install nginx (on RHEL or CentOS) or apt-get install nginx (on Debian)./etc/init.d/nginx startyum install wbm-virtualmin-nginx wbm-virtualmin-nginx-ssl (on RHEL or CentOS) or apt-get install webmin-virtualmin-nginx webmin-virtualmin-nginx-ssl (on Debian).Once this is done, you can configure Virtualmin to use it as follows :
Once Nginx support has been configured, you should be able to create virtual servers just as you would with Apache. However, on the Create Virtual Server page you will need to select Enable Nginx website? in the Enabled features section, instead of Enable Apache.
When creating a domain from the command-line API, you will need to use the --virtualmin-nginx flag instead of --web . For SSL websites, you will need to use --virtualmin-nginx-ssl instead of --ssl .
Similarly, when creating a domain via the remote API, you will need to use the virtualmin-nginx= parameter instead of web= .
Nginx as configured by Virtualmin lacks some features of Apache, such as :
Only one virtual server can have SSL enabled per IP address, even if a wildcard or UCC certificate would potentially allow multiple SSL sites to share the same IP.
Nginx does not support CGI, so any applications or Virtualmin scripts that use CGI will not work. Virtualmin should prevent the installation of scripts that require CGI, mod_perl or Apache-specific features.
PHP can only be executed via FastCGI, and all PHP scripts run with domain owner permissions. Execution via CGI or mod_php is not supported. For PHP to work, Virtualmin will setup a PHP FastCGI server process that Nginx communicates with for each virtual server.
Only one PHP version is supported, and Virtualmin will pick the highest version available on the system. This typically means that PHP v4 scripts cannot be run.
Virtualmin supports a few of methods of "previewing" a site before the DNS stuff is pointing to the right place.
A quick way to do this is to log into Virtualmin, and click Services -> Preview Website. When you click that, Virtualmin will retrieve the website, and you will be able to navigate it from within the control panel GUI.
Another method, and the way we'd recommend, is to setup an alias so that your customer could access their site using http://username.mydomain.tld. You can do that by going into System Settings -> Server Templates -> Default Template -> Virtual Server Creation, and adding your primary domain in "Automatically create alias domain". This makes it so that any new Virtual Server created will have not only the domain you setup, but also an alias your customer can use before the DNS is pointing to your server.
Some have asked why Virtualmin doesn't use the UserDir (http://www.mydomain.com/~username) feature they've seen used in other virtual host administrative tools. This method of access is discouraged by the Apache developers as it is potentially a security issue, particularly in shared virtual hosting environments where Virtualmin is usually used. How large a security issue is debatable and depends on the environment, but we trust the Apache folks to know their own software and what is and isn't a good default, so we don't enable it by default. Those issues are increased exponentially by allowing CGI/PHP scripts to run in this way, and we strongly discourage use of UserDir with executable applications, as it introduces serious security problems.
However, you can use this mode, if you wish.
To switch your Virtualmin server to behaving the way you're used to, you just need to turn it on in Apache. Here's how:
Browse to the Apache Webmin module.
Click on the Default virtual server (just be sure you know what your default Domain is so you can point folks to the right place).
Click on the Automatic Virtual Hosts icon.
Switch the radio button by Automatic virtual host root to the one beside the empty field, and fill in the field with, /home/%0/public_html. Note that if you've configured Virtualmin to create domains with a different path convention (e.g. "/home/a/abc") things get more complicated and you'll need to construct a path using the variables documented here:
http://httpd.apache.org/docs/1.3/mod/mod_vhost_alias.html
It's possible to use Roundcube as the default webmail program, in place of Usermin. To do that, our recommendation is to install Roundcube into one specific Virtual Server, and then update the webmail redirects so that going to webmail.domain.tld on any domain hosted on your server will redirect to your Roundcube installation.
The first step would be to choose a Virtual Server that should host Roundcube, and to install it. If you have Virtualmin Pro, you can use the Install Script to perform the installation. If you have Virtualmin GPL, you can download Roundcube from roundcube.net, and perform the installation manually using the instructions on their site.
Once Roundcube is working -- the next step is to setup the webmail redirects to point to your installation. To do that, log into Virtualmin, and browse to System Settings -> Server Templates -> Default Settings -> Apache Website. Scroll down, and look for the setting "URL for webmail redirect". You'll want to set that to the URL for which you've installed RoundCube (such as http://roundcube.your_domain.tld).
Making the above update will only change new Virtual Servers. To update existing Virtual Servers with your new webmail redirect, you would need to use the Virtualmin command line tools. First, run this command from the command line as root to disable the webmail redirect for all Virtual Servers:
virtualmin modify-web --no-webmail --all-domains
Then, you can re-enable the webmail redirect (but with the new settings) by using this command:
virtualmin modify-web --webmail --all-domains
After you complete the above, going to webmail.domain.tld for any domain hosted on your server should then take the user to your central Roundcube installation.
If you're able to log into FTP, but you receive an error like this when trying to change directories or list files:
Connection timed out Error: Failed to retrieve directory listing
That may mean you need to load the FTP connection tracking module on your server.
You can do that by running this command as root:
modprobe ip_conntrack_ftp
Website HTML content and PHP applications reside in public_html within the home directory of the virtual server. For example, the website content for virtualmin.com would reside in /home/virtualmin/public_html.
Sub-servers reside within a sub-directory of their parent virtual server home. For example, software.virtualmin.com resides in /home/virtualmin/domains/software.virtualmin.com, and thus web content would be located in /home/virtualmin/domains/software.virtualmin.com/public_html.
CGI scripts reside in the cgi-bin directory within the virtual server home directory. For example, the CGI applications for virtualmin.com would reside in /home/virtualmin/cgi-bin.
There are several ways to upload content to your Virtualmin account. You can use any of them or all of them, based on your needs and skills.
The preferred method for sending many files, directories of files, or very large files, is the SSH protocol. SSH is a fast and secure protocol, that allows you to safely login, upload and download files, and manage existing files. SCP is the name for file transfer commands that work using the SSH protocol. Likewise, FTP over SSH (sometimes also called FISH, or SFTP) is a mechanism for providing FTP-like service over a secure link.
There are many graphical and textmode clients for the SSH protocol available for free and commercially.
We'll cover where to find SSH-capable clients for your Operating System, and we'll provide a few examples of using them to manage the files in your Virtualmin account.
pscp
The best free command line SCP client is called pscp.exe and it can be found at:
http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html
It is related to PuTTY, which is a very nice free SSH client.
After you've placed the pscp.exe file into your system path, using it is quite simple. In a DOS shell, simply enter a command like the following:
C:\> pscp.exe myfile.htm user@domain.tld:/home/user/public_html
Then, enter your password at the prompt, and hit enter. This will copy the file "myfile.htm", located in the current directory, to the /home/user/public_html folder on the Virtualmin server.
Filezilla
A free graphical FTP client that supports FTP over SSH is Filezilla. Filezilla Home Page.
To Configure Filezilla:
Your admin user will be able to use a graphical FTP style program or Dreamweaver to upload their pages now.
WinSCP
Another good free graphical FTP over SSH option is WinSCP:
After installation, simply start it up. It will ask for your login information. Enter the details as provided by your system administrator for hostname, username, and password. Then click Login.
Now you'll see a window displaying the files in your Virtualmin account home directory. You can copy files into your public_html directory to make them accessible via the webserver, or into the cgi-bin directory, if the files are executable CGI scripts.
scp
Mac OS X includes the free OpenSSH SCP client, called simply scp. Usage is just like Linux and UNIX scp clients. Open a Terminal and execute a command like the following:
$ scp myfile.htm user@domain.tld:/home/usr/public_html
After this hit enter, and then enter your password.
scp
Like Mac OS X, all Linux distributions include a complete SSH implementation, including the scp command. Run the following to copy a file named "myfile.htm" to the domain.tld server using the username "user":
$ scp myfile.htm user@domain.tld:/home/usr/public_html
After this hit enter, and then enter your password.
gftp
gftp is a popular Gnome-based graphical FTP client that also supports scp and FTP over SSH protocol connections.
Download it for free from here:
Or, preferably, simply install the package provided by your OS vendor. gftp is very popular and is available from the majority of Linux distributions, so you don't need to build it yourself.
Your FTP client should be configured to connect to yourdomain.tld, or, if DNS has not yet propagated, you could use the IP address or temporary hostname given to you by your administrator (which will be of the form youdomain.hostdomain.tld). You will use the domain account name and password given to you by your system administrator. Note that, by default, only the domain account has FTP access to the website data for your account, and additional users are only email users.
The Webmin File Manager applet is documented in detail in the Webmin Documentation.
Problems with the web server are usually relatively easy to troubleshoot, but some common problems are tricky, because they aren't usually errors of configuration and so might not show up as reasonable errors in the error_log.
The first place to look for clues in any webserver problem is in the logs. Every virtual server or sub-server in Virtualmin has its own webserver log files. You can find them in the logs directory in the virtual servers home directory. The error_log is usually the most useful when troubleshooting, but the access_log can contain clues
If you browse to one of the domain names on your server and see the wrong site content, there is likely an IP address mismatch on your system.
A common cause of that is due to a mis-configuration when behind a NAT router. It can also occur when tools outside of Virtualmin change the IP address in the Apache config file, or change the IP address of your server.
The key to resolving it is to find the primary IP address of your server, and then to verify that the IP address listed in Apache is your current IP address.
To determine your primary IP address, you can run "/sbin/ifconfig", and then look for your primary interface (which is often "eth0").
Next, review your Apache config, and make sure the VirtualHost sections in your config are using that IP address.
On CentOS, that is located in /etc/httpd/conf/httpd.conf.
On Ubuntu and Debian, the config files for each domain are stored as individual files in /etc/apache2/sites-enabled/.
When looking at those config files, you'll see "VirtualHost" blocks that look like this:
<VirtualHost x.y.z.q:80>
Where "x.y.z.q" is the IP address. You would want to make sure that IP address is your server's primary IP.
You would also want to verify that each VirtualHost block lists an IP address, and not an asterisk (*) character.
If you make any changes, you would need to restart Apache. You can restart Apache on CentOS by typing "/etc/init.d/httpd restart", or on Ubuntu and Debian by typing "/etc/init.d/apache2 restart".
Once you've corrected the Apache config, you may also want to review some options in Virtualmin to make sure new records are being created correctly. Those options are in System Settings -> Virtualmin Config -> Network Settings:
Network interface for virtual addresses - This is automatically detected by Virtualmin during the configuration check, but could be detected incorrectly, if you have multiple physical interfaces, or your system is some virtualized system like a vserver or Zone or OpenVZ instance. You would typically want this to be the primary IP address of your server -- in most cases that is "eth0".
Default virtual server IP address - We recommend leaving this as it's default of "From Network Interface".
Default IP address for DNS records - If your server is behind a NAT router, this option should be set to "Automatically detect external address". Otherwise, you should leave it at the default of "Same as virtual server IP".
This error is the bane of every Apache administrator's existence, as it rarely results in a useful error message in the error_log. And, to compound matters, permission problems show up in the suexec_log, which users don't have access to.
A common problem in an environment using suexec is that permissions on the executable files are too loose. There is a lot of bad advice on the web about setting permissions to 777 for testing, and then figuring out the tighter security later. If group or other users can write your scripts in a suexec environment, they will not execute. Correct permissions for scripts in a suexec equipped system are 750 or less. The script will be executed as the owner of the domain, so as long as the owner has appropriate permissions the script will be executable by the Apache suexec process.
Scripts may have errors in syntax, or be incompatible with the default version of PHP. You may be able to check the syntax from the command line by explicitly calling PHP and the script, like so:
php -l scriptname.phpIf you think it might be a version mismatch you could see if the script runs with each of the available versions (Virtualmin provides both PHP4 and PHP5 on most supported platforms).
php4 scriptname.php
And:
php5 scriptname.php
Scripts may also not have the correct permissions for the files it needs to access. A common problem is unzipping or untarring a script archive as root for use by a domain account user. This will result in files that may not be readable or writable by the domain owner, and thus unreadable or unwritable by the suexec process. Check to be sure the files are all owned by the owner of the domain using ls -l. If they aren't, you can use:
chown -R domainname:domainname scriptdirectory
The Webmin Wiki contains the following article that may be also be useful: