|
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提供了多种哈希算法,如MD5,SHA1,GOST 等。你可以通过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
|
|
|