grants.net.au

Tech Blog

  • Ubuntu
  • WordPress

WordPress on DigitalOcean Ubuntu

October 16, 2015 by Grant Tyers Leave a Comment

This guide outlines the steps required to create a WordPress powered website running on top of Ubuntu 14.04 LTS server deployed from a DigitalOcean droplet. These steps could easily be adapted for any infrastructure.

What you need to begin.

SSH client (e.g. PuTTY) connected to your server as root.

Step 1  – Toughen up server access.

Follow the steps provided in the guide Easily Secure Your Ubuntu Server

Step 2 – Install Web Server
sudo apt-get install -y apache2
sudo a2enmod rewrite
Step 3 – Install Database
sudo apt-get install -y mysql-server libapache2-mod-auth-mysql php5-mysql
sudo mysql_install_db
sudo /usr/bin/mysql_secure_installation
mysql -u root -p

Run the following SQL

CREATE DATABASE wordpress;
CREATE USER dbuser@localhost;
SET PASSWORD FOR dbuser@localhost=PASSWORD("my_password");
GRANT ALL PRIVILEGES ON wordpress.* TO dbuser@localhost IDENTIFIED BY 'my_password';
FLUSH PRIVILEGES;
exit
Step 4 – Install PHP
sudo apt-get install -y php5 libapache2-mod-php5 php5-mcrypt php5-gd

sudo nano /etc/apache2/mods-enabled/dir.conf

Edit dir.conf so index.php is at the start of the list.

Step 5 – Install WordPress
wget http://wordpress.org/latest.tar.gz
tar -xzvf latest.tar.gz
cp ~/wordpress/wp-config-sample.php ~/wordpress/wp-config.php
sudo rsync -avP ~/wordpress/ /var/www/wordpress
mkdir /var/www/wordpress/wp-content/uploads
touch /var/www/wordpress/.htaccess
sudo nano /var/www/wordpress/wp-config.php

Update wp-config.php with database details from Step 3.

sudo chown www-data: /var/www/wordpress -R
sudo chmod g+w /var/www/wordpress -R
sudo chmod o-rwx /var/www/wordpress -R
sudo nano /etc/apache2/sites-available/000-default.conf

Update 000-default.conf to match below.

<VirtualHost *:80>
ServerAdmin webmaster@123.45.67.89
DocumentRoot /var/www/wordpress
ServerName 123.45.67.89
<Directory /var/www/wordpress/>
AllowOverride All
</Directory>
sudo service apache2 restart
sudo ufw allow 80
Step 6 – Install FTP
sudo apt-get install vsftpd
sudo useradd -m -d /home/ftpuser -s /bin/bash ftpuser
sudo passwd ftpuser 
sudo chown ftpuser: /home/ftpuser 
sudo adduser ftpuser www-data
sudo nano /etc/vsftpd.conf

Edit vsftpd.conf parameters as below

write_enable=YES
chroot_local_user=YES

Add the following parameters at the end of the vsftpd.conf file.

seccomp_sandbox=NO
allow_writeable_chroot=YES
local_root=/var/www/wordpress

Restart the FTP service.

sudo ufw allow 21
sudo service vsftpd restart
Step 7 – Finish Up

If you are running your server in a virtual environment/cloud this is the perfect place to create a rollback point should you need to start again fresh.

Browse to your site’s URL to begin using WordPress!

http://yoursite.com

Share this:

  • Click to share on Twitter (Opens in new window)
  • Click to share on Facebook (Opens in new window)
  • Click to share on Google+ (Opens in new window)

Related

Filed Under: WordPress Tagged With: Ubuntu, WordPress

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Copyright © 2019 · News Pro Theme on Genesis Framework · WordPress · Log in