Go to TogaWare.com Home Page. GNU/Linux Desktop Survival Guide
by Graham Williams
Duck Duck Go


WordPress Basic Setup

20200902 Setting up a WordPress instance on Ubuntu is illustrated below using an Azure virtual machine running Ubuntu 20.04 LTS (myhub.australiacentral.cloudapp.azure.com). We begin by installing the wordpress software:

$ ssh myhub.australiaeast.cloudapp.azure.com
$ wajig update; wajig distupgrade
$ wajig install wordpress php libapache2-mod-php mysql-server php-mysql

The WordPress configuration file for Apache is then created:

$ sudo emacs /etc/apache2/sites-available/wordpress.conf
Alias /blog /usr/share/wordpress
<Directory /usr/share/wordpress>
    Options FollowSymLinks
    AllowOverride Limit Options FileInfo
    DirectoryIndex index.php
    Order allow,deny
    Allow from all
<Directory /usr/share/wordpress/wp-content>
    Options FollowSymLinks
    Order allow,deny
    Allow from all

We can then enable the WordPress module for Apache:

$ sudo a2ensite wordpress
$ sudo a2enmod rewrite
$ wajig reload apache2

WordPress uses MySQL to store its data, including users:

$ sudo mysql -u root
mysql> CREATE DATABASE wordpress;
mysql> CREATE USER 'wordpress'@'localhost' IDENTIFIED BY '<secret>';
mysql> GRANT ALL PRIVILEGES ON wordpress.* TO 'wordpress'@'localhost';
mysql> QUIT
$ wajig restart mysql

Configure the database information for WordPress to connect to it:

$ sudo emacs /etc/wordpress/config-localhost.php
define('DB_NAME', 'wordpress');
define('DB_USER', 'wordpress');
define('DB_PASSWORD', '<secret>');
define('DB_HOST', 'localhost');
define('DB_COLLATE', 'utf8_general_ci');
define('WP_CONTENT_DIR', '/usr/share/wordpress/wp-content');

Now try it out.

$ firefox localhost/blog
Site Title: Kayon Institute
Username:   kayon
Password:   @6ClqvImsMsG1di$Yh
Email:      kayon@togaware.com

Click the Install WordPress button
Click the Log In button

Also need To allow wordpress to upgrade itself

$ sudo chown -R www-data:www-data /usr/share/wordpress

$ sudo find /usr/share/wordpress/ -type d -exec chmod 750 {} \;
$ sudo find /usr/share/wordpress/ -type f -exec chmod 640 {} \;

Support further development by purchasing the PDF version of the book.
Other online resources include the Data Science Desktop Survival Guide.
Books available on Amazon include Data Mining with Rattle and Essentials of Data Science.
Popular open source software includes rattle and wajig.
Hosted by Togaware, a pioneer of free and open source software since 1984.
Copyright © 1995-2020 Togaware Pty Ltd. Creative Commons ShareAlike V4.