Install Ubuntu Server 16.04 plus LAMP Stack with the Webmin Management GUI

I urge you to read the whole document or at least to the end of each section before acting on the instructions. In many cases I show a easier way at the bottom but I feel it's important to know the details of what the easier way accomplishes.

Most of my goals after this server build are not dependent specifically on a LAMP stack. The L can be any of a plethora of Linux flavors, and some people accomplish the same goals I have in the tutorials but do it with a Windows, or a Apple/Macintosh operating system. I merely prefer Ubuntu Linux. The A can be a variety of web serving software, like the Nginx webserver program is a quite popular alternative in a stack; LEMP stack E implies engine=ngin. Again I merely prefer Apache, but mainly because I started learning that first. Instead of the MySQL you could go with PostgreSQL for your database. Programs like the Drupal CMS web development environment don't care if you pick MariaDB, PostgreSQL or MySQL. Here's a how to for a LEMP example where the M is MariaDB. Like I mentioned before about preferences, I started with MySQL, so I'm sticking to it—with slim to no justification. When it comes to the P, it seems you have fewer choices; Java, .NET, and PHP are the main ones, but time will bring prominence to new players.

At this point, I'm assuming that you have a modern computer which you can boot from a CD-ROM or USB Drive, and that you have stuck the start-up device you made in the last step into that computer.

Power that target server on or Reboot it if it's already running, your total install time could take 30 minutes depending on your particular machine and your software choices, but your keyboard time is merely 5-6 minutes. Scroll down to my video of the server install process: (this might be boring get yourself a coffee)

12/11/2017 Update on using Virtualmin to manage a server instead of just Webmin

For a while now I heard about the Virtualmin system and never thought it was something I should care about. After struggling with eMail server difficulty for a long time I thought a Virtualmin system may solve my problems. It didn't, but two things developed as a result; I saw the beauty and power inherent in the Virtualmin system, and found an independent solution to the eMail issues that plagued me.

Below the Webmin section I discuss the install of Virtualmin, but note that you don't install Webmin if you chose to install Virtualmin.

On the page for tweaking eMail on your installation I give details about how to overcome the problems I had.

The reason this message is above the video is that if you are going to do the Virtualmin install, you will only select the OpenSSH Server package while installing Ubuntu. Virtualmin automatically installs the rest and adjusts the settings for those other packages.

12/27/2017 Update on deciding whether to pick Encrypted LVM or just /home during install

Ubuntu recently had an Enterprise Summit on new things and this "What's the security story?" bit is worth your time to watch.

12/11/2017 Update about computing behind a DHCP connection to the Internet

Your operating system has some wake up things it does to establish who it is relative to the network. If your a DHCP connection, it will make bad decisions about itself. Like my server is called "OutsourcedMath" but it thinks it's called "" which louses up some things, so the following commands will fix that issue:

Change these lines ...

send host-name = gethostname();
request subnet-mask, broadcast-address, time-offset, routers;
 domain-name, domain-name-servers, domain-search, host-name,, dhcp6.domain-search, dhcp6.fqdn, dhcp6.sntp-servers,
 netbios-name-servers, netbios-scope, interface-mtu,
 rfc3442-classless-static-routes, ntp-servers;

... to be these lines (note the comma at the end of the line changes to a semi-colon) ...

send host-name = gethostname();
request subnet-mask, broadcast-address, time-offset, routers;
#  domain-name, domain-name-servers, domain-search, host-name,
#, dhcp6.domain-search, dhcp6.fqdn, dhcp6.sntp-servers,
# netbios-name-servers, netbios-scope, interface-mtu,
# rfc3442-classless-static-routes, ntp-servers;

prepend domain-name-servers,,,;
    • [Ctrl]+X
      • Y
      • [Enter]

Also in that terminal window, check your hosts file and your hostname files:

  • sudo nano /etc/hosts

If necessary, change this line ...  OutsourcedMath

... to be this line ... OutsourcedMath
    • [Ctrl]+X
      • Y
      • [Enter]
  • sudo pico /etc/hostname

You should see your machine name you entered during the Ubuntu install ...


... if you see "localhost" change it to your machine host name, then ...

    • [Ctrl]+X
      • Y
      • [Enter]

As an afterthought, I believe it's better for you to install your UPS monitoring software using the command line in a Terminal/Shell window at this stage. Then after you put the Webmin/Usermin on, add the Webmin module for your UPS management.

In this next video, I'll be briefly using the "Shell" or "Terminal Window" on my Ubuntu Desktop 17.04 operating system to put on a couple pieces of software that will get me to a web based GUI, "Point & Click" interface, that I use to control nearly everything on the server. My preferential GUI is Webmin. There are other choices, but like a lot of other decisions I make, it's the first good one I found. Immediately below the embedded video on this page, I will post the commands I executed so you can copy & paste them into your own Shell/Terminal window to execute the same commands without worrying about typo's.

After the recording was complete, I noticed the following mistakes:

  • 9:30 | I said, "bring in all the thing's," and should have said, "it will update the list of available software and the revision status."
  • 13:33 | I said programs that might not be installed were "apt-get" and "install" because my brain wasn't engaged while I was killing time. The "apt-get install" portion was the command and the rest were component programs that may or may not be present on your system, but Webmin depends on them.
  • 14:07 | I said, "you just have to do those two," referring to apt-get update and apt-get install usermin, but you only need to do the latter.
  • 23:57 | #Lolz! I said, "you can see which one of your processors are running," but it's processes being run. That's the equivalent of asking your mom at a family dinner which one of her cooks are you eating for dinner.

The video is about 30 minutes long, but your at-the-keyboard install time should be about 3 minutes and depending on the system you are doing it on, expect about 20 minutes to install Webmin and Usermin.

Commands in the Terminal Window are:

  • ssh <your username on your new server>@<your server's name> e.g. ssh jimmysmith@localhost
    • <your password on that server> e.g. uiopH(*&&^T_iguugblkJHO*&7yghpI*7y0&Hpj
    • yes
  • sudo nano /etc/apt/sources.list
    • <your password on that server> e.g. uiopH(*&&^T_iguugblkJHO*&7yghpI*7y0&Hpj
      • # I put this next line in here
      • deb sarge contrib
      • [Ctrl]+X
      • Y
      • [Enter]
  • cd /
  • sudo wget
  • sudo apt-key add jcameron-key.asc
  • sudo apt-get update
  • sudo apt-get install apt-transport-https
  • sudo apt-get install -y -f zip unzip php7.0-zip php-soap php-curl php7.0-cgi php-pgsql
  • sudo apt-get install webmin
    • Y
  • sudo apt-get install usermin, the webmin install took long enough for my SUDO to time out so
    • <your password on that server> e.g. uiopH(*&&^T_iguugblkJHO*&7yghpI*7y0&Hpj

As an alternative to the last four bullet points above you can enter this single line:

  • sudo apt-get -y install webmin usermin

The install commands allow multiple programs to be listed for batch installation. The "-y" will answer the yes/no question for you when the installer command ask's you if it's okay to proceed.

12/11/2017 Update on Virtualmin option

After I started posting these how-to's a YouTUBE commenter asked me why I was still doing "monkey work" and by that he meant Virtualmin automates a lot of the tasks I struggled with which prompted this whole site. I am using Virtualmin now. It runs on top of Webmin, and is made by the same people. With a few clicks, Virtualmin spins up a virtual server under a given hostname and set's up email, FTP, and a variety of other things. If you are going to do Virtualmin instead, skip all those command-line statements above and instead execute the following Commands:

After that 20 minute or so procedure finishes, you can log into your Virtualmin server the same way as logging into a Webmin server.

The video below is what your install will look like, but I also execute these commands for various reasons:

  • sudo apt-get install -y -f build-essential
  • sudo apt-get install -y -f libtest-exception-perl libmodule-build-perl libwrap0 libwrap0-dev
  • sudo apt-get install -y -f libdbi-perl libdbd-pg-perl libdbd-mysql-perl mcrypt libmcrypt-dev

Their's a post installation procedure that Virtualmin has you do. This next video depicts what that is like. (video not released yet)

Important tip

I've meddled with the SSL and CA authority in Webmin a few times where I did it wrong and lost all access to my server via Webmin. The following is a brilliant link that shows how to use the command line interface to turn off the SSL temporarily and restore your system to order again.

I discovered a problem afterwards with installing Perl Modules in Webmin. It seems that the 16.04 distro doesn't come set-up to "build" programs on a machine with the "make" command. Running this command line argument will fix that for you and stave off a lot of trouble,

sudo apt-get install -y -f build-essential

That came to my attention while I was in the "cpan[1]> " shell trying to "install CPAN" and I was there because webmin failed to auto-magically put on a Perl module that was supposed to let me open encrypted eMail for reading. I can't say at this time if it will solve all your Perl problems, but it's definitely going to prevent some of them. Notice the error message in the image below. In a terminal window I ran sudo perl -MCPAN -e shell to get into the "cpan[1]> " shell. It's wise to execute "sudo apt-get install build-essential" as a normal shell command prior to installing Webmin and Usermin.

And at the "cpan[#]> " prompt (sudo perl -MCPAN -e shell), you can go ahead and run these commands:

  • install Test::Exception
  • install Module::Build
  • install Authen::Libwrap
    • y
    • /usr/lib

Executing those adds a tricky Perl module that Webmin is supposed to be using but doesn't install properly on any Webmin I've used yet. Trying to install it via Webmin is gonna be more difficult than the Terminal Window. After that is done the rest can easily be managed in the Webmin module for Perl modules.

While you're at the "cpan[#]> " prompt, The following would be needed if you were going to write or run Perl programs that touched your MySQL or PostgreSQL database systems:

  • install DBI
  • install DBD::Pg
  • install DBD::mysql

However they could be installed outside of the "cpan[#]> " prompt via APT:

  • sudo apt-get -y -f install libdbd-pg-perl libdbd-mysql-perl libdbi-perl

Or installed via System => Software Packages, by clicking the radio button for "Package from APT" in the "Install a New Package" section then pasting the following into the text-box:

  • libdbd-pg-perl libdbd-mysql-perl libdbi-perl

Or from the Others => Perl Modules => Suggested modules, then clicking the button for installing selected packages.

PHP Configuration Screw-up for PHP 7.0+:

Here's another detail you need to fix, and you should just get used to thinking on the fly looking at errors then "Google" searching for fixes based on the text of the errors.

No PHP configuration files were found. Adjust the module configuration to set the correct path to the global PHP config file.

Sometimes you have a new version of a program on your distro and Webmin is by default looking where an old version of the program was.

1/12/2018 Update on /etc/php/7.0/apache2/php.ini

When using a Virtualmin option instead of a Webmin only, I noticed that the Apache php 7 ini file wasn't there. Virtualmin people did that by design, but I wanted it so I ran this:

  • sudo apt install php7.0 libapache2-mod-php7.0 php7.0-mysql

It's likely you have 2 out of 3 of those programs installed already, but it doesn't hurt to run that command if they are already installed.

In your Others > PHP Configuration > Module config area you should have something like this:

  • /etc/php/7.0/apache2/php.ini=Configuration for mod_php /etc/php/7.0/cgi/php.ini=Configuration for scripts run via CGI /etc/php/7.0/cli/php.ini=Configuration for command-line scripts /etc/php/7.0/fpm/php.ini=Configuration for nginx scripts

On your new system, just click the gear in the top row or the hyperlinked text of "module configuration", then you'll see that Webmin is looking to connect some files to the PHP program; notice the 3 lines below near "php.ini".

It turns out they are pointing to the wrong place. Use your Others => File Manager, and search for "php.ini".

You have:

  • /etc/php5/apache2/php.ini
  • /etc/php5/cgi/php.ini
  • /etc/php5/cli/php.ini

But you should have:

Save that and your Others => PHP Configuration, should now look like this:

And now clicking on the green Manage buttons will get you to these interfaces:

Just for fun, use Others => File Manager, to go to your "/var/www/html" directory and create a file called "phpinfo.php" with this in it:


Now open it in your browser by going to http://[your host name]/phpinfo.php

It should look like this: