Like in our previous blog post on installing WordPress on CentOS, we will be going through the steps of installing WordPress on Ubuntu today. Now, they’re both very similar in terms of the steps; however, with Ubuntu, there will be a few differences in terms of the commands and language.

Like before, we will need some requirements before the initial installation of WP and after you run a sudo apt-get update:

 

Prerequisites

 

  • Have L.A.M.P (Linux, Apache, MySQL, and PHP) installed on your server

 

Creating a Database

 

Before we create a new WordPress database, type in the following to log into your MySQL:

#mysql -u root -p

 

After you’re logged in, start creating the database and username. In this example, we will use wpuser as the username:

 

mysql> CREATE DATABASE wordpress DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;

mysql> GRANT ALL ON wordpress.* TO ‘wpuser’@’localhost’ IDENTIFIED BY ‘password’;

mysql> FLUSH PRIVILEGES;

mysql> EXIT;

 

Additional Packages

 

Next, we will be needing to install a few additional PHP packages, proceed with:

#sudo apt-get install php-curl php-gd php-mbstring php-mcrypt php-xml php-xmlrpc

 

Install WordPress

 

To install, proceed with the steps below. We will also be moving the directory into /var/www/html like below:

#wget -c http://wordpress.org/latest.tar.gz

# tar -xzvf latest.tar.gz

#sudo mv wordpress /var/www/html

 

Setting Up Permissions

 

After installing and moving them over to the correct directory, we will be setting up the permissions of the WordPress directory:

#sudo chown -R www-data:www-data /var/www/html/wordpress

# sudo chmod -R 755 /var/www/html/wordpress

 

Finalizing

 

Once everything has been changed, added, and updated, go ahead and restart Apache and MySQL by typing in the following:

 

#sudo systemctl restart apache2.service

# sudo systemctl restart mysql.service

 

Once you’ve completed this, go to your browser and type in either your IP (www.10.10.10.10/wordpress) or your domain and add /wordpress at the end. After entering all your required steps on WordPress, you’re all set!

Do you have any questions about installing WordPress on Ubuntu? Let us know and we can help!