Prerequisites
To follow this tutorial, you will need:- One of the CentOS 7 servers needs Apache, MySQL, and PHP installed. in my blog already a tutorial there for lamp installation in CentOS 7.
- sudo rpm -ivh http://repo.zabbix.com/zabbix/3.0/rhel/7/x86_64/zabbix-release-3.0-1.el7.noarch.rpm
You will see the following output:
Output
Retrieving http://repo.zabbix.com/zabbix/3.0/rhel/7/x86_64/zabbix-release-3.0-1.el7.noarch.rpm
warning: /var/tmp/rpm-tmp.qLbOPP: Header V4 DSA/SHA1 Signature, key ID 79ea5ed4: NOKEY
Preparing... ################################# [100%]
Updating / installing...
1:zabbix-release-3.0-1.el7 ################################# [100%]
Now you can run the following command to install the Zabbix server and web frontend with MySQL database support:
- sudo yum install
yum install php php-cli php-common php-devel php-pear php-gd php-mbstring php-mysql php-xml
yum install httpd httpd-devel
yum install zabbix-server-mysql zabbix-web-mysql
During the installation process you will be asked about importing a GPG key. Confirm it so the installation can complete.Let's also install the Zabbix agent, which will let us collect data about the Zabbix server itself.
- sudo yum install zabbix-agent
Before we can use Zabbix, we have to set up a database to hold the data that the Zabbix server will collect from its agents.Step 2 — Configuring the MySQL Database For Zabbix
We need to create a new MySQL database and populate it with some basic information in order to make it suitable for Zabbix. We'll also create a specific user for this database so Zabbix isn't logging into MySQL with theroot
account. Log into MySQL as the root user using the root password that you set up during the MySQL server installation:
- mysql -uroot -p
First, create the Zabbix database with UTF-8 character support:
- create database zabbix character set utf8;
Next, create a user that the Zabbix server will use, give it access to the new database, and set the password:
- grant all privileges on zabbix.* to zabbix@localhost identified by 'your_password';
Then apply these new permissions:
- flush privileges;
That takes care of the user and the database. Exit out of the database console.
- quit;
Next we have to import the initial schema and data. The Zabbix
installation provided us with a file that sets this up for us. We just
have to import it. Navigate to the directory:
- cd /usr/share/doc/zabbix-server-mysql-3.x.x/
Run the following command to set up the schema and import the data into the zabbix
database. We'll use zcat
since the data in the file is compressed.
gunzip create.sql.gz
mysql -u root -p zabbix_db < create.sql
Enter the password for the zabbix user that you configured when prompted.This command will not output any errors if it was successful. If you see the error
ERROR 1045 (28000): Access denied for user 'zabbix'@'localhost' (using password: YES)
then make sure you used the password for the zabbix
user and not the root
user.In order for the Zabbix server to use this database, you need to set the database password in the Zabbix server configuration file.
- sudo vi /etc/zabbix/zabbix_server.conf
Look for the following section of the file:
/etc/zabbix/zabbix_server.conf
### Option: DBPassword
# Database password. Ignored for SQLite.
# Comment this line if no password is used.
#
# Mandatory: no
# Default:
# DBPassword=
These comments in the file explain how to connect to the database. We need to set the DBPassword
value in the file to the password for our database user. Add this line below those comments to configure the database:
/etc/zabbix/zabbix_server.conf
DBPassword=your_zabbix_mysql_password
That takes care of the Zabbix server configuration, but we have to
make some modifications to our PHP setup in order for the Zabbix web
interface to work properly.Step 3 —
Setup Zabbix Apache Configuration
Zabbix creates its own apache configuration file /etc/httpd/conf.d/zabbix.conf. Edit this file and just update timezoneas you timezone Asia/Kolkata
- sudo systemctl restart httpd
You can now start the Zabbix server.
- sudo systemctl start zabbix-server
Then check whether the Zabbix server is running properly:
- sudo systemctl status zabbix-server
You will see the following status:
Output
● zabbix-server.service - Zabbix Server
Loaded: loaded (/usr/lib/systemd/system/zabbix-server.service; disabled; vendor preset: disabled)
Active: :active (running) since Fri 2016-08-05 07:16:35 UTC; 2s ago
Process: 10033 ExecStart=/usr/sbin/zabbix_server -c $CONFFILE (code=exited, status=0/SUCCESS)
...
Finally, enable the Zabbix server to start at boot time:
- sudo systemctl enable zabbix-server
The server is set up and connected to the database. Now let's set up the web frontend.Step 4 — Configuring Settings for the Zabbix Web Interface
The web interface lets us see reports and add hosts that we want to monitor, but it needs some initial setup before we can use it. Launch your browser and go to the addresshttp://your_zabbix_server_ip_address/zabbix/
. On the first screen, you will see a welcome message. Click Next step to continue.On the next screen, you will see the table that lists all of the prerequisites to run Zabbix.
/etc/httpd/conf.d/zabbix.conf
ReplyDeletedat/time issue