We wrote a guide to setting up an in-house testing server for website development on Ubuntu, but times have changed and we’re doing things differently now. We thought it was time to update that guide with our current approach.
What’s new in this guide?
There are three main differences from before:
- While we still maintain some static HTML websites, we almost always use WordPress for new sites, so this guide is focused on creating an environment suitable for WordPress development. There are more steps to the process, so the guide is split into multiple parts.
- We no longer bother installing phpMyAdmin, because we use Webmin for most server management tasks, and Webmin’s built-in MySQL tools are good enough for basic database tweaking.
- We no longer bother installing an FTP server, because we install SSH (secure shell) for occasional remote command-line access, and SSH includes support for SFTP (secure FTP), which is more secure and works better than plain FTP.
What’s the same as before?
This new guide still assumes your server will be running on your LAN behind your firewall, so we trade security for convenience in many places. Do not follow this guide when setting up a publicly accessible server unless you know what should be done differently for a secure setup. We’ll highlight the most glaring security issues, but that’s all. We also assume you’re familiar enough with the command-line that you know what we mean when we say something like “execute the
Part 1 of 3: Install Ubuntu LAMP Server, SSH, Webmin, and Postfix Mail Server
1. Download a server installation disk image from ubuntu.com. At the time of writing the recommended LTS (long term support) version is 14.04.01.
2. If your testing server is a physical machine, burn the Ubuntu Server image to a CD or create a bootable USB stick and boot your machine from it. If your testing server is a virtual machine, set up your VM to boot from the disk image and start it up. We won’t be going into detail about virtualization in this guide, but we suggest that if you are using a VM you set its network to bridged mode for best results.
Proceed through the installation accepting the defaults, except as noted below.
3. At the “Configure the network” screen, enter a name for your new server.
4. If the disk you’re installing to isn’t completely blank, you may see a message similar to the following when you reach the “Partition disks” screen. Select “Yes” unless you have a reason to install to an existing partition, in which case you’re on your own for step 5 below.
5. At the “Partition disks” screen select “Guided – use entire disk”. We see no point in adding the logical volume manager overhead to a setup dedicated to WordPress development.
Confirm saving of the new partition table.
6. At the “Software selection” screen choose “OpenSSH server” and “LAMP server”.
7. At the “Configuring mysql-server” screen enter and confirm your choice of password for the MySQL root user. Make a note of it for later.
When the Ubuntu installation is complete you will be invited to reboot the server. After rebooting, login at the console to complete the following steps.
8. Execute the command
This will show you the IP address of your new server. Make a note of it so you can login later using Webmin or SSH.
A default LAMP installation on Ubuntu Server 14.04.1 gives ownership of
/var/www/html to the root user, which is inconvenient for WordPress development. Installing plugins and themes from the WordPress dashboard is easier if the user running Apache owns the folder where WordPress is installed.
9. Execute the command
sudo chown www-data:www-data /var/www/html
10. While we’re here, we may as well install any pending updates. Execute the command
sudo apt-get upgrade
and confirm that you want to install the updates.
11. Install Webmin by following the directions under “Using the Webmin APT repository” at webmin.com/deb.html, modified as follows to account for the differences between Ubuntu and plain vanilla Debian:
sudo nano /etc/apt/sources.list (to edit the repositories file as described)
(you can’t do this on Ubuntu unless you enable root login)
wget http://www.webmin.com/jcameron-key.asc (extra step)
sudo mv jcameron-key.asc /root
sudo apt-key add /root/jcameron-key.asc
sudo apt-get update
sudo apt-get install webmin
12. When the Webmin installation is complete you can login by opening your browser and navigating to
Your browser will warn you that it doesn’t trust Webmin’s self-signed certificate, so you’ll have to reassure it that you know what you’re doing. Enter the user name and password you created when you installed Ubuntu (this user is sudo-enabled, which is required by Webmin).
If you’re in a Bonjour/Zeroconf environment, installing avahi-daemon will allow you to refer to your server by name instead of IP address. The best part about this is that it won’t matter if the server get’s a different IP address from your DHCP server the next time it boots.
13. Navigate to “System | Software Packages”, enter “avahi-daemon” in the box labelled “Packages from APT” and click the “Install” button. When the installation is complete you will be able to navigate to
to log into Webmin.
14. Navigate to “Un-used Modules | Postfix Mail Server” and click the link labelled “Click here” to install Postfix. This will enable outgoing email from your server, which is very handy when developing with WordPress, or when configuring Webmin to inform you about things like pending software updates.
15. Navigate to “Webmin | Webmin Configuration” and click on “Sending Email”.
16. Under “Send test message” enter your email address in the “Send message to” box and click the “Send Email” button. Our email host is happy to accept email from Postfix with no additional setup, but some services are more fussy. If the test email doesn’t arrive in your inbox within a couple of minutes, you might have to enter SMTP account credentials under “Mail sending options” and/or change the From address.