Sei sulla pagina 1di 6

Zabbix Installation Manual (CentOS 5)

NOTE: This manual is for clean install of Zabbix 1.6.7 or Zabbix 1.8. Don’t use it to upgrade the current
installation.

1. Install OS (Core Server ONLY and remove all other components)

2. Installing and configuring NTP


Installing NTP
shell>yum -y install ntp
Adding NTP to auto start after system reboots
shell>chkconfig ntpd on
Configuring NTP to use our server
shell>vi /etc/ntp.conf
Edit the file as follows
server xxx.xxx.xxx -> this line is for the setup of the ntp server. Replace xxx.xxx.xxx with the ntp
server of your choice. You can get a list of public ntp servers from http://www.pool.ntp.org/en/
fudge Server_IP_Address stratum 10 -> this line is to forward the acquired date/time to the
correct network interface.
Starting NTP service
shell>service ntpd start

3. Handling of SELinux and Security Levels


Install System Configuration components
shell>yum –y install system-config-securitylevel
Run the system configuration tools
shell>system-config-securitylevel
i. Enable Security Level.
ii. Disable SELinux.
iii. Click Customize, and check/add the services allowed through the firewall (HTTP, SSH, 10050:tcp,
10050:udp, 10051:tcp, 10051:udp)
iv. Exit.

4. Restricting access to the server through SSH


Open the file hosts.allow
shell>vi /etc/hosts.allow
Add the subnets that are allowed to access the server through SSH as per the example below. Click INS to be
able to edit/modify. To save, Press ESC and then type :w and to exit type :q
sshd : localhost : allow
sshd : 192.168.3. : allow
sshd : 192.168.1. : allow
sshd : ALL : deny

5. Configuring SSH to use only SSH 2 for extra security (if the server has a real IP address)
Open the SSH configuration file for editing.
shell>vi /etc/ssh/sshd_config
Search for “#Protocol 2,1” and change it to “Protocol 2”. Click INS to be able to edit/modify. To save, Press
ESC and then type :w and to exit type :q

6. Restart the SSH service


shell>service sshd restart

7. Install necessary OS components for Zabbix


shell>yum -y install make wget gcc mysql-server mysql-devel curl-devel httpd php php-mysql
php-bcmath php-xml php-gd net-snmp-devel

8. Installing Fping. FPING is a utility that allows the system to ping multiple hosts at once.
a. if using 64bit OS
Downloading the 64bit rpm package
shell>wget http://dag.wieers.com/rpm/packages/fping/fping-2.4-1.b2.2.el5.rf.x86_64.rpm
Installing FPING 64bit
shell>rpm -Uvh fping-2.4-1.b2.2.el5.rf.x86_64.rpm
Changing access permissions to the FPING folder
shell>chown root:zabbix /usr/sbin/fping
shell>chmod 710 /usr/sbin/fping
shell>chmod ug+s /usr/sbin/fping

b. if using 32bit OS
Downloading the 32bit rpm package
shell>wget http://dag.wieers.com/rpm/packages/fping/fping-2.4-1.b2.2.el5.rf.i386.rpm
Installing FPING 32bit
shell>rpm -Uvh fping-2.4-1.b2.2.el5.rf.i386.rpm
Changing ownership and access permissions to the FPING
shell>chown root:zabbix /usr/sbin/fping
shell>chmod 710 /usr/sbin/fping
shell>chmod ug+s /usr/sbin/fping

9. Update the whole system to the latest version


Updating the whole system to the latest releases. The –y option is to automatically answer YES to any
question from the system during the upgrade process.
shell>yum -y update

10. Configure MySQL for auto start after reboots


shell>chkconfig mysqld on

11. Start MySQL


shell>service mysqld start

12. Set a password for MySQL login (replace yourrootsqlpassword with the root account password)
shell>mysqladmin -u root password yourrootsqlpassword

13. Configure Apache for auto start after reboots


shell>chkconfig httpd on

14. Modify PHP.ini


Opening PHP.ini for editing. Press INS to be able to edit/modify. To save, Press ESC and then type :w and to
exit type :q
shell>vi /etc/php.ini
Search for and change the following. Feel free to change the time zone to an area of your choosing. Use this
link (http://php.net/manual/en/timezones.php) to get a list of supported time zones.
i. max_execution_time = 300
ii. date.timezone= "Asia/Dubai"

15. Starting Apache. Apache's default document root is /var/www/html on Linux 5, and the configuration file is
/etc/httpd/conf/httpd.conf. Additional configurations are stored in the /etc/httpd/conf.d/ directory
shell>service httpd start

16. Install phpMyAdmin 3.2.3 to manage the MySQL database through web interface (This step is optional)
Installing necessary components
shell>yum -y install php-mcrypt php-mbstring
Changing directory to /usr/share
shell>cd /usr/share/
Downloading phpMyAdmin 2.11.9.6 to use it with PHP 5 available on CentOS 5.4
shell>wget
http://downloads.sourceforge.net/project/phpmyadmin/phpMyAdmin/2.11.9.6/phpMyAdmin-
2.11.9.6-all-languages.tar.gz
Extracting the files
shell>tar xvfz phpMyAdmin-2.11.9.6-all-languages.tar.gz
Changing the extracted folder name to phpmyadmin
shell>mv phpMyAdmin-2.11.9.6-all-languages.tar.gz phpmyadmin
Deleting the downloaded file.
shell>rm phpMyAdmin-2.11.9.6-all-languages.tar.gz
Going into the phpmyadmin folder
shell>cd phpmyadmin
Copying the config file
shell>cp config.sample.inc.php config.inc.php
Editing the config file. Press INS to be able to edit/modify. To save, Press ESC and then type :w and to exit
type :q
shell>vi config.inc.php

Change the following and save the file


$cfg['blowfish_secret'] = „Type_Anything_for_Security‟;

Creating a new phpmyadmin.conf file


shell>vi /etc/httpd/conf.d/phpmyadmin.conf
Add the following and save the file. Press INS to be able to edit/modify. To save, Press ESC and then type :w
and to exit type :q.
Alias /phpMyAdmin /usr/share/phpmyadmin
Restarting the Apache service
shell>service httpd restart

17. To download and install Zabbix 1.8, please read the notes at the end of the document (Page 6) before
proceeding. To download and install Zabbix 1.6.7 do the following
Go to the tmp folder
shell>cd /tmp

Downloading Zabbix 1.6.7


shell>wget
http://downloads.sourceforge.net/project/zabbix/ZABBIX%20Latest%20Stable/1.6.7/zabbix-
1.6.7.tar.gz

Downloading Zabbix 1.8


shell>wget
http://downloads.sourceforge.net/project/zabbix/ZABBIX%20Latest%20Stable/1.8/zabbix-
1.8.tar.gz

To extract the files


shell>tar xzf zabbix-1.6.7.tar.gz
Go into the extracted folder
shell>cd zabbix-1.6.7

18. MySQL Zabbix DB creation


Login to the MySQL server
shell>mysql –u root -p
Creating a new database
mysql> create database zabbix;
Exit from the MySQL server
mysql> quit;

19. Zabbix DB configuration


Changing directory to create/schema/
shell> cd create/schema
Loading the content of mysql.sql into Zabbix database.
shell> cat mysql.sql | mysql -u<username> -p<password> zabbix
Changing directory to create/data/
shell> cd ../data
Loading the content of data.sql into Zabbix database.
shell> cat data.sql | mysql -u<username> -p<password> zabbix
Loading the content of images_mysql.sql into Zabbix database.
shell> cat images_mysql.sql | mysql -u<username> -p<password> zabbix

20. Configuring Zabbix


Changing directory
shell>cd ..
Changing directory
shell>cd ..
Configuring Zabbix with agent, server, mysql, libcurl, and snmp
shell>./configure --enable-agent --enable-server --with-mysql --with-libcurl --with-net-snmp

21. Make and install everything


Compiling Zabbix
shell>make install

22. Adding Zabbix service ports to the services


Editing the services file and add the following. Press INS to be able to edit/modify. To save, Press ESC and
then type :w and to exit type :q
shell>vi /etc/services
zabbix-agent 10050/tcp Zabbix Agent
zabbix-agent 10050/udp Zabbix Agent
zabbix-trapper 10051/tcp Zabbix Trapper
zabbix-trapper 10051/udp Zabbix Trapper

23. Create Zabbix user account and setting password


shell>adduser -r -d /var/run/zabbix-server -s /sbin/nologin zabbix
shell>passwd zabbix

24. Configuring Zabbix run environment for extra security


Creating a new directory zabbix/alert.d under /etc/
shell>mkdir -p /etc/zabbix/alert.d
Creating a new directory zabbix-server under /var/log/
shell>mkdir -p /var/log/zabbix-server
Creating a new directory zabbix-agent under /var/log/
shell>mkdir -p /var/log/zabbix-agent
Creating a new directory zabbix-server under /var/run/
shell>mkdir -p /var/run/zabbix-server
Creating a new directory zabbix-agent under /var/run/
shell>mkdir -p /var/run/zabbix-agent
Changing the ownership of the all folders that starts with zabbix under /var/run/ to the user zabbix
shell>chown zabbix.zabbix /var/run/zabbix*
Changing the ownership of the all folders that starts with zabbix under /var/log/ to the user zabbix
shell>chown zabbix.zabbix /var/log/zabbix*
Copying zabbix_server.conf to /etc/zabbix folder
shell>cp /tmp/zabbix-1.6.7/misc/conf/zabbix_server.conf /etc/zabbix
Copying zabbix_agentd.conf to /etc/zabbix folder
shell>cp /tmp/zabbix-1.6.7/misc/conf/zabbix_agentd.conf /etc/zabbix
Copying zabbix_server to /etc/init.d folder
shell>cp /tmp/zabbix-1.6.7/misc/init.d/redhat/8.0/zabbix_server /etc/init.d
Copying zabbix_agentd to /etc/init.d folder
shell>cp /tmp/zabbix-1.6.7/misc/init.d/redhat/8.0/zabbix_agentd /etc/init.d
Changing folder to /etc/zabbix
shell>cd /etc/zabbix
Creating a backup copy of zabbix_server.conf
shell>cp zabbix_server.conf zabbix_server.conf.org
Creating a backup copy of zabbix_agentd.conf
shell>cp zabbix_agentd.conf zabbix_agentd.conf.org

Editing the Zabbix_server.conf to reflect the current configuration. Search for the values mentioned and
change them as shown below. Press INS to be able to edit/modify. To save, Press ESC and then type :w and
to exit type :q
shell>vi zabbix_server.conf
Search for and change the following
PidFile=/var/run/zabbix-server/zabbix_server.pid
LogFile=/var/log/zabbix-server/zabbix_server.log
AlertScriptsPath=/etc/zabbix/alert.d/
DBUser=root
DBPassword=<root_password>
FpingLocation=/usr/sbin/fping
Fping6Location=/usr/sbin/fping6

Editing the Zabbix_agentd.conf to reflect the current configuration. Search for the values mentioned and
change them as shown below. Press INS to be able to edit/modify. To save, Press ESC and then type :w and
to exit type :q
shell>vi zabbix_agentd.conf
Search for and change the following
EnableRemoteCommands=1
PidFile=/var/run/zabbix-agent/zabbix_agentd.pid
LogFile=/var/log/zabbix-agent/zabbix_agentd.log
Timeout=10
Changing directory to /etc/init.d
shell>cd /etc/init.d
Creating a backup copy of zabbix_server
shell>cp zabbix_server zabbix_server.org
Creating a backup copy of zabbix_agentd
shell>cp zabbix_agentd zabbix_agentd.org

Editing the zabbix_server to reflect the current configuration. Search for the values mentioned and change
them as shown below. Press INS to be able to edit/modify. To save, Press ESC and then type :w and to exit
type :q
shell>vi zabbix_server
Search for and change the following
progdir="/usr/local/sbin/"
Editing the zabbix_agentd to reflect the current configuration. Search for the values mentioned and change
them as shown below. Press INS to be able to edit/modify. To save, Press ESC and then type :w and to exit
type :q
shell>vi zabbix_agentd
Search for and change the following
progdir="/usr/local/sbin/"

Configuring Zabbix agent for auto start after reboots


shell>chkconfig zabbix_agentd on
Making zabbix_server as an executive file
shell>chmod +x /etc/init.d/zabbix_server
Making zabbix_agentd as an executive file
shell>chmod +x /etc/init.d/zabbix_agentd
Starting the Zabbix agent service
shell>service zabbix_agentd start

25. Configuring Zabbix Web Interface


Copying Zabbix frontend files to the Apache home page
shell>cp -r /tmp/zabbix-1.6.7/frontends/php/* /var/www/html/

26. Starting Zabbix server at startup. This step is to get Zabbix server service to start after the MySQL service has
been started.
shell>vi /etc/rc.d/rc.local
Add the following line then save and exit. Press INS to be able to edit/modify. To save, Press ESC
and then type :w and to exit type :q
service zabbix_server start
Restarting the system
shell>reboot

27. Start the web installation procedure from the browser and then use WinSCP to copy the configuration file to the
proper location
a. Default username and password are
i. Username: admin
ii. Password: zabbix
NOTE: The procedure above will work also to install Zabbix 1.8 with few modifications. These modifications are
1. Zabbix 1.8 will not work on CentOS 5.4 without upgrading PHP 5.1.6 to PHP 5.2.9. To do that on CentOS
5.4, follow the below steps.
2. Install and configure the following PHP module
a. Installing php-mbstring module
shell>yum –y install php-mbstring
b. Editing the PHP.ini file to enable certain funtions
shell>vi /etc/php.ini
i. Search for “mbstring.func_overload” and modify it to “mbstring.func_overload = 2”
ii. Search for “memory_limit” and make sure it is 128M at least.
iii. Search for “post_max_size” and make sure it is 16M at least.
c. Restarting the Apache web server.
shell>service httpd restart
3. Adding the official CentOS test repository and upgrading PHP
a. Importing the PGP key for the CentOS test library (all official CentOS test library updates are certified
and already on their way to production phase)
shell>rpm --import http://dev.centos.org/centos/RPM-GPG-KEY-CentOS-testing
b. Changing the directory to the repository directory
shell>cd /etc/yum.repos.d
c. Getting the testing repository
shell>wget http://dev.centos.org/centos/5/CentOS-Testing.repo
d. Downloading and updating the current PHP version and all its components to PHP 5.2.9 ONLY from
the test library.
shell>yum --disablerepo=* --enablerepo=c5-testing update php*
e. Deleting the testing repository
shell>rm /etc/yum.repos.d/CentOS-Testing.repo
4. Restarting the Apache web server.
shell>service httpd restart
5. Replace Zabbix-1.6.7 with Zabbix-1.8 in the rest of the document.

Potrebbero piacerti anche