Tutorial

How To Install and Utilize VirtualMin on a VPS

Published on August 12, 2013
Default avatar

By

How To Install and Utilize VirtualMin on a VPS

About Virtualmin

Virtualmin is a Webmin module which allows for extensive management of (multiple) virtual private servers. You will be able to manage Apache, Nginx, PHP, DNS, MySQL, PostgreSQL, mailboxes, FTP, SSH, SSL, Subversion/Git repositories and many more.

In this tutorial, we will be installing the GPL (free) edition of Virtualmin on a freshly created VPS (droplet).

Prerequisites

  • Virtualmin highly recommends using a freshly installed server to prevent conflicts, assuming you just created a new VPS, this should be all good.
  • Confirm that your VPS has a fully qualified domain name set as hostname. An example of a fully qualified domain name is "myserver.example.com" or "example.com".

    Make sure that the domain name points to your server's IP address.

    Use the following command to check your current hostname.

    hostname -f

    And use the following command to change your hostname if necessary.

    hostname myserver.example.com

Login as Root

Grab the IP address of your droplet from the DigitalOcean control panel and use SSH to login as root.

ssh root@123.45.67.89

Downloading the Install Script

Virtualmin provides an install script which allows for an easy installation. Use the following command to download the script to your root directory.

wget http://software.virtualmin.com/gpl/scripts/install.sh -O /root/virtualmin-install.sh

You should expect to see something like this when it's finished:

2013-07-06 11:03:57 (129 KB/s) - `/root/virtualmin-install.sh' saved [45392/45392]

Running the Install Script

	Now it&#39;s time to run the script we just downloaded.<pre>sh /root/virtualmin-install.sh</pre>

This will start the installation wizard. It will start with a short disclaimer, after accepting it the installation will begin.

Accessing Virtualmin

When the install script has finished installing, you can reach Virtualmin with the following URL:

https://myserver.example.com:10000/

There you can login with your root username and password. Once you are logged in the "Post-Installation Wizard", it will begin to configure your Virtualmin installation.

Post-Installation Wizard

This wizard is pretty self-explanatory, we'll cover some of the steps with some additional information.

Memory use

  • Preload Virtualmin libraries? This will make your Virtualmin UI faster, use this when you are going to use the UI extensively, the UI is very usable without it.
  • Run email domain lookup server? If fast e-mail is important to you and you have the spare RAM then it's recommended to enable this.

Virus scanning

	<ul>
		<li>Run ClamAV server scanner? This is explained pretty well on the page, if your server receives a lot of e-mails then it&#39;s beneficial to enable it.</li>
	</ul>

Note: If you are installing Virtualmin on a 512MB VPS and you have just enabled ClamAV server scanner in the step above, then it is very likely that you run accros this error:

A problem occurred testing the ClamAV server scanner :
ERROR: Can't connect to clamd: No such file or directory

----------- SCAN SUMMARY -----------
Infected files: 0
Time: 0.000 sec (0 m 0 s)
		

The reason why you get this error is because your VPS is running out of RAM... you can choose to upgrade your RAM or add swap space to handle the increased memory usage.

For more information about swap space and how to enable it, please follow this tutorial: https://www.digitalocean.com/community/articles/how-to-add-swap-on-ubuntu-12-04.

Spam filtering

	<ul>
		<li>
			Run SpamAssassin server filter?<br><br>
			Again this is explained pretty well on the page, if your server receives a lot of e-mails then it&#39;s beneficial to enable it.<br>
		</li>
	</ul>

Database servers

This step should be pretty clear assuming you know what MySQL or PostgreSQL is. Enable whichever one you need.

If you picked MySQL, the next step will ask you to enter a root password for your MySQL server. The step after that asks what type of configuration MySQL should use.

It's recommended to pick the one that matches your RAM (I believe it selects the right one by default).

DNS zones

If you plan on managing your DNS zones with Virtualmin then enter your primary and secondary nameservers here.

Passwords

Virtualmin gives you two choices on how it should save passwords. It is highly recommended to select "Only store hashed passwords".

This way if any uninvited people get into your server they won't be able to retrieve any personal passwords.

All right, you've completed the post-installation wizard! You might see a big yellow bar on the top of the page with a button that says "Re-check and refresh configuration".

It's recommended to press that button just to make sure everything is well.

If you run into an error during that check, follow the instructions to resolve it and re-check your configuration until all errors are gone.

Some Useful Knowledge

Here's some information which will help you get around Virtualmin:

Virtual Private Server

A virtual private server (usually) represents a website, typically every website has it's own virtual private server.

Sub-server

A sub-server sounds confusing but it's basically a subdomain.

Virtualmin vs Webmin

As you can see on the top left, you have Virtualmin and Webmin. These are different control panels, Virtualmin is where you manage all the VPS and anything related to that. Webmin is where you manage the server itself.

Documentation

Virtualmin is very well documented, this means that every page has it's own help page and every option's label (the label in front of the input field) is linked to an explanation of that option.

Here's a screenshot explaining the menu structure of Virtualmin.

Setting Up a Virtual Private Server

Now that we've gone through the installation and wizard, we can start setting up our virtual private server(s). Click "Create Virtual Server" in the navigation on the left side.

Enter the domain name you want to setup a server for, in this tutorial we will use: example.com.

Enter an administration password which will become the main password to manage the virtual private server. If you are managing the virtual private server by yourself then you don't really need to know this password. In that case, I suggest using a long generated password for extra security.

Virtualmin allows you to manage server configuration templates and account plans, these can be modified under "System Settings" and then "Server Templates" and "Account Plans".

You can specify an administration username, leaving it on automatic would make "example" the username.

Have a look at the options hidden underneath the other tabs and enable/disable/change anything you'd like to configure your virtual private server.

Now click "Create Server", Virtualmin will execute the steps needed to setup your virtual private server, if any errors occur, it will display them there.

Setting Up a Subdomain

Now that we've setup our virtual private server, it's time to add a subdomain, click on "Create Virtual Server" again.

Notice how different options are now on the top of the page: "Top-level server" (Virtual private server), "Sub-server" (Subdomain), "Alias of example.com" and "Alias of example.com, with own e-mail".

Click on "Sub-server" to create a subdomain of "example.com".

Fill in the full domain name (test.example.com) and go through the options below it, once you are ready click "Create Server".

Watch Virtualmin do what it needs to do and after it's all done, you should see "test.example.com" as the currently selected virtual private server.

Setting Up Users

First of all, let's make sure we are on the top-level server "example.com" and then click on "Edit Users". On the top, you see you have three options of creating users: "Add a user to this server.", "Batch create users." and "Add a website FTP access user."

If you are only looking to setup a user that has FTP access then click that link, we will go with "Add a user to this server.". The first step is to enter the user's email address, real name and password. Then, carefully look at the other options available to get your ideal setup, when you're done press "Create".

You will now see your user being added to the list, the main user is bold. It also tells you what the user's login is (by default this is something like test.example).

For further setup of e-mail addresses see the "Edit Mail Aliases" link in the menu.

Setting Up Your Databases

Click the "Edit Databases" link in the menu, remember to set your virtual private server correctly. Depending on your settings, every virtual private server has its own database (or multiple).

Every database has a "Manage..." link which gives you a very simple view of the database and allows you to execute queries. Now go back to the "Edit Databases" page and click "Passwords", here is your database's password which was automatically generated by Virtualmin.

Moving on to the "Import Database" tab you can assign an existing database (a database created outside of Virtualmin) to the current virtual private server, useful for when you created databases using a MySQL client of some form.

Last but not least, the "Remote hosts" tab allows you to provide multiple hosts to connect to your server, it's recommended to leave it as is (localhost) and use an SSH tunnel to login to your database server.

Directory Structure

Virtualmin has a very nicely organised directory structure. See the following scheme.

`-- /home/example
    |-- /home/example/awstats
    |-- /home/example/cgi-bin
    |-- /home/example/domains
    |   `-- /home/example/domains/test.example.com
    |       |-- /home/example/domains/test.example.com/awstats
    |       |-- /home/example/domains/test.example.com/cgi-bin
    |       |-- /home/example/domains/test.example.com/homes
    |       |-- /home/example/domains/test.example.com/logs
    |       `-- /home/example/domains/test.example.com/public_html
    |           `-- /home/example/domains/test.example.com/public_html/stats
    |-- /home/example/etc
    |   `-- /home/example/etc/php5
    |-- /home/example/fcgi-bin
    |-- /home/example/homes
    |   `-- /home/example/homes/test
    |       `-- /home/example/homes/test/Maildir
    |           |-- /home/example/homes/test/Maildir/cur
    |           |-- /home/example/homes/test/Maildir/new
    |           `-- /home/example/homes/test/Maildir/tmp
    |-- /home/example/logs
    |-- /home/example/public_html
    |   `-- /home/example/public_html/stats
    `-- /home/example/tmp	
		

As you can see, everything is put in /home/example and our subdomain can be found in /home/example/domains/test.example.com/. Every domain has its own logs directory and Virtualmin comes with awstats by default and is accessible through "http://www.example.com/stats", unless you disabled this during the creation of the virtual private server.

Where Do I Go from Here?

Take some time to go through Virtualmin's settings. There are many things you can change to make your experience better. Don't forget to also explore the Webmin side of this control panel.

This tutorial only touches the surface of Virtualmin and there's a lot more which can be done with it or added to it through modules. There are even modules for setting up svn/git repositories.

Thanks for learning with the DigitalOcean Community. Check out our offerings for compute, storage, networking, and managed databases.

Learn more about us


About the authors

Still looking for an answer?

Ask a questionSearch for more help

Was this helpful?
 
10 Comments


This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

There seems to be confusion between a VPS (Virtual Private Server), like a DO Droplet and what Virtualmin calls a “Virtual Server” in it’s menu. A VPS is a hosting platform.

The writer of the above is calling Virtualmin’s (and Apache2’s) “Virtual Server” a VPS. When a new Virtual Server is set up in Webmin a new VPS isn’t created, you are still on the same Droplet.

See Apache and Linux Docs for info on Virtual Server, a means of hosting several sites (Apache web servers) on the same IP address.

The Virus scanning-part is repeated in this article. Still a great article!

do I install LAMP before or after virtualmin?

Kamal Nasser
DigitalOcean Employee
DigitalOcean Employee badge
February 3, 2014

@yazirarafath: You’ll probably break your droplet if you install Virtualmin on it.

Kamal Nasser
DigitalOcean Employee
DigitalOcean Employee badge
November 13, 2013

@pmartelletti: You will need to set up branded nameservers if you are using virtualmin.

Hi Kamal, same question as alex vazqued… which are my domain’s nameservers? The ones provided by digitalocean or should i creat some branded ones?

Sorry if this is a dumb question, but if I’m using Virtualmin to manage my dns, would I still put in the digitalocean nameservers (ns1.digitalocean, etc.), or would I create my own nameservers based on the primary domain tied to my IP address?

Kamal Nasser
DigitalOcean Employee
DigitalOcean Employee badge
September 2, 2013

@Joseph: Since you’re using the GPL version of Virtualmin, you will have to install RoR manually:

https://www.digitalocean.com/community/articles/how-to-install-ruby-on-rails-on-ubuntu-12-04-lts-precise-pangolin-with-rvm

What about Windows users,should I carry out the instruction using Putty or is there any different instruction for WIndows?

Any reply is much appreciated.

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

Join the Tech Talk
Success! Thank you! Please check your email for further details.

Please complete your information!

Get our biweekly newsletter

Sign up for Infrastructure as a Newsletter.

Hollie's Hub for Good

Working on improving health and education, reducing inequality, and spurring economic growth? We'd like to help.

Become a contributor

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

Welcome to the developer cloud

DigitalOcean makes it simple to launch in the cloud and scale up as you grow — whether you're running one virtual machine or ten thousand.

Learn more
DigitalOcean Cloud Control Panel