How to install WordPress 4.5 on Ubuntu 16.04 LAMP
This document describes how to install and configure WordPress 4.5 on Ubuntu 16.04. WordPress started in 2003 with a single bit of code to enhance the typography of everyday writing and with fewer users than you can count on your fingers and toes. Since then it has grown to be the largest self-hosted blogging tool in the world, used on millions of sites and seen by tens of millions of people every day. This tutorial explains the process of installing WordPress 4.5 on Ubuntu 16.04 in the form of a simple-to-follow guide.eval(ez_write_tag([[728,90],’howtoforge_com-box-3′,’ezslot_6′,106,’0′,’0′]));
1 Preliminary Note
This tutorial is based on the Ubuntu 16.04 server installation CD. You have to set up a basic Ubuntu 16.04 (Xenial Xerus) server installation before you continue with this tutorial. The system should have a static IP address. I use 192.168.1.100 as my IP address in this tutorial and server1.example.com as the hostname. The server must have a LAMP server installed in Ubuntu 16.04 e.g. as described in this tutorial before you proceed.
2 WordPress Database initialization
I will create the database for WordPress as follows. Login to the MySQL or MariaDB database as root user:
mysql -u root -p
And create a database with the name wordpressdb, a user with the name wordpressuser and the password wordpresspassword. Please use different and secure password on your installation, the password used here is just an example!
CREATE DATABASE wordpressdb;
CREATE USER [email protected] IDENTIFIED BY 'wordpresspassword';
GRANT ALL PRIVILEGES ON wordpressdb.* TO [email protected];
Then exit the MySQL shell:
service apache2 restart
service mysql restart
3 Installation of WorPpress 4.5
Go to the /tmp directory in which we will the download the latest version of the WordPress as follows:eval(ez_write_tag([[580,400],’howtoforge_com-medrectangle-4′,’ezslot_1′,108,’0′,’0′]));
We have to install unzip to unpack the WordPress archive:
apt-get install unzip
Unzip the WordPress zip archive in the /var/www/html folder:
unzip -q latest.zip -d /var/www/html/
Now set appropriate permissions for the WordPress directory.
chown -R www-data:www-data /var/www/html/wordpress
chmod -R 755 /var/www/html/wordpress
Further, we need to create the uploads directory beneath the wp-content directory at our document root. This will be the parent directory of our content:
mkdir -p /var/www/html/wordpress/wp-content/uploads
We need to allow the web server itself to write to this directory. We can do this by assigning user and group ownership of this directory to our web server user www-data. This will allow the web server to create files and directories under this directory, which will permit us to upload content to the server. Proceed like this:
chown -R www-data:www-data /var/www/html/wordpress/wp-content/uploads
Now proceed to the web installation of WordPress. Go to the URL http://192.168.1.100/wordpress/ in your web browser. The WordPress installer will show up.
Select language and press Continue:
The welcome screen shows up in the selected language. Click on Let’s go.
Type in the Login details of the WordPress database that we created in step 2. The database host is “localhost” and the prefix can be left at its default. Then click on the “Submit” button.
WordPress saves the database configuration details to the file /var/www/html/wordpress/wp-config.php. Click on “Run the install” to proceed to the next part of the installer.
Now enter some details for the Blog like website title, admin username, password and email address. I used these values:
Site Title = My WordPress Blog Admin Email = [email protected] Username = admin Admin password = howtoforge
The above values are just examples and you should use the real title and email address here. Using admin as administrator name is ok for an internal website but you might want to use a nonstandard name or your personal name instead.
The press InstallWordpress to finish the installation:
Now we will proceed towards the login page by pressing LogIn:
Type in the credentials that you selected during WordPresspress installation. The WordPress Dashboard will show up.
6 Configure Pretty Permalinks for WordPress
This part is optional.
By default, WordPress creates URLs dynamically that look something like this http://server_domain_name_or_IP/?p=1. This isn’t exactly the most useful interface for visitors or search engines, so most users want to modify this. WordPress has the ability to create “pretty” permalinks which will clean up the URL into a more human-friendly format. The following steps show you how to setup pretty permalinks in your WordPress Blog.
6.1 Apache Rewrite
We will modify the apache virtual host file for WordPress 4.5 to allow .htaccess overrides. Add the following (red) lines in the 000-default.conf file:
ServerAdmin [email protected] DocumentRoot /var/www/html ServerName server1.example.com <Directory /var/www/html/> AllowOverride All </Directory> [...]
Next, we have to to enable the Apache rewrite module. Run:
service apache2 restart
6.2 Permalink Settings in WordPress
Now we can easily adjust the permalink settings through the WordPress administration interface. Go to Settings–>Permalinks:
I’ll choose “Post name” as Pretty-Link format for my blog so that the Post title is used in the URL.
When you have made your selection, click “Save Changes” to generate the rewrite rules.
Congratulations! You now have a fully functional WordPress 4.5 instance on your Ubuntu 16.04 🙂
- WordPress : http://wordpress.org/
- Ubuntu : http://www.ubuntu.com/