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

LNMP开发环境搭建

[复制链接]
累计签到:1 天
连续签到:1 天
发表于 2015-11-4 08:52:45 | 显示全部楼层 |阅读模式
Nginx安装
安装版本: 稳定版 1.8.0
1).确定是否安装pcre-devel编译所需要的兼容正则,nginx需要pcre这个包文件
   没有的情况下,直接用
  
1
2
[iyunv@moban ~]# yum -y install pcre-devel
#安装时有的可能没有安装openssl库,直接用 yum -y install openssl*安装





2).执行nginx编译安装
1
2
[iyunv@moban ~]# ./configure --prefix=/application/nginx1.8.0 --user=nginx --group=nginx --with-http_stub_status_module --with-http_ssl_module
[iyunv@moban ~]# make && make install




不出意外的话,nginx就安装成功了......

Mysql安装
   关于mysql,常用的有以下安装方式: 1.源码安装 2.二进制安装 3.RPM包安装,本次安装使用的是二进制包安装(不需要编译,直接解压即可)
安装步骤:
   1)建立用户
1
[iyunv@moban ~]# useradd -M -s /sbin/nologin mysql



    2)解压tar包
1
2
[iyunv@moban ~]# tar xf mysql-5.5.45-linux2.6-i686.tar
[iyunv@moban ~]# cp mysql-5.5.45-linux2.6-i686 /application/mysql-5.5.45



    3) 初始化data数据
1
2
3
4
5
[iyunv@moban ~]# ln -s /application/mysql-mysql-5.5.45 /application/mysql #创建软链接   
[iyunv@moban ~]# mkdir /application/mysql/data #创建data目录   
[iyunv@moban ~]# chown -R mysql:mysql /application/mysql/data #修改所属用户与组   
[iyunv@moban ~]# cd /application/mysql/   
[iyunv@moban ~]# scripts/mysql_install_db --user=mysql --datadir=/application/mysql5.5.45/data/ --basedir=/application/mysql5.5.45/ #初始化数据



   4)配置mysql服务启动所需要的脚本与配置文件
1
2
3
4
5
6
  [iyunv@moban ~]# cp support-files/mysql.server /etc/init.d/mysqld     
  [iyunv@moban ~]# cp support-files/my-.cnf/etc/my.cnf   
  [iyunv@moban ~]# vi /etc/init.d/mysqld
   #将mysqld文件里的第46行左右修改为:
   basedir=/application/mysql5.5.45/   
   datadir=/application/mysql5.5.45/data



   5)优化MYSQL
    #为root用户添加密码
1
[iyunv@moban ~]# /application/mysql5.5.45/bin/mysqladmin -u root password '123456'



    #删除mysql库user表中不需要的用户数据,默认只保留以下这两条用户数据
1
2
3
4
5
6
7
mysql> select user,host from mysql.user;   
+------+-----------+   
| user | host    |   
+------+-----------+   
| root | 127.0.0.1 |   
| root | localhost |   
+------+-----------+





#删除用户的操作:   
drop user [user列的内容]@[host列对应的内容] ;
MYSQL的搭建就已经成功了......


PHP安装
1).检查并安装相应的编译库文件
1
2
[iyunv@moban tools]# rpm -qa zlib libxml libjpeg libpng freetype curl libiconv gd zlib-devel libxml-devel libjpeg-devel gd-devel freetype-devel curl-devel
[iyunv@moban tools]# yum -y install zlib libxml libjpeg libpng freetype curl libiconv gd zlib-devel libxml-devel libjpeg-devel gd-devel freetype-devel curl-devel



安装libiconv库
1
2
3
[iyunv@moban tools]# cd libiconv-1.14
[iyunv@moban libiconv-1.14]# ./configure --prefix=/usr/local/libiconv
[iyunv@moban tools]#make && make install



安装libmcrypt
1
2
3
4
5
6
7
8
[iyunv@moban tools]# tar xf libmcrypt-2.5.8.tar.gz
[iyunv@moban tools]#  cd libmcrypt-2.5.8
[iyunv@moban tools]#  .configure
[iyunv@moban tools]#  make && make install
[iyunv@moban tools]# /sbin/ldconfig
[iyunv@moban tools]# cd libltdl/
[iyunv@moban tools]#  ./configure --enable-ltdl-install
[iyunv@moban tools]#  make && make install



安装mhash
1
2
3
4
5
[iyunv@moban tools]# wget http://soft.7dot.com/soft/mhash-0.9.9.9.tar.gz
[iyunv@moban tools]# tar xf mhash-0.9.9.9.tar.gz
[iyunv@moban tools]# cd mhash-0.9.9.9
[iyunv@moban mhash-0.9.9.9]# ./configure
[iyunv@moban mhash-0.9.9.9]# make && make install



安装mcrypt--加密扩展库
Mhash是基于离散数学原理的不可逆向的php加密方式扩展库,其在默认情况下不开启。mhash的可以用于创建校验数值,消息摘要,消息认证码,以及无需原文的关键信息保存(如密码)等。
Mhash为PHP提供了多种哈希算法,如MD5SHA1GOST 等。你可以通过MHASH_hashname()来查看支持的算法有哪些。
注意问题:
1该扩展不能提供最新的哈希算法。
2.该扩展结果原则上运算不可逆。

)

安装Mcrypt
    简介:PHP程序员们在编写代码程序时,除了要保证代码的高性能之外,还有一点是非常重要的,那就是程序的安全性保障。PHP除了自带的几种加密函数外,还有功能更全面的PHP加密扩展库Mcrypt和Mhash。
其中,Mcrypt扩展库可以实现加密解密功能,就是既能将明文加密,也可以密文还原。
mcrypt 是 php 里面重要的加密支持扩展库,linux环境下:该库在默认情况下不开启。window环境下:PHP>=5.3,默认开启mcrypt扩展。
Mcrypt库支持20多种加密算法和8种加密模式,具体可以通过函数mcrypt_list_algorithms()和mcrypt_list_modes()来显示。一般情况下开发用不到他们。
参考资料:http://baike.baidu.com/view/9537042.htm

1
2
3
4
5
[iyunv@moban tools]# wget http://soft.7dot.com/soft/mcrypt-2.6.8.tar.gz
[iyunv@moban tools]# tar xf mcrypt-2.6.8.tar.gz
[iyunv@moban tools]# cd mcrypt-2.6.8
[iyunv@moban mcrypt-2.6.8]# LD_LIBRARY_PATH=/usr/local/lib ./configure
[iyunv@moban mcrypt-2.6.8]# make && make install




PHP安装
在进行configure后,执行make操作会有一个错误:
/home/tools/php-5.3.27/sapi/cli/php: error while loading shared libraries: libmysqlclient.so.18: cannot open shared object file: No such file or directory
make: *** [ext/phar/phar.php] Error 127
最好是提交先解决掉:
解决一:创建一个软链接:
[iyunv@moban php-5.3.27]# ln -s /application/mysql/lib/libmysqlclient.so.18 /usr/lib/
在执行make会报第二个错误:
chmod: cannot access `ext/phar/phar.phar': No such file or directory
解决二:


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
[iyunv@moban tools]# tar php-5.3.27.tar.gz
[iyunv@moban tools]#  tar xf  php-5.3.27.tar.gz
[iyunv@moban tools]#  cd php-5.3.27
[iyunv@moban php-5.3.27]#  yum install libxsl*
[iyunv@moban php-5.3.27]#  yum install libxsl* -y
[iyunv@moban php-5.3.27]# ./configure \
--prefix=/application/php5.3.27 \
--with-mysql=/application/mysql5.5.45 \
--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-safe-mode \
--enable-bcmath \
--enable-shmop \
--enable-sysvsem \
--enable-inline-optimization \
--with-curl \
--with-curlwrappers \
--enable-mbregex \
--enable-fpm \
--enable-mbstring \
--enable-mbstring \
--with-mcrypt \
--with-gd \
--enable-gd-native-ttf \
--with-openssl \
--with-mhash \
--enable-pcntl \
--enable-sockets \
--with-xmlrpc \
--enable-zip \
--enable-soap \
--enable-short-tags \
--enable-zend-multibyte \
--enable-static \
--with-xsl \
--with-fpm-user=nginx \
--with-fpm-group=nginx \
--enable-ftp
  
  
######看到如下内容说明./configure成功
+--------------------------------------------------------------------+
| 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.


[iyunv@moban php-5.3.27]# make && make install
  
[iyunv@moban php]# cp php-5.3.27/php.ini-production /application/php5.3.27/lib/php.ini









运维网声明 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-134770-1-1.html 上篇帖子: centos7安装配置lnmp 下篇帖子: LNMP最新源码包一般安装过程及常见问题 开发
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

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

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

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

扫描微信二维码查看详情

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


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


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


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



合作伙伴: 青云cloud

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