How to Install PHP Server Monitor on Elementary OS

PHP Server Monitor is an open-source web-based tool that allows you to monitor your server's performance and services. In this tutorial, we will guide you to install PHP Server Monitor on Elementary OS.

Prerequisites

Step 1 - Download PHP Server Monitor

First of all, navigate to the official website of PHP Server Monitor [https://www.phpservermonitor.org/] and download the latest stable version of PHP Server Monitor. You can use wget command to download the latest version:

sudo wget -O /var/www/html/psm.zip https://github.com/phpservermon/phpservermon/releases/download/3.3.2/phpservermon-3.3.2.zip 

Step 2 - Unzip PHP Server Monitor

After downloading the PHP Server Monitor zip package, use the following command to unzip the zipped file in the /var/www/html directory:

sudo apt install unzip
sudo unzip /var/www/html/psm.zip -d /var/www/html/

Step 3 - Set Permissions

Now you need to configure the appropriate permissions for PHP Server Monitor's directory so that Apache can access it.

sudo chown -R www-data:www-data /var/www/html/phpservermon/

Step 4 - Install Required PHP Modules

PHP Server Monitor requires some essential PHP modules to run correctly. You can install them using the following command:

sudo apt install php7.4-gd php7.4-mysqli php7.4-curl libapache2-mod-php7.4

Step 5 - Configure MySQL Database

Next, you need to create a MySQL database for PHP Server Monitor. Run the following command to create a new database for PHP Server Monitor:

mysql -u root -p
CREATE DATABASE psm_db;
GRANT ALL PRIVILEGES ON psm_db.* TO 'user'@'localhost' IDENTIFIED BY 'password';
FLUSH PRIVILEGES;
exit

Replace the user and password credentials with your own desired values.

Step 6 - Configure PHP Server Monitor

Copy the default configuration file to the new config file and make it writeable.

sudo cp /var/www/html/phpservermon/config/config.default.php /var/www/html/phpservermon/config/config.php
sudo chmod o+w /var/www/html/phpservermon/config/config.php

In the next step, you need to modify the configuration file to include your MySQL database credentials, including the IP address or hostname of your MySQL server, the database name, database username, and password.

sudo nano /var/www/html/phpservermon/config/config.php

Change the following settings:

$CONFIG["psm_version"] = "3.3.2";
$CONFIG["db_hostname"] = "localhost";
$CONFIG["db_database"] = "psm_db";
$CONFIG["db_username"] = "user";
$CONFIG["db_password"] = "password";

Remember to change to your own database credentials.

Step 7 - Restart Apache

To apply the modifications you have made, restart Apache service using the following command:

sudo systemctl restart apache2

Step 8 - Access PHP Server Monitor

Now PHP Server Monitor is installed, and you can access it by typing the following URL on your web browser:

http://your_server_ip/phpservermon/

When you first access PHP Server Monitor, you will be redirected to the login page where you can use the default username admin and the password password. After you log in, you can change the administrator's password and start monitoring your services and servers.

Conclusion

In this tutorial, we guided you to install PHP Server Monitor on your Elementary OS operating system. Now you can monitor your server's services and performance using PHP Server Monitor.

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!