Lab 5: Wordpress

 

Objective

To get experience installing and configuring more complex software.


 

Task

For this lab you will install the Wordpress content management system. A CMS is software that lets you create and manage a website. You'll need to follow these steps to do this:

  1. Install a LAMP stack. This acronym stands for Linux, Apache, MySQL (or MariaDB) and PHP (or Python or Perl). We already have Linux and Apache setup, so we'll just need the latter two.
    1. Install the mariadb-server and mariadb-client packages. Then make sure the MariaDB service is started and enabled.
    2. Run sudo mysql_secure_installation which will configure the database system, including setting the root password. MariaDB has its own root password which is separate from the Linux one. Make sure you remember what you pick.
    3. Install PHP with the following packages (most of which are libraries that Wordpress requires): php libapache2-mod-php php-cli php-fpm php-json php-pdo php-mysql php-zip php-gd php-mbstring php-curl php-xml php-pear php-bcmath.
    4. Enable PHP with Apache: sudo a2enmod php8.2.
    5. Verify PHP is working with Apache by putting the code <?php phpinfo(); ?> into the file /var/www/html/test.php, and then navigating to your IP address with "/test.php" on the end in a web browser. You should see a page with PHP info on it.
    6. Remove the test.php file as it was just for testing purposes.
  2. Setup the databases needed for Wordpress:
    1. Run mysql -u root -p and enter your database root password. You should be at a MariaDB prompt. Enter the following commands at the shell:
    2. CREATE DATABASE wp_database;
    3. CREATE USER 'wpuser'@'localhost' IDENTIFIED BY 'StrongPassword'; (replacing the password of course).
    4. GRANT ALL ON `wp_database`.* TO `wpuser`@`localhost`;
    5. FLUSH PRIVILEGES;
    6. Exit the database shell
  3. Download Wordpress from https://wordpress.org/latest.tar.gz into your home directory.
  4. Decompress the tar-ball, which will make a directory called wordpress in your home directory.
  5. Make sure /var/www/html is empty. If there's anything there, delete it.
  6. Move all of the files in this wordpress directory into /var/www/html/. We can now remove the empty wordpress directory in our home, and the .tar.gz file.
  7. Set the owner of all of these files to www-data.
  8. Ensure that all of the permissions in /var/www/html are correct. The files should be 644 and the directories should be 755. If something isn't readable, the website will not be accessible.
  9. Copy the wp-config-sample.php file to wp-config.php.
  10. Open up the file and put in the following info we setup with MariaDB:
    1. Put in wp_database DB_NAME
    2. Put in wpuser for DB_USER
    3. Put in the password you set for this user in for DB_PASSWORD
  11. Load your IP address in your web browser. You should see a Wordpress welcome page asking for your site title, email and so on. Put in whatever you want and click the Install Button.
  12. Login with the info you just setup. You should be at the Wordpress dashboard!

 

Submitting

Take a screenshot of the Wordpress dashboard with your IP address visible in the screenshot, and submit it in Canvas for this lab.