This tutorial diverges significantly from Professor Kevin Lu's "lesson4" exercise on his iot GitHub repo
Up first was setting up apache2 so that I had a foundation to build the Wordpress site on. Apache allows you to host a server on your computer and actually comes pre-installed on some MacBook models
sudo apt install apache2
Next, I restarted the apache service so that it was able to make sure it was up and running properly - this will also make the service run at startup
sudo systemctl stop apache2.service
sudo systemctl start apache2.service
sudo systemctl enable apache2.service
You can check the status of the apache service (or really any service in general) by running the following command and replacing "apache2.service" with your desired service name
sudo systemctl status apache2.service
Note: pressing "q" will close the menu opened
Next was installing Mariadb and configuring the mysql installation
sudo apt install mariadb-server mariadb-client
sudo systemctl stop mysql.service
sudo systemctl start mysql.service
sudo systemctl enable mysql.service
sudo mysql_secure_installation
Set the root password to what you desire and pass through the wizard
Next, restart the service so changes can take effect
sudo systemctl restart mysql.service
To install php, the following commands must be run
sudo apt-get install software-properties-common
sudo add-apt-repository ppa:ondrej/php
sudo apt update
sudo apt install php7.1 libapache2-mod-php7.1 php7.1-common php7.1-mbstring php7.1-xmlrpc php7.1-soap php7.1-gd php7.1-xml php7.1-intl php7.1-mysql php7.1-cli php7.1-mcrypt php7.1-zip php7.1-curl
Now that all of the required packages are installed, make some quick changes to these settings in your apache2 php.ini file
sudo vim /etc/php/7.1/apache2/php.ini
Change these settings:
file_uploads = On
allow_url_fopen = On
memory_limit = 256M
upload_max_filesize = 100M
max_execution_time = 360
date.timezone = America/Chicago
The following will create the database required for your Wordpress site to function
sudo mysql -u root -p
create database wordpress;
create user 'wordpressuser'@'localhost' identified by 'password';
grant all on wordpress.* to 'wordpressuser'@'localhost' identified by 'password' with grant option;
flush privileges;
exit;
First, install the latest release of wordpress onto your computer, I placed the compressed version in my tmp folder
cd /tmp
wget https://wordpress.org/latest.tar.gz
tar -zxvf latest.tar.gz
sudo mv wordpress /var/www/html/wordpress
Now, these commands will set ownership of the wordpress folders to user www-data and set group to www-data along with changing their chmod permissions to make them read, write, execute by its owner, read, execute by its group, and read, execute by everyone else
sudo chown -R www-data:www-data /var/www/html/wordpress/
sudo chmod -R 755 /var/www/html/wordpress/
Next, you have to configure apache to run wordpress so run this command to make the document wordpress.conf and paste what comes afterwards into the document
sudo vim /etc/apache2/sites-available/wordpress.conf
<VirtualHost *:80>
ServerAdmin admin@example.com
DocumentRoot /var/www/html/wordpress/
ServerName example.com
ServerAlias www.example.com
<Directory /var/www/html/wordpress/>
Options +FollowSymlinks
AllowOverride All
Require all granted
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
Save and exit
Now enable wordpress and rewrite, then restart apache
sudo a2ensite wordpress
sudo a2enmod rewrite
sudo a2dismod php7.0
sudo a2enmod php7.1
sudo systemctl restart apache2.service
Now it's finally time to configure wordpress!
sudo mv /var/www/html/wordpress/wp-config-sample.php /var/www/html/wordpress/wp-config.php
sudo vim /var/www/html/wordpress/wp-config.php
Change the following settings and save
// ** MySQL settings - You can get this info from your web host ** //
/** The name of the database for WordPress */
define('DB_NAME', 'wordpress');
/** MySQL database username */
define('DB_USER', 'wordpressuser');
/** MySQL database password */
define('DB_PASSWORD', 'user_password_here');
/** 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', '');
Now that that's all taken care of, its time to finish this setup off with your browser.
In a chromium based browser (Google Chrome, Firefox, Opera, etc..., I've only tested this on firefox) type the following unto the URL bar:
http://127.0.0.1/wordpress/wp-config.php
After that, a wordpress setup page should appear asking for your preferred language
Create an account and continue with the setup wizard, you should be all done!
By the end, your site should look something like this: