[root@justin src]# tar zxvf libmcrypt-2.5.7.tar.gz
[root@justin src]# cd libmcrypt-2.5.7
[root@justin libmcrypt-2.5.7]# ./configure
[root@justin libmcrypt-2.5.7]# make && make install
c、安装cmake
[root@justin src]# tar zxvf cmake-2.8.12.2.tar.gz
[root@justin src]# cd cmake-2.8.12.2
[root@justin cmake-2.8.12.2]# ./configure
[root@justin cmake-2.8.12.2]# make && make install
d、安装apr
[root@justin src]# tar zxvf apr-1.5.0.tar.gz
[root@justin src]# cd apr-1.5.0
[root@justin apr-1.5.0]# ./configure
[root@justin apr-1.5.0]# make && make install
e、安装apr-util
[root@justin src]# tar zxvf apr-util-1.5.3.tar.gz
[root@justin src]# cd apr-util-1.5.3
[root@justin apr-util-1.5.3]# mkdir -p /usr/local/apr-util
[root@justin apr-util-1.5.3]# ./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr/bin/apr-1-config
[root@justin apr-util-1.5.3]# make && make installl
f、安装mysql
[root@justin apr-util-1.5.3]# cd ..
[root@justin src]# groupadd mysql
[root@justin src]# useradd -g mysql mysql -s /sbin/nologin --禁止登陆
[root@justin src]# mkdir -p /data/mysql --mysql数据库目录
[root@justin src]# chown -R mysql:mysql /data/mysql/
[root@justin src]# mkdir -p /usr/local/mysql --mysql安装目录
[root@justin src]# tar zxvf mysql-5.5.36.tar.gz
[root@justin mysql-5.5.36]# cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DMYSQL_DATADIR=/data/mysql -DSYSCONFDIR=/etc
-- Could NOT find Curses (missing: CURSES_LIBRARY CURSES_INCLUDE_PATH)
CMake Error at cmake/readline.cmake:83 (MESSAGE):
Curses library not found. Please install appropriate package,
remove CMakeCache.txt and rerun cmake.On Debian/Ubuntu, package name is libncurses5-dev, on Redhat and derivates it is ncurses-devel.
出错了,提示RHEL平台安装ncurses-devel并删除CMakeCache.txt
[root@justin mysql-5.5.36]# yum install -y ncurses-devel
[root@justin mysql-5.5.36]# rm -f CMakeCache.txt
[root@justin mysql-5.5.36]# cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DMYSQL_DATADIR=/data/mysql -DSYSCONFDIR=/etc
[root@justin mysql-5.5.36]# make && make install
[root@justin mysql-5.5.36]# cd /usr/local/mysql/
[root@justin mysql]# cp ./support-files/my-huge.cnf /etc/my.cnf
cp: overwrite `/etc/my.cnf'? y
[root@justin mysql]# vim /etc/my.cnf
[mysqld] ---该部分下
port = 3306
socket = /tmp/mysql.sock
skip-external-locking
datadir = /data/mysql ---添加此行,指定数据库路径
[root@justin mysql]# ./scripts/mysql_install_db --user=mysql --生成mysql系统数据库
[root@justin mysql]# cp ./support-files/mysql.server /etc/rc.d/init.d/mysqld --把Mysql加入系统启动
[root@justin mysql]# chmod 755 /etc/init.d/mysqld
[root@justin mysql]# chkconfig mysqld on
[root@justin mysql]# vim /etc/rc.d/init.d/mysqld
46 basedir=/usr/local/mysql
47 datadir=/data/mysql
[root@justin mysql]# /etc/init.d/mysqld start
Starting MySQL...... [ OK ]
[root@justin mysql]# vim /etc/profile --把mysql服务加入系统环境变量
export PATH=$PATH:/usr/local/mysql/bin --文末添加该行
[root@justin mysql]# ln -s /usr/local/mysql/lib/mysql /usr/lib/mysql
[root@justin mysql]# ln -s /usr/local/mysql/include/mysql /usr/include/mysql --把myslq的库文件链接到系统默认的位置,在编译类似PHP等软件时可以不用指定mysql的库文件地址
[root@justin mysql]# mysql_secure_installation
-bash: mysql_secure_installation: command not found --需要先重启系统
[root@justin mysql]# init 6
[root@justin ~]# mysql_secure_installation
[root@justin ~]# service mysqld restart
Shutting down MySQL. [ OK ]
Starting MySQL... [ OK ]
[root@justin ~]#
g、安装apache
[root@justin src]# cd /usr/local/src/
[root@justin src]# tar zxvf httpd-2.4.7.tar.gz
[root@justin src]# cd httpd-2.4.7
[root@justin httpd-2.4.7]# mkdir -p /usr/local/apache
[root@justin httpd-2.4.7]# ./configure --prefix=/usr/local/apache --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util --with-ssl --enable-ssl --enable-module=so --enable-rewrite --enable-cgid --enable-cgi
[root@justin httpd-2.4.7]# make && make install
[root@justin httpd-2.4.7]# /usr/local/apache/bin/apachectl -k start
[root@justin httpd-2.4.7]# vim /usr/local/apache/conf/httpd.conf
191 ServerName localhost
249 DirectoryIndex index.html index.php
229 Options FollowSymLinks --不显示目录结构
236 AllowOverride All ---开启apache支持伪静态
349 AllowOverride All
199 AllowOverride All
149 LoadModule rewrite_module modules/mod_rewrite.so --开启apache支持伪静态
[root@justin httpd-2.4.7]# vi /etc/profile --添加apache服务系统环境变量
export PATH=$PATH:/usr/local/apache/bin --最后添加下面这一行
[root@justin httpd-2.4.7]# cp /usr/local/apache/bin/apachectl /etc/rc.d/init.d/httpd
cp: overwrite `/etc/rc.d/init.d/httpd'? y
[root@justin httpd-2.4.7]# vim /etc/init.d/httpd
#!/bin/sh --添加以下两行
#chkconfig:2345 10 90
#description:Activates/Deactivates Apache Web Server
[root@justin httpd-2.4.7]# chown daemon.daemon -R /usr/local/apache/htdocs
[root@justin httpd-2.4.7]# chmod 700 !$
chmod 700 /usr/local/apache/htdocs
[root@justin httpd-2.4.7]# chkconfig httpd on
[root@justin httpd-2.4.7]# /etc/init.d/httpd start