How to Install PHP Server Monitor on Debian 11.3
- 00:42 lsb_release -a
- 00:55 sudo apt-get update
- 01:18 sudo apt install apache2 mariadb-server -y
- 01:50 sudo apt install php-curl php-cli php-fpm php-json php-common php-mysql php-zip php-gd php-mbstring php-curl php-xml php-pear
- 02:19 apt install php -y
- 02:36 systemctl start mariadb
- 02:49 systemctl enable mariadb
- 03:03 systemctl start apache2
- 03:17 sudo mysql -u root -p
- 03:35 create database linuxhelp;
- 03:51 grant all on phpmonitordb.* to 'user1'@'localhost' identified by 'Linuxc#7';
- 04:41 flush privileges;
- 04:51 exit
- 05:03 cd /var/www/html
- 05:14 sudo wget https://downloads.sourceforge.net/project/phpservermon/phpservermon/phpservermon-3.2.0.tar.gz
- 05:26 sudo tar -xvzf phpservermon-3.2.0.tar.gz
- 05:46 sudo mv phpservermon-3.2.0 phpservermon
- 06:02 sudo vim /etc/php/7.4/cli/php.ini
- 06:49 sudo vim /var/www/html/phpservermon/config.php.sample
- 07:44 sudo chown -R www-data:www-data /var/www/html/phpservermon
- 08:14 systemctl restart apache2
- 08:40 sudo ufw allow http
To Install PHP Server Monitor on Debian 11.3
Introduction:
PHP Server Monitor is an open-source web-based monitoring tool that reviews whether your websites, services, and servers are up. It comes with a web interface where you can control your services and websites. Also, you can manage users for each server/service with a mobile number and email address.
Step 1: Check the OS Version by using the below command
[root@linuxhelp:~#] lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description: Debian GNU/Linux 11 (bullseye)
Release: 11
Codename: bullseye
Step 2: Next, update the system package by using the below command.
[root@linuxhelp:~#] sudo apt-get update
Get:1 http://deb.debian.org/debian bullseye InRelease [116 kB]
Get:2 http://security.debian.org/debian-security bullseye-security InRelease [48.4 kB]
Get:3 http://deb.debian.org/debian bullseye-updates InRelease [44.1 kB]
Get:4 http://deb.debian.org/debian bullseye/main Sources [8,633 kB]
Get:5 http://security.debian.org/debian-security bullseye-security/main Sources [158 kB]
Get:6 http://security.debian.org/debian-security bullseye-security/main amd64 Packages [186 kB]
Get:7 http://security.debian.org/debian-security bullseye-security/main Translation-en [117 kB]
Get:8 http://deb.debian.org/debian bullseye-updates/main Sources.diff/Index [11.7 kB]
Get:9 http://deb.debian.org/debian bullseye-updates/main amd64 Packages.diff/Index [11.7 kB]
Step 3: Next install the Apache web server and MariaDB Database server by using the below command
[root@linuxhelp:~#] sudo apt install apache2 mariadb-server –y
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following additional packages will be installed:
apache2-data apache2-utils galera-4 gawk libaio1 libcgi-fast-perl libcgi-pm-perl libconfig-inifiles-perl libdbd-mariadb-perl libdbi-perl
libfcgi-bin libfcgi-perl libfcgi0ldbl libhtml-template-perl libmariadb3 libsigsegv2 libterm-readkey-perl mariadb-client-10.5
mariadb-client-core-10.5 mariadb-common mariadb-server-10.5 mariadb-server-core-10.5 mysql-common rsync socat
Suggested packages:
apache2-doc apache2-suexec-pristine | apache2-suexec-custom gawk-doc libmldbm-perl libnet-daemon-perl libsql-statement-perl
libipc-sharedcache-perl mailx mariadb-test netcat-openbsd
The following NEW packages will be installed:
apache2 apache2-data apache2-utils galera-4 gawk libaio1 libcgi-fast-perl libcgi-pm-perl libconfig-inifiles-perl libdbd-mariadb-perl
libdbi-perl libfcgi-bin libfcgi-perl libfcgi0ldbl libhtml-template-perl libmariadb3 libsigsegv2 libterm-readkey-perl mariadb-client-10.5
mariadb-client-core-10.5 mariadb-common mariadb-server mariadb-server-10.5 mariadb-server-core-10.5 mysql-common rsync socat
0 upgraded, 27 newly installed, 0 to remove and 112 not upgraded.
Need to get 17.8 MB of archives.
After this operation, 159 MB of additional disk space will be used.
Get:27 http://deb.debian.org/debian bullseye/main amd64 mariadb-server all 1:10.5.15-0+deb11u1 [35.3 kB]
Fetched 17.8 MB in 3s (6,731 kB/s)
Preconfiguring packages ...
Selecting previously unselected package apache2-data.
(Reading database ... 139326 files and directories currently installed.)
Selecting previously unselected package apache2.
Processing triggers for man-db (2.9.4-2) ...
Processing triggers for libc-bin (2.31-13+deb11u3) ...
Step 4: Next install the Php dependency packages by using the below command.
[root@linuxhelp:~#] sudo apt install php-curl php-cli php-fpm php-json php-common php-mysql php-zip php-gd php-mbstring php-curl php-xml php-pear
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
php-common is already the newest version (2:76).
php-common set to manually installed.
The following additional packages will be installed:
libonig5 libzip4 php7.4-curl php7.4-fpm php7.4-gd php7.4-mbstring php7.4-mysql php7.4-xml php7.4-zip
The following NEW packages will be installed:
libonig5 libzip4 php-cli php-curl php-fpm php-gd php-json php-mbstring php-mysql php-pear php-xml php-zip php7.4-curl php7.4-fpm php7.4-gd
Do you want to continue? [Y/n] y
Get:1 http://deb.debian.org/debian bullseye/main amd64 libonig5 amd64 6.9.6-1.1 [185 kB]
Get:2 http://deb.debian.org/debian bullseye/main amd64 libzip4 amd64 1.7.3-1 [55.4 kB]
Get:3 http://deb.debian.org/debian bullseye/main amd64 php-cli all 2:7.4+76 [6,796 B]
NOTICE: a2enconf php7.4-fpm
NOTICE: You are seeing this message because you have apache2 package installed.
Step 5: Install php 8.0 by using the below command.
[root@linuxhelp:~#] apt install php -y
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following additional packages will be installed:
libapache2-mod-php7.4 php-common php7.4 php7.4-cli php7.4-common php7.4-json php7.4-opcache php7.4-readline
Suggested packages:
php-pear
The following NEW packages will be installed:
libapache2-mod-php7.4 php php-common php7.4 php7.4-cli php7.4-common php7.4-json php7.4-opcache php7.4-readline
0 upgraded, 9 newly installed, 0 to remove and 112 not upgraded.
Need to get 4,128 kB of archives.
Enabling module mpm_prefork.
apache2_switch_mpm Switch to prefork
apache2_invoke: Enable module php7.4
Setting up php7.4 (7.4.30-1+deb11u1) ...
Setting up php (2:7.4+76) ...
Processing triggers for man-db (2.9.4-2) ...
Processing triggers for php7.4-cli (7.4.30-1+deb11u1) ...
Processing triggers for libapache2-mod-php7.4 (7.4.30-1+deb11u1) ...
Step 6: Start the database server and Apache webserver by using the below command
[root@linuxhelp:~#] systemctl start mariadb
[root@linuxhelp:~#] systemctl enable mariadb
Synchronizing state of mariadb.service with SysV service script with /lib/systemd/systemd-sysv-install.
Executing: /lib/systemd/systemd-sysv-install enable mariadb
[root@linuxhelp:~#] systemctl start apache2
Step 7: Login to database server by using the below command.
[root@linuxhelp:~#] sudo mysql -u root -p
enter password:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 30
Server version: 10.5.15-MariaDB-0+deb11u1 Debian 11
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
Step 8: Next create the database by using the below command.
MariaDB [(none)]> create database linuxhelp;
Query OK, 1 row affected (0.001 sec)
Step 9: Now create the database username and password and grant all privileges and flush the privileges by using the below command.
MariaDB [(none)]> grant all on phpmonitordb.* to 'user1'@'localhost' identified by 'Linuxc#7';
Query OK, 0 rows affected (0.001 sec)
MariaDB [(none)]> flush privileges;
Query OK, 0 rows affected (0.000 sec)
Step 10: Exit from the database.
MariaDB [(none)]> exit
Bye
Step 11: Next, Configure PHP Server Monitor. Go to apache root directory and download the latest version of PHP Server Monitor package by using the below commands.
[root@linuxhelp:~#] cd /var/www/html
[root@linuxhelp /var/www/html:~#] sudo wget https://downloads.sourceforge.net/project/phpservermon/phpservermon/phpservermon-3.2.0.tar.gz
--2022-10-04 02:59:05-- https://downloads.sourceforge.net/project/phpservermon/phpservermon/phpservermon-3.2.0.tar.gz
Resolving downloads.sourceforge.net (downloads.sourceforge.net)... 204.68.111.105
Connecting to downloads.sourceforge.net (downloads.sourceforge.net)|204.68.111.105|:443... connected.
HTTP request sent, awaiting response... 302 Found
Location: https://master.dl.sourceforge.net/project/phpservermon/phpservermon/phpservermon-3.2.0.tar.gz?viasf=1 [following]
--2022-10-04 02:59:05-- https://master.dl.sourceforge.net/project/phpservermon/phpservermon/phpservermon-3.2.0.tar.gz?viasf=1
Resolving master.dl.sourceforge.net (master.dl.sourceforge.net)... 216.105.38.12
Connecting to master.dl.sourceforge.net (master.dl.sourceforge.net)|216.105.38.12|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 1473336 (1.4M) [application/x-gzip]
Saving to: ‘phpservermon-3.2.0.tar.gz’
phpservermon-3.2.0.tar.gz 100%[==================================================================>] 1.40M 598KB/s in 2.4s
2022-10-04 02:59:09 (598 KB/s) - ‘phpservermon-3.2.0.tar.gz’ saved [1473336/1473336]
Step 12: Let’s Extract the downloaded file and rename it by using the below command.
[root@linuxhelp /var/www/html:~#] sudo tar -xvzf phpservermon-3.2.0.tar.gz
./phpservermon-3.2.0/
./phpservermon-3.2.0/CHANGELOG.rst
./phpservermon-3.2.0/favicon.ico
./phpservermon-3.2.0/static/
./phpservermon-3.2.0/static/css/
./phpservermon-3.2.0/static/css/style.css
./phpservermon-3.2.0/static/css/history.css
./phpservermon-3.2.0/static/index.html
./phpservermon-3.2.0/static/phpservermon.png
./phpservermon-3.2.0/static/plugin/
./phpservermon-3.2.0/static/plugin/jqplot/
./phpservermon-3.2.0/cron/
./phpservermon-3.2.0/cron/index.html
./phpservermon-3.2.0/cron/status.cron.php
./phpservermon-3.2.0/index.php
./phpservermon-3.2.0/LICENSE
./phpservermon-3.2.0/README.rst
./phpservermon-3.2.0/install.php
./phpservermon-3.2.0/config.php.sample
[root@linuxhelp /var/www/html:~#] sudo mv phpservermon-3.2.0 phpservermon
Step 13: Update the timezone in the php.ini file by using the below command.
[root@linuxhelp /var/www/html:~#] sudo vim /etc/php/7.4/cli/php.ini
date.timezone = America/New_York
Step 14: Next, Create a config.php in the phpservermon directory by using the below command.
[root@linuxhelp /var/www/html:~#] sudo vi /var/www/html/phpservermon/config.php.sample
<?php
define('PSM_DB_PREFIX', 'monitor_');
define('PSM_DB_USER', 'user1');
define('PSM_DB_PASS', 'Linuxc#7');
define('PSM_DB_NAME', 'phpmonitordb');
define('PSM_DB_HOST', 'localhost');
define('PSM_DB_PORT', '3306');
define('PSM_DEBUG', true);
Step 15: Change ownership of the directory by using the below command.
[root@linuxhelp /var/www/html:~#] sudo chown -R www-data:www-data /var/www/html/phpservermon
Step 16: Finally Restart the apache Webserver by using the below command.
[root@linuxhelp /var/www/html:~#] systemctl restart apache2
Step 17: Next, Configure the firewall to allow HTTP traffic so that we can access the PHP Server Monitor from external machines.
[root@linuxhelp /var/www/html:~#] sudo ufw allow http
Rules updated
Rules updated (v6)
Step 18: Go to the browser and browse the IP address as shown in the below image.
Step 19: This is welcome page for server monitor.
Step 20: Fill up the details such as username, password, and email for the PHP Server Monitor installation and then click the Install button to begin the installation as shown in the below image.
Step 21: Check for any errors on this installation page. If there are no errors, then proceed with the next step by clicking "Go to your monitor".
Step 22: Login with username and password that we created earlier as shown in the below image.
Step 23: This is the PHP Server Monitor Dashboard
Step 24: Here we will monitor the service by going to Servers >> Add new as shown in the below image.
Step 25: Fill up your server information on this page and click Save. For a demo, we will monitor the HTTPS service.
Step 26: Now, the new check has been added to PHP Server Monitor. Click on Update to get the status of services as shown in the below image.
Step 27: Now, you should get the Last online and Latency information about all services including your service as shown in the below image.
Conclusion:
We have reached the end of this article. In this guide, we have walked you through the steps required to PHP Server Monitor on Debian 11.3. Your feedback is much welcome.
Comments ( 0 )
No comments available