zabbix server安装
在数据库安装完成后,接着开始安装server端了。
3.2.1 安装rpm源
Zabbix 2.2 for RHEL5, Oracle Linux 5, CentOS 5:
#rpm -ivh http://repo.zabbix.com/zabbix/2.2/rhel/5/x86_64/zabbix-release-2.2-1.el5.noarch.rpm
Zabbix 2.2 for RHEL6, Oracle Linux 6, CentOS 6:
#rpm -ivh http://repo.zabbix.com/zabbix/2.2/rhel/6/x86_64/zabbix-release-2.2-1.el6.noarch.rpm
3.2.2 安装mysql
上面已经完成。
3.2.3 安装server
yum install zabbix-server-mysql zabbix-web-mysql zabbix-sender yum install zabbix-agent
3.2.4 初始化数据库
Create zabbix database and user on MySQL.
# mysql -uroot mysql> create database zabbix character set utf8 collate utf8_bin; mysql> grant all privileges on zabbix.* to [email protected] identified by ‘zabbix‘; mysql> exit
Import initial schema and data.
# cd /usr/share/doc/zabbix-server-mysql-2.2.0/create # mysql -uroot -p zabbix < schema.sql # mysql -uroot -p zabbix < images.sql # mysql -uroot -p zabbix < data.sql
3.2.5 配置文件修改
# vi /etc/zabbix/zabbix_server.conf
DBHost=localhost DBName=zabbix DBUser=zabbix DBPassword=zabbix
Start Zabbix server process.
# service zabbix-server start
3.2.6 配置zabbix web前端
Apache configuration file for Zabbix frontend is located in /etc/httpd/conf.d/zabbix.conf. Some PHP settings are already configured.
php_value max_execution_time 300 php_value memory_limit 128M php_value post_max_size 16M php_value upload_max_filesize 2M php_value max_input_time 300 date.timezone = Asia/Shanghai
3.2.7 安装nginx
nginx-1.6.2.tar.gz openssl-1.0.1c.tar.gz pcre-8.34.tar.gz zlib-1.2.8.tar.gz
yum -y install openssl openssl-devel ./configure --user=nginx --group=nginx --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module 可能会提示libpcre.so.1找不到 ln -s /usr/local/lib/libpcre.so.1 /lib64/ 安装php-fpm yum install php php-fpm
3.2.8 初始化web
chown -R nginx:nginx /usr/share/zabbix/ chown -R nginx:nginx /etc/zabbix/web/
# cat nginx.conf|grep -v "#" user nginx; worker_processes 4; events { worker_connections 1024; } http { include mime.types; default_type application/octet-stream; sendfile on; keepalive_timeout 65; server { listen 80; charset utf-8; access_log /var/log/nginx/zabbix.access.log; error_log /var/log/nginx/zabbix.error.log; location / { root /usr/share/zabbix/; allow 你的IP; deny all; index index.php index.html index.htm; } location ~ \.php$ { root /usr/share/zabbix/; fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME /usr/share/zabbix$fastcgi_script_name; include fastcgi_params; } error_page 500 502 503 504 /50x.html; location = /50x.html { root html; } } }
设置nginx启动脚本
#!/bin/sh # # nginx - this script starts and stops the nginx daemin # # chkconfig: - 85 15 # description: Nginx is an HTTP(S) server, HTTP(S) reverse # proxy and IMAP/POP3 proxy server # processname: nginx # config: /usr/local/nginx/conf/nginx.conf # pidfile: /usr/local/nginx/logs/nginx.pid # Source function library. . /etc/rc.d/init.d/functions # Source networking configuration. . /etc/sysconfig/network # Check that networking is up. [ "$NETWORKING" = "no" ] && exit 0 nginx="/usr/local/nginx/sbin/nginx" prog=$(basename $nginx) NGINX_CONF_FILE="/usr/local/nginx/conf/nginx.conf" lockfile=/var/lock/subsys/nginx start() { [ -x $nginx ] || exit 5 [ -f $NGINX_CONF_FILE ] || exit 6 echo -n $"Starting $prog: " daemon $nginx -c $NGINX_CONF_FILE retval=$? echo [ $retval -eq 0 ] && touch $lockfile return $retval } stop() { echo -n $"Stopping $prog: " killproc $prog -QUIT retval=$? echo [ $retval -eq 0 ] && rm -f $lockfile return $retval } restart() { configtest || return $? stop start } reload() { configtest || return $? echo -n $"Reloading $prog: " killproc $nginx -HUP RETVAL=$? echo } force_reload() { restart } configtest() { $nginx -t -c $NGINX_CONF_FILE } rh_status() { status $prog } rh_status_q() { rh_status >/dev/null 2>&1 } case "$1" in start) rh_status_q && exit 0 $1 ;; stop) rh_status_q || exit 0 $1 ;; restart|configtest) $1 ;; reload) rh_status_q || exit 7 $1 ;; force-reload) force_reload ;; status) rh_status ;; condrestart|try-restart) rh_status_q || exit 0 ;; *) echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload|configtest}" exit 2 esac
3.2.9 Server端web配置
时间: 2024-12-29 06:54:21