You are going to be learning how to install WordPress on a VPS server running ubuntu 16.04 LTS. This is the extra bonus section for the “How to build a Software Developer Portfolio” blog series that I put together.
Below you will see all the TODO checklist items that you have to complete when following this guide. You can check them off as you go through the guide to help you stay on track.
Verify MySQL Access
Install PHP and PHP Drivers
Prioritize `.php` files
Verify PHP is working
Install PHP WordPress Libraries
Apache custom site `.conf` file
Configure `wp-config.php` file
WordPress UI Wizard Setup
Verify Install of WordPress
Setting up LAMP Stack
Installing Linux: You are going to need to have a server that is running ubuntu 16.04 LTS on a VPS. If you can not afford a VPS you might want to first learn how to do this with a free setup using VirtualBox. You can read a complete write up on how to do that in this blog post. Getting started with LAMP.
When installing a MySQL instance you are going to need to create a strong password for the root account of MySQL.
If you want to take security to the next level use the
mysql_secure_installation package to help you decide if your chosen password is strong enough.
You now have access to the MySQL Shell you can verify this with the following command you will be prompted with a password request. Make sure that you enter the correct password to login into the shell.
In order for us to setup WordPress, we are going to need the driver and the programming language that is going to allow us to execute code on the server. To install PHP run the following command.
You will also want to setup apache to make
.php files a priority in file execution order.
Verify that PHP is working correctly by creating a new
Write the following function call.
You can now verify that PHP is installed correctly by going to the following URL
If you can see the following PHP page you are ready to move forward with the WordPress installation.
After seeing the screen above go ahead and remove the
Setup and Install WordPress
WordPress uses MySQL as it’s data store. You will need to create a database to store all of the content and configurations for WordPress, to create a database use the following commands.
That command will log you into the MySQL shell but you will need to create a database. In this example I’m naming the database “portfolio” and for the user, we will name it “portfolio-admin” and set a strong password you can use whatever values you want here but keep this in mind because we will need them again. The following commands will execute this.
WordPress requires additional plugins for PHP for example
php-curl to set up these required packages run the following command.
You are now all set to download and extract WordPress into the folder that you want to store WordPress in. This will all depend on your own preference but for me, I’m going to go with the following setup
After having the folder structure setup WordPress is going to require you two different types of files the
.htaccess and the
wp-config.php file. You can create them with the following commands.
The files inside the
portfolio directory are going to require the right permissions for the web server apache to execute and modify any of the files. You are going to give the directory the following permissions.
After setting up the permissions apache needs to know about your new setup to configure the new site with apache run the following commands.
After creating the
portfolio.conf file you are going to need to open the file and add a couple of changes to account for your new folder structure. You are going to want to edit the
DocumentRoot, and the
ServerName to reflect your own setup.
You can now enable the site with apache.
To make sure the changes take effect you are going to need to restart apache.
You now have a good working directory of files. You are going to need to modify the
wp-config.php file and add in the credentials that you created on the database.
To edit the file use the following commands. Make sure that you set your username, database name, and password correctly.
WordPress requires you to have authentication keys and salt values to secure any sessions that you have with the WebServer. You can download them with the following API URL.
Copy the values that the command returns you and open the
wp-config.php file and replace the values with the ones that you copied.
WordPress needs a directory to write files to disk, append the following function call to the end of the file.
You are almost done! Open up your favorite browser and access the webserver with a domain or the IP address of the machine.
WordPress is going to prompt you to create a user and setup WordPress for the first time. Continue with the wizard and you will be all setup with WordPress on a VPS server.
Talk to you next time,
P.S. Whenever you are ready to sign up for a VPS and host your killer site online. Make sure that you take full advantage of the $10 USD Digital Ocean resource.
I always had a passion for the field of STEM (Science, Technology, Engineering, and Math) and I knew I wanted to do something to make a difference in the world. I just didn’t know where to start. I was an immigrant in a new country, grew up in a tough environment, and wasn’t sure how… Read More