How to Quickly Install WordPress on Ubuntu

quickly install wordpress on ubuntu

WordPress is by far the most popular content management system. There are countless tutorials on how to install it. This tutorial will not just show you how to install WordPress but describe steps that show you how to quickly install it on Ubuntu.

As you probably already know, WordPress depends on the LAMP stack. The stack is an acronym for Linux, Apache2, MySQL and PHP. This guide detail the steps of installing and configuring WordPress below.

Before installing WordPress, go and prepare the Ubuntu server. Continue below to quickly install get WordPress going.

Step 1: Update and Prepare Ubuntu server

To prepare your server, run the command below to update all packages and remove obsoletes software.

sudo apt-get update && sudo apt-get dist-upgrade && sudo apt-get autoremove

After running the above commands, restart the host computer.

Step 2: Install the LAMP Stack

After updating the and restarting the Ubuntu server, run the single line commands below to install the LAMP stack.

sudo apt-get install lamp-server^

During LAMP installation, you’ll be prompted to create MySQL root password. Type and confirm a password to continue.

Ubuntu MySQL password prompt screen

After installing the LAMP stack, continue below to create WordPress database and user.

Step 3: Creating WordPress Database and User

After the LAMP stack is installed, run the command below to logon to MySQL server

mysql -u root -p

Then run the commands below to create WordPress database called wpdb;


Next, run the commands below to create a database user called wpuser;

GRANT ALL ON wpdb.* TO 'wpuser'@'localhost' IDENTIFIED BY 'type_new_password_here';

Finally, save the exit.


Step 4: Download WordPress content

After doing all the steps above, go and download WordPress content from online. To do that, run the commands below.

cd /tmp/ && wget

Next, run the commands below to extract the content and copy it to Apache2 default root directory.

tar -xzvf latest.tar.gz
sudo cp -R wordpress/* /var/www/html

After extracting the content, remove Apache2 default index.html file from the root directory. This can quickly become problem for new users.

sudo rm -rf /var/www/html/index.html

Step 5: Configure WordPress settings

After copying WordPress content into the root directory, run the commands to create WordPress configuration file.

sudo cp /var/www/html/wp-config-sample.php /var/www/html/wp-config.php

After copying the file, run the commands below to edit WordPress config file.

sudo nano /var/www/html/wp-config.php

Then type the database connection settings for WordPress.

// ** MySQL settings - You can get this info from your web host ** //
/** The name of the database for WordPress */
define('DB_NAME', 'wpdb');

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

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

/** MySQL hostname */
define('DB_HOST', 'localhost');

/** Database Charset to use in creating database tables. */
define('DB_CHARSET', 'utf8');

/** The Database Collate type. Don't change this if in doubt. */
define('DB_COLLATE', '');

Step 6: Change WordPress Content Permission

Next, change the directory permissions for WordPress content by running the commands below.

sudo chown -R www-data:www-data /var/www/html/
sudo chmod -R 755 /var/www/html/

Finally, restart Apache2 webserver and open your browser and browse to the server  hostname or IP address. This should bring up WordPress setup page.

sudo systemctl restart apache2

Open your browser and go to the server hostname or IP address

WordPress default setup page

Type the site information and click Install

wordpress install ubuntu

That’s it!

This is how to quickly install WordPress on Ubuntu.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.