How Do You Install Zabbix Server on RHEL 7.x Running in AWS?

Problem scenario
You have a RedHat Linux server with only 1 vCPU and 1 GB of RAM.  You want to install Zabbix Server to monitor other servers.  How do you deploy Zabbix server to an AWS instance of RHEL?

Solution
1. Install the LAMP stack components by running this command:
sudo yum -y install php httpd mariadb-server

2.  Install essential Zabbix components with these four commands:
sudo rpm --import http://repo.zabbix.com/RPM-GPG-KEY-ZABBIX

sudo rpm -Uv  http://repo.zabbix.com/zabbix/2.4/rhel/7/x86_64/zabbix-release-2.4-1.el7.noarch.rpm

sudo yum-config-manager --enable rhui-REGION-rhel-server-extras rhui-REGION-rhel-server-optional

sudo yum -y install zabbix-server-mysql zabbix-web-mysql zabbix-agent zabbix-java-gateway php-mbstring php-bcmath

3.  Configure the zabbix.conf file.
i.  sudo vi /etc/httpd/conf.d/zabbix.conf
Change the time zone entry by first uncommenting it out.  To find your time zone in the Americas, go to this link in a web browser.

ii.  This entry may look like this when you are done:

        php_value date.timezone America/New_York

iii. Save the changes to zabbix.conf.

4.  Restart the Apache web service daemon with this command:  sudo systemctl restart httpd

5. Start the MariaDB service with this command:  sudo systemctl start mariadb.service

6. This step of a command will assign the MySQL/MariaDB administrator password (for the database user "root"). Replace "strongpassword" with the password of your choice when you actually run this Linux command.

i.  Run this command: stty -echo
Please note that you will not see keystrokes on the terminal after you run the above command.  This is so you can type in a password and have no one else view it.

ii.  Replace "strongPassword" below with the password you want the root user of your MySQL server to have.  Once "strongPassword" is substituted, run the command below and press enter.

var1=strongPassword

iii.  Run this command:  stty echo

iv.  Run this command:  mysqladmin -u root password $var1

7.i.  Now you should be able to use this command to get into a SQL command prompt with this command:
mysql -u root -p

ii.  Type in the password (the one entered in step #6.ii) to the prompt you see.

8.  Now that you are the MariaDB prompt, enter this command: create database zabbixdb character set utf8;

9.  Now run this command but ask other people looking at your screen to turn away (and replace "strongPassword" with the password for root):

grant all privileges on zabbixdb.* to 'zabbixuser'@'localhost' identified by 'strongPassword';

#Expect to see "0 rows affected" by the above command.

10. Now run this command (which should display "0 rows affected" after it is succesfully run):

flush privileges;

11. Then exit the SQL command prompt with this command:  exit

12. i. Run this command:  sudo find / -name schema.sql

ii. With the result from the above command, run a new command like this (just substitute the "/path/to/file/found/above/schema.sql" with the file found in the above command):
mysql -u zabbixuser -p zabbixdb < /path/to/file/found/above/schema.sql

iii. At the prompt you now see, enter the password you chose for mysql above (in step 6.ii).

13. i. Run this command: sudo find / -name images.sql

ii. With the result from the above command run a new command like this  (just substitute the "/path/to/file/found/above/images.sql" with the file found in the above command):
mysql -u zabbixuser -p zabbixdb < /path/to/file/found/above/images.sql

iii. At the prompt you now see, enter the password you chose for mysql above (in step 6.ii).

14. i. Run this command: sudo find / -name data.sql

ii. With the result from the above command run a new command like this  (just substitute the "/path/to/file/found/above/data.sql" with the file found in the above command):

mysql -u zabbixuser -p zabbixdb < /path/to/file/found/above/data.sql

iii.  At the prompt you now see, enter the password you chose for mysql above (in step 6.ii).

15.  Modify the zabbix_server configuration file.

i. sudo vi /etc/zabbix/zabbix_server.conf

ii. Uncomment out the DBPassword stanza on line 106.  It will look like this at first:

# DBPassword=

It will look like this when you have uncommented it:

 DBPassword=

iii. Make sure these stanzas have the values as follows:

DBName=zabbixdb  #(unless you deviated from these directions above),

DBUser=zabbixuser #(unless you deviated from these directions above),

DBPassword=strongPassword #replace "strongPassword" with the password you chose above in step 6.ii.

iv. Save the changes.

16. i. sudo vi /etc/zabbix/zabbix_agentd.conf

ii.  #Change line number137 to look like this:

Hostname=127.0.0.1

iii. Save the changes.

17. i.  sudo vi /etc/php.ini

ii.  Find the following five settings and change them so their numbers reflect the following:

max_execution_time = 600
max_input_time = 600
memory_limit = 256M
post_max_size = 32M
upload_max_filesize = 16M

(These suggested settings above were taken from this link.)

iii.   Find the "date.timezone" stanza and change it to your time zone as found in this link.  For example, it may end up being like this (with no semi-colon):

date.timezone = America/New_York

iv. Save the changes to /etc/php.ini.

18.  Start many services.  You can cut and paste the following:
sudo systemctl restart httpd; sudo systemctl restart mariadb;
sudo systemctl enable zabbix-server; sudo systemctl enable zabbix-agent;
sudo systemctl start zabbix-server; sudo systemctl start zabbix-agent;

19.  i. Open a web browser.  Craft the URL like this:

http://<external IP address of the RHEL server>/zabbix

ii.  Click "Next" in the lower right hand corner.

iii.  On the right hand column, you should see green OKs.  Click next.

iv. For the "3. Configure DB connection" menu, enter the password you entered above (step 6.ii) in the password field.  Change the database name to zabbixdb unless you deviated from these directions.

v.  Click "Test Connection."  It should say "OK" after the menu refreshes.  Click "Next."

vi.  For Zabbix server details (#4 menu option), just click "Next."

vii.  For the "5. Pre-installation summary", just click "Next."

viii.  For the "6. Install" menu, just click "Finish."

ix.  Go back to the back end (command prompt of the Linux server).  Run this command:
sudo setsebool -P httpd_can_connect_zabbix=1

20.  At the Zabbix GUI login, enter admin for the user and zabbix for the password.

Leave a comment

Your email address will not be published. Required fields are marked *