These are the minimum steps I needed to get WordPress running on Ubuntu Server 18.04. It is based on the below guide at the time of this writing:
- During the install and setup of Ubuntu Server 18.04, the only option I chose beyond the defaults was to install Open SSH server but is not required depending on your needs.
- sudo apt install apache2
- Optional: if you want SSL support
sudo a2enmod ssl - sudo apt install mysql-server
- Set up a MySQL user and database for WordPress to use by using the debian-sys-maint user:
sudo cat /etc/mysql/debian.cnf
mysql -u debian-sys-maint -p(copy/paste the password from the previous cat output)
CREATE USER 'username'@'localhost' IDENTIFIED BY 'password'; CREATE DATABASE your_dbname DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci; GRANT ALL PRIVILEGES ON your_dbname.* TO 'username'@'localhost'; FLUSH PRIVILEGES; quit;
- sudo apt install php libapache2-mod-php php-mysql php-gd php-xml php-mbstring
- By default apache will look at /var/www/html location for your WordPress install, but you can modify it with these steps
sudo nano /etc/apache2/sites-enabled/000-default.conf
in this example we will change DocumentRoot line to be /var/www/wordpress - Optional: if you want SSL support add this entire block<VirtualHost *:443>
ServerAdmin webmaster@localhost
DocumentRoot /var/www/wordpress
SSLCertificateFile /etc/ssl/certs/ssl-cert-snakeoil.pem
SSLCertificateKeyFile /etc/ssl/private/ssl-cert-snakeoil.key
</VirtualHost> - cd /var/www
- sudo curl -O https://wordpress.org/latest.tar.gz
- sudo tar xfvz latest.tar.gz
- sudo cp wordpress/wp-config-sample.php wordpress/wp-config.php
- sudo nano wordpress/wp-config.php
- Modify database_name_here, username_here, password_here
- sudo chown -R www-data:www-data /var/www/wordpress
- Allow .htaccess permissions in Apache2 (otherwise changing the Permalinks settings in WordPress will result in 404 errors, as well as plugins that rely on subfolders to serve content).sudo nano /etc/apache2/apache2.conf
Find the section where Directory parameters are specified and add the following block:
<Directory /var/www/wordpress/>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>sudo a2enmod rewrite - If you need to adjust maximum upload filesize and post size for PHP it is found in /etc/php/7.2/apache2/php.ini
Then change upload_max_filesize and post_max_size - sudo systemctl restart apache2
- Done