CentOS6安装Zabbix(RPM包)
1、 系统环境状态
2、 安装zabbix4.0
3、 安装mysql+apache+php环境
4、配置mysql
5、配置zabbix-server
6、 配置apache
7、 web安装
1 zabbix4.0安装(CentOS6.7+Apache2.2+Mysql5.1+PHP5.5) 2 3 4 1、安装zabbix、mysql、apache、php 5 rpm -i https://repo.zabbix.com/zabbix/4.0/rhel/6/x86_64/zabbix-release-4.0-1.el6.noarch.rpm 6 yum install zabbix-agent zabbix-get zabbix-sender zabbix-server-mysql zabbix-web-mysql -y 7 yum install mysql-server httpd -y 8 rpm -i https://mirror.webtatic.com/yum/el6/latest.rpm 9 yum install php55w php55w-mysql php55w-cli php55w-xml php55w-gd php55w-common php55w-bcmath php55w-pdo php55w-mbstring -y 10 11 2、配置mysql 12 /etc/init.d/mysqld start 13 mysql 14 create database zabbix character set utf8; 15 grant all on zabbix.* to 'zbxuser'@'10.0.0.%' identified by 'zbxpass'; 16 flush privileges; 17 show databases; 18 quit 19 zcat /usr/share/doc/zabbix-server-mysql-4.0.3/create.sql.gz | `mysql zabbix` 20 mysql zabbix 21 show tables; 22 quit 23 24 3、配置zabbix-server 25 sed "s/.*DBHost=.*/DBHost=10.0.0.106/g" /etc/zabbix/zabbix_server.conf -i 26 sed "s/^DBName=.*/DBName=zabbix/g" /etc/zabbix/zabbix_server.conf -i 27 sed "s/^DBUser=.*/DBUser=zbxuser/g" /etc/zabbix/zabbix_server.conf -i 28 sed "s/.*DBPassword=.*/DBPassword=zbxpass/g" /etc/zabbix/zabbix_server.conf -i 29 cat /etc/zabbix/zabbix_server.conf |grep -E "DBHost=|DBName=|DBUser=|DBPassword=" 30 /etc/init.d/zabbix-server start 31 32 33 4、配置apache 34 cat >>/etc/httpd/conf.d/zabbix.conf<<EOF 35 # 36 # Zabbix monitoring system php web frontend 37 # 38 39 Alias /zabbix /usr/share/zabbix 40 41 <Directory "/usr/share/zabbix"> 42 Options FollowSymLinks 43 AllowOverride None 44 Order allow,deny 45 Allow from all 46 47 <IfModule mod_php5.c> 48 php_value max_execution_time 300 49 php_value memory_limit 128M 50 php_value post_max_size 16M 51 php_value upload_max_filesize 2M 52 php_value max_input_time 300 53 php_value max_input_vars 10000 54 php_value date.timezone Asia/Shanghai 55 </IfModule> 56 </Directory> 57 58 <Directory "/usr/share/zabbix/conf"> 59 Order deny,allow 60 Deny from all 61 <files *.php> 62 Order deny,allow 63 Deny from all 64 </files> 65 </Directory> 66 67 <Directory "/usr/share/zabbix/api"> 68 Order deny,allow 69 Deny from all 70 <files *.php> 71 Order deny,allow 72 Deny from all 73 </files> 74 </Directory> 75 76 <Directory "/usr/share/zabbix/include"> 77 Order deny,allow 78 Deny from all 79 <files *.php> 80 Order deny,allow 81 Deny from all 82 </files> 83 </Directory> 84 85 <Directory "/usr/share/zabbix/include/classes"> 86 Order deny,allow 87 Deny from all 88 <files *.php> 89 Order deny,allow 90 Deny from all 91 </files> 92 </Directory> 93 94 EOF 95 ls /etc/httpd/conf.d 96 chown -R apache. /etc/zabbix/web/ 97 /etc/init.d/httpd start 98 netstat -lntp 99 100 101 5、安装web界面 102 web访问http://server_ip/zabbix 103 104 105 6、实现zabbix-server监控本机 106 /etc/init.d/zabbix-agent start 107 108 109 110 111 112 ====================================================简化版========================================================= 113 114 rpm -i https://repo.zabbix.com/zabbix/4.0/rhel/6/x86_64/zabbix-release-4.0-1.el6.noarch.rpm 115 yum install zabbix-agent zabbix-get zabbix-sender zabbix-server-mysql zabbix-web-mysql -y 116 yum install mysql-server httpd -y 117 rpm -i https://mirror.webtatic.com/yum/el6/latest.rpm 118 yum install php55w php55w-mysql php55w-cli php55w-xml php55w-gd php55w-common php55w-bcmath php55w-pdo php55w-mbstring -y 119 /etc/init.d/mysqld start 120 mysql 121 create database zabbix character set utf8; 122 grant all on zabbix.* to 'zbxuser'@'localhost' identified by 'zbxpass'; 123 flush privileges; 124 quit 125 zcat /usr/share/doc/zabbix-server-mysql-4.0.3/create.sql.gz | `mysql zabbix` 126 sed "s/.*DBHost=.*/DBHost=localhost/g" /etc/zabbix/zabbix_server.conf -i 127 sed "s/^DBName=.*/DBName=zabbix/g" /etc/zabbix/zabbix_server.conf -i 128 sed "s/^DBUser=.*/DBUser=zbxuser/g" /etc/zabbix/zabbix_server.conf -i 129 sed "s/.*DBPassword=.*/DBPassword=zbxpass/g" /etc/zabbix/zabbix_server.conf -i 130 /etc/init.d/zabbix-server start 131 cat >>/etc/httpd/conf.d/zabbix.conf<<EOF 132 # 133 # Zabbix monitoring system php web frontend 134 # 135 136 Alias /zabbix /usr/share/zabbix 137 138 <Directory "/usr/share/zabbix"> 139 Options FollowSymLinks 140 AllowOverride None 141 Order allow,deny 142 Allow from all 143 144 <IfModule mod_php5.c> 145 php_value max_execution_time 300 146 php_value memory_limit 128M 147 php_value post_max_size 16M 148 php_value upload_max_filesize 2M 149 php_value max_input_time 300 150 php_value max_input_vars 10000 151 php_value date.timezone Asia/Shanghai 152 </IfModule> 153 </Directory> 154 155 <Directory "/usr/share/zabbix/conf"> 156 Order deny,allow 157 Deny from all 158 <files *.php> 159 Order deny,allow 160 Deny from all 161 </files> 162 </Directory> 163 164 <Directory "/usr/share/zabbix/api"> 165 Order deny,allow 166 Deny from all 167 <files *.php> 168 Order deny,allow 169 Deny from all 170 </files> 171 </Directory> 172 173 <Directory "/usr/share/zabbix/include"> 174 Order deny,allow 175 Deny from all 176 <files *.php> 177 Order deny,allow 178 Deny from all 179 </files> 180 </Directory> 181 182 <Directory "/usr/share/zabbix/include/classes"> 183 Order deny,allow 184 Deny from all 185 <files *.php> 186 Order deny,allow 187 Deny from all 188 </files> 189 </Directory> 190 191 EOF 192 chown -R apache. /etc/zabbix/web/ 193 /etc/init.d/httpd start 194 /etc/init.d/zabbix-agent start 195 netstat -lntp
1 zabbix3.0安装(CentOS6.7+Apache2.2+Mysql5.1+PHP5.5) 2 3 1、安装zabbix、mysql、apache、php 4 rpm -i https://repo.zabbix.com/zabbix/3.0/rhel/6/x86_64/zabbix-release-3.0-1.el6.noarch.rpm 5 sleep 1 6 yum install zabbix-agent zabbix-get zabbix-sender zabbix-server-mysql zabbix-web-mysql -y 7 yum install mysql-server httpd -y 8 rpm -i https://mirror.webtatic.com/yum/el6/latest.rpm 9 sleep 1 10 yum install php55w php55w-mysql php55w-cli php55w-xml php55w-gd php55w-common php55w-bcmath php55w-pdo php55w-mbstring -y 11 rpm -qa |grep -E "zabbix|mysql|httpd|php" |sort >>zabbix.log 12 13 2、配置mysql 14 /etc/init.d/mysqld start 15 mysql 16 create database zabbix character set utf8; 17 grant all on zabbix.* to 'zbxuser'@'10.0.0.%' identified by 'zbxpass'; 18 grant all on zabbix.* to 'zbxuser'@'localhost' identified by 'zbxpass'; 19 flush privileges; 20 show databases; 21 quit 22 zcat /usr/share/doc/zabbix-server-mysql*/create.sql.gz | `mysql zabbix` 23 mysql zabbix 24 show tables; 25 quit 26 27 3、配置zabbix-server 28 sed "s/.*DBHost=.*/DBHost=10.0.0.17/g" /etc/zabbix/zabbix_server.conf -i 29 sed "s/^DBName=.*/DBName=zabbix/g" /etc/zabbix/zabbix_server.conf -i 30 sed "s/^DBUser=.*/DBUser=zbxuser/g" /etc/zabbix/zabbix_server.conf -i 31 sed "s/.*DBPassword=.*/DBPassword=zbxpass/g" /etc/zabbix/zabbix_server.conf -i 32 cat /etc/zabbix/zabbix_server.conf |grep -E "DBHost=|DBName=|DBUser=|DBPassword=" 33 /etc/init.d/zabbix-server start 34 35 36 4、配置apache 37 ln -s /usr/share/zabbix /var/www/html/zabbix 38 \cp /etc/php.ini{,.bak} 39 sed -i '/post_max_size =/ s/=.*M$/= 16M/g' /etc/php.ini 40 sed -i '/max_execution_time =/ s/=.*/= 300/g' /etc/php.ini 41 sed -i '/max_input_time =/ s/=.*/= 300/g' /etc/php.ini 42 sed -i '/date.timezone =/ adate.timezone = Asia/Shanghai' /etc/php.ini 43 cat /etc/php.ini |grep -E "post_max_size =|max_execution_time =|max_input_time =|date.timezone =" 44 chown -R apache. /etc/zabbix/web/ 45 /etc/init.d/httpd start 46 netstat -lntp 47 48 49 5、安装web界面 50 web访问http://server_ip/zabbix 51 52 53 6、实现zabbix-server监控本机 54 /etc/init.d/zabbix-agent start 55 56 57 58 59 60 ====================================================简化版========================================================= 61 rpm -i https://repo.zabbix.com/zabbix/3.0/rhel/6/x86_64/zabbix-release-3.0-1.el6.noarch.rpm 62 sleep 1 63 yum install zabbix-agent zabbix-get zabbix-sender zabbix-server-mysql zabbix-web-mysql -y 64 yum install mysql-server httpd -y 65 rpm -i https://mirror.webtatic.com/yum/el6/latest.rpm 66 sleep 1 67 yum install php55w php55w-mysql php55w-cli php55w-xml php55w-gd php55w-common php55w-bcmath php55w-pdo php55w-mbstring -y 68 rpm -qa |grep -E "zabbix|mysql|httpd|php" |sort >>zabbix.log 69 70 /etc/init.d/mysqld start 71 mysql 72 create database zabbix character set utf8; 73 grant all on zabbix.* to 'zbxuser'@'10.0.0.%' identified by 'zbxpass'; 74 grant all on zabbix.* to 'zbxuser'@'localhost' identified by 'zbxpass'; 75 flush privileges; 76 quit 77 zcat /usr/share/doc/zabbix-server-mysql*/create.sql.gz | `mysql zabbix` 78 79 sed "s/.*DBHost=.*/DBHost=10.0.0.17/g" /etc/zabbix/zabbix_server.conf -i 80 sed "s/^DBName=.*/DBName=zabbix/g" /etc/zabbix/zabbix_server.conf -i 81 sed "s/^DBUser=.*/DBUser=zbxuser/g" /etc/zabbix/zabbix_server.conf -i 82 sed "s/.*DBPassword=.*/DBPassword=zbxpass/g" /etc/zabbix/zabbix_server.conf -i 83 /etc/init.d/zabbix-server start 84 85 ln -s /usr/share/zabbix /var/www/html/zabbix 86 \cp /etc/php.ini{,.bak} 87 sed -i '/post_max_size =/ s/=.*M$/= 16M/g' /etc/php.ini 88 sed -i '/max_execution_time =/ s/=.*/= 300/g' /etc/php.ini 89 sed -i '/max_input_time =/ s/=.*/= 300/g' /etc/php.ini 90 sed -i '/date.timezone =/ adate.timezone = Asia/Shanghai' /etc/php.ini 91 chown -R apache. /etc/zabbix/web/ 92 /etc/init.d/httpd start 93 /etc/init.d/zabbix-agent start 94 netstat -lntp
1、 系统环境状态
uname -a
cat /etc/redhat-release
2、 安装zabbix4.0
2.1 构建安装zabbix的yum源
rpm -i https://repo.zabbix.com/zabbix/4.0/rhel/6/x86_64/zabbix-release-4.0-1.el6.noarch.rpm
rpm -q zabbix-release
ll /etc/yum.repos.d/
2.2 安装zabbix
yum list |grep zabbix
yum install zabbix-agent zabbix-get zabbix-sender zabbix-server-mysql zabbix-web-mysql -y
3、 安装mysql+apache+php环境
3.1 安装mysql和apache,直接yum安装即可
yum install mysql-server -y
yum install httpd -y
3.2 zabbix4.x需要php5.4以上的php环境
# 构建yum源
rpm -i https://mirror.webtatic.com/yum/el6/latest.rpm
# yum安装
yum install php71w php71w-mysql php71w-cli php71w-xml php71w-gd php71w-common php71w-bcmath php71w-pdo php71w-mbstring -y
4、配置mysql
4.1 启动mysqld服务,创建并授权zabbix数据库
/etc/init.d/mysqld start
mysql
create database zabbix character set utf8;
grant all on zabbix.* to 'zbxuser'@'10.0.0.%' identified by 'zbxpass';
flush privileges;
quit
mysql -h10.0.0.106 -uzbxuser -pzbxpass
4.2 导入zabbix-server的相关表内容到mysql
rpm -ql zabbix-server-mysql
zcat /usr/share/doc/zabbix-server-mysql-4.0.3/create.sql.gz | `mysql zabbix`
mysql zabbix
show tables;
5、配置zabbix-server,修改/etc/zabbix/zabbix_server.conf 如下选项内容
vim /etc/zabbix/zabbix_server.conf
DBHost=10.0.0.106
DBName=zabbix
DBUser=zbxuser
DBPassword=zbxpass
/etc/init.d/zabbix-server start
6、 配置apache
修改/etc/httpd/conf.d/zabbix.conf 文件内容如下(如文件不存在则创建)
1 #
2 # Zabbix monitoring system php web frontend
3 #
4
5 Alias /zabbix /usr/share/zabbix
6
7 <Directory "/usr/share/zabbix">
8 Options FollowSymLinks
9 AllowOverride None
10 Order allow,deny
11 Allow from all
12
13 <IfModule mod_php7.c>
14 php_value max_execution_time 300
15 php_value memory_limit 128M
16 php_value post_max_size 16M
17 php_value upload_max_filesize 2M
18 php_value max_input_time 300
19 php_value max_input_vars 10000
20 php_value date.timezone Asia/Shanghai
21 </IfModule>
22 </Directory>
23
24 <Directory "/usr/share/zabbix/conf">
25 Order deny,allow
26 Deny from all
27 <files *.php>
28 Order deny,allow
29 Deny from all
30 </files>
31 </Directory>
32
33 <Directory "/usr/share/zabbix/api">
34 Order deny,allow
35 Deny from all
36 <files *.php>
37 Order deny,allow
38 Deny from all
39 </files>
40 </Directory>
41
42 <Directory "/usr/share/zabbix/include">
43 Order deny,allow
44 Deny from all
45 <files *.php>
46 Order deny,allow
47 Deny from all
48 </files>
49 </Directory>
50
51 <Directory "/usr/share/zabbix/include/classes">
52 Order deny,allow
53 Deny from all
54 <files *.php>
55 Order deny,allow
56 Deny from all
57 </files>
58 </Directory>
修改/etc/zabbix/web/目录的属主为apache并启动httpd服务
chown -R apache. /etc/zabbix/web/
/etc/init.d/httpd start
7、 web安装
web访问http://server_ip/zabbix
静静的学习一阵子儿...