WordPress + Apache2 Manual Install

Intro

WordPress is a free and open-source content management system (CMS) based on PHP and MySQL. It is used to create and manage websites, blogs, e-commerce sites, and other web-based applications. WordPress is known for its ease of use, flexibility, and versatility, making it a popular choice among website owners, developers, and designers.

WordPress was first released in 2003 and has since become one of the most widely used CMS platforms globally. One of its key features is its customizable appearance through the use of themes, which can be easily installed and changed to give a website a unique look and feel. Additionally, WordPress also offers a large number of plugins, which are add-ons that can be used to extend its functionality and add new features to a website.

WordPress is used by individuals, small businesses, and large enterprises, and is suitable for a wide range of websites, from personal blogs to complex e-commerce sites. It is easy to use, even for those with little or no technical knowledge, and offers a user-friendly dashboard for managing content, media, and other aspects of a website.

Overall, WordPress is a powerful and flexible platform that offers a wide range of features and customization options, making it a popular choice for building and managing websites.

Requirements.

None of real note, other than a VM or machine running Ubuntu 20.04 or higher

Install

  1. Install Apache2 and PHP dependency using the command
# sudo apt-get update && apt-get upgrade -y && apt full-upgrade -y
# sudo apt install apache2 \
                 ghostscript \
                 libapache2-mod-php \
                 mysql-server \
                 php \
                 php-bcmath \
                 php-curl \
                 php-imagick \
                 php-intl \
                 php-json \
                 php-mbstring \
                 php-mysql \
                 php-xml \
                 php-zip

2. Create WordPress directories, download the WordPress tar ball and ser ownership

# sudo mkdir -p /srv/www
# sudo chown www-data: /srv/www
# curl https://wordpress.org/latest.tar.gz | sudo -u www-data tar zx -C /srv/www

3. Configure the site for Apache

Type: sudo nano /etc/apache2/sites-available/wordpress.conf

and enter the following

<VirtualHost *:80>
    DocumentRoot /srv/www/wordpress
    <Directory /srv/www/wordpress>
        Options FollowSymLinks
        AllowOverride Limit Options FileInfo
        DirectoryIndex index.php
        Require all granted
    </Directory>
    <Directory /srv/www/wordpress/wp-content>
        Options FollowSymLinks
        Require all granted
    </Directory>
</VirtualHost>

Then run the Following commands to enable the site and disable the default apache site

sudo a2ensite wordpress
sudo a2enmod rewrite
sudo a2dissite 000-default
sudo service apache2 reload

4. Configure the MySQL database. change the <your-password> to the password of your choosing.

$ sudo mysql -u root
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 7
Server version: 5.7.20-0ubuntu0.16.04.1 (Ubuntu)

Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> CREATE DATABASE wordpress;
Query OK, 1 row affected (0,00 sec)

mysql> CREATE USER wordpress@localhost IDENTIFIED BY '<your-password>';
Query OK, 1 row affected (0,00 sec)

mysql> GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,DROP,ALTER
    -> ON wordpress.*
    -> TO wordpress@localhost;
Query OK, 1 row affected (0,00 sec)

mysql> FLUSH PRIVILEGES;
Query OK, 1 row affected (0,00 sec)

mysql> quit
Bye

5.Configure WordPress to use the newly created Database

run the following commands

sudo -u www-data cp /srv/www/wordpress/wp-config-sample.php /srv/www/wordpress/wp-config.php

sudo -u www-data sed -i 's/database_name_here/wordpress/' /srv/www/wordpress/wp-config.php

sudo -u www-data sed -i 's/username_here/wordpress/' /srv/www/wordpress/wp-config.php

##Change the <your-password> to the MySQL password set earlier##
sudo -u www-data sed -i 's/password_here/<your-password>/' /srv/www/wordpress/wp-config.php

Open in a web browser https://api.wordpress.org/secret-key/1.1/salt/ and copy what is displayed.

Then run the command

sudo -u www-data nano /srv/www/wordpress/wp-config.php

Then find the lines containing and replace with the salt data was copied

define( 'AUTH_KEY',         'put your unique phrase here' );
define( 'SECURE_AUTH_KEY',  'put your unique phrase here' );
define( 'LOGGED_IN_KEY',    'put your unique phrase here' );
define( 'NONCE_KEY',        'put your unique phrase here' );
define( 'AUTH_SALT',        'put your unique phrase here' );
define( 'SECURE_AUTH_SALT', 'put your unique phrase here' );
define( 'LOGGED_IN_SALT',   'put your unique phrase here' );
define( 'NONCE_SALT',       'put your unique phrase here' );

If all is successful Navigate to http://localhost/wp-admin in your browser and finish the install by creating a login information and it all should be done.

All that is left is to create your first post…