Install WordPress on Linux Cloud Servers

2019-12-20 By Aaron 7258 Views linux wordpress cms_application
2 reviews

WordPress is a widely used CMS (Content Management System) application, which is based on PHP and MySQL. It is the most popular and the simplest way of creating a website or a blog.


The guide outlines the basic steps of installing WordPress application in an Ubuntu server, assuming that the server already has a web service (Apache), database service (MySQL/MariaDB) and PHP installed in it.


Create WordPress database

The first step before installing WordPress on the server would be to create a database that would be used to store the WordPress data.


  1. Log in to the database server by executing the below command.

    # mysql -u root -p
    

    wordpress1

  2. Create the WordPress database and an associated database user.

    # CREATE DATABASE lswp_db;
    
    # CREATE USER 'lswp_usr'@'localhost' IDENTIFIED BY 'wpusrpwd';
    

    wordpress2

    NOTE: lswp_db is the database name, lswp_usr is the database user associated with lswp_db and wpusrpwd is the password for the user lswp_usr.

  3. Grant permissions for the database user to access the WordPress database.

    # GRANT ALL ON lswp_db.* TO 'lswp_usr'@'localhost' IDENTIFIED BY 'wpusrpwd';
    

    wordpress3

  4. Exit the MySQL/MariaDB database server.

    # FLUSH PRIVILEGES;
    
    # quit;
    

    wordpress4


Installing WordPress

For installing WordPress, the latest WordPress installation archive file first needs to be downloaded. This can be done from the official WordPress downloads page https://wordpress.org/download/.


  1. Navigate to the path under which the WordPress application is to be installed. This can be under the default document root of the web service or under any website.

    In the below example, WordPress is being installed under the default document directory of Apache /var/www/html/.

    # cd /var/www/html/
    

    wordpress5

  2. Download the latest WordPress installation archive file.

    # wget https://wordpress.org/latest.tar.gz
    

    wordpress6

  3. Extract the tarball latest.tar.gz, which will create a folder named “WordPress” containing the installation files.

    # tar -xvf latest.tar.gz
    

    wordpress7

  4. Update ownership of the WordPress folder and all files inside it.

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

    wordpress8

    Here, www-data is the user that the Apache webserver runs as. If WordPress is being installed under a website, then the owner needs to be updated using the username associated with the website.

  5. Execute below two commands to set the required permissions for the wordpress folder and files and folders inside it.

    # find /var/www/html/wordpress/ -type d -exec chmod 755 {} \;
    
    # find /var/www/html/wordpress/ -type f -exec chmod 644 {} \;
    

    wordpress9

  6. The WordPress installation page can now be browsed using a browser.

    http://ipaddress/wordpress (if wordpress installed under default directory)
    (or)
    http://websitename/wordpress (if wordpress installed under a website)
    

    wordpress10

  7. Select the preferred installation language and click on Let’s go! on the next page to continue with the WordPress installation wizard.

    wordpress11

  8. On the next page, fill in the details of the database that was created earlier. The WordPress default data would be loaded into this database. The Database Host and Table Prefix fields can be left changed.

    wordpress12

  9. Click on Run the installation to proceed

    wordpress13

  10. Type in additional details required such as Site Title, Username, Password and Email address. Make sure that a strong password is used and the user credentials are saved safely. Once all details are filled in, scroll down and click on Install WordPress.

    wordpress14

  11. Once the installation has been completed, a Success! notification will be shown.

    wordpress15

  12. Click on the Login button to access the login page of WordPress. Type in the user credentials to access the WordPress dashboard, which can be used to further develop the website.

    wordpress16

    wordpress17


Related Tutorials

What do you think about this article?

Rate this article
LayerStack Promotion
Need assistance?

Try this guide to receive free bundled services at signup on a new free account.

Sign Up

Your Feedback Is Important

We hope you’ll give the new products and updates a try. If you have an idea for improving our products or want to vote on other user ideas so they get prioritized, please submit your feedback on our Community platform. And if you have any questions, please feel free to ask in the Community or contact our Technical Support team.