Basic installation and configuration of Zabbix
Here are the basic installation and configuration steps for Zabbix.
- Install Apache, PHP, and MySQL:
- Install Apache using the following command: sudo apt-get install apache2.
- Install PHP and MySQL with the following command: sudo apt-get install php mysql-server php-mysql.
- Install Zabbix server:
- Add the Zabbix official repository by using the following command: wget https://repo.zabbix.com/zabbix/5.4/ubuntu/pool/main/z/zabbix-release/zabbix-release_5.4-1+ubuntu18.04_all.deb
- To install the official Zabbix repository, use the following command: sudo dpkg -i zabbix-release_5.4-1+ubuntu18.04_all.deb
- Update the repository using the following command: sudo apt-get update.
- Install the Zabbix server using the following command: sudo apt-get install zabbix-server-mysql
- Set up the Zabbix database:
- Login to the MySQL server with the following command: sudo mysql -u root -p
- Create a new database in the MySQL terminal with the following command: CREATE DATABASE zabbix character set utf8 collate utf8_bin;
- Create a new database user and grant access to the database: CREATE USER ‘zabbix’@’localhost’ IDENTIFIED BY ‘password’;
- Grant all privileges on the database “zabbix” to the new user ‘zabbix’ at ‘localhost’ with the option to grant permissions to others.
- Refresh MySQL privileges: FLUSH PRIVILEGES;
- Leave the MySQL terminal by typing ‘exit’.
- Import the Zabbix database schema and data.
- Use the following command to import the database schema and data: sudo zcat /usr/share/doc/zabbix-server-mysql*/create.sql.gz | mysql -u zabbix -p zabbix
- Set up the Zabbix server.
- Open the Zabbix server configuration file by typing: sudo nano /etc/zabbix/zabbix_server.conf
- Update the settings as follows:
DBHost=localhost
DBName=zabbix
DBUser=zabbix
DBPassword=password - Save and close the file.
- Start the Zabbix server and Zabbix agent.
- Start the Zabbix server using the following command: sudo systemctl start zabbix-server.
- Start the Zabbix agent using the following command: sudo systemctl start zabbix-agent.
- Set up the Zabbix front-end.
- Copy the Zabbix frontend files to the Apache web directory by running the command: sudo cp -r /usr/share/zabbix /var/www/html/
- Edit Zabbix frontend configuration file: sudo nano /etc/zabbix/apache.conf
- Remove the comment symbol (#) from the following line: php_value date.timezone Asia/Shanghai
- Save and close the file.
- Set up a firewall.
- If a firewall is in place, make sure to allow access to the Zabbix server port (default is 10051).
- Accessing the Zabbix frontend:
- Enter the IP address or domain name of the server in a web browser, followed by /zabbix, for example: http://
/zabbix. - Follow the installation wizard to set up, create a Zabbix administrator account, and complete the installation.
This is the basic installation and configuration steps for Zabbix. Once completed, you should be able to use Zabbix to monitor your servers and network devices.