Zabbix Server Setup

Source: Internet
Author: User
Tags snmp


Installing the Iptables Firewall


Yum Install iptables-services #安装


Vi/etc/sysconfig/iptables #编辑防火墙配置文件


# Firewall configuration written by System-config-firewall


# Manual Customization of this file are not recommended.


*filter


: INPUT ACCEPT [0:0]

: FORWARD ACCEPT [0:0]

: OUTPUT ACCEPT [0:0]

-A input-m state--state established,related-j ACCEPT

-A input-p icmp-j ACCEPT

-A input-i lo-j ACCEPT

-A input-m state--state new-m tcp-p TCP--dport 22-j ACCEPT


-A input-m state--state new-m tcp-p TCP--dport 80-j ACCEPT #追加这行

-A input-m state--state new-m tcp-p TCP--dport 3306-j ACCEPT #追加这行



-A input-j REJECT--reject-with icmp-host-prohibited

-A forward-j REJECT--reject-with icmp-host-prohibited

COMMIT


: wq! #保存退出


Systemctl Restart Iptables.service #最后重启防火墙使配置生效


Systemctl Enable Iptables.service #设置防火墙开机启动


Second, to close SELinux


Vi/etc/selinux/config


#SELINUX =enforcing #注释掉


#SELINUXTYPE =targeted #注释掉


Selinux=disabled #增加


: wq! #保存退出


Setenforce 0 #使配置立即生效


Installation article:


First, install Apache


Yum Install httpd #根据提示, enter Y to install successfully


Systemctl Start Httpd.service #启动apache


Systemctl Stop Httpd.service #停止apache


Systemctl Restart Httpd.service #重启apache


Systemctl Enable Httpd.service #设置apache开机启动


Open the server IP address in the client browser, the test interface will appear, indicating that the Apache installation was successful



Second, installation mariadb



1. Install MySQL




Yum install MySQL mysql-server #询问是否要安装, enter y for automatic installation until installation is complete


Serivice mysqld Start


CP/USR/SHARE/MYSQL/MY-HUGE.CNF/ETC/MY.CNF #拷贝配置文件 (Note: If the/etc directory has a my.cnf under the default, you can directly overwrite it)


2. Set the password for the root account


Mysql

Go to change Password


Third, install PHP


1. Install PHP



Yum Install PHP #根据提示输入Y直到安装完成


2, install PHP components, so that PHP support MariaDB


Yum install php-mysql php-gd libjpeg* php-ldap php-odbc php-pear php-xml php-xmlrpc php-mbstring php-bcmath Php-mhash


#这里选择以上安装包进行安装, enter Y return as prompted


Service mysqld Restart #重启mysqlDB


Service httpd Restart #重启apache


Configuration Chapter


One, Apache configuration


Vi/etc/httpd/conf/httpd.conf #编辑文件


Serversignature on #添加, the Apache version is displayed on the error page, off is not displayed


Options Indexes followsymlinks #修改为: Options includes execcgi followsymlinks (Allow server to execute CGI and SSI, disallow listing of directories)


#AddHandler cgi-script. CGI #修改为: AddHandler cgi-script. cgi. PL (allows CGI scripts with extension. pl to run)


AllowOverride None #修改为: allowoverride All (Allow. htaccess)


Adddefaultcharset UTF-8 #修改为: Adddefaultcharset GB2312 (add GB2312 as default encoding)


#Options Indexes followsymlinks #修改为 Options followsymlinks (does not show the tree structure on the browser)


DirectoryIndex index.html #修改为: DirectoryIndex index.html index.htm default.html default.htm index.php (set default home file, add index.php)


Maxkeepaliverequests #添加MaxKeepAliveRequests 500 (increase the number of simultaneous connections)


: wq! #保存退出


Systemctl Restart Httpd.service #重启apache


Rm-f/etc/httpd/conf.d/welcome.conf/var/www/error/noindex.html #删除默认测试页


Second, PHP configuration


Vi/etc/php.ini #编辑


Date.timezone = PRC #把前面的分号去掉, changed to Date.timezone = PRC


Disable_functions = Passthru,exec,system,chroot,scandir,chgrp,chown,shell_exec,proc_open,proc_get_status,ini_ Alter,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,stream_socket_server, Escapeshellcmd,dll,popen,disk_free_space,checkdnsrr,checkdnsrr,getservbyname,getservbyport,disk_total_space, POSIX_CTERMID,POSIX_GET_LAST_ERROR,POSIX_GETCWD, Posix_getegid,posix_geteuid,posix_getgid, Posix_getgrgid,posix_ Getgrnam,posix_getgroups,posix_getlogin,posix_getpgid,posix_getpgrp,posix_getpid, Posix_getppid,posix_getpwnam, Posix_getpwuid, Posix_getrlimit, Posix_getsid,posix_getuid,posix_isatty, Posix_kill,posix_mkfifo,posix_setegid, Posix_seteuid,posix_setgid, Posix_setpgid,posix_setsid,posix_setuid,posix_strerror,posix_times,posix_ttyname, Posix_uname


#列出PHP可以禁用的函数, if some programs need to use this function, you can delete, cancel disable.


expose_php = Off #禁止显示php版本的信息


Short_open_tag = on #支持php短标签


Open_basedir =.:/ tmp/#设置表示允许访问当前目录 (that is, the PHP script files in the directory) and/tmp/directory, you can prevent the PHP Trojan cross-site, if you change the installation program after the problem, you can log off this line, or directly write the program directory/data/www.osyunwei.com/:/tmp/


: wq! #保存退出


Systemctl Restart Mariadb.service #重启MariaDB


Systemctl Restart Httpd.service #重启apache


Test article


Cd/var/www/html


VI index.php #输入下面内容


<?php


Phpinfo ();


?>


: wq! #保存退出


In the client browser enter the server IP address, you can see the configuration information about PHP!




NOTE: The Apache default program directory is/var/www/html


Permission settings: Chown apache.apache-r/var/www/html


At this point, the CentOS 0 installation configuration Lamp server (apache+php+mysql) tutorial is complete!


Zabbix-3.2.0/database/mysql #进入mysql数据库创建脚本目录


LS #列出文件, you can see that there are Schema.sql, Images.sql, data.sql three of files


Mysql-u root-p #输入密码, enter the MySQL console


Create database Zabbix character set UTF8; #创建数据库zabbix, and the database encoding uses UTF8


Insert into Mysql.user (Host,user,password) VALUES (' localhost ', ' Zabbix ', Password (' 123456 ')); #新建账户zabbix, Password 123456


Flush privileges; #刷新系统授权表


Grant all on zabbix.* to ' Zabbix ' @ ' 127.0.0.1 ' identified by ' 123456 ' with GRANT option; #允许账户zabbix能从本机连接到数据库zabbix


Flush privileges; #再次刷新系统授权表


Use Zabbix #进入数据库


Source/usr/local/src/zabbix-3.2.0/database/mysql/schema.sql #导入脚本文件到zabbix数据库


Source/usr/local/src/zabbix-3.2.0/database/mysql/images.sql #导入脚本文件到zabbix数据库


Source/usr/local/src/zabbix-3.2.0/database/mysql/data.sql #导入脚本文件到zabbix数据库


Note: Please import in the order above, otherwise an error will occur.


Exit #退出


or so Import


Mysql-uzabbix-p123456-hlocalhost Zabbix </usr/local/src/zabbix-3.2.0/database/mysql/schema.sql


Mysql-uzabbix-p123456-hlocalhost Zabbix </usr/local/src/zabbix-3.2.0/database/mysql/images.sql


Mysql-uzabbix-p123456-hlocalhost Zabbix </usr/local/src/zabbix-3.2.0/database/mysql/data.sql


Cd/usr/lib64/mysql #32位系统为/usr/lib/mysql, note that the system version may not be the same as the file version, this is 16.0.0


Ln-s libmysqlclient.so.16.0.0 libmysqlclient.so #添加软连接


Ln-s libmysqlclient_r.so.16.0.0 libmysqlclient_r.so #添加软连接


Second, installation Zabbix


1. Add Users:


Groupadd Zabbix #创建用户组zabbix


Useradd zabbix-g zabbix-s/bin/false #创建用户zabbix, and add user Zabbix to user group Zabbix


2. Install the dependent package #CentOS使用yum命令安装


Yum Install Net-snmp-devel Curl curl-devel mysql-devel gcc


Note: If the above package is installed when you install the Web environment lamp or LNMP, this step can be ignored


3, Installation Zabbix


Ln-s/usr/local/lib/libiconv.so.2/usr/lib/libiconv.so.2 #添加软连接


/sbin/ldconfig #使配置立即生效


cd/usr/local/src/zabbix-3.2.0 #进入安装目录


./configure--prefix=/usr/local/zabbix--enable-server--enable-agent--with-net-snmp--with-libcurl--enable-proxy- -with-mysql=/usr/bin/mysql_config #配置


Make #编译


Make install #安装


Ln-s/usr/local/zabbix/sbin/*/usr/local/sbin/#添加系统软连接


Ln-s/usr/local/zabbix/bin/*/usr/local/bin/#添加系统软连接


Description: Find/-name mysql_config lookup location, if not mysql_config, need to install Yum install Mysql-devel


4. Add the port corresponding to the Zabbix service


Vi/etc/services #编辑, add the following code at the end


# Zabbix


Zabbix-agent 10050/tcp # Zabbix Agent


Zabbix-agent 10050/UDP # Zabbix Agent


Zabbix-trapper 10051/tcp # Zabbix Trapper


Zabbix-trapper 10051/UDP # Zabbix Trapper


: wq! #保存退出


5. Modify the Zabbix configuration file


Cd/usr/local/zabbix/etc


Vi/usr/local/zabbix/etc/zabbix_server.conf


Dbname=zabbix #数据库名称


Dbuser=zabbix #数据库用户名


dbpassword=123456 #数据库密码


listenip=127.0.0.1 #数据库ip地址


Alertscriptspath=/usr/local/zabbix/share/zabbix/alertscripts #zabbix运行脚本存放目录


: wq! #保存退出


Vi/usr/local/zabbix/etc/zabbix_agentd.conf


include=/usr/local/zabbix/etc/zabbix_agentd.conf.d/


Unsafeuserparameters=1 #启用自定义key


: wq! #保存退出


6. Add Boot Script


Cp/usr/local/src/zabbix-2.2.6/misc/init.d/fedora/core/zabbix_server/etc/rc.d/init.d/zabbix_server #服务端


Cp/usr/local/src/zabbix-2.2.6/misc/init.d/fedora/core/zabbix_agentd/etc/rc.d/init.d/zabbix_agentd #客户端


chmod +x/etc/rc.d/init.d/zabbix_server #添加脚本执行权限


chmod +x/etc/rc.d/init.d/zabbix_agentd #添加脚本执行权限


Chkconfig Zabbix_server on #添加开机启动


Chkconfig Zabbix_agentd on #添加开机启动


7. Modify the Zabbix installation directory in the Zabbix boot script


Vi/etc/rc.d/init.d/zabbix_server #编辑服务端配置文件


basedir=/usr/local/zabbix/#zabbix安装目录


: wq! #保存退出


Vi/etc/rc.d/init.d/zabbix_agentd #编辑客户端配置文件


basedir=/usr/local/zabbix/#zabbix安装目录


: wq! #保存退出


Third, configure the Web site


cd/usr/local/src/zabbix-3.2.0


Cp-r/usr/local/src/zabbix-3.2.0/frontends/php/var/www/html/zabbix


Chown Apache.apache-r/var/www/html/zabbix


Service Zabbix_server Start #启动zabbix服务端


Service Zabbix_agentd Start #启动zabbix客户端


Iv. modifying PHP configuration file parameters


1, Vi/etc/php.ini #编辑修改


Post_max_size =16m


Max_execution_time =300


Max_input_time =300


: wq! #保存退出


2. Yum Install php-fpm #如果没安装的话请执行


V. Installation of the Web


Open in Browser:


http://192.168.40.131/zabbix/php/setup.php

Web side has a problem error "PHP parseerror:syntax error, unexpected ' [' in/var/www/html/index.php on line 29" from the new download zabbix-2.4.8.tar.gz the Web End copy to the Web site root directory.


Check the system environment settings, must all be OK, in order to continue


# wget http://iweb.dl.sourceforge.net/project/zabbix/ZABBIX%20Latest%20Stable/2.4.8/zabbix-2.4.8.tar.gz



Next


Configuring MySQL Database Information


Database:mysql


Database host:127.0.0.1


Database port:use Default Port


Database Name:zabbix


User:zabbix


password:123456


Test connection #测试数据库连接是否正常, indicating that OK is passed


Next


Next Default


Next


Finish installation Complete


3. Open in the browser:


http://192.168.40.131/zabbix/php


Account: admin


Password: Zabbix


Sign in Login



Click Profile


Language:chinese (ZH_CN) #简体中文


Point Save Save


After you exit the site and log back in,


The default interface is already displayed in Chinese

This article is from the "Legend of the Hungry Wolf" blog, please be sure to keep this source http://9548010.blog.51cto.com/9538010/1869065

Zabbix Server Setup

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.