CentOS 6.6 下Zabbix 3.0 的安装部署(2)

# yum install tree nmap lrzsz dos2unix -y
# mkdir -p /usr/local/mysql-5.5.32
[root@zabbix_3.0]# tar -zxvf mysql-5.5.32-linux2.6-x86_64.tar.gz
[root@zabbix_3.0]# mv mysql-5.5.32-linux2.6-x86_64 /usr/local/mysql-5.5.32
[root@zabbix_3.0]# ln -s /usr/local/mysql-5.5.32/ /usr/local/mysql
[root@zabbix_3.0]# useradd mysql -s /sbin/nologin -M
[root@zabbix_3.0]# chown -R mysql.mysql /usr/local/mysql
[root@zabbix_3.0]# cd /usr/local/mysql
[root@zabbix_3.0 mysql]
-- 创建系统表
# ./scripts/mysql_install_db --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data/ --user=mysql
cp support-files/mysql.server /etc/init.d/mysqld
--这步不用做sed -i 's#/usr/local/mysql#/application/mysql#g' /application/mysql/bin/mysqld_safe /etc/init.d/mysqld
cp support-files/my-small.cnf /etc/my.cnf
cp:是否覆盖"/etc/my.cnf"? y
echo 'export PATH=/usr/local/mysql/bin:$PATH' >>/etc/profile
# source /etc/profile
[root@zabbix_3.0]# echo $PATH
/usr/local/mysql/bin:/usr/lib64/qt-3.3/bin:/usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin
[root@zabbix_3.0 application]# cp -a /application/mysql/bin/* /usr/local/sbin
[root@zabbix_3.0 application]#service mysqld start
[root@zabbix_3.0 application]#chkconfig mysqld on
[root@zabbix_3.0 application]#mysqladmin -uroot password 123456

三、PHP安装:

1.yum -y install zlib-devel libxml2-devel libjpeg-devel libiconv-devel freetype-devel libpng-devel gd-devel curl-devel libxslt-devel
2.wget
tar zxf libiconv-1.14.tar.gz
mkdir -p /usr/local/libiconv
cd libiconv-1.14
./configure --prefix=/usr/local/libiconv
make && make install
cd ../
3.yum -y install libmcrypt-devel mhash mcrypt --这3个rpm包必须安装,CentOS6.6系统的标准YUM源里没有, 需要从EPEL源上找到下载安装
ln -s /usr/local/mysql/lib/libmysqlclient.so.18 /usr/lib64/
php 5.5.30:( --with-mysqli=mysqlnd和--with-gettext一定要加上,否则前者不装时安装 zabbix时database type没有选项 默认出来的数据库是SqLite 3,且不能切换 ,后者不装时,会报PHP gettext warning)
mkdir -p /usr/local/php-5.5.30
tar -zxvf php-5.5.30.tar.gz
cd php-5.5.30
./configure \
--prefix=/usr/local/php-5.5.30 \
--with-mysql=/usr/local/mysql/ \
--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 \
--with-gettext \
--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=nginx \
--with-fpm-group=nginx \
--enable-ftp \
--enable-opcache=no回车
+-----------------------------------------------------------------------------------+
| License:                                                                        |
| This software is subject to the PHP License, available in this        |
| distribution in the file LICENSE. By continuing this installation      |
| process, you are bound by the terms of this license agreement.        |
| If you do not agree with the terms of this license, you must abort |
| the installation process at this point.                                    |
+-----------------------------------------------------------------------------------+
Thank you for using PHP.
config.status: creating php5.spec
config.status: creating main/build-defs.h
config.status: creating scripts/phpize
config.status: creating scripts/man1/phpize.1
config.status: creating scripts/php-config
config.status: creating scripts/man1/php-config.1
config.status: creating sapi/cli/php.1
config.status: creating sapi/fpm/php-fpm.conf
config.status: creating sapi/fpm/init.d.php-fpm
config.status: creating sapi/fpm/php-fpm.service
config.status: creating sapi/fpm/php-fpm.8
config.status: creating sapi/fpm/status.html
config.status: creating sapi/cgi/php-cgi.1
config.status: creating ext/phar/phar.1
config.status: creating ext/phar/phar.phar.1
config.status: creating main/php_config.h
config.status: executing default commands
#make && make install
Generating phar.php
Generating phar.phar
PEAR package PHP_Archive not installed: generated phar will require PHP's phar extension be enabled.
directorytreeiterator.inc
directorygraphiterator.inc
invertedregexiterator.inc
clicommand.inc
pharcommand.inc
phar.inc
Build complete.
Don't forget to run 'make test'.
Installing PHP CLI binary: /usr/local/php-5.5.30/bin/
Installing PHP CLI man page: /usr/local/php-5.5.30/php/man/man1/
Installing PHP FPM binary: /usr/local/php-5.5.30/sbin/
Installing PHP FPM config: /usr/local/php-5.5.30/etc/
Installing PHP FPM man page: /usr/local/php-5.5.30/php/man/man8/
Installing PHP FPM status page: /usr/local/php-5.5.30/php/php/fpm/
Installing PHP CGI binary: /usr/local/php-5.5.30/bin/
Installing PHP CGI man page: /usr/local/php-5.5.30/php/man/man1/
Installing build environment: /usr/local/php-5.5.30/lib/php/build/
Installing header files: /usr/local/php-5.5.30/include/php/
Installing helper programs: /usr/local/php-5.5.30/bin/
program: phpize
program: php-config
Installing man pages: /usr/local/php-5.5.30/php/man/man1/
page: phpize.1
page: php-config.1
Installing PEAR environment: /usr/local/php-5.5.30/lib/php/
[PEAR] Archive_Tar - installed: 1.3.12
[PEAR] Console_Getopt - installed: 1.3.1
[PEAR] Structures_Graph- installed: 1.0.4
[PEAR] XML_Util - installed: 1.2.3
[PEAR] PEAR - installed: 1.9.5
Wrote PEAR system config file at: /usr/local/php-5.5.30/etc/pear.conf
You may want to add: /usr/local/php-5.5.30/lib/php to your php.ini include_path
/root/software/php-5.5.30/build/shtool install -c ext/phar/phar.phar /usr/local/php-5.5.30/bin
ln -s -f phar.phar /usr/local/php-5.5.30/bin/phar
Installing PDO headers: /usr/local/php-5.5.30/include/php/ext/pdo/
[root@zabbix_3.0 php-5.5.30]# make test --此步可不做,是进行测试
[root@zabbix_3.0 php-5.5.30]# ln -s /usr/local/php-5.5.30/ /usr/local/php
生成配置php配置文件
[root@zabbix_3.0 php-5.5.30]# pwd
/root/software/php-5.5.30
[root@zabbix_3.0 php-5.5.30]# cp php.ini-production /usr/local/php/lib/php.ini
[root@zabbix_3.0 php-5.5.30]# cd /usr/local/php/etc/
[root@zabbix_3.0 etc]# pwd
/usr/local/php/etc
[root@zabbix_3.0 etc]# cp php-fpm.conf.default php-fpm.conf
php启动测试
[root@zabbix_3.0 etc]# /usr/local/php/sbin/php-fpm
验证是否成功启动
[root@zabbix_3.0 etc]# netstat -lntup|grep php-fpm

验证LNMP安装是否成功。

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/14298.html