WordPress Installation

This section deals with the installation of WordPress on Ubuntu 16.04 LTS.  You will have to substitute your site specific attributes for values I have used!

Assumption:  you will do this under the user:  mysiteuser

WordPress will be installed at:  /webserver

This is a quick install procedure designed to quickly identify requirements and how to install and configure them.  It is generic so you will have to “make substitutions” for your site and configuration.

1. install apache

sudo apt-get install apache2
systemctl enable apache2

vi /etc/apache2/envvars file and replace these two lines:

export APACHE_RUN_USER=www-data
export APACHE_RUN_GROUP=www-data


export APACHE_RUN_USER=mysiteuser
export APACHE_RUN_GROUP=mysiteuser

wordpress will be in /webserver/
and everything will be owned by  mysiteuser:mysiteuser  starting with /webserver

these changes are necessary if you are going to successfully download themes
plugins etc from the word press site.

2. install mysql

a. sudo apt-get install mysql-server mysql-client
password for mysql administrator
write down this passwd

b. sudo mysql_secure_installation
answer questions: use passwd from above and remove old users and databases

3. install php

a. sudo apt-get update

b. sudo apt-get install php7.0-mysql php7.0-curl php7.0-json php7.0-cgi php7.0 libapache2-mod-php

NOTE: libapache2-mod-php must be installed or the test.php file will fail to run!!!!

c. sudo apt-get install php7.0-cli

d. sudo apt-get install hhvm

e. sudo apt-get -y install php7.0-mysql php7.0-curl php7.0-gd php7.0-intl php-pear php-imagick php7.0-imap php7.0-mcrypt php-memcache php7.0-pspell php7.0-recode php7.0-sqlite3 php7.0-tidy php7.0-xmlrpc php7.0-xsl php7.0-mbstring php-gettext

f. test php

create a file called /var/www/html/test.php

restart apache2: systemctl restart apache2

should load a page with lots of data

g. vi /etc/php/7.0/apache2/php.ini

change upload_max_filesize = 2M
upload_max_filesize = 12M


post_max_size = 18M

h. vi /etc/php/7.0/cli/php.ini

change upload_max_filesize = 2M
upload_max_filesize = 12M

i. restart apache2

4. Install phpmyadmin (optional)

I am not installing.  You may if you wish.

5. download and extract the wordpress tar file

after downloading the file extract it using gunzip download_file_name.  it will create a directory with the wordpress files.  You will be copying/moving these file to /webserver later.

6. create a wordpress database in mysql

mysql -u root -p
enter password: password from above

Following 3 lines are info only if you are new to mysql:

to drop a database:
show databases;
drop database {database_name}

mysql> CREATE DATABASE wordpress;

mysql> GRANT ALL PRIVILEGES ON wordpress.* TO ‘wordpress_user’@’localhost’ IDENTIFIED BY ‘some_password’;


mysql> exit

7. cp wp-config-sample.php wp-config.php and edit with your database information

8. cd to where you downloaded and extracted the wordpress tar file.

a. move the contents to your apache directory.

cd to your untar’d wordpress directory and move everything to /webserver
everything will be ownded by mysiteuser:mysiteuser

b. find . -print | cpio -pdmvu /webserver <— put the new wordpress here.

9. configure apaches to not use /var/www/html but /webserver/usefulramblings/wordpress

a. cd /etc/apache2/sites-available

vi wordpress.conf
place the following in this file:

note the “<—“: examples only do not include in file.

—–cut here—-
<VirtualHost *:80>
ServerName www.yoursitesname.extension            <—www.doodah.com
ServerAlias usefulramblings.org *.yoursite.extension  <—*.doodah.com
DocumentRoot /webserver
ServerAdmin webmaster@yoursite.extension  <–webmaster@doodah.com
# Available loglevels: trace8, …, trace1, debug, info, notice, warn,
# error, crit, alert, emerg.
# It is also possible to configure the loglevel for particular
# modules, e.g.
#LogLevel info ssl:warn

ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
—–cut here—-

b. cd /etc/apache2/sites-enabled

sudo ln -s ../sites-available/wordpress.conf wordpress.conf

c. cd /etc/apache2

vi /apache2.conf
insert the following lines:

—-cut here—
<Directory “/webserver/”>
Options Indexes FollowSymlinks
AllowOverride None
Require all granted
—-cut here—

10.  in the /var/www/html directory rename index.html to orig_index.html. failure to do this will
prevent the wordpress index.php file to load and you will get the index.html file

11.  in a browser: localhost – this should load your wordpress site with some Q&A

this will start a small configuration process PAY ATTENTIION TO THE PASSWORD YOU ENTER
DON’T USE THE SUGGESTED ONE FOR NOW. Pick a simple one and change it later.

1. install vsftpd – you need an ftp client to effect the automatic updating of WordPress, Themes, Pluggins, etc.

a. sudo apt install vsftpd
b. vi /etc/vsftpd.conf


c. ftp example.com <— your website

Leave A Reply

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


Bad Behavior has blocked 449 access attempts in the last 7 days.