柳橙汁儿

国内IDC租用,海外IDC租用,CN2,DDOS清洗,大带宽

  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理
 
一 安装源和Zabbix的依赖包:
1 添加源
wget -q -O - http://www.atomicorp.com/installers/atomic | sh
2 安装LAMP环境
yum -y install nginx php php-mysql mysql mysql-server vim nmap php-fpm
3 安装拓展包
yum -y install mysql-devel libcurl-devel net-snmp-devel php-bcmath php-ldap php-mbstring php-gd php-xmlwriter libevent-devel libevent pcre*
 
二 添加用户:
 
groupadd zabbix
useradd -g zabbix -s /sbin/nologin zabbix
 
三 创建数据库并添加授权账号:
 
#启动mysql数据库
/etc/init.d/mysqld start
#解决中文乱码问题
mysql -e "create database zabbix character set utf8;"
#对用户进行授权
mysql -e "grant all privileges on zabbix.* to zabbix@localhost identified by 'admin@123';"
 
四 下载zabbix
zabbix下载地址:
 
1 下载源码
wget "https://sourceforge.net/projects/zabbix/files/ZABBIX%20Latest%20Stable/4.0.1/zabbix-4.0.1.tar.gz/download" -O zabbix-4.0.1.tar.gz
 
2 编译安装
tar -zxvf zabbix-4.0.1.tar.gz
cd zabbix-4.0.1
./configure --prefix=/usr/local/zabbix --enable-server --enable-agent --with-mysql --with-net-snmp --with-libcurl
make -j 4 && make install
 
4 #导入数据库
cd /tmp/zabbix-4.0.1
mysql -uzabbix -p'admin@123' -hlocalhost zabbix < database/mysql/schema.sql
mysql -uzabbix -p'admin@123' -hlocalhost zabbix < database/mysql/images.sql
mysql -uzabbix -p'admin@123' -hlocalhost zabbix < database/mysql/data.sql
 
5 #修改配置在zabbix包路径下
sed -i 's/^DBUser=.*$/DBUser=zabbix/g' /usr/local/zabbix/etc/zabbix_server.conf
sed -i 's/^.*DBPassword=.*$/DBPassword=admin@123/g' /usr/local/zabbix/etc/zabbix_server.conf
sed -i 's/^DBSocket=.*$/DBSocket=\/var\/lib\/mysql\/mysql.sock /usr/local/zabbix/etc/zabbix_server.conf
cp -r frontends/php /var/www/html/zabbix
cp misc/init.d/fedora/core/zabbix_* /etc/init.d/
sed -i 's/BASEDIR=\/usr\/local/BASEDIR=\/usr\/local\/zabbix/g' /etc/init.d/zabbix_server
sed -i 's/BASEDIR=\/usr\/local/BASEDIR=\/usr\/local\/zabbix/g' /etc/init.d/zabbix_agentd
 
6 #添加服务端口
cat >>/etc/services <<EOF
zabbix-agent 10050/tcp Zabbix Agent
zabbix-agent 10050/udp Zabbix Agent
zabbix-trapper 10051/tcp Zabbix Trapper
zabbix-trapper 10051/udp Zabbix Trapper
EOF
 
7 #修改php.ini
sed -i 's/^\(.*\)date.timezone =.*$/date.timezone = Asia\/Shanghai/g' /etc/php.ini
sed -i 's/^\(.*\)post_max_size =.*$/post_max_size = 16M/g' /etc/php.ini
sed -i 's/^\(.*\)max_execution_time =.*$/max_execution_time = 300/g' /etc/php.ini
sed -i 's/^\(.*\)max_input_time =.*$/max_input_time = 300/g' /etc/php.ini
sed -i 's/^\(.*\)always_populate_raw_post_data =.*$/always_populate_raw_post_data = .*/g' /etc/php.ini
 
8#配置nginx
vim /etc/nginx/conf.d/default.conf
 
server {
listen 80 default_server;
listen [::]:80 default_server;
server_name 10.0.5.150;
location / {
root /var/www/html/zabbix;
index index.php index.html;
}
location ~ \.php$ {
root /var/www/html/zabbix;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
#fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_scrip
t_name;
include fastcgi_params;
}
 
9#修改权限
chown -R root:root /var/lib/php/
chmod 777 /var/lib/php/session/
 
10 #启动服务
/etc/init.d/nginx start
/etc/init.d/php-fpm start
/etc/init.d/mysqld start
/etc/init.d/zabbix_server start
/etc/init.d/zabbix_agentd start
chkconfig nginx on
chkconfig mysqld on
chkconfig php-fpm on
echo "/etc/init.d/zabbix_server start" >> /etc/rc.local
echo "/etc/init.d/zabbix_agentd start" >> /etc/rc.local
 
五 WEB页面配置:
访问http://10.0.5.150/setup.php
1、确认每个Required都是ok的才会显示Next按钮,如果有Fail的需要完善系统要求
2、这里主要下,出现Fail的原因是zabbix的配置文件没有,需要点击“Download configuration file”将zabbix.conf.php下载到本地在上传到服务器的zabbix/conf/目录下即可
 
 
到此web页面配置完毕,直接访问IP就可以登录,zabbix的默认登陆账号是admin,密码是zabbix
 
3、更换中文字体,登陆后在页面的右上边点击“Prefile”
 
4、在Language选项中选择“Chinese(zh_CN)”,然后Save

posted on 2018-12-11 09:41  柳橙汁儿  阅读(1546)  评论(2编辑  收藏  举报