Install WordPress on Ubuntu 16.04 with LAMP

Although you can create a WordPress installation on a $5 Digital Ocean droplet using a one click app, you might want to run multiple WordPress installations on the same droplet. Follow my guide below for quick way to install WordPress on a droplet through SSH using terminal or putty.

First you need to know your MYSQL password. Run the following command:

cat /root/.digitalocean_password

Now you have your password, login to MYSQL using:

mysql -p

Create your database:

create database DATABASE-NAME;

Create and add a database user to the database:

grant all privileges on DATABASE-NAME.* to 'DATABASE-USER'@'localhost' identified by "PASSWORD";

flush privileges;


Ok thats the database info created. Make sure you have made a note of your database name, username and password. You need these later on when running the WordPress installation.

Next we need to make sure rewrite module is on and htaccess overrides is enabled, WordPress requires HTACCESS files and rewritable URLs for permalinks.

sudo nano /etc/apache2/apache2.conf

Towards the bottom of the file, make sure the directory block has AllowOverrideAll as seen below:

    AllowOverride All


sudo a2enmod rewrite

sudo systemctl restart apache2

Next we download and install WordPress.

cd /tmp

curl -O

tar xzvf latest.tar.gz

touch /tmp/wordpress/.htaccess

chmod 660 /tmp/wordpress/.htaccess

cp /tmp/wordpress/wp-config-sample.php /tmp/wordpress/wp-config.php

mkdir /tmp/wordpress/wp-content/upgrade

sudo cp -a /tmp/wordpress/. /var/www/YOURDOMAIN/public_html

sudo chown -R www-data:www-data /var/www/YOURDOMAIN/public_html

sudo find /var/www/YOURDOMAIN/public_html -type d -exec chmod g+s {} \;

sudo chmod g+w /var/www/YOURDOMAIN/public_html/wp-content

sudo chmod -R g+w /var/www/YOURDOMAIN/public_html/wp-content/themes

sudo chmod -R g+w /var/www/YOURDOMAIN/public_html/wp-content/plugins

curl -s
  • Copy the output (salt) from the previous step and overwrite the values in the wp-config.php file.
  • Add the database name, username and password into the wp-config.php file.
  • Run the WordPress browser installation tool to finish, just load up the website in your browser and foolow the steps and you are done.

Use the guide above to install WordPress per domain name on your virtual host Droplet. There are some more optional things you can do for added security but the guide above will get you up and running with WordPress installations on a virtual host multi-site droplet.

It’s always a good idea to have an SSL certificate on any website, almost compulsary these days with browser warnings about connecting to an unsecured website etc. If you want to install a free SSL certificate, I use Lets Encrypt and have written a guide here on how to install Lets Encrypt and enable SSL for your domains.