预先安装:
yum install -y autoconf make automake imake cmake gcc gcc-c++ libaio libaio-devel bzr bison expat-devel libtool ncurses5-devel gd-devel libjpeg-devel libpng-devel libxml2-devel bzip2-devel libcurl-devel yum install pcre* yum install openssl* yum install epel-release yum clean all yum repolist
第一部分:安装MysqL 5.7
1. 首先下载MysqL Yum repository,CentOS 7对应的下载链接如下
wget http://dev.MysqL.com/get/MysqL57-community-release-el7-7.noarch.rpm
2. 下载完成之后安装下载好的rpm文件
yum localinstall MysqL57-community-release-el7-7.noarch.rpm
3. 安装完成之后验证MysqL YUM repository
yum repolist enabled | grep "MysqL.*-community.*"
如下图所示,表示验证成功:
4. 安装最新版的MysqL
yum install MysqL-community-server
5. 安装完成之后启动并查看MysqL状态:
service MysqLd start service MysqLd status
6. 手动验证MysqL安装的版本:
MysqL --version
7. 安装MysqL 5.7之后,MysqL会生成一个随机密码在/var/log/MysqLd.log文件中,使用如下命令查看密码:
grep 'temporary password' /var/log/MysqLd.log
8. 记录密码之后,运行 MysqL_secure_installation初始化MysqL,初始化过程中会提示输入随机密码
MysqL_secure_installation
9. 使用新设置的密码连接MysqL:
MysqL -u root -p
10. 至此,MysqL 5.7安装完成。
第二部门 安装Nginx
1. 首先下载Nginx的最新稳定版,本示例使用的版本是1.10,下载之后解压压缩包:
tar zxvf Nginx-1.10.1.tar.gz
2. 进入解压之后的Nginx目录,运行configure
./configure --prefix=/usr/local/Nginx --with-http_ssl_module --with-http_stub_status_module --with-pcre
3. 编译安装
make make install
4. 测试Nginx
/usr/local/Nginx/sbin/Nginx -t
第三部分 安装PHP
1. 首先安装开发软件包:
yum -y groupinstall "Development Tools"
2. 下载PHP最新稳定版,解压安装包,本示例使用的是PHP 5.6.25
tar -zxvf PHP-5.6.25.tar.gz
3. 切换到PHP目录,运行configure:
./configure -prefix=/usr/local/PHP -with-config-file-path=/usr/local/PHP/etc -with-bz2 -with-curl -enable-ftp -enable-sockets -disable-ipv6 -with-gd -with-jpeg-dir=/usr/local -with-png-dir=/usr/local -with-freetype-dir=/usr/local -enable-gd-native-ttf -with-iconv-dir=/usr/local -enable-mbstring -enable-calendar -with-gettext -with-libxml-dir=/usr/local -with-zlib -with-pdo-MysqL=MysqLnd -with-MysqLi=MysqLnd -with-MysqL=MysqLnd -enable-dom -enable-xml -enable-fpm -with-libdir=lib64 -enable-bcmath
4.
make make install
5. 复制安装包中的PHP.ini-production到 /usr/local/PHP/etc/PHP.ini
cp PHP.ini-production /usr/local/PHP/etc/PHP.ini
cp /usr/local/PHP/etc/PHP-fpm.conf.default.conf PHP-fpm.conf
6. 测试PHP安装是否成功。
/usr/local/PHP/sbin/PHP-fpm -t
7. 测试成功之后启动PHP
cp /usr/local/src/PHP-5.3.27/sapi/fpm/init.d.PHP-fpm /etc/init.d/PHP-fpm chmod 755 /etc/init.d/PHP-fpm
servicePHP-fpmstart
8. 添加到开机启动
chkconfig PHP-fpm on
9. 检查是否启动
ps aux |grep PHP-fpm netstat -ant |grep 9000
vim /usr/local/Nginx/conf/Nginx.conf
View Code
2. 创建PHP测试网页
vim /usr/local/Nginx/html/test.PHP
<?PHP PHPinfo(); ?>
3. 在浏览器中输入localhost/test.PHP,测试PHP页面
4. 配置PHP参数,Zabbix的硬件要求
vim /usr/local/PHP/etc/PHP.ini
max_execution_time = 300 max_input_time = 300 memory_limit = 128M post_max_size = 16M upload_max_filesize = 2M date.timezone = Asia/Shanghai always_populate_raw_post_data = -1
5. 重启PHP
service PHP-pfm stop service PHP-pfm start
第五部分 安装Zabbix
1. 下载安装zabbix的YUM源
rpm -ivh http://repo.zabbix.com/zabbix/3.0/rhel/7/x86_64/zabbix-release-3.0-1.el7.noarch.rpm
2. 安装Zabbix
yum -y install zabbix-server-MysqL zabbix-web-MysqL zabbix-get
create database zabbix character set utf8 collate utf8_bin; grant all privileges on zabbix.* to 'zabbix'@'%' identified by 'zabbixpass'; flush privileges;
4. 导入Zabbix到数据库
cd /usr/share/doc/zabbix-server-MysqL-3.0.1/ zcat create.sql.gz |MysqL -uroot -ppass zabbix
5. 配置zabbix用户
groupadd zabbix useradd -g zabbix -s /bin/false zabbix
6. 配置Zabbix服务器端
vim /etc/zabbix/zabbix_server.conf DBHost=localhost DBName=zabbix DBUser=zabbix DBPassword=zabbixpass cd /usr/share/ cp -r zabbix /usr/local/Nginx/html chown -R zabbix:zabbix /etc/zabbix chown -R zabbix:zabbix /usr/share/zabbix chown -R zabbix:zabbix /usr/lib/zabbix
7. Zabbix加入开机启动并启动
systemctl enable zabbix-server systemctl start zabbix-server
8. 在浏览器中测试Zabbix
常见错误排除
问题,运行Zabbix时出现“
FastCGIsentinstderr:"PHPmessage:PHPWarning:require_once(/etc/zabbix/web/maintenance.inc.PHP): Failedtoopenstream:Permissiondeniedin/app/Nginx/html/zabbix/include/classes/core/ZBase.PHPonline292
PHPmessage:PHPFatalerror:require_once():Failedopeningrequired'/etc/zabbix/web/mainte
”
解决方法:
chmod-R755/etc/zabbix/web原文链接:https://www.f2er.com/centos/378317.html