How to Install PHP Server Monitor on Void Linux

PHP Server Monitor (PSM) is an open-source tool that monitors your web server and services to ensure that they remain available and responsive to users. In this tutorial, we will take you through the process of how to install PSM on Void Linux.

Prerequisites

Before we can proceed with the installation of PSM, there are a few software prerequisites that we need to install on our Void Linux system:

To install these, run the following commands:

sudo xbps-install -S apache php-fpm php-mysqli
sudo xbps-install -S mariadb

Step 1: Download PHP Server Monitor

Go to the official PSM website at https://www.phpservermonitor.org/ and download the latest version of PSM. Alternatively, you can use the following command to download and extract the code:

cd /var/www
sudo wget -O psm.tar.gz https://github.com/phpservermon/phpservermon/archive/master.tar.gz
sudo tar -xzvf psm.tar.gz
cd phpservermon-master
sudo mv * ../
cd ..
sudo rmdir phpservermon-master

Step 2: Configure the Database

We need to create a new MySQL or MariaDB database and user for PSM. Login to your MySQL shell:

sudo mysql -u root -p

Create a new user:

CREATE USER 'psmuser'@'localhost' IDENTIFIED BY 'yourpassword';

Create a new database and grant privileges to the user:

CREATE DATABASE psmdatabase;
GRANT ALL PRIVILEGES ON psmdatabase.* TO 'psmuser'@'localhost';
FLUSH PRIVILEGES;

Exit the MySQL shell:

exit

Step 3: Configure PHP Server Monitor

Copy the config.dist.php file to config.php:

sudo cp config.dist.php config.php

Edit the config.php file:

sudo nano config.php

Update the following lines according to your settings:

define('PSM_DB_HOST', 'localhost');
define('PSM_DB_PORT', '3306');
define('PSM_DB_USER', 'psmuser');
define('PSM_DB_PASS', 'yourpassword');
define('PSM_DB_NAME', 'psmdatabase');

Step 4: Configure Apache

Create a new virtual host file for PSM:

sudo nano /etc/apache2/vhosts.d/psm.conf

Add the following configuration:

<VirtualHost *:80>
    ServerName yourserver.com
    DocumentRoot /var/www
    <Directory /var/www>
        Options FollowSymLinks
        AllowOverride All
        Require all granted
    </Directory>
</VirtualHost>

Save and exit the file. Restart Apache:

sudo apachectl graceful

Step 5: Access PHP Server Monitor

Now you can access PHP Server Monitor in your web browser by visiting http://yourserver.com/.

Congratulations, you have successfully installed PSM on Void Linux!

Conclusion

In this tutorial, we covered the installation of PHP Server Monitor on Void Linux. We installed the necessary software prerequisites, created a new MySQL database and user, and configured Apache for PSM. We hope that this tutorial has helped you install this useful tool for monitoring your web server and services.

If you want to self-host in an easy, hands free way, need an external IP address, or simply want your data in your own hands, give IPv6.rs a try!

Alternatively, for the best virtual desktop, try Shells!