Home » Blog » How to Set Up Ubuntu Server for WordPress Development: Step by Step Guide – Part 1

How to Set Up Ubuntu Server for WordPress Development: Step by Step Guide – Part 1

Four years ago we had no experience with self-hosted WordPress, and like many web developers, we were still building websites with static HTML in DreamWeaver. We created dynamic content with hand-rolled PHP and Javascript and purpose-built MySQL databases.

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:

  1. 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.
  2. 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.
  3. 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 ifconfig command”.

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.

enter host name and press enter

3. At the “Configure the network” screen, enter a name for your new server.

unmount existing partitions

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.

Guided - use entire disk

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.

write the changes to disks

Confirm saving of the new partition table.

choose OpenSSH server and LAMP server

6. At the “Software selection” screen choose “OpenSSH server” and “LAMP server”.

enter new password for MySQL "root" user

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.

execute ifconfig

8. Execute the command
ifconfig
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.

30-www-data

9. Execute the command
sudo chown www-data:www-data /var/www/html

install pending updates

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)
cd /root (you can’t do this on Ubuntu unless you enable root login)
wget http://www.webmin.com/jcameron-key.asc
sudo mv jcameron-key.asc /root
(extra step)
sudo apt-key add /root/jcameron-key.asc
sudo apt-get update
sudo apt-get install webmin

login with IP address

12. When the Webmin installation is complete you can login by opening your browser and navigating to
https://[your-server-ip-address]:10000
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.

install avahi-daemon
login with server name

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
https://[your-server-name.local]:10000
to log into Webmin.

install PostFix Mail Server

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.

Webmin Configuration

15. Navigate to “Webmin | Webmin Configuration” and click on “Sending Email”.

Send test message

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.

This concludes Part 1 of our guide to setting up Ubuntu Server for WordPress development. In Part 2 we’ll configure Apache and PHP. In Part 3 we’ll create MySQL database and install WordPress.

Pin It on Pinterest