Zabbix installation
System: Centos 6.8 software package: mysql-5.6.35.tar.g nginx-1.10.3.tar.gz php-7.1.2.tar.gzlibmcrypt-2.5.7.tar.gz pcre-8.40.tar.gzzabbix installation using LNMP architecture installation, the following is the detailed installation process: First build LNMP architecture platform 1.yum installation related dependency packages
yum -y install gcc gcc-c++ autoconf automake make cmake pcre pcre-devel openssl openssl-devel ncurses-devel libxml2-devel bison zlib-devel libtool-ltdl-devel libtool flex php-pear curl curl-devel php-pear libjpeg-devel
2. Install pcre , support rewrite , just decompress, followed by nginx./ configure Specify directory--with-pcre=/usr/local/src/pcre-8.40 to compile, if you use yum installation, you need to use--with-pcre
tar xf pcre-8.40.tar.gz
3. Source code installation nginx
tar xf nginx-1.10.3.tar.gz
cd nginx-1.10.3
./ configure --prefix=/usr/local/nginx --with-http_ssl_module --with-http_stub_status_module --with-http_addition_module --with-http_dav_module --with-http_flv_module --with-http_mp4_module --with-pcre=/usr/local/src/pcre-8.40
make && make install
Start and count firewall rules, allowing 80 passes
/usr/local/nginx/sbin/nginx
iptables -I INPUT -p tcp --dport 80 -j ACCEPT
service iptables save
Create user nginx
useradd -r -s /sbin/nologin nginx
Edit nginx configuration file, support php, modify the following location
Add nginx service to boot
Testing:
4. Source code installation mysql
Resolving Dependency
yum -y install gcc gcc-c++ autoconf automake make cmake pcre pcre-devel openssl openssl-devel ncurses-devel libxml2-devel bison zlib-devel libtool-ltdl-devel libtool flex
#Common Users and Groups
groupadd mysql
useradd -r -s /sbin/nologin -g mysql mysql
mkdir -p /data/mysqldata
cd /usr/local/src
tar xf mysql-5.6.35.tar.gz
cd /usr/local/src/mysql-5.6.35
#cmake compile
cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DMYSQL_DATADIR=/data/mysqldata -DSYSCONFDIR=/etc -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_ARCHIVE_STORAGE_ENGINE=1 -DWITH_MYISAM_STORAGE_ENGIEN=1 -DWITH_BLACKHOLE_STORAGE_ENGINE=1 -DWITH_MEMORY_STORAGE_ENGINE=1 -DWITH_PARTITION_STORAGE_ENGINE=1 -DWITH_READLINE=1 -DWITH_SSL=system -DWITH_ZLIB=system -DMYSQL_UNIX_ADDR=/tmp/mysql.sock -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci
make && make install
#Database initialization
/usr/local/mysql/scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql/ --datadir=/data/mysqldata
#Modify owner and group
chown -R mysql.mysql /usr/local/mysql
chown -R mysql.mysql /data/mysqldata
#Edit configuration file
cd /usr/local/mysql
\cp -rf my.cnf /etc/my.cnf
#Setting environment variables
PATH=$PATH:/usr/local/mysql/bin/
echo "export PATH=$PATH:/usr/local/mysql/bin/" >> /etc/profile
source /etc/profile
#Start the service, set the boot to start automatically
cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysqld
service mysqld start
chkconfig --add mysqld
chkconfig mysqld on
#Security initialization settings
/usr/local/mysql/bin/mysql_secure_installation
5. Build and install php
#Install libcrm
tar xf libmcrypt-2.5.7.tar.gz
cd libmcrypt-2.5.7
./ configure --prefix=/usr/local/libmcrypt
make && make install
#Add Dynamic Link Library
vim /etc/ld.so.conf
include ld.so.conf.d/*.conf #This line is original
/usr/local/libmcrypt/lib #This line adds
/usr/local/mysql/lib #This line adds
Run:
ldconfig
echo 'ldconfig' >> /etc/rc.local
#Compile installation
tar -xf php-7.1.2.tar.gz
cd php-7.1.2
./ configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php --with-mysqli=/usr/local/mysql/bin/mysql_config --with-pdo-mysql=mysqlnd --with-iconv-dir=/usr/local --with-freetype-dir=/usr/local --with-jpeg-dir=/usr/local --with-png-dir=/usr/local --with-zlib-dir=/usr/local --with-libxml-dir=/usr/local --enable-bcmath --enable-shmop --enable-sysvsem --with-curl --enable-mbstring --enable-fpm --with-gd --enable-gd-native-ttf --with-openssl --with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-zip --enable-soap --with-mcrypt=/usr/local/libmcrypt --with-freetype-dir --enable-calendar --with-iconv-dir=/usr/local --with-gettext
make && make install
#Provide configuration files for php
cp php.ini-production /usr/local/php/php.ini
cp /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf
#Copy www.conf and change user=nobody group=nobody to nginx
cp /usr/local/php/etc/php-fpm.d/www.conf.default /usr/local/php/etc/php-fpm.d/www.conf
vim usr/local/php/etc/php-fpm.d/www.conf
user = nginx
group = nginx
#Modify nginx , add index.php default home page
location / {
root html;
index index.php index.html index.htm;
}
Start:
/usr/local/php/sbin/php-fpm
Test: echo "" >/usr/local/nginx/html/index. php
So far, the LNMP platform has been built.
Next, we proceed to install zabbix
#Install zabbix
Create database, set up authorized account
create database zabbix;
grant all on zabbix.* to 'zabbix'@localhost identified by 'zabbix';
flush privileges;
2. Unzip zabbix , import the database files that come with zabbix installation package into the new zabbix database, in order, otherwise there will be problems
mysql -uzabbix -pzabbix zabbix
< database/mysql/schema.sql mysql -uzabbix -pzabbix zabbix < database/mysql/p_w_picpaths.sql mysql -uzabbix -pzabbix zabbix < database/mysql/data.sql 3.编译安装zabbix yum install -y net-snmp-devel net-snmp-config ./configure --prefix=/usr/local/zabbix --enable-server --enable-agent --with-mysql=/usr/local/mysql/bin/mysql_config --with-net-snmp --with-libcurl make install # 注意这里不需要make #配置 zabbix Server vim /usr/local/zabbix/etc/zabbix_server.conf DBHost=localhost #默认注释掉了,直接取消注释即可 DBName=zabbix #数据库用户,我们授权的用户也是 zabbix DBUser=zabbix #默认是 root,我们授权的用户是 zabbix DBPassword=zabbix #密码我们授权的也是 zabbix #配置agentd.conf,修改如下位置 UnsafeUserParameters=1 #创建zabbix 用户,如果 zabbix 用户不存在, 将以 root 运行,新建之后,如果 zabbix 存在,那么久直接可以用 zabbix 运行 useradd -r -s /sbin/nologin zabbix #运行zabbix 服务器 /usr/local/zabbix/sbin/zabbix_server #设置开机启动 echo /usr/local/zabbix/sbin/zabbix_server >> /etc/rc.local
#View ports:
netstat -antup | grep zabbix
#edit php page control file
\cp -af /usr/local/src/zabbix-3.2.3/frontends/php/* /usr/local/nginx/html/
#restart ngxin
/usr/local/nginx/sbin/nginx -s reload
Open the browser, enter the ip address, and start configuring zabbix, as shown below:
Following the error prompt, correct to the required data and time zone:
When installing, there will be several errors, modify vim/usr/local/php/php.ini as required
post_max_size = 16M #modify
max_execution_time = 300 #Modify
max_input_time = 300 #modify
date.timezone = Asia/Shanghai #This line has comments, go comment and modify
#If refreshing the page directly is invalid, find the process, kill it, reopen php, and then refresh it
#If the page is invalid, find the process, kill it, reopen php, and then refresh it, you can
ps -ef |grep php
kill xxxxxx
/usr/local/php/sbin/php-fpm
Enter database password:
Skip this step directly, as shown below:
The following problem occurs, download the prompted file to the specified directory, as shown below:
This problem occurs after the installation is completed, this is because PHP 7.1.0 type enhancement, the processing method is also very simple to find the Zabbix WEB directory include/func.inc.php file
sed -i '/$last = strtolower(substr($val, -1));/a$val = substr($val,0,-1);' /usr/local/nginx/html/include/func.inc.php
Here, the installation is complete.
#Start agent monitoring server itself
/usr/local/zabbix/sbin/zabbix_agentd
At this point, zabbix installation is complete, the subsequent specific monitoring configuration, the next section continues