Zabbix安装要求
webserver、mysql、php
我一般喜欢用yum安装,很少用编译安装;
===========================================================================================
添加软件包源,安装系统基础软件和工具。
# yum -y install http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.3-1.el6.rf.x86_64.rpm # yum -y install http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm # yum -y install http://repo.zabbix.com/zabbix/2.2/rhel/6/x86_64/zabbix-2.2.5-1.el6.x86_64.rpm # yum -y install vim wget unzip
老版本:
# vim /etc/yum.repos.d/zabbix.repo
[zabbix]
name=Server
baseurl=http://repo.zabbix.com/zabbix/2.2/rhel/6/x86_64/
enable=1
gpgcheck=0
2. 安装webserver(httpd)
# yum -y install httpd
# remove welcome page
# rm -f /etc/httpd/conf.d/welcome.conf
# remove default error page
# rm -f /var/www/error/noindex.html
[configure httpd]
# vim /etc/httpd/conf/httpd.conf
# line 44: change
ServerTokens Prod
# line 262: Admin's Email Address
ServerAdmin [email protected]
# line 276: change to your server's name
ServerName # 写成你ServerName或者IPAddr
# line 338: change
AllowOverride All
# line 402: add file name that it can access only with directory's name
DirectoryIndex index.php index.html index.htm # 写到最前面的默认首先加载*.php文件
# line 536:change
ServerSignature Off
# /etc/rc.d/init.d/httpd start Starting httpd: [OK] # chkconfig httpd on
[Create a html page use test server]
# vim /var/www/html/index.html <html> <body> <div style="width: 100%; font-size: 40px; font-weight: bold; text-align: center;"> Test Page </div> </body> </html>
3. 安装mysql
# yum -y install mysql-server # /etc/rc.d/init.d/mysqld start Initializing MySQL database: WARNING: The host 'webserver1.lisys.cn' could not be looked up with resolveip. This probably means that your libc libraries are not 100 % compatible with this binary MySQL version. The MySQL daemon, mysqld, should work normally with the exception that host name resolving will not work. This means that you should use IP addresses instead of hostnames when specifying MySQL privileges ! Installing MySQL system tables... OK Filling help tables... OK To start mysqld at boot time you have to copy support-files/mysql.server to the right place for your system PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER ! To do so, start the server, then issue the following commands: /usr/bin/mysqladmin -u root password 'new-password' /usr/bin/mysqladmin -u root -h webserver1.lisys.cn password 'new-password' Alternatively you can run: /usr/bin/mysql_secure_installation # 使用此命令初始化mysql which will also give you the option of removing the test databases and anonymous user created by default. This is strongly recommended for production servers. See the manual for more instructions. You can start the MySQL daemon with: cd /usr ; /usr/bin/mysqld_safe & You can test the MySQL daemon with mysql-test-run.pl cd /usr/mysql-test ; perl mysql-test-run.pl Please report any problems with the /usr/bin/mysqlbug script! [ OK ] Starting mysqld: [ OK ] # chkconfig mysqld on
# /usr/bin/mysql_secure_installation NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MySQL SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY! In order to log into MySQL to secure it, we'll need the current password for the root user. If you've just installed MySQL, and you haven't set the root password yet, the password will be blank, so you should just press enter here. Enter current password for root (enter for none): OK, successfully used password, moving on... Setting the root password ensures that nobody can log into the MySQL root user without the proper authorisation. Set root password? [Y/n] y New password: # 输入为root设置的密码 Re-enter new password: # 再次输入密码 Password updated successfully! Reloading privilege tables.. ... Success! By default, a MySQL installation has an anonymous user, allowing anyone to log into MySQL without having to have a user account created for them. This is intended only for testing, and to make the installation go a bit smoother. You should remove them before moving into a production environment. Remove anonymous users? [Y/n] y # 移除匿名用户 ... Success! Normally, root should only be allowed to connect from 'localhost'. This ensures that someone cannot guess at the root password from the network. Disallow root login remotely? [Y/n] y # 不允许root远程登陆 ... Success! By default, MySQL comes with a database named 'test' that anyone can access. This is also intended only for testing, and should be removed before moving into a production environment. Remove test database and access to it? [Y/n] y # 删除test数据库 - Dropping test database... ... Success! - Removing privileges on test database... ... Success!http://www.server-world.info/en/note?os=CentOS_6&p=zabbix&f=1 Reloading the privilege tables will ensure that all changes made so far will take effect immediately. Reload privilege tables now? [Y/n] y # 重新加载权限表 ... Success! Cleaning up... All done! If you've completed all of the above steps, your MySQL installation should now be secure. Thanks for using MySQL!
4. 安装php
yum -y install php php-mysql php-devel
5. 安装Zabbix
# yum -y --enablerepo=zabbix install zabbix-server-mysql zabbix-agent zabbix-web-mysql # mysql -u root -p Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 67 Server version: 5.1.73 Source distribution Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql> create database zabbix; Query OK, 1 row affected (0.00 sec) mysql> grant all privileges on zabbix.* to zabbix@localhost identified by 'zabbixpassword'; Query OK, 0 rows affected (0.00 sec) mysql> flush privileges; Query OK, 0 rows affected (0.00 sec) mysql> exit Bye # cd /usr/share/doc/zabbix-server-mysql-2.2.3/create/ # ls data.sql images.sql schema.sql # cat schema.sql | mysql -u root -p zabbix Enter password: # cat images.sql | mysql -u root -p zabbix Enter password: # cat data.sql | mysql -u root -p zabbix Enter password: ex # cd # vim /etc/zabbix/zabbix_server.conf line 91: zabbix databases name DBName=zabbix line 107: zabbix user DBUser=zabbix line 115: uncomment and add DB password for Zabbix DBPassword=zabbixpassword # vim /etc/zabbix/zabbix_agentd.conf line 137: change to your hostname or ipaddr Hostname=zabbix.iopenstack.com # vim /etc/php.ini line 440: change to zabbix recomended max_execution_time = 600 line 449: change to zabbix recomended max_input_time = 600 line 457: change to zabbix recomended memory_limit = 256M line 729: change to zabbix recomended post_max_size = 32M line 878: change to zabbix recomended upload_max_filesize = 16M line 946: uncomment and add you timezone date.timezone =Asia/Shanghai # vim /etc/httpd/conf.d/zabbix.conf Alias /zabbix /usr/share/zabbix <Directory "/usr/share/zabbix"> Options FollowSymLinks AllowOverride None Order allow,deny Allow from 192.168.1.0/24 192.168.2.0/24 # change to the range you allow to access php_value max_execution_time 300 php_value memory_limit 128M php_value post_max_size 16M php_value upload_max_filesize 2M php_value max_input_time 300 # php_value date.timezone Europe/Riga </Directory> # /etc/rc.d/init.d/zabbix-server start Starting Zabbix server: [ OK ] # /etc/rc.d/init.d/zabbix-agent start Starting Zabbix agent: [ OK ] # /etc/rc.d/init.d/httpd restart Stopping httpd: [ OK ] Starting httpd: [ OK ] # chkconfig zabbix-server on # chkconfig zabbix-agent on
6. 完成配置
访问 http://$youripaddr/zabbix/
点击【netx】
查看是否都已满足要求(如果按照上面配置一般都是ok)
点击【next】
填写链接本地数据库信息,密码是刚才上面在数据库中为zabbix设置的密码
点击【next】
填写主机名称或者ip地址,以及客户端连接zabbix服务端的端口号,和安装以后显示的名称;
点击【next】
再次确认安装信息
点击【next】
到此配置完成!
提示:
默认用户:admin
默认密码:zabbix