说在最前面
1.所有的安装指令都要在对应的文件夹里
2.按照给的顺序安装,目前已经是调整过顺序的
3.不要随便改参数,除非你真的懂
4.如果你觉得你真的完全懂,我觉得你不会看我博客
5.以上请重新读一遍
前期准备
编译环境
yum -y install gcc*
关闭不必要的服务
新虚拟机没必要
关闭防火墙setenforce
关闭不需要的服务
新虚拟机没必要
解包确认磁盘空间
解包代码
#!bin/bash
/bin/ls *.tar.gz > ls.list
/bin/ls *.tgz >> ls.list
for a in `cat ls.list`
do
/bin/tar -zxf $a
done
rm -rf ls. list
APACHE安装
libxml2 解释器
yum -y install python-devel
./configure --prefix=/usr/local/libxml2 #进入对应的文件中安装
make
make install
libmcrypt 加密
./configure --prefix=/usr/local/libmcrypt/
make
make install
libltdl 加密
./configure --enable-ltdl-install
mhash 提供加密方式扩展
./configure
make
make install
mcrypt 提供php相关的加密支持
LD_LIBRARY_PATH=/usr/local/libmcrypt/lib:/usr/local/lib\
> ./configure --with-libmcrypt-prefix=/usr/local/libmcrypt
make
make install
zlib 提供压缩用途的函数库
./configure
make
make install >> /root/zlib.log
libpng 提供png格式图片的库
./configure --prefix=/usr/local/libpng
make
make install
jpeg6 提供jpeg格式图片的库
先安装libtool 及 libtool-ltdl-devel(yum安装),复制文件
./configure --prefix=/usr/local/jpeg6/ --enable-shared --enable-static
make
make install
feeetype 提供字体相关引擎
./configure --prefix=/usr/local/freetype
make
make install
GD 提供PHP图形扩展库
vim gd_png.c
#include "/usr/local/libpng/include/png.h"
./configure --prefix=/usr/local/gd2/ --with-jpeg=/usr/local/jpeg6/ --with-freetype=/usr/local/freetype/ --with-png=/usr/local/libpng/
make
make install
http
cp -r apr-1.4.6 httpd-2.4.7/srclib/apr
cp -r apr-util-1.4.1 httpd-2.4.7/srclib/apr-util
先安装pcre
cd pcre-8.34
./configure
make
make install
继续安装http
./configure --prefix=/usr/local/apache2 --sysconfdir=/etc/httpd --with-z=/usr/local/zlib --with-included-apr --disable-userdir --enable-so --enable-deflate=shared --enable-expires=shared --enable-rewrite=shared --enable-static-support
make
make install
/usr/local/apache2/bin/apachectl start
验证一下
设置开机启动
vim /etc/rc.d/rc.local
加入启动命令
mysql安装
前期准备
yum -y install cmake
yum -y install bison
yum -y install ncurses-devel
./configure --with-shared --without-debug --with-ada --enable-overwrite
make
make install
开始安装
cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DMYSQL_UNIX_ADDR=/tmp/mysq1.sock -DEXTRA_CHARSET=al1 -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DWITH_MYISAM_STORAGE_ENGINE=1 -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_MEMORY_STORAGE_ENGINE=1 -DWITH_READLINE=1 -DENABLED_LOCAL_INFILE=1 -DMYSQL_USER=mysql -DMYSQL_TCP_PORT=3306
make
make install
初始化并启动
cd /usr/local/mysql/
chown -R root .
[root@bogon mysql]# chown -R mysql data/
[root@bogon mysql]# cp support-files/my-medium.cnf /etc/my.cnf
cp: overwrite `/etc/my.cnf'? y
[root@bogon mysql]# /usr/local/mysql/bin/mysqld_safe --user=mysql
检验
给个密码
/usr/local/mysql/bin/mysqladmin -u root password '123456'
PHP安装
./configure --prefix=/usr/local/php/ --with-config-file-path=/usr/local/php/etc/ --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql=/usr/local/mysql/ --with-libxml-dir=/usr/local/libxml2/ --with-jpeg-dir=/usr/local/jpeg6/ --with-png-dir=/usr/local/libpng/ --with-freetype-dir=/usr/local/freetype/ --with-gd=/usr/local/gd2/ --with-mcrypt=/usr/local/libmcrypt/ --with-mysqli=/usr/local/mysql/bin/mysql_config --enable-soap --enable-mbstring=all --enable-sockets --with-pdo-mysql=/usr/local/mysql/ --without-pear
make
make install
配置文件