View Categories

Installing WordPress on your server

2 min read

Following on from our How to Install a LAMP Stack on Ubuntu article linked here.

We are now going to get WordPress up and running on your server.Login to the MySQL/MariaDB server

mariadb -u root

 

Create the database for the new WordPress installation to use:

MariaDB [(none)]> CREATE DATABASE wp1;
Query OK, 1 row affected (0.000 sec)

 

Create the database user (using the root user is a bad idea):

MariaDB [(none)]> CREATE USER 'wordpress'@'localhost' IDENTIFIED BY 'password123';
Query OK, 0 rows affected (0.000 sec)

 

Give the new user full permissions over the new database:

MariaDB [(none)]> GRANT ALL PRIVILEGES ON wp1.* TO 'wordpress'@'localhost';
Query OK, 0 rows affected (0.001 sec)

 

You can check the permissions as follows:

MariaDB [(none)]> SHOW GRANTS FOR 'wordpress'@'localhost';
+--------------------------------------------------------------------------------------------+
| Grants for wordpress@localhost |
+--------------------------------------------------------------------------------------------+
| GRANT USAGE ON *.* TO `wordpress`@`localhost` IDENTIFIED BY PASSWORD '*A0F874BC7F54EE086FCE60A37CE7887D8B31086B' |
| GRANT ALL PRIVILEGES ON `wp1`.* TO `wordpress`@`localhost` |
+--------------------------------------------------------------------------------------------+
2 rows in set (0.000 sec)

 

Download the latest WordPress version from wordpress.org: https://en-gb.wordpress.org/download/#download-install

wget https://en-gb.wordpress.org/latest-en_GB.zip

 

Unzip the WordPress latest zip into your web root e.g. /var/www/html/ (note: this will unpack into a directory called wordpress, if you want this wordpress install to run from the webroot directly move everything from the /wordpress directory to /var/www/html/

unzip latest-en_GB.zip

make the file and directory owner www-data:

chown -R www-data.www-data /var/www/html/*

Move wp-config-sample.php to wp-config.php:

mv wp-config-sample.php wp-config.php

 

Now edit wp-config.php and enter the database name, username and password you created in the previous steps in the following lines:

define( 'DB_NAME', 'wp1' );

/** MySQL database username */
define( 'DB_USER', 'wordpress' );

/** MySQL database password */
define( 'DB_PASSWORD', 'password123' );

Now navigate to the IP address or domain name you have pointed to your servers IP and you will see the WordPress install wizard waiting for your input, complete the steps and your site will be ready to use!