安装apr
[root@cce62 src]# tar xf apr-1.4.8.tar.bz
[root@cce62 src]# tar xf apr-1.4.8.tar.bz2
[root@cce62 src]# cd apr-1.4.8
[root@cce62 apr-1.4.8]# ./configure --prefix=/usr/local/apr && make -j 2 && make install
安装apr-util
[root@cce62 src]# tar xf apr-util-1.5.1.tar.bz2
[root@cce62 src]# cd apr-util-1.5.1
[root@cce62 apr-util-1.5.1]# ./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr && make -j 2 && make install
安装sqlite
[root@cce62 src]# tar xf sqlite-autoconf-3080200.tar.gz
[root@cce62 src]# cd sqlite-autoconf-3080200
[root@cce62 sqlite-autoconf-3080200]# ./configure --prefix=/usr/local/sqlite && make -j 2 && make install
安装apache
[root@cce62 src]# tar xf httpd-2.2.25.tar.gz
[root@cce62 src]# cd httpd-2.2.25
[root@cce62 httpd-2.2.25]#./configure --prefix=/usr/local/apache --enable-so --enable-dav --with-apr=/usr/local/apr/bin/apr-1-config --with-apr-util=/usr/local/apr-util/bin/apu-1-config --with-sqlite=/usr/local/sqlite --enable-maintainer-mode --enable-ssl --enable-cgi --enable-rewrite --with-zlib --enable-cgi
[root@cce62 httpd-2.2.25]# make -j 2 && make install
配置apache启动脚本
[root@cce62 src]# cp /usr/local/apache/bin/apachectl /etc/init.d/httpd
[root@cce62 src]# chmod +x /etc/init.d/httpd
配置开机自启
[root@cce62 src]# vim /etc/init.d/httpd
# chkconfig: 2345 64 36
# description: Activates/Deactivates all network interfaces configured to
[root@cce62 src]# chkconfig --add httpd
创建启动用户并修改配置文件中的监听域名
[root@cce62 src]# useradd -s /sbin/nologin www
[root@cce62 src]# chown www:www /usr/local/apache/ -R
测试
[root@cce62 src]# /etc/init.d/httpd start
源码编译mysql
[root@cce62 src]# useradd -s /sbin/nologin mysql
[root@cce62 src]# tar xf mysql-5.6.19.tar.gz
[root@cce62 src]# cd mysql-5.6.19
[root@cce62 mysql-5.6.19]# cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DMYSQL_UNIX_ADDR=/usr/local/mysql/mysql.sock -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DWITH_EXTRA_CHARSETS=all -DWITH_MYISAM_STORAGE_ENGINE=1 -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_MEMORY_STORAGE_ENGINE=1 -DWITH_READLINE=1 -DENABLED_LOCAL_INFILE=1 -DMYSQL_DATADIR=/usr/local/mysql/data -DMYSQL_USER=mysql
安装
[root@cce62 mysql-5.6.19]# make -j 2
[root@cce62 mysql-5.6.19]# make install
配置运行环境
chown mysql:mysql -R /usr/local/mysql/
cp support-files/my-large.cnf /etc/my.cnf
cp support-files/mysql.server /etc/init.d/mysqld
chmod +x /etc/init.d/mysqld
修改启动脚本参数
vim /etc/init.d/mysqld
basedir=/usr/local/mysql
datadir=/usr/local/mysql/data
初始化数据库
/usr/local/mysql/scripts/mysql_install_db --defaults-file=/etc/my.cnf --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data --user=mysql 开启启动
chkconfig --add mysqld
添加客户端命令
echo "PATH=$PATH:/usr/local/mysql/bin" >>/etc/profile && source /etc/profile && source /etc/profile
安装PHP
[root@cce62 src]# tar xf php-5.4.14.tar.bz2
[root@cce62 src]# cd php-5.4.14
[root@cce62 php-5.4.14]# ./configure --prefix=/usr/local/php --with-mysql=/usr/local/mysql --with-apxs2=/usr/local/apache/bin/apxs --with-config-file-path=/usr/local/php
[root@cce62 php-5.4.14]# make -j 2
[root@cce62 php-5.4.14]# make install
[root@cce62 php-5.4.14]# cp /usr/local/src/php-5.4.14/php.ini-production /usr/local/php/etc/php.ini
[root@cce62 php-5.4.14]# ls /usr/local/apache/modules/
httpd.exp libphp5.so
[root@cce62 php-5.4.14]# vin /usr/local/apache/conf/httpd.conf
AddType application/x-httpd-php .php
让apache可以识别php文件
测试lamp环境
[root@cce62 ~]# cat /usr/local/apache/htdocs/index.php
<?php
phpinfo();
?>
[root@cce62 ~]# vim /usr/local/apache/conf/httpd.conf
本文出自 “攻城狮” 博客,谢绝转载!