zabbix 安装
安装LNMP平台
##1.安装开发软件包##
yum -y groupinstall "Development Tools"
2.安装依赖包
yum -y install libxml2* curl curl-devel libjpeg* libpng* libmcrypt* freetype-devel
wget http://www.atomicorp.com/installers/atomic
执行 sh ./atomic
yum -y install libmcrypt libmcrypt-devel
3.安装nginx
vi /etc/yum.repos.d/nginx.repo
[nginx]
name=nginx repo
baseurl=http://nginx.org/packages/centos/$releasever/$basearch/
gpgcheck=0
enabled=1
yum install nginx -y
#修改配置文件
##1.安装mysql##
yum install perl-DBD-MySQL libaio -y
2.下载mysql,二进制包。
mysql-5.6.35-linux-glibc2.5-x86_64.tar.gz
3.解压安装mysql
tar xf mysql-5.6.35-linux-glibc2.5-x86_64.tar.gz
mkdir -p /application
mv mysql-5.6.35-linux-glibc2.5-x86_64 /application/mysql
useradd -s /sbin/nologin -M mysql
chown -R mysql.mysql /application/mysql/
cd /application/mysql/
cp support-files/my-default.cnf /etc/my.cnf
cp support-files/mysql.server /etc/init.d/mysql
mkdir /application/data/3306 -p
./scripts/mysql_install_db --basedir=/application/mysql --datadir=/application/data/3306 --user=mysql
chmod +x /etc/init.d/mysql
echo -e "export PATH=/application/mysql/bin:\$PATH" >>/etc/profile
source /etc/profile
sed -i 's#/usr/local/mysql#/application/mysql#g' /application/mysql/bin/mysqld_safe
sed -i '18a basedir = /application/mysql' /etc/my.cnf
sed -i '19a datadir = /application/data/3306' /etc/my.cnf
sed -i '22a socket = /tmp/mysql.sock' /etc/my.cnf
service mysql start
##1.安装php##
php-5.6.30.tar.gz
tar xf php-5.6.30.tar.gz
useradd -s /sbin/nologin -M www
cd php-5.6.30
./configure --prefix=/application/php --with-config-file-path=/application/php/etc --enable-fpm --with-fpm-user=www --with-fpm-group=www --with-mysql=mysqlnd --with-mysql-sock=/tmp/mysql.sock --with-pdo-mysql=/application/mysql --with-libxml-dir --with-gd --with-jpeg-dir --with-png-dir --with-freetype-dir --with-iconv-dir --with-zlib-dir --with-mcrypt --enable-soap --enable-gd-native-ttf --enable-ftp --enable-mbstring --enable-exif --disable-ipv6 --with-pear --with-curl --with-openssl --enable-bcmath --enable-sockets
2 修改配置文件
cd /root/php-5.6.13
cp php.ini-production /application/php/etc/php.ini
cp /application/php/etc/php-fpm.conf.default /application/php/etc/php-fpm.conf
cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm
vim /usr/local/php/etc/php-fpm user=www group=www
chmod +x /etc/init.d/php-fpm
chkconfig php-fpm on
测试php
cd /usr/share/nginx/html
vim index.php
<?
phpinfo();
?>
##1.安装zabbix##
zabbix-3.2.6.tar.gz
1.解压
tar xf zabbix-3.2.6.tar.gz
useradd -u 8001 -M -s /sbin/nologin zabbix
yum install -y net-snmp-devel
mysql -u root -p123456 -e "create database zabbix;"
mysql -u root -p123456 -e "grant all privileges on zabbix.* to zabbix@localhost identified by 'zabbix';"
cd /root/zabbix-3.2.6
mysql -uzabbix -pzabbix zabbix < database/mysql/schema.sql
mysql -uzabbix -pzabbix zabbix < database/mysql/images.sql
mysql -uzabbix -pzabbix zabbix < database/mysql/data.sql
./configure --prefix=/application/zabbix --enable-server --enable-agent --with-mysql=/application/mysql/bin/mysql_config --with-net-snmp --with-libcurl && make install
sed -i -e '278s/#//g' -e '278s/0/1/' /application/zabbix/etc/zabbix_agentd.conf
cp fedora/core/zabbix_agentd /etc/init.d/
cp fedora/core/zabbix_server /etc/init.d/
sed -i '22s@/usr/local@/application/zabbix@' /etc/init.d/zabbix_server
sed -i '22s@/usr/local@/application/zabbix@' /etc/init.d/zabbix_agentd
cd /application/zabbix/etc
sed -i '77s/#//' zabbix_server.conf
sed -i '111s/#//' zabbix_server.conf
sed -i '111s/=/&zabbix/' zabbix_server.conf
cd /root/zabbix-3.2.6/frontends/php/
cp -r * /usr/share/nginx/html/
打开网页安装,红报错
8图--->php缺少mysqli扩展库,报错。
解决:
cd /root/php-5.6.30/ext/mysqli/
./configure --prefix=/application/mysqli -with-php-config=/application/php/bin/php-config -with-mysqli=/application/mysql/bin/mysql_config
make && make install
vim php.ini
添加
extension=mysqli.so
重启
/etc/init.d/php-fpm restart
9图,也一样方法解决,就能显示有中文。
extension=gettext.so
11图,把网页的文件下载下来,cp 到页面上面显示的路径。
12图,因为zabbix,没有启动,所以提示NO。
13图,因为缺少libmysqlclient.so.18.
解决:echo "/application/mysql/lib">>/etc/ld.so.conf
ldconfig
启动zabbix
/etc/init.d/zabbix_agentd start
/etc/init.d/zabbix_server start
安装完成!
开启监控server