service iptables stop
chkconfig iptables off
关闭防火墙
sed -i 's/SELINUX=.*/SELINUX=disabled/g' /etc/selinux/config
setenforce 0
关闭selinux
rpm -Uvh http://mirror.webtatic.com/yum/el6/latest.rpm
rpm -ivh http://repo.webtatic.com/yum/el6/latest.rpm
设置可以安装php的yum
#rpm -e webtatic-release-6-9.noarch
# 备用 卸载rpm的 不用操作
yum -y install httpd php56w php56w-gd php56w-mysql php56w-bcmath php56w-mbstring php56w-xml php56w-ldap wget ntpdate net-snmp*
安装php
如果repo 不能安装的话
备份现在的repo 在进行下面操作
wget http://mirrors.163.com/.help/CentOS6-Base-163.repo
再次尝试安装
php --version
版本5.6就行了
yum install -y gcc mysql-community-devel libxml2-devel unixODBC-devel net-snmp-devel libcurl-devel libssh2-devel OpenIPMI-devel openssl-devel openldap-devel libevent-devel pcre*
安装所需要依赖的软件包
yum -y install mysql mysql-devel mysql-server
安装mysql数据库
/etc/init.d/mysqld restart
mysql_secure_installation
mysql -u root -p
CREATE DATABASE zabbix CHARACTER SET utf8 COLLATE utf8_bin;
GRANT ALL PRIVILEGES ON zabbix.* TO zabbix@localhost IDENTIFIED BY 'zabbix';
quit
启动数据库 初始化设置root密码 进入数据库设置zabbix
groupadd zabbix
useradd -g zabbix zabbix
创建zabbix用户
cd /root/
tar -xvf zabbix-3.4.0.tar.gz
去官方网站下载安装包 我的放在root家目录 解压
cd ~/zabbix-3.4.0/database/mysql
mysql -u zabbix -pzabbix zabbix < schema.sql
mysql -u zabbix -pzabbix zabbix < images.sql
mysql -u zabbix -pzabbix zabbix < data.sql
导入数据
cd ../../
./configure --enable-server --with-mysql --enable-ipv6 --with-net-snmp --with-libcurl --with-libxml2 --with-unixodbc --with-ssh2 --with-openipmi --with-openssl --prefix=/etc/zabbix
编译安装zabbix 我这里指定了家目录/etc/zabbix
configure: error: Unable to use libevent (libevent check failed)
yum install libevent-devel -y
报错安装解决
configure: error: Unable to use libpcre (libpcre check failed)
yum -y install pcre*
报错安装解决
Thank you for using Zabbix!
出现这句话就可以直接安装了
make && make install
ok了
grep -v "^#" /etc/zabbix/etc/zabbix_server.conf|grep -v "^$"
DBName=zabbix
DBUser=zabbix
DBPassword=zabbix
Timeout=4
LogSlowQueries=3000
修改zabbix服务器配置文件
cd ~/zabbix-3.4.0/frontends/php
cp -a . /var/www/html/zabbix/
chown -R apache:apache /var/www/html/zabbix
chmod +x /var/www/html/zabbix/conf/
cp ~/zabbix-3.4.0/misc/init.d/fedora/core/zabbix_server /etc/init.d/zabbix_server
chmod +x /etc/init.d/zabbix_server
chkconfig --add zabbix_server
chkconfig zabbix_server on
chkconfig httpd on
chkconfig mysqld on
web界面设置 并将zabbix_server httpd mysqld 服务加入开机启动
vim /etc/init.d/zabbix_server
BASEDIR=/etc/zabbix
/etc/init.d/zabbix_server start
netstat -tnlp | grep 10051
修改设置为自定义安装位置
vim /etc/php.ini
post_max_size=16M
max_execution_time=300
max_input_time=300
date.timezone=Asia/Shanghai
always_populate_raw_post_data=-1
php配置文件设置
vim /etc/httpd/conf/httpd.conf
ServerName localhost:80
/etc/init.d/httpd restart
httpd配置文件修改 并启动服务
http://192.168.0.216/zabbix/
有不是ok的 百度下怎么解决
Admin/zabbix
- 错误记录
1)遇到个错误是安装界面变成了ftp的样子 没有图 全是文件
安装php为5.3.3以上解决
2)错误是web配置界面第二张图check的 /etc/php.ini 的参数已经修改完 但界面还是显示不对
[root@localhost zabbix]# cat phpinfo.php
<?php
phpinfo();
?>
[root@localhost zabbix]# pwd
/var/www/html/zabbix
要看下php的生效的php.ini的位置是不是不对
http://192.168.0.180/zabbix/phpinfo.php
那就要去修改这个位置的配置文件
/opt/remi/php56/root/etc/php.ini
和之前一样修改完 重启httpd服务 check就正常了
3)zabbix服务器 icmpping
默认是没有的 要安装下
wget http://www.fping.org/dist/fping-4.0.tar.gz
tar xf fping-4.0.tar.gz
cd fping-4.0
./configure
make install
fping 192.168.0.180
192.168.0.180 is alive
which fping
/usr/local/sbin/fping
chmod 4770 /usr/local/sbin/fping
chown root:zabbix /usr/local/sbin/fping
cat /etc/zabbix/etc/zabbix_server.conf | grep FpingLocation
FpingLocation=/usr/local/sbin/fping
修改配置文件对应位置
su - zabbix
fping 192.168.0.180
192.168.0.180 is alive
ok
4)图形界面方框中文乱码
复制到桌面文件名为:simsun.ttc
上传到服务器/var/www/html/zabbix/fonts/
cd /var/www/html/zabbix
cd fonts/
mv simsun.ttc simsun.ttf
chown apache.apache simsun.ttf
设置成和之前一样的权限
cat ../include/defines.inc.php | grep DejaVuSans
define('ZBX_GRAPH_FONT_NAME', 'DejaVuSans'); // font file name
define('ZBX_FONT_NAME', 'DejaVuSans');
vim ../include/defines.inc.php
define('ZBX_GRAPH_FONT_NAME', 'simsun'); // font file name
define('ZBX_FONT_NAME', 'simsun');
修改配置文件对应文件名字
刷新界面就行了
#zabbix服务器要用的脚本存放位置
cat /etc/zabbix/etc/zabbix_server.conf|grep AlertScriptsPat
### Option: AlertScriptsPath
# AlertScriptsPath=${datadir}/zabbix/alertscripts
用的话可以写上
/etc/zabbix/share/zabbix/alertscripts/