Installation zabbix server under centos7

Installation package is first prepared: 
 PHP - 5.6 . 36 .tar.gz 
ZABBIX - 4.0 . 0 .tar.gz 
MySQL - 5.7 . 26 is . -Linux have glibc2- 12 is - x86_64.tar.gz 
Nginx - 1.12 . 2 .tar.gz 
then installation dependencies need 
yum the install GCC GCC -C ++ OpenSSL OpenSSL-devel PCRE PCRE-devel Gd-devel the libxml2-devel libcurl-devel libjpeg-devel the libpng-devel OpenSSL-devel the libxslt-devel the make the libevent-devel NET-SNMP-devel MySQL devel--community - the y- 
extracting package 
tar xzvf nginx - 1.12 . 2.tar.gz 
the tar xzvf PHP - 5.6 . 36 .tar.gz 
the tar xzvf MySQL - 5.7 . 26 is . -linux have glibc2- 12 is - x86_64.tar.gz 
the tar xzvf ZABBIX - 4.0 . 0 .tar.gz 
then proceeds to extract the good compile and install nginx installation directory 
 cd nginx - 1.12 . 2 /    # to enter the installation directory 
useradd -r -s / sbin / nologin # nginx nginx create user 
. / the configure --user = = nginx nginx --group --prefix = / usr / local / nginx --with-http_stub_status_module --with- http_ssl_module # compile 
the make && make install  #编译安装
/usr/local/nginx/sbin/nginx   #启动nginx
接着安装PHP
cd ../php-5.6.36/   #进入PHP解压安装目录
 ./configure --prefix=/usr/local/php \
 --with-config-file-path=/usr/local/php/etc \
 --enable-fpm --enable-opcache \
 --with-mysql --with-mysqli  \
 --enable-session --with-zlib --with-curl --with-gd \
 --with-jpeg-dir --with-png-dir --with-freetype-dir \
 --enable-mbstring --enable-xmlwriter --enable-xmlreader \
 --enable-xml --enable-sockets --enable-bcmath --with-gettext          #编译
the make&&make install # install 
CP the php.ini -production / usr / local / PHP / etc / the php.ini 
CP SAPI /fpm/php-fpm.conf / usr / local / PHP / etc / PHP- fpm.conf 
CP SAPI / FPM /etc/init.d/php- /init.d.php-fpm FPM # copy module file 
chmod + the X-/etc/init.d/php- FPM # increased execute permissions
 /etc/init.d/php- FPM Start # Enable PHP 
then install MySQL 
mv .. 
mv MySQL - 5.7 . 26 . -linux-glibc2 12 -x86_64 / usr / local / MySQL directory replication # 
cd / usr / local / MySQL /               # to enter the installation directory 
useradd   -s / sbin / nologin mysql # create a user
mkdir etc logs # Create a folder 
bin / mysqld --initialize --basedir = / usr / local / MySQL / --datadir = / usr / local / MySQL / the Data --user = MySQL # compile ps: will eventually compiled emergence of a string of random passwords 
vim / usr / local / MySQL / etc / my.cnf # edit the configuration file 
[mysqld] 
daemonize = ON 
the User = MySQL 
Port = 3306 
basedir = / usr / local / MySQL 
datadir = / usr / local / MySQL / Data 
Socket = / tmp / mysql.sock 
the bind -address = 0.0 . 0.0 
PID -file = / usr / local / MySQL /mysqld.pid 
Character - SET -server = UTF8 
collation -server = utf8_general_ci 
max_connections = 1024 
log -error = / usr / local / MySQL / logs / mysqld.log the configuration files # 
Vim / lib / systemd / System / mysqld.service # edit the startup configuration file 
[Unit] 
the Description = MySQL Server 
Documentation = man: mysqld ( 8 ) 
Documentation = HTTP: // dev.mysql.com/doc/refman/en/using-systemd.html 
the After = network.target 
the After = syslog .target 
[the Install] 
WantedBy = multi- user.target 
[-Service] 
the User = MySQL 
Group = MySQL 
the Type = the forking 
TimeoutSec = 0 
PermissionsStartOnly = to true 
ExecStart = / usr / local / MySQL / bin / mysqld --defaults-File = / usr / local / MySQL / etc / My .cnf 
LimitNOFILE = 5000 
the Restart = ON- failure 
RestartPreventExitStatus = 1 
PrivateTmp = false         # startup configuration file contents 
chown - . R mysql # change your user 
systemctl start mysqld.service # start mysql 
bin / MySQL-uroot-- the p-# to enter the MySQL database
the User root @ the ALTER ' localhost ' IDENTIFIED by ' 123456 ' ; # to enter the default password for the database into 123456 
the Create Database zabbix; # create database zabbix 
Grant All ON zabbix. * to ' zabbix ' @ ' localhost ' IDENTIFIED by ' 123456 ' ; # to the database authorized 
quit # exit the database 
Next, install zabbix 
 cd ~ / zabbix- 4.0 . 0 /    # to enter the software installation package directory 
groupadd zabbix # create a working group 
useradd -g zabbix zabbix -s / sbin / nologin # create a user
. / Configure --prefix = / usr / local / ZABBIX --enable --enable-Proxy-Server Agent --enable---with-MySQL = / usr / local / MySQL / bin / the mysql_config --with-NET - --with-libcurl --with- snmp libxml2 # compiler 
make install # install 
vim / usr / local / zabbix / etc / zabbix_server.conf # edit the startup configuration file 
DBHost = localhost 
DBName = zabbix 
DBUser = zabbix 
DBPassword = 123456 
LogFile = / usr / local / ZABBIX / log / ZABBIX / zabbix_server.log the configuration files # 
Vim / usr / lib / systemd / System / zabbix_server.service systemd compiled file # 
[Unit] 
the Description =Zabbix Server
After=syslog.target
After=network.target

[Service]
Environment="CONFFILE=/usr/local/zabbix/etc/zabbix_server.conf"
EnvironmentFile=-/etc/sysconfig/zabbix-server
Type=forking
Restart=on-failure
PIDFile=/tmp/zabbix_server.pid
KillMode=control-group
ExecStart=/usr/local/zabbix/sbin/zabbix_server -c $CONFFILE
ExecStop=/bin/kill -SIGTERM $MAINPID
RestartSec=10s
TimeoutSec=0 

[the Install] 
WantedBy = Multi- user.target # contents of the file 
mkdir / usr / local / zabbix / log / zabbix - the p-# Create a log folder 
Touch     / usr / local / zabbix / log / zabbix / zabbix_server.log create a log # file 
chmod 777 zabbix_server.log given permission # 
mkdir / var / lib / mysql # mysql create folders 
LN -s /tmp/mysql.sock / var / lib / mysql / mysql.sock # linked file 
LN -s / usr / local /mysql/lib/libmysqlclient.so. 20 / usr / lib64 # create a soft link 
systemctl start zabbix_server.service # start zabbix
/ usr / local / zabbix / sbin / zabbix_agentd agent # start 
the next data import and integration zabbix Nginx + PHP 
CD zabbix - 4.0 . 0 / Database / MySQL /      # of the store data into the directory
 / usr / local / mysql / bin / -uzabbix -p123456 ZABBIX MySQL < schema.sql # import data
 / usr / local / mysql / bin / mysql -uzabbix -p123456 zabbix < images.sql # import data
 / usr / local / mysql / bin / mysql -uzabbix -p123456 zabbix < data.sql import data # 
CP -rf frontends / PHP / * / usr / local / nginx / HTML / # will be copied to the front end zabbix nginx distribution directory 
vim /usr/local/php/etc/php.ini # Review profile php 
the max_execution_time = 300  
post_max_size = 16M
max_input_time directives in = 300
always_populate_raw_post_data = -1
date.timezone = Asia/Shanghai
mysqli.default_socket = /var/lib/mysql/mysql.sock   #配置文件
/etc/init.d/php-fpm restart     #重启php-fpm
vim /usr/local/nginx/conf/nginx.conf    #修改nginx的配置文件 
worker_processes  1;
events {
    worker_connections  1024;
}
http {
    include       mime.types;
    default_type  application/octet-stream;
    sendfile        on;
    keepalive_timeout  65;
    server {
        listen       80;
        server_name  localhost;
        location / {
            root   html;
            index.html index.htm index; 
        }
        location ~ \.php$ {
            the root HTML; 
            fastcgi_pass 127.0.0.1:9000; 
            fastcgi_index the index.php; 
            fastcgi_param SCRIPT_FILENAME $ $ DOCUMENT_ROOT fastcgi_script_name; 
            the include fastcgi_params; 
        }}} # configuration file 
/ usr / local / nginx / sbin / nginx - s rereload # reload Nginx 
systemctl mysqld.service the restart # restart the service 
input ip / zabbix.php after installation into the

 

Guess you like

Origin www.cnblogs.com/chengfenggood/p/11413833.html