您的位置:首页 > 运维架构 > Linux

CentOS6.6 for Zabbix install

2017-11-29 17:56 309 查看
[base]
cat /etc/issue
centos 6.6
service iptables stop
vim /etc/sysconfig/selinux
----------------
SELINUX=disabled
----------------

[creat zabbix user and group]
groupadd zabbix
useradd –g zabbix zabbix

[install apache]
yum install httpd libxml2-devel net-snmp-devel libcurl-devel
vim /etc/httpd/conf/httpd.conf
----------------------------------
DocumentRoot "/var/www/html/zabbix"
<Directory "/var/www/html/zabbix">
ServerName 127.0.0.1:80
DirectoryIndex index.html index.html.var index.php
--------------------------------------------------
mkdir -p /var/www/html/zabbix

[install php]
rpm -ivh http://repo.webtatic.com/yum/el6/latest.rpm yum -y install httpd php56w php56w-gd php56w-mysqlnd php56w-bcmath php56w-mbstring php56w-xml php56w-ldap
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
------------------------------------

[install mysql]
rpm -ivh http://dev.mysql.com/get/mysql-community-release-el6-5.noarch.rpm yum install –y mysql-server mysql-devel
vim /etc/my.cnf
---------------
default-storage-engine = innodb
innodb_file_per_table
collation-server = utf8_general_ci
init-connect = 'SET NAMES utf8'
character-set-server = utf8
-----------------------------
service mysqld start
mysql_secure_installation
Set root password? [Y/n] y
Remove anonymous users? [Y/n] y
Disallow root login remotely? [Y/n] y
Remove test database and access to it? [Y/n] y
Reload privilege tables now? [Y/n] y

[creat zabbix database]
[root@linuxtest zabbix]# mysql -uroot -p
Enter password:
mysql> create database zabbix character set utf8 collate utf8_bin;
mysql> show create database zabbix;
mysql> grant all privileges on zabbix.* to zabbix@localhost identified by 'zabbix';
mysql> flush privileges;
mysql> show databases;
mysql> quit;

[zabbix-3.4.4 install]
wget https://nchc.dl.sourceforge.net/project/zabbix/ZABBIX%20Latest%20Stable/3.4.4/zabbix-3.4.4.tar.gz tar -zxvf zabbix-3.4.4.tar.gz

[Import the configuration to the database]
cd zabbix-3.4.4/database/mysql
[root@linuxtest mysql]# mysql -uroot -hlocalhost -p zabbix <schema.sql
Enter password: 123.com
[root@linuxtest mysql]# mysql -uroot -hlocalhost -p zabbix <images.sql
Enter password: 123.com
[root@linuxtest mysql]# mysql -uroot -hlocalhost -p zabbix <data.sql
Enter password: 123.com

[zabbix install]
yum -y install gcc mysql-community-devel libxml2-devel unixODBC-devel net-snmp-devel libcurl-devel libssh2-devel OpenIPMI-devel openssl-devel openldap-devel
yum -y install libevent libevent-devel pcre pcre-devel
cd /root/software/zabbix/zabbix-3.4.4
./configure --enable-server --enable-agent --with-mysql --enable-ipv6 --with-net-snmp --with-libcurl --with-libxml2 --with-unixodbc --with-ssh2 --with-openipmi --with-openssl --prefix=/usr/local/zabbix
***********************************************************
*            Now run 'make install'                       *
*                                                         *
*            Thank you for using Zabbix!                  *
*              <http://www.zabbix.com>                    *
***********************************************************
make install

[modify zabbix_server.conf]
mkdir –p /var/log/zabbix
touch /var/log/zabbix/zabbix_server.log
vim /usr/local/zabbix/etc/zabbix_server.conf
----------------
DBName=zabbix
DBUser=zabbix
DBPassword=123.com
LogFile=/var/log/zabbix/zabbix_server.log
-------------------------------------------
cp -a /root/software/zabbix/zabbix-3.4.4/frontends/php/* /var/www/html/zabbix/
cp /root/software/zabbix/zabbix-3.4.4/misc/init.d/fedora/core/* /etc/init.d/
chkconfig --add /etc/init.d/zabbix_server
chkconfig --add /etc/init.d/zabbix_agentd
chkconfig httpd on
chkconfig mysqld on
chkconfig zabbix_server on
chkconfig zabbix_agentd on

[modify]
vim /etc/init.d/zabbix_server
vim /etc/init.d/zabbix_agentd
--------------------------
BASEDIR=/usr/local/zabbix
--------------------------

[start service]
service httpd start
cd /etc/init.d/
./zabbix_server start

[creat start script]
touch /root/zabbix_start.sh
-----------------------------------------------------------
#!/bin/bash
echo '(1)start      (2)restart      (3)stop      (4)quit'
echo 'Please select the function you need:'
read state
file='/etc/init.d/'
if [ "1" -eq "$state" ];then
cd $file
./zabbix_server start
fi
if [ "2" -eq "$state" ];then
cd $file
./zabbix_server restart
fi
if [ "3" -eq "$state" ];then
cd $file
./zabbix_server stop
fi
if [ "4" -eq "$state" ];then
exit
fi
------------------------------------------------------------

[visit zabbix web page] http://192.168.75.128/setup.php default login account:Admin
default login password:zabbix

[solve problems]
number 1:
zabbix server is not running......
can't connect to this database 'zabbix@localhost' eq.....
WAY:
modify your zabbix_server.conf
vim /usr/local/zabbix/etc/zabbix_server.conf
---------------
DBHost=localhost
DBName=zabbix
DBUser=zabbix
DBPassword=zabbix
DBPort=3306
ListenIP=192.168.75.128
-------------------------
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  zabbix centos