In this guide, you will learn the steps to setup and configure ProcessWire CMS on your LAMP stack.
ProcessWire is a free and open-source content management system and content management framework developed in the PHP programming language. It offers easy to use and intuitive features for both developers and end-users.
This guide discusses the installation and setup of the ProcessWire CMS on an Ubuntu 20.04 LTS using the LAMP stack (Linux, Apache, MySQL, and PHP).
Requirements
- Ubuntu 20.04 LTS
- A
sudo
account
Step 1 - Setup a sudo
user
The first step is to create a sudo
user. SSH into your instance as root
:
$ ssh root@remote_ip_address
Provide the password for the root
account to login to the server.
Step 2 - Login with a non-root account
After setting up a sudo
account as provided in the instructions above, restart the SSH service:
# systemctl restart sshd
Exit the SSH root session:
# exit
The exit
command will terminate your SSH session for the root
account.
Login to the server with the sudo
account.
$ ssh example_user@remote_ip_address
Enter the password for the example_user
to login.
Step 3 - Update Ubuntu 20.04
Before installing any packages on the Ubuntu instance, it is good to ensure the system is up to date. Doing so will ensure you get the latest packages and minimize compatibility issues with newer packages.
While logged in as the sudo
user, execute the following commands to update the system packages:
$ sudo apt-get update
$ sudo apt-get upgrade -y
If prompted for the non-root user's password, provide the login password the respective user account.
Step 4 - Install Apache2
Install the Apache Web server with the command:
$ sudo apt-get install apache2 -y
Step 5 - Enable mod_rewrite
ProcessWire requires the Apache mod_rewrite
module. To enable the module, use the a2enmod
utility as:
$ sudo a2enmod rewrite
Edit the default host configuration with your editor of choice and configure mod_rewrite
directives.
$ sudo nano /etc/apache2/sites-enabled/000-default.conf
Locate the DocumentRoot
Directive and ensure it is set to /var/www/html
DocumentRoot "/var/www/html"
Inside the <VirtualHost *:80>
and </VirtualHost>
sections. Add the entries to ensure the final configuration is as:
<VirtualHost *:80>
...
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
Allow from all
Require all granted
</Directory>
...
</VirtualHost>
NOTE: Ensure to the set theAllowOverride
directive toAll
Use the systemctl
command to enable automatic start of the Apache web server after restart.
$ sudo systemctl enable apache2@.service
Start the Apache web server:
$ sudo systemctl start apache2@.service
Step 6 - Install and Configure MySQL Server
ProcessWire requires MySQL or MariaDB server version 5.0 and higher. To install, execute the command:
$ sudo apt-get install mysql-server -y
Enable MySQL automatic startup and Start the MySQL server:
$ sudo systemctl enable mysql
$ sudo systemctl start mysql
Setup MySQL server by running the command:
$ sudo mysql_secure_installation
The command above will interactively prompt you for input for various options:
Set MySQL password policy to strong. This will prevent MySQL users from setting weak passwords:
Press y|Y for Yes, any other key for No: y
There are three levels of password validation policy:
LOW Length >= 8
MEDIUM Length >= 8, numeric, mixed case, and special characters
STRONG Length >= 8, numeric, mixed case, special characters and dictionary file
Please enter 0 = LOW, 1 = MEDIUM and 2 = STRONG: 2
Configure a secure password for MySQL root
user. You will be using the MySQL root
user to connect to the MySQL server.
NOTE: The MySQL root
user is different from the system's root
user.
Please set the password for root here.
New password: <SecurePassword>
Re-enter new password: <SecurePassword>
Follow the prompts in the mysql_secure_installation
utility and configure as you see fit.
The following are recommended settings for a secure MySQL server:
Remove anonymous users? (Press y|Y for Yes, any other key for No) : Y
Disallow root login remotely? (Press y|Y for Yes, any other key for No) : Y
Remove test database and access to it? (Press y|Y for Yes, any other key for No) : y
Reload privilege tables now? (Press y|Y for Yes, any other key for No) : y
Restart MySQL server:
$ sudo systemctl restart mysql
Step 7 - Setting Up ProcessWire Database
Using the MySQL root
account you setup earlier, login to the MySQL server:
$ sudo mysql -u root -p
Enter the MySQL root password.
Upon successful login, you should see the MySQL prompt mysql
>
Create a database for ProcessWire and the database user:
mysql> CREATE USER 'processwire_user@localhost' IDENTIFIED BY 'securepassword';
mysql> CREATE DATABASE processwire_db;
mysql> GRANT ALL PRIVILEGES ON processwire_db.* TO 'processwire_user@localhost';
mysql> FLUSH PRIVILEGES;
Feel free to replace the processwire_user
and processwire_db
with a meaningful name for your ProcessWire database user and ProcessWire database respectively.
Step 8 - Install PHP 7.4
Install PHP 7.4 and all the modules required to run ProcessWire:
$ sudo apt-get install php7.4 php7.4-gd php7.4-mbstring php7.4-common php7.4-xml libapache2-mod-php7.4 php7.4-curl php7.4-zip php7.4-mysql -y
Step 9 - Download ProcessWire 3.x
To install ProcessWire, start by navigating to your web root folder:
$ cd /var/www/html
Launch your browser and navigate to the ProcessWire download page:
Select the ProcessWire core and copy download link for the master.zip file.
Download the installation package using wget
:
$ sudo wget https://github.com/processwire/processwire/archive/master.zip
Check the files in the web root directory:
$ ls -la
total 16
-rw-r--r-- 1 root root 10918 Sep 13 09:16 index.html
-rw-r--r-- 1 root root 15466098 Sep 13 10:32 master.zip
Remove the index.html
file.
$ sudo rm -rf index.html
While inside the web root directory, unzip the ProcessWire archive:
Ensure you have unzip
installed:
$ which unzip
If you do not get any output, install unzip:
$ sudo apt-get install unzip -y
Extract all the files:
$ sudo unzip master.zip
Navigate to the extracted directory:
$ cd processwire-master
Move all the files in the process-master
directory to the web root directory:
$ sudo mv * /var/www/html
Clean up the web root directory:
$ sudo rm -rf master.zip processwire-master
Modify file ownership for the web root to the www-data
user:
$ sudo chown -R www-data:www-data * .
Restart Apache web server:
$ sudo systemctl restart apache2
Step 10 - Configure Firewall
For security, install and firewall and block all ports except port 80 for Apache web server.
$ sudo apt-get install ufw -y
Enable UFW Firewall:
$ sudo ufw enable
Allow port 80 traffic:
$ sudo ufw allow 80/tcp
Step 11 - Install ProcessWire 3.x
Install ProcessWire CMS.
Open your browser and navigate to the IP address of your server instance.
Navigate to:
http://servrer_instance_ip/install.php
You should see the ProcessWire 3.x installer:
Click on Get Started
to begin the installation process.
Select your installation profile and click Continue
.
In the compatibility window, ensure all the requirements are marked as correct. If not, you might be missing specified modules. Install them if required.
Click on Continue to Next Step
to proceed with the installation.
In the Database configuration window, provide the database information as configured in the previous steps.
DB Name -> processwire_db
DB User -> processwire_user
DB Pass -> securepassword
DB Host -> localhost
DB Port -> 3306
DB Charset -> utf-8
DB Engine -> MyISAM
Select your Time Zone.
Under File Permissions
, leave as default and proceed.
If you have multiple hostnames
for your site. Provide them in the hostname section, one host per line.
Set the Debug Mode
to off in production. If you are in development, set debug mode
to on.
Click on Continue
to proceed.
If you get ERROR 1045 (28000): Access denied for user 'processwire_user'@'localhost' (using password: YES
) error, following the following instructions.
Stop the MySQL service.
$ sudo systemctl stop mysql
Grant MySQL permissions for the created directory.
$ sudo chown mysql: /var/run/mysqld/
Start MySQL service:
$ sudo systemctl start mysql
In ProcessWire, click continue and ensure the database connection is successful.
Configure the Admin URL
and Admin Account
details.
Select Continue to install.
Upon successful installation, select Login to Admin to go to your Admin dashboard.
For Security purposes, change the permissions of the config.php file to read only for the owner only.
$ sudo chmod 400 /var/www/html/site/config.php
Restart Apache
$ sudo systemctl restart apache2
Wrapping Up
PRocessWire will automatically remove the installation files after completion. However, manually verify and remove them if they are still available.
$ sudo rm -rf install.php /var/www/html/site/install
You should now have ProcessWire fully configured and ready to use. Feel free to check ProcessWire Documentation to learn more.