添加 mysql 用户及用户组
# groupadd mysql
# useradd -g mysql mysql
修改 mysql 目录权限
# chown -R root /usr/local/mysql
# chgrp -R mysql /usr/local/mysql
# chown -R mysql /usr/local/mysql/data
生成 mysql 系统数据库
# /usr/local/mysql/scripts/mysql_install_db --user=mysql& // 启动 mysql 服务
# /usr/local/mysql/bin/mysqld_safe --user=mysql&
如出现 Starting mysqld daemon with databases from /usr/local/mysql/data 代表正常启动 mysql 服务了 .
按 Ctrl + C 跳出修改 mysql 的 root 密码
# /usr/local/mysql/bin/mysqladmin -u root -p password "123456"
三:安装 GD 库 ( 让 PHP 支持 GIF,PNG,JPEG)
a. 安装 jpeg6 建立目录:
# mkdir -p /usr/local/jpeg6
# mkdir -p /usr/local/jpeg6/bin
# mkdir -p /usr/local/jpeg6/lib
# mkdir -p /usr/local/jpeg6/include
# mkdir -p /usr/local/jpeg6/man
# mkdir -p /usr/local/jpeg6/man1
# mkdir -p /usr/local/jpeg6/man/man1
# cd /root/Software/
# tar -zvxf jpegsrc.v6b.tar.gz
# cd jpeg6
# ./configure --prefix=/usr/local/jpeg6/ --enable-shared --enable-static
# make
# make install
b.libpng 包 ( 支持 PNG)
# cd /root/Software/
# tar -zvxf libpng-(version).tar.gz
# cd libpng-(version)
# ./configure --prefix=/usr/local/libpng
# make
#> make install
c. 安装 freetype
# cd /root/Software/
# tar -zvxf freetype-(version).tar.gz
# cd freetype-(version)
# mkdir -p /usr/local/freetype
# ./configure --prefix=/usr/local/freetype
# make
# make install
d. 安装 zlib
# cd /root/Software/
# tar -zxvf zlib-1.2.3.tar.gz
# cd zlib.1.2.3
# mkdir /usr/local/zlib
# ./configure --prefix=/usr/local/zlib
# make
# make install
e. 安装 GD 库
# cd /root/Software/
# tar -zvxf gd-(version).tar.gz
# mkdir -p /usr/local/gd2
# cd gd-(version)
# ./configure --prefix=/usr/local/gd2 --with-jpeg=/usr/local/jpeg6 --with-zlib-dir=/usr/local/zlib --with-png=/usr/local/libpng --with-freetype=/usr/local/freetype
# make
# make install
e. 安装 Curl 库
# cd /root/Software/
# tar -zxf curl-(version).tar.gz
# mkdir -p /usr/local/curl
# ./configure --prefix=/usr/local/curl
# make
# make install
四:安装 apache2
# cd /roo/Software/
# tar -zvxf httpd-2.2.6.tar.gz
# cd httpd-2.2.6
# mkdir -p /usr/local/apache2
# ./configure --prefix=/usr/local/apache --enable-modules=so --enable-rewrite
# make
# make install
# /usr/local/apache2/bin/apachectl -k start // 启动 apahce
用浏览器查看 http://localhost, 得到 it works ,说明 apache 已经配置成功了 .
# /usr/local/apache2/bin/apachectl -k stop // 停止 apache
五:安装 php5 , php5 必须有 libxml2 支持 !
a. 安装 libxml2
# cd /root/Software/
# tar -zvxf libxml2-(version).tar.gz
# cd libxml2-(version)
# mkdir -p /usr/local/libxml2
# ./configure --prefix=/usr/local/libxml2
# make
# make install
b. 安装 libxslt ( 可选安装,你可以不安装 )
# cd /root/Software/
# tar -zvxf libxslt-(version).tar.gz
# mkdir -p /usr/local/libxslt
# cd libxslt-(version)
# ./configure --prefix=/usr/local/libxslt --with-libxml-prefix=/usr/local/libxml2
# make
# make install
2. 编辑 /etc/selinux/config ,找到这段:
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
# enforcing - SELinux security policy is enforced.
# permissive - SELinux prints warnings instead of enforcing.
# disabled - SELinux is fully disabled.
SELINUX=enforcing
编辑 /etc/sysconfig/selinux ,找到 :
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
# enforcing - SELinux security policy is enforced.
# permissive - SELinux prints warnings instead of enforcing.
# disabled - SELinux is fully disabled.
SELINUX=enforcing