设为首页 收藏本站
查看: 1157|回复: 0

CentOS 6.5搭建 LNMP 生产环境

[复制链接]
累计签到:1 天
连续签到:1 天
发表于 2016-3-1 09:01:03 | 显示全部楼层 |阅读模式
CentOS 6.5搭建 LNMP 生产环境

安装前准备:
  1、软件包下载:
MySQL5.6.5-M8http://downloads.mysql.com/archives/get/file/mysql-5.6.5-m8.tar.gz
Cmake-2.8.8http://www.cmake.org/files/v2.8/cmake-2.8.8.tar.gz
php-5.4.29http://cn2.php.net.get/php-5.4.29.tar.gz/from/this/mirror
libiconv-1.14http://ftp.gun.org/gnu/libiconv/libiconv-1.14.tar.gz
nginx-1.2.9http://nginx.org/downlload/nginx-1.2.9.tar.gz

  2、安装MySQL数据库:因为MySQL从5.5版本开始,不再使用开源软件通行使用的./configure脚本来配置编译选项,而改用cmake命令来编译,而且cmake默认不安装在系统中,所以,我们首先安装cmake软件包:

   a、Cmake安装
1
2
3
4
5
[iyunv@Zabbix_Server ~]# tar -zxvf cmake-2.8.8.tar.gz
[iyunv@Zabbix_Server ~]# cd cmake-2.8.8
[iyunv@Zabbix_Server ~]# ./bootstrap
[iyunv@Zabbix_Server ~]# gmake
[iyunv@Zabbix_Server ~]# gmake install




  3、安装MySQL

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
[iyunv@Zabbix_Server ~]# tar -zxvf mysql-5.6.5-m8.tar.gz
[iyunv@Zabbix_Server ~]# cd mysql-5.6.5-m8
[iyunv@Zabbix_Server ~]# cmake -DCMAKE_INSTALL_PREFIX=/opt/mysql \
-DMYSQL_UNIX_ADDR=/tmp/mysql.sock -DDEFAULT_CHARSET=UTF8 \
-DDEFAULT_COLLATION=utf8_general_ci \
-DWITH_EXTRA_CHARSETS:STRING=all \
-DWITH_INNODB_STORAGE_ENGINE=1 \
-DWITH_ARCHIVE_STORAGE_ENGINE=1 \
-DWITH_READLINE=1 -DENABLED_LOCAL_INFILE=1 \
-DMYSQL_USER=mysql -DMYSQL_TCP_PORT=3306

[iyunv@Zabbix_Server ~]# make                         #编辑
[iyunv@Zabbix_Server ~]# make install                        #安装
[iyunv@Zabbix_Server ~]# useradd -s /sbin/nologin mysql    #添加mysql用户
[iyunv@Zabbix_Server ~]# cp support-files/my-large.cnf /etc/my.cnf    #复制配置文件
[iyunv@Zabbix_Server ~]# cd /usr/local/server/mysql
[iyunv@Zabbix_Server ~]# mkdir -p /data/mysql/data            #创建mysql数据目录
[iyunv@Zabbix_Server ~]# scripts/mysql_install_db --datadir=/data/mysql/data \   
--defaults-file=/etc/my.cnf --user=mysql                    #初始化数据库
[iyunv@Zabbix_Server ~]# cp support-files/mysql.server /etc/init.d/    #复制启动脚本
[iyunv@Zabbix_Server ~]# chkconfig --add mysql.server            #添加启动服务
[iyunv@Zabbix_Server ~]# service mysql.server start               
[iyunv@Zabbix_Server ~]# echo "PATH=/opt/mysql/bin">>/etc/profile    #设置环境变量
[iyunv@Zabbix_Server ~]# echo "export PATH">>/etc/profile




  4、安装PHP

    在安装PHP之前,需要安装libconv软件包,其它PHP所需软件包在前面都已经使用yum安装完成了,所以无需重复安装。

    a、安装libiconv软件包

1
2
3
4
5
[iyunv@Zabbix_Server ~]# tar -zxvf libiconv-1.14.tar.gz
[iyunv@Zabbix_Server ~]# cd libiconv-1.14
[iyunv@Zabbix_Server ~]# ./configure --prefix=/usr/local
[iyunv@Zabbix_Server ~]# make && make install
[iyunv@Zabbix_Server ~]# ldconfig            #执行ldconfig命令更新动态库缓存



    b、安装PHP

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
[iyunv@Zabbix_Server ~]# tar -zxvf php-5.4.5.tar.gz
[iyunv@Zabbix_Server ~]# cd php-5.4.5
[iyunv@Zabbix_Server ~]# ./configure --prefix=/opt/php --disable-debug --disable-ipv6 \
--disable-rpath --enable-bcmath --enable-exif --enable-gd-native-ttf \
--enable-mbregex --enable-mbstring=all --enables-pcntl --enable-sage-mode \
--enable-shmop --enable-soap --enable-sockets --enable-xml \
--with-config-file-path=/opt/php/etc --with-curl --with-curlwrappers \
--with-freetype-dir --with\-gd --with-gettext --with-iconv-dir=/usr/local \
--with-jpeg-dir --with-ldap --with-ldap-sasl --with-libdir=lib \
--with-libxml-dir=/usr --with-mcrypt --with-mhash --with-openssl --with-pdo-mysql \
--with-pear --with-png-dir --with-xmlrpc --with-zlib-dir \
--with-mysqlli=/opt/mysql/bin/mysql_config --with-mysql=/opt/mysql \
--enable-fastcgi --enable-fpm --enable-force-cgi-redirect
[iyunv@Zabbix_Server ~]#  make ZEND_EXTRA_LIBS='-liconv'
[iyunv@Zabbix_Server ~]# make install
[iyunv@Zabbix_Server ~]# cp php.ini-production /opt/php/etc/php.ini
[iyunv@Zabbix_Server ~]# cp /op/php/etc/php-fpm.conf.default /opt/php/etc/php-fpm.conf
[iyunv@Zabbix_Server ~]#



   5、安装Nginx

1
2
3
4
5
6
7
[iyunv@Zabbix_Server ~]# tar -zxvf nginx-1.2.9.tar.gz
[iyunv@Zabbix_Server ~]# cd nginx-1.2.9
[iyunv@Zabbix_Server ~]# ./configure --prefix=/opt/nginx --user=nobody --group=nobody \
--with-poll_module --with-http_ssl_module --with-http_sub_module \
--with-http_perl_module --with-mail --with-pcre
[iyunv@Zabbix_Server ~]# make
[iyunv@Zabbix_Server ~]# make install




   6、启动服务

1
2
3
4
[iyunv@Zabbix_Server ~]# /opt/php/sbin/php-fpm
[iyunv@Zabbix_Server ~]# killall -php-fpm
[iyunv@Zabbix_Server ~]# /opt/nginx/sbin/nginx
[iyunv@Zabbix_Server ~]# /opt/nginx/sbin/nginx -s stop






运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-184711-1-1.html 上篇帖子: linux服务器 LAMP平台的部署 下篇帖子: Varnish配置应用
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表