WordPress, a free and user-friendly content management system (CMS) allows anyone to build powerful and dynamic websites based on PHP. In this post, I’m going to show students and new users how to install WordPress on Ubuntu servers with Apache2, MariaDB and PHP support.
With WordPress, webmasters can use its vast support base to find plugins, templates to build websites that suit any taste. It’s a great system and if you’re in the business of building websites, WordPress should be on the top of your list.
The steps below will guide you to quickly getting WordPress running on Ubuntu… so continue below to get started.
Step 1: Prepare and Update Ubuntu
It’s good to always update Ubuntu servers before installing packages… to update Ubuntu, run the commands below.
MariaDB database server is rapidly overtaking MySQL in the open source and Linux communities… MariaDB is the default database server on majority of Linux distributions… and WordPress requires a database server.. run the commands below to install MariaDB.
At this point, all the required WordPress packages and and servers are installed. The new server is now ready to host WordPress… On the new server, create a blank WordPress database. WordPress will use this empty database to store its content.
Run the commands below to logon to the database server. When prompted for a password, type the root password you created above.
sudo mysql -u root -p
Then create a blank database called WP_database you can use the same database name from the old server.
CREATE DATABASE WP_database;
Create a database user called wp_user with new password. You can use the same username and password from the old server.
CREATE USER 'wp_user'@'localhost' IDENTIFIED BY 'type_password_here';
Then grant the user full access to the database.
GRANT ALL ON WP_database.* TO 'wp_user'@'localhost' IDENTIFIED BY 'type_password_here' WITH GRANT OPTION;
Finally, save your changes and exit.
STEP 6: CONFIGURE THE NEW WORDPRESS SITE
Next, configure the WordPress site configuration file on the server. Run the commands below to create a new configuration file called wordpress.conf
Then run the commands below to open WordPress configuration file.
sudo nano /var/www/html/wordpress/wp-config.php
Enter the highlighted text below that you created for your database and save.
// ** MySQL settings - You can get this info from your web host ** //
/** The name of the database for WordPress */
/** MySQL database username */
/** MySQL database password */
/** MySQL hostname */
/** Database Charset to use in creating database tables. */
/** The Database Collate type. Don't change this if in doubt. */
Save the file and you’re done.
Now all is configured… run the commands below to reload Apache2 web server settings.
sudo systemctl reload apache2.service
After that, open your browser and browse to the server IP address or domain name to continue with WordPress setup.
If everything is setup correctly, you’ll see WordPress setup wizard and continue with the setup.
Follow the on-screen instruction to complete the wizard.. you’ll have to create the site administrator account with password.. then use it to logon to WordPress dashboard to manage WordPress.