tar xf mariadb-10.0.20-linux-x86_64.tar.gz -C /usr/local/ cd /usr/local/ ln -sv mariadb-10.0.20-linux-x86_64 mysql useradd -r mysql mkdir -pv /mydata/data chown -R mysql.mysql /mydata/data/ cd mysql/ chown -R root.mysql . scripts/mysql_install_db --user=mysql --datadir=/mydata/data/ cp support-files/my-large.cnf /etc/my.cnf cp support-files/mysql.server /etc/init.d/mysqld chkconfig --add mysqld chkconfig mysqld on
2.編輯配置文件並啟動:
vim /etc/my.cnf -----------------------------------------------> [mysqld] datadir = /mydata/data //增加此行 <----------------------------------------------- service mysqld start
3.創建zabbix數據庫和授權用戶:
/usr/local/mysql/bin/mysql ------------------------------------> CREATE DATABASE zabbix; GRANT ALL ON zabbix.* TO 'zabbix'@'192.168.19.%' IDENTIFIED BY '123456'; GRANT ALL ON zabbix.* TO 'zabbix'@'localhost' IDENTIFIED BY '123456'; GRANT ALL ON zabbix.* TO 'zabbix'@'mysql.jason.com' IDENTIFIED BY '123456'; FLUSH PRIVILEGES;
4.導入數據庫文件:
wget http://iweb.dl.sourceforge.net/project/zabbix/ZABBIX%20Latest%20Development/3.0.0alpha2/zabbix-3.0.0alpha2.tar.gz tar xf zabbix-3.0.0alpha2.tar.gz cd zabbix-3.0.0alpha2/database/mysql/ /usr/local/mysql/bin/mysql -uzabbix -p123456 zabbix < schema.sql //導入順序不能錯 /usr/local/mysql/bin/mysql -uzabbix -p123456 zabbix < images.sql /usr/local/mysql/bin/mysql -uzabbix -p123456 zabbix < data.sql
三、安裝Zabbix-Server服務器 1.在server.jason.com主機上編譯安裝zabbix:
yum -y install mysql-devel libxml2-devel net-snmp-devel libcurl-devel wget http://iweb.dl.sourceforge.net/project/zabbix/ZABBIX%20Latest%20Development/3.0.0alpha2/zabbix-3.0.0alpha2.tar.gz tar xf zabbix-3.0.0alpha2.tar.gz cd zabbix-3.0.0alpha2 groupadd zabbix useradd -g zabbix zabbix ./configure --prefix=/usr/local/zabbix-server --enable-server --with-mysql --with-net-snmp --with-libcurl --with-libxml2 make install
2.編輯配置文件並啟動:
mkdir /var/log/zabbix chown -R zabbix:zabbix /var/log/zabbix vim /usr/local/zabbix-server/etc/zabbix_server.conf -------------------------------------------------------------> LogFile=/var/log/zabbix/zabbix_server.log DBHost=192.168.19.66 DBName=zabbix DBUser=zabbix DBPassword=123456 ListenIP=127.0.0.1,192.168.19.74 <------------------------------------------------------------- /usr/local/zabbix-server/sbin/zabbix_server -c /usr/local/zabbix-server/etc/zabbix_server.conf //啟動服務
查看端口,已經開始監聽了: 四、安裝Zabbix-Web服務器 1.在web.jason.com主機上安裝httpd和php:
yum -y install httpd php php-mysql libXpm php-bcmath php-gd php-mbstring php-xml t1lib mkdir /var/www/html/zabbix wget http://iweb.dl.sourceforge.net/project/zabbix/ZABBIX%20Latest%20Development/3.0.0alpha2/zabbix-3.0.0alpha2.tar.gz tar xf zabbix-3.0.0alpha2.tar.gz cd zabbix-3.0.0alpha2/frontends/php/ cp -a . /var/www/html/zabbix/
2.配置php並啟動httpd:
vim /etc/php.ini -----------------------------------------> date.timezone = Asia/Shanghai post_max_size = 16M max_execution_time = 300 max_input_time = 300 -----------------------------------------> service httpd start
用浏覽器訪問http://192.168.19.76/zabbix,並按照提示安裝:
vim /var/www/html/zabbix/conf/zabbix.conf.php //手動寫入配置 ----------------------------------------------------------> <?php // Zabbix GUI configuration file. global $DB; $DB['TYPE'] = 'MYSQL'; $DB['SERVER'] = '192.168.19.66'; $DB['PORT'] = '0'; $DB['DATABASE'] = 'zabbix'; $DB['USER'] = 'zabbix'; $DB['PASSWORD'] = '123456'; // Schema name. Used for IBM DB2 and PostgreSQL. $DB['SCHEMA'] = ''; $ZBX_SERVER = '192.168.19.74'; $ZBX_SERVER_PORT = '10051'; $ZBX_SERVER_NAME = ''; $IMAGE_FORMAT_DEFAULT = IMAGE_FORMAT_PNG; ?>
五、安裝Zabbix-Agent端 1.在agent.jason.com主機上安裝:
wget http://iweb.dl.sourceforge.net/project/zabbix/ZABBIX%20Latest%20Development/3.0.0alpha2/zabbix-3.0.0alpha2.tar.gz tar xf zabbix-3.0.0alpha2.tar.gz cd zabbix-3.0.0alpha2 groupadd zabbix-agent useradd -g zabbix-agent zabbix-agent ./configure --prefix=/usr/local/zabbix-agent --enable-agent make install
2.編輯配置文件:
mkdir /var/log/zabbix chown -R zabbix-agent:zabbix-agent /var/log/zabbix/ vim /usr/local/zabbix-agent/etc/zabbix_agentd.conf ------------------------------------------------------------> LogFile=/var/log/zabbix/zabbix_agentd.log Server=192.168.19.74 ServerActive=192.168.19.74 Hostname=agent.jason.com User=zabbix-agent <------------------------------------------------------------ /usr/local/zabbix-agent/sbin/zabbix_agentd -c /usr/local/zabbix-agent/etc/zabbix_agentd.conf
六、添加主機 這裡我就大體截圖一下來演示了,過程可能並不詳細: