How to Install Zabbix on Manjaro
In this tutorial, we will go through the steps required to install Zabbix on Manjaro. Zabbix is an open-source monitoring software that is used to monitor the performance of networks, servers, and applications.
Prerequisites
Before we begin, make sure that you have the following prerequisites:
- Manjaro Linux installed
- Root or sudo privileges
- A stable internet connection
Step 1: Update System Packages
It is always recommended to update the system packages before installing any new software. To update the system packages in Manjaro, run the following command in the terminal:
sudo pacman -Syu
Step 2: Install Zabbix Dependencies
Zabbix requires certain dependencies to be installed on your system. To install the dependencies, run the following command in the terminal:
sudo pacman -S php php-fpm nginx mariadb
Step 3: Install Zabbix
To install Zabbix on Manjaro, you need to add the official Zabbix repository to your system. To add the repository, run the following command in the terminal:
wget https://repo.zabbix.com/zabbix/5.4/manjaro/pool/main/z/zabbix-release/zabbix-release-5.4-1.manjaro.noarch.rpm
sudo pacman -U zabbix-release-5.4-1.manjaro.noarch.rpm
Update the system packages again by running the following command:
sudo pacman -Syu
Now, install Zabbix by running the following command:
sudo pacman -S zabbix-server-mysql zabbix-web-nginx-mysql
Step 4: Configure Zabbix
Create a database
Create a new database and user for Zabbix to use. Log into the MySQL server and run the following commands:
sudo mysql -u root -p
You will be prompted to enter the MySQL root password. Once logged in, run the following commands:
CREATE DATABASE zabbix CHARACTER SET utf8 collate utf8_bin;
GRANT ALL PRIVILEGES ON zabbix.* TO 'zabbix'@'localhost' IDENTIFIED BY 'password';
FLUSH PRIVILEGES;
EXIT;
Replace the password with your desired password.
Create a Zabbix server configuration file
Create a Zabbix server configuration file named zabbix_server.conf:
sudo nano /etc/zabbix/zabbix_server.conf
Add the following lines to the file:
LogFile=/var/log/zabbix/zabbix_server.log
LogFileSize=0
Server=127.0.0.1
DBName=zabbix
DBUser=zabbix
DBPassword=password
DBPort=3306
SNMPTrapperFile=/var/log/snmptrap/snmptrap.log
PIDFile=/var/run/zabbix/zabbix_server.pid
SocketDir=/var/run/zabbix
Replace the password with your desired password.
Create a Zabbix database schema
Now, import the initial schema and data into the database by running the following command:
sudo zcat /usr/share/zabbix-mysql/schema.sql.gz | mysql -u zabbix -p zabbix
You will be prompted to enter the password you set for the Zabbix user.
Modify NGINX Configuration
You need to modify the NGINX configuration file to access the Zabbix frontend. Open the file using nano:
sudo nano /etc/nginx/nginx.conf
Add the following location block to the file:
location /zabbix {
alias /usr/share/webapps/zabbix;
index index.php;
location ~ /zabbix/(.+\.php)$ {
fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $request_filename;
include fastcgi_params;
}
}
server {
listen 80;
server_name your_server_name;
root /usr/share/webapps/zabbix;
index index.php;
location / {
try_files $uri $uri/ /index.php?$args;
}
location ~ \.php$ {
fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
Save and exit the file.
Step 5: Start the Zabbix Services
Start the Zabbix services by running the following commands in the terminal:
sudo systemctl start zabbix-server
sudo systemctl start nginx
sudo systemctl start php-fpm
sudo systemctl enable zabbix-server
sudo systemctl enable nginx
sudo systemctl enable php-fpm
Step 6: Access Zabbix
Open your web browser and navigate to http://your_server_name/zabbix. You should see the Zabbix login page. Login with the default credentials:
Username: Admin Password: zabbix
Congratulations! You have successfully installed Zabbix on Manjaro. You can now customize it according to your needs.