[ root@centos ~]# cat /etc/redhat-release
CentOS release 6.9(Final)[root@centos ~]# uname -a
Linux lb02 2.6.32-696.el6.x86_64 #1 SMP Tue Mar 2119:29:05 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
Server configuration
The first milestone: deploy LNP architecture on m01
cd /server/scripts
sh nginx_install.sh
sh php_install.sh
#! /bin/bash
# base setting
mkdir -p /server/tools
## install nginx
killall nginx
yum install -y pcre-devel openssl-devel
useradd -M -s /sbin/nologin www -u 501
cd /server/tools/
\ rm -rf /application/nginx-1.10.2
wget http://nginx.org/download/nginx-1.10.2.tar.gz
tar xf nginx-1.10.2.tar.gz
cd /server/tools/nginx-1.10.2./configure --prefix=/application/nginx-1.10.2--user=www --group=www --with-http_stub_status_module --with-http_ssl_module
make
make install
ln -sf /application/nginx-1.10.2/application/nginx
cd /application/nginx/conf/
egrep -v "#|^$" nginx.conf.default>nginx.conf
/application/nginx/sbin/nginx
#! /bin/bash
killall php-fpm
killall php-fpm
# devel anzhuang
yum install zlib-devel libxml2-devel libjpeg-devel libjpeg-turbo-devel libiconv-devel freetype-devel libpng-devel gd-devel libcurl-devel libxslt-devel -y
yum install -y zlib-devel libxml2-devel libjpeg-devel libjpeg-turbo-devel libiconv-devel freetype-devel libpng-devel gd-devel libcurl-devel libxslt-devel
# libiconv INSTALL
cd /server/tools
http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz
tar zxf libiconv-1.14.tar.gz
cd libiconv-1.14./configure --prefix=/usr/local/libiconv
make
make install
# by epel yum
yum -y install libmcrypt-devel mhash mcrypt
\ rm -rf /application/php-5.5.32
##### install php
cd /server/tools/
# wget http://10.0.0.250/tools/php-5.5.32.tar.gz
tar xf php-5.5.32.tar.gz
cd /server/tools/php-5.5.32
# set php config ##########################
. /configure \
- - prefix=/application/php-5.5.32 \
- - with-mysql=mysqlnd \
- - with-mysqli=mysqlnd \
- - with-pdo-mysql=mysqlnd \
- - with-iconv-dir=/usr/local/libiconv \
- - with-freetype-dir \
- - with-jpeg-dir \
- - with-png-dir \
- - with-zlib \
- - with-libxml-dir=/usr \
- - enable-xml \
- - disable-rpath \
- - enable-bcmath \
- - enable-shmop \
- - enable-sysvsem \
- - enable-inline-optimization \
- - with-curl \
- - enable-mbregex \
- - enable-fpm \
- - enable-mbstring \
- - with-mcrypt \
- - with-gd \
- - enable-gd-native-ttf \
- - with-openssl \
- - with-mhash \
- - enable-pcntl \
- - enable-sockets \
- - with-xmlrpc \
- - enable-soap \
- - enable-short-tags \
- - enable-static \
- - with-xsl \
- - with-fpm-user=www \
- - with-fpm-group=www \
- - enable-ftp \
- - enable-opcache=no \
- - with-gettext
# fangchuo
# ln -s /application/mysql/lib/libmysqlclient.so.18/usr/lib64/
touch ext/phar/phar.phar
make && make install
ln -sf /application/php-5.5.32/application/php
cd /server/tools/php-5.5.32
\ cp php.ini-production /application/php/lib/php.ini
cd /application/php/etc/
\ cp php-fpm.conf.default php-fpm.conf
/application/php/sbin/php-fpm
The second milestone: Create the users needed to run zabbix
useradd zabbix -M -s /sbin/nologin -u 1010
The third milestone: Create the required database and authorized users
mysql> create database zabbix character set utf8;
mysql> grant all on zabbix.* to zabbix@'172.16.1.0/255.255.255.0' identified by 'oldboy123';
mysql> flush privileges;
The fourth milestone: download zabbix source code package, compile and install
yum install libdbi-dbd-mysql mysql-devel net-snmp-devel -y
wget https://jaist.dl.sourceforge.net/project/zabbix/ZABBIX%20Latest%20Stable/2.2.20/zabbix-2.2.20.tar.gz
tar zxf zabbix-2.2.20.tar.gz
cd zabbix-2.2.20./configure --prefix=/application/zabbix-2.2.20--enable-server --enable-agent --with-net-snmp --with-libcurl --with-mysqli=mysqlnd --with-mysql=mysqlnd
make && make install
The fifth milestone: creating soft connections
ln -sf /application/zabbix-2.2.20/application/zabbix
The sixth milestone: Import the imported data into the database
cd /server/tools/zabbix-2.0.6/database/mysql/
mysql -uzabbix -poldboy123 zabbix -h 10.0.0.51< schema.sql
mysql -uzabbix -poldboy123 zabbix -h 10.0.0.51< images.sql
mysql -uzabbix -poldboy123 zabbix -h 10.0.0.51< data.sql
Seventh Milestone: Define Service Port
vim /etc/services ##Add the following at the end
zabbix-agent 10050/tcp # Zabbix Agent
zabbix-agent 10050/udp # Zabbix Agent
zabbix-trapper 10051/udp # Zabbix Trapper
zabbix-trapper 10051/tcp # Zabbix Trapper
Eighth milestone: Modify the configuration file
# vim /application/zabbix/etc/zabbix_server.conf
# egrep -v "#|^$"/application/zabbix/etc/zabbix_server.conf
LogFile=/tmp/zabbix_server.log
PidFile=/tmp/zabbix_server.pid
DBHost=172.16.1.51
DBName=zabbix
DBUser=zabbix
DBPassword=oldboy123
The ninth milestone: Copy the startup script
cd /server/tools/zabbix-2.2.20
cp -a misc/init.d/fedora/core/zabbix_server /etc/init.d/zabbix
The tenth milestone: modify the startup script
vim /etc/init.d/zabbix_server
BASEDIR=/application/zabbix //zabbix installation location
CONFILE=$BASEDIR/etc/zabbix_server.conf //Define the zabbix configuration file location
## Search for the item start and modify the startup options
# functions
start(){if[ $RUNNING -eq 1]
then
echo "$0 $ARG: $BINARY_NAME (pid $PID) already running"else
action $"Starting $BINARY_NAME: " $FULLPATH -c $CONFILE //Add this line-c $CONFILE
touch /var/lock/subsys/$BINARY_NAME
fi
}
# Write the service to boot automatically
echo "/etc/init.d/zabbix start">>/etc/rc.local
The eleventh milestone: copy the web code to the site directory
rsync -az /server/tools/zabbix-2.2.20/frontends/php//application/nginx/html/zabbix/
Pay attention to modify the belonging group of the site directory, otherwise there will be problems during installation
chown -R www.www /application/nginx/html/
Twelfth Milestone: Start the service
[ root@m01 init.d]# /etc/init.d/zabbix start
Starting zabbix_server:[ OK ]
The thirteenth milestone: modify the php configuration file
cd /application/php/lib/
sed -i '/^;default_charset/a\default_charset = "UTF-8"' php.ini
sed -i '/^expose_php/cexpose_php = Off'/etc/php.ini
sed -i '/^max_execution_time/cmax_execution_time = 300' php.ini
sed -i '/^max_input_time/cmax_input_time = 300' php.ini
sed -i '/^memory_limit/cmemory_limit = 256M' php.ini
sed -i '/^post_max_size/cpost_max_size = 32M' php.ini
sed -i '/^upload_max_filesize/cupload_max_filesize = 300M' php.ini
sed -i '/^max_file_uploads/cmax_file_uploads = 30' php.ini
sed -i '/^;date.timezone/cdate.timezone = "PRC"' php.ini
After modifying the network php configuration file, restart the php service.
Fourteenth milestone: software configuration configuration
Client configuration
The first milestone: download the client and install it
mkdir -p /application/zabbix_agents /server/tools
cd /server/tools
wget http://www.zabbix.com/downloads/2.0.6/zabbix_agents_2.0.6.linux2_6.amd64.tar.gz
tar xf zabbix_agents_2.0.6.linux2_6.amd64.tar.gz -C /application/zabbix_agents/
The second milestone: modify the client configuration file
[ root@web03 conf]# tail -4/application/zabbix_agents/conf/zabbix_agentd.conf
LogFile=/tmp/zabbix_agentd.log
Server=172.16.1.61 #Management host address
ServerActive=172.16.1.61 #Active management host address
Hostname=172.16.1.9 #Client address
The third milestone: Push the startup script to the managed end
[ root@m01 scripts]# rsync -avz /server/tools/zabbix-2.2.20/misc/init.d/fedora/core/zabbix_agentd 172.16.1.9:/etc/init.d/zabbix_agentd
sending incremental file list
zabbix_agentd
sent 1139 bytes received 31 bytes 780.00 bytes/sec
total size is 2170 speedup is 1.85
# Zabbix-Directory
BASEDIR=/application/zabbix_agents
CONFILE=$BASEDIR/conf/zabbix_agentd.conf
## Search for the item start and modify the startup options
# functions
start(){if[ $RUNNING -eq 1]
then
echo "$0 $ARG: $BINARY_NAME (pid $PID) already running"else
action $"Starting $BINARY_NAME: " $FULLPATH -c $CONFILE //Add this line-c $CONFILE
touch /var/lock/subsys/$BINARY_NAME
fi
}
Fourth milestone: start service
Before starting the service, you need to create a zabbix user, otherwise you will be prompted that it cannot be started without a zabbix user
useradd zabbix -M -s /sbin/nologin -u 1010
/etc/init.d/zabbix_agentd start
echo '/etc/init.d/zabbix_agentd start'>>/etc/rc.local
This concludes the client configuration.
web management configuration
The first milestone: adding a host
**The second milestone: fully clone the host template and quickly add new hosts. **
For more configuration of the web interface, please refer to the official website. https://www.zabbix.com/documentation/3.4/zh/start
? problem:
After changing to the Chinese interface, I found the Chinese in the image
Solution:
Enter C:\Windows\Fonts in the address bar of the Windows Explorer
[ root@m01 ~]# cd /application/nginx/html/zabbix/fonts/[root@m01 fonts]# ls
DejaVuSans.ttf
3 ) Rename the uploaded font file to DejaVuSans.ttf (note the original file backup)
[ root@m01 fonts]# mv xxx.ttf DejaVuSans.ttf
Recommended Posts