This guide assumes you already have a working LAMP server, and have already met the WordPress requirements.
Prerequisites
The WordPress requirements as of 2018 February:
- PHP 7.2 or greater
- MySQL 5.6 or greater OR MariaDB 10.0 or greater
- Nginx or Apache with mod_rewrite module
- HTTPS support
- PHP-JSON (required for wp-cli)
Click here for my guide on setting up a LAMP server on Fedora 27.
WordPress Installation
After the above requirements are met, we can install any needed web apps, such as WordPress.
Installing WP CLI
Installing and using the WordPress Command Line Interface (WP-CLI) makes installing, configuring, and managing WordPress simpler, as you can do it from simple commands, and even automate things.
- Download the wp-cli.phar file using wget or curl:
curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
- Next, check the Phar file to verify that it’s working:
php wp-cli.phar
- To use WP-CLI from the command line by typing wp, make the file executable and move it to somewhere in your PATH:
chmod +x wp-cli.phar
mv wp-cli.phar /usr/local/bin/wp
cp /usr/local/bin/wp /usr/bin
- If WP-CLI was installed successfully, you should some output with directories after running the following command:
wp --info
Installing WP with WP CLI
Here we’ll create the main directory, download WordPress, create a database, and set up WordPress. We’ll also go ahead and install and activate all needed themes and plugins to make our WordPress function as a Wiki.
- Create website directory:
mkdir /var/www/html/wpwiki
- Set ownership:
chown apache:apache /var/www/html/wpwiki
- Set ownership:
- Change to directory where you want to install WordPress:
cd /var/www/html/wpwiki
- Download WP:
sudo -u apache wp core download
- Create WP Config:
sudo -u apache wp core config --dbname=wpwiki --dbuser=root --dbpass=rootpassword --dbhost=localhost --dbprefix=wpwi_ #NOTE: You should create a different user and password for your database!
- Create Database per above config file:
sudo -u apache wp db create
- Set-up WP Site: (make note of your login password after below command finishes)
sudo -u apache wp core install --url=timothygruber.com/wpwiki --title="My WordPress Wiki" --admin_user="root" --admin_email="your@email.com" --skip-email
- Install Themes and Plugins: (enter each command from within the wpwiki directory)
wp theme install twentyfifteen wp theme install wikiwp --activate wp plugin install wordfence --activate wp plugin install sucuri-scanner --activate wp plugin install mivhak --activate wp plugin install members --activate wp plugin install image-elevator --activate wp plugin install responsive-lightbox-lite --activate wp plugin install table-of-contents-plus --activate wp plugin install tablepress --activate wp plugin install tinymce-advanced --activate wp plugin install disable-comments --activate wp plugin install broken-link-checker --activate
- Note: The WikiWP theme is what I used to recommend, but it looks like the devs stopped maintaining it, so I can no longer recommend activating it on publicly accessible web servers due to possible security concerns. You may activate it at your own risk.
- Log in and change password. Password is displayed after above command in Step #6 is ran.
- If certain pages don’t display content, try:
setsebool -P httpd_can_network_connect on
Getting Started
Now that WordPress is set up and installed with all needed themes and plugins, log in and make a quick test post to try out the WYSIWYG editor. Go ahead, take a screenshot, and paste it directly into the editor!
There are a few steps to take in securing your site if you have it publicly accessible. Both WordFence and Sucuri have built-in guides to help you with that, and is beyond the scope of this article.
If you are using WikiWP, you’re pretty much ready to go.
If you are using this site in a more publicly accessible environment, then I recommend using the “Twenty Fifteen” theme. Below, I will guide you on wikitizing the theme.
- <in progress>
Additional Help
A section to address any potentials issues that may arise during your setup.
- If you get weird esmtp issues, uninstall the the package. It’s not needed at this point, but verify you are not first:
dnf remove esmtp
Starting over
If you make a mistake when installing WordPress via WP-CLI, it’s easy to start over.
- Make sure you are in your WP Wiki directory:
cd /var/www/html/wpwiki
- Delete the WP database you just created:
wp db drop --yes
- Delete all files in current directory: (be careful, verify you are in ‘wpwiki’ directory)
rm -fr *
Extra: WordPress Directory permissions
Just in case permissions get messed up, folders should be 755, files 644. Config file 640.
find /var/www/html/wpwiki/ -type d -exec chmod 0755 {} \;
find /var/www/html/wpwiki/ -type f -exec chmod 0644 {} \;
- Make sure wp-config.php is 0640!!!
- html directory = 0755
- www directory = 0755
- cgi-bin directory = 0755
Extra: Fix SELinux if needed
If SELinux gets messed up beyond the point of repair:
setenforce 0
dnf remove selinux-policy
rm -rf /etc/selinux/targeted /etc/selinux/config
dnf install selinux-policy-targeted
touch /.autorelabel; reboot
After reboot, Fedora may relabel everything. This may take a few minutes, then it'll automatically reboot again.