Installing WordPress on Ubuntu 15.10 server isn’t difficult as compare to other Linux distributions.
Right out of the box, Ubuntu servers and services are configured without firewall enabled.. which is a good thing since Linux firewall can really be a show stopper if not configured correctly.
This brief tutorial is going to show you how to easily install and configure WordPress on a Ubuntu servers.
No complicated setup, no unnecessary steps and no fuss.
To get WordPress setup correctly, follow these steps below.
Step 1: Make sure you have already installed Ubuntu server edition and that you have root access to it. If you do, run the commands below to update your systems.
sudo apt-get update && sudo apt-get dist-upgrade && sudo apt-get autoremove
You may want to restart your server after running the commands above, but you don’t have to.
Step 2: Run the commands below to install Apache2 web server. WordPress relies on webservers.. The web server can be Apache2, Nginx and others. Since Apache2 is the most popular, lets install it.
sudo apt-get install apache2
When you’re done installing Apache2, the below commands allow you to start it up, restart it and enable it to startup everytime you reboot your systems.
sudo systemctl start apache2
sudo systemctl restart apache2
sudo systemctl enable apache2
Step 3: Run the commands to install MySQL database server. Again, just like Apache2, WordPress depends on a database server to store it content.
sudo apt-get install mysql-server mysql-client
During MySQL database server installation, you’ll be prompted to create a root password.. This password enables the root users to administer MySQL server.
After installing MySQL database server, the commands below allow you to start it up, restart it and enable it so that it starts up automatically everytime you reboot your servers.
sudo systemctl start mysql
sudo systemctl restart mysql
sudo systemctl enable mysql
After running the above commands and installing MySQL, run the commands below to configure it.
When prompted, follow the guide below.
Next, choose Yes for the rest of the prompts until you’re done.
- Enter current password for root (enter for none): Type root password
- Change the root password? N
- Remove anonymous users? Y
- Disallow root login remotely? Y
- Remove test database and access to it? Y
- Reload privilege tables now? Y
After that, continue with the database setup to configure a database for WordPress.
Run the commands below to sign onto the database. When prompted for a password, type the root password you created in the earlier.
mysql -u root -p
Next, run the commands below to create a new database called wpdb.
CREATE DATABASE wpdb;
Next, run the commands below to create a new database user called wpuser with a new password that you specify..
CREATE USER wpuser@localhost IDENTIFIED BY 'new_password_here';
Then run the commands below to give the user full access to the newly created database you created earlier.
GRANT ALL ON wpdb.* to wpuser@localhost;
Finally, run the commands below to refresh the database permissions table and exit.
Step 4: Run the commands below to install PHP and its modules.. These PHP modules help WordPress to function. WordPress requires these.
sudo apt-get install php5 libapache2-mod-php5 php5-mysql php5-curl php5-gd php5-intl php-pear php5-imagick php5-imap php5-mcrypt php5-memcache php5-ming php5-ps php5-pspell php5-recode php5-sqlite php5-tidy php5-xmlrpc php5-xsl
After installing all the above servers and packages, Ubuntu server is now ready to host WordPress.
It’s now time to download and configure WordPress system on Ubuntu.
Step 5: Run the commands below to download WordPress latest package.
cd /tmp/ && wget http://wordpress.org/latest.tar.gz
Step 6: Then run the commands below to extract the downloaded package
tar -xvzf latest.tar.gz
Step 7: Run the commands below to copy or move WordPress content to Apache2’s default root directory. This directory will already have a file called Index.html.. Delete it please.
sudo rm /var/www/html/index.html
sudo mv wordpress/* /var/www/html/
Step 8: Run the commands below to make a copy of WordPress wp-config-sample.php file and call it wp-config.php.
sudo cp /var/www/html/wp-config-sample.php /var/www/html/wp-config.php
Then edit the newly created file and enter your database information you created earlier.
sudo vi /var/www/html/wp-config.php
// ** MySQL settings – You can get this info from your web host ** //
/** The name of the database for WordPress */
/** MySQL database username */
/** MySQL database password */
Save your changes and continue below..
The last and final step is to configure the correct security permissions on WordPress files and folders. To do that, run the commands below.
sudo chown -R www-data:www-data /var/www/html/
sudo chmod -R 755 /var/www/html/
Restart Apache2 and browse to the server’s IP address or hostname and you should see WordPress default installation page.
Enjoy! This is how to install and configure WordPress on Ubuntu.
Continue with WordPress installation using the wizard.. Create an administrator username and password.. then click Install to complete.