How to Install ProcessWire CMS on Debian 9, Part 1: LAMP Stack Installation
Don't know anything about the LAMP stack? Prepare to be illuminated! In this post, we look at how to get LAMP up and running.
Join the DZone community and get the full member experience.Join For Free
ProcessWire CMS is an open source framework and PHP-based content management system (CMS) built to save time; its users do not require any training to use it. It is designed to provide a satisfying experience to designers, developers, and its end-users.
ProcessWire CMS provides a strong and simple way to manage your fields, pages, templates, and styles. It also provides an open source API that is jQuery-inspired which makes it more enjoyable and easy to use.
ProcessWire CMS does not restrict its installation to any specific operating system (OS). You can use any operating system (OS) of your choice; however, the installation steps would vary according to the choice of operating system.
In this tutorial, we will be installing ProcessWire CMS on an Alibaba Cloud Elastic Compute Service (ECS) instance with Debian 9 installed.
This tutorial is divided into 2 sub-tutorials.
- In the first part, we will add a super user, setup firewalls, setup Apache Server, MariaDB Server, install PHP 7 (LAMP) and its various modules, and install various other necessary packages.
- In the second part, we will learn to configure your domain, creating a virtual host, and installing Let's Encrypt SSL to our website. We will also be installing ProcessWire CMS and configuring it.
- You must have Alibaba Cloud Elastic Compute Service (ECS) activated and verify your valid payment method. If you are a new user, you can get free $300 credits in your Alibaba Cloud account. If you don't know about how to setup your ECS instance, you can refer to this tutorial.
- A domain name registered from Alibaba Cloud. If you have already registered a domain from Alibaba Cloud or any other host, you can update its domain nameserver records.
- You should setup your server's hostname.
- Access to the VNC console in your Alibaba Cloud or SSH client installed in your PC.
Add a User With Root Privileges
After completing the prerequisites, login as root user with your root username and password via the SSH client (e.g. Putty – You can get Putty from https://www.putty.org ) or the VNC console available in your Alibaba Cloud account dashboard.
In the first step, you will add a new user and give it sudo privileges. Sudo privileges will allow this username to make administrative changes on the system when required. This user will be used to log in via SSH for everyday use. Once you have added this user, to keep your server secure from various attacks, you will disable the remote root access to the root user.
- To create a new user account, use the following command:
# adduser aareezwhere "aareez" can be any username of your choice. Now set your desired password and retype your desired password. Then, enter your full name, room number, work phone, home phone, and other. After entering the information, hit the Enter key. To confirm the data is correct, type 'Y' and hit Enter key.
- Now assign the username to the sudo user's group to give administrative privileges. For this, we will check the /etc/sudoers file and see whether the sudoers group is enabled or not. For this purpose, we will execute the following command.
- After executing the above command, a file will be opened. Find the following lines in the opened file. Sometimes, by default, the second line (
%sudo ALL=(ALL:ALL) ALL) is commented (starting with hash,
#), due to which, even after adding a username to sudoers, it gives an error on using the
sudocommand. To prevent this issue, if this line starts with the
#sign, remove this symbol and save the changes by pressing Ctrl+X, then type 'Y' and then hit the Enter key to save.
- Now you will add your username "aareez" to the "sudo" group by executing the following command:
# adduser aareez sudo. After execution of the above command, you can verify the membership for that group by executing the following command:
# groups aareez. Your username has been successfully added to the sudoers group and is able to execute any root command.
- Now, log in by using your new username and password or use the following command to switch the user:
# su – aareez. You can see that you have been logged in from your new account now. If you want to verify this, you can use the command below:
Update Your Debian 9 System
Before proceeding with the installation of any kind of package, use the following command to update your Debian 9 system. To execute this command, remember to log in from the non-root user with sudo privileges.
# sudo apt-get update
You will be prompted to enter your password. Now type your password and hit the Enter key and wait for the update to finish.
Now execute the following command to upgrade packages:
# sudo apt-get -y upgrade
You will be prompted to configurations below. Select the option to install the package maintainer's version.
Install Apache Web Server
- To install the apache web server, you will need to execute the following command:
# sudo apt-get -y install apache2
- After installation, you will need to enable the Apache server to run automatically when you boot your ECS. For that, execute the following command:
# sudo systemctl enable apache2
- To start your Apache server, execute the following command:
# sudo systemctl start apache2
- To ensure that your DocumentRoot directive is pointing to correct directory, check your Apache configuration file by using the following command:
# sudo nano /etc/apache2/sites-enabled/000-default.conf— Note: The configuration for DocumentRoot should look like: DocumentRoot /var/www/html. Press Ctrl + X, to exit the editor.
- Now add the following text before the </VirtualHost> tag in the opened file and press Ctrl+X, then press 'Y' and then hit the Enter key to save the changes.
<Directory /var/www/html/> Options Indexes FollowSymLinks MultiViews AllowOverride All Order allow,deny allow from all </Directory>
- Now execute the following command to enable the
mod_rewritemodule in Apache.
# sudo a2enmod rewrite
- To make the changes work correctly, we will need to restart Apache. To do so, execute the command below:
# sudo systemctl restart apache2
- To verify, you have successfully installed Apache Web Server. Open http://22.214.171.124/ in your web browser where 126.96.36.199 is my ECS IP address. Remember to replace it with your ECS IP address. You will see the following page.
Setup Firewalls for HTTP and HTTPS
- If you have activated firewalls, you will have to define a rule in the Alibaba Cloud security group for your cloud server to add an exception for port 80/tcp, 443/tcp. You can enable these ports while creating ECS instance, but, in case you have forgotten to unblock these ports, you can follow the procedure below. By default, these ports are blocked by the firewalls. To do this, go to your Elastic Compute Service section. Click on More for the ECS you are using for ImpressPages CMS and click Security Group Configuration. Click on Configure Rules and then click on Quickly Create Rules. Add the configurations as shown in screenshot below and click OK.
Install PHP 7.0
- To install PHP 7.0 on Debian 9, along with its modules required for ProcessWire CMS, you will need to execute the following command:
# sudo apt-get -y install php php-gd php-mbstring php-common php-MariaDB php-imagick php-xml libapache2-mod-php php-curl php-zip
- You can check the progress of your PHP installation by executing the following command:
# php -v
Install MariaDB Server
- Instead of a MySQL server, Debian uses a MariaDB server by default. To install MariaDB, use the following command:
# sudo apt-get -y install mariadb-server. You can also use Alibaba Cloud Aspara DB for RDS as an alternative. Alibaba Cloud AsparaDB for RDS frees you from managing a database and you can focus on your business. It also provides protection against SQL injections, network attacks, brute force attacks, and many other types of database attacks. It is highly scalable, highly available, and easy to use.
- After successful installation, enable the MariaDB server to start automatically when the system reboots. To do so, use the following command:
# sudo systemctl enable mariadb
- To start the MariaDB server, execute the following command:
# sudo systemctl start mariadb
- Now, to secure your MariaDB server, execute the command:
# sudo mysql_secure_installation. The root password will be blank by default, just hit the Enter button to proceed and select 'Y' and choose your password. You have successfully secured your MariaDB server.
- To unzip any zip folder, you will require an unzipping tool. To do so, use the following command:
# sudo get-apt -y install unzip
We have successfully installed the LAMP stack and other necessary packages to continue with second part of How to install ProcessWire CMS on Debian 9 tutorial. In the next part, we will learn how configure your domain in Alibaba Cloud DNS, how to create virtual host to point your domain name to your ECS IP address and how to finally install ProcessWire on our ECS instance.
Opinions expressed by DZone contributors are their own.