EOF
service httpd restart
==============================
#配置数据库
mysql -u root -e "create database zabbix character set utf8 collate utf8_bin;show databases;"
#mysql -u root -e "insert into mysql.user(Host,User,Password) values('localhost','zabbix',password('zabbix'));"
mysql -u root -e "grant all on *.* to admin@'%' identified by 'admin' with grant option;flush privileges;"
mysql -u root -e "grant all on zabbix.* to zabbix@'%' identified by 'zabbix';flush privileges;"
mysql -u root -e "grant all on zabbix.* to zabbix@'127.0.0.1' identified by 'zabbix';flush privileges;"
mysql -u root -e "grant all on zabbix.* to zabbix@'localhost' identified by 'zabbix';flush privileges;"
mysql -u root -e "select user,host,password from mysql.user;flush privileges;"
6.导入数据库。
updatedb
locate images.sql
cd $(dirname $(locate images.sql))
cd $(dirname $(locate create.sql.gz))
mysql -e "create database zabbix character set utf8 collate utf8_bin;show databases;"
mysql -e "grant all on zabbix.* to zabbix@localhost identified by 'zabbix';"
mysql -e "grant all on *.* to admin identified by 'zabbix' with grant option;"
mysql -e "select user,host,password from mysql.user;flush privileges;"
zcat create.sql.gz | mysql -uroot zabbix
方法二:
updatedb
locate images.sql
cd $(dirname $(locate images.sql))
cd $(dirname $(locate create.sql.gz))
mysql -u root -e "create database zabbix character set utf8;show databases;"
mysql -u root zabbix < schema.sql
mysql -u root zabbix < images.sql
mysql -u root zabbix < data.sql
方法三:zabbix-3.2源码包安装时导入数据的方法。
updatedb
locate images.sql
cd $(dirname $(locate images.sql))
cd $(dirname $(locate create.sql.gz))
zcat /usr/share/doc/zabbix-server-mysql-3.2.*/create.sql.gz | mysql -uzabbix -pzabbix zabbix
第4步,修改zabbix配置文件(选做)。
# vi /etc/zabbix/zabbix_server.conf
DBHost=localhost
DBName=zabbix
DBUser=zabbix
DBPassword=数据库密码
说明:配置文件中只需要修改DB相关的配置就能正常使用了。(金测OK)
第5步,重启zabbix服务端,设置为开机启动。(金测OK)
service zabbix-server restart
service zabbix-agent restart
chkconfig zabbix-server on
chkconfig zabbix-agent on
netstat -atunlp|grep zabbix 查看到有10050、10051端口的进程就说明服务正常
默认,直接NEXT=====》出现错误,提示Fail(忘截图了)
Configuration file"/var/www/html/zabbix/conf/zabbix.conf.php"
created: Fail
Unable to create the configuration file.Please install it manually, or fix permissions on the conf directory.
Press the "Download configuration file" button, download the configuration file and save it as"/var/www/html/zabbix/conf/zabbix.conf.php"When done, press the "Retry" button