Skip to content

Instantly share code, notes, and snippets.

@yiquncode
Created January 11, 2012 02:22
Show Gist options
  • Save yiquncode/1592583 to your computer and use it in GitHub Desktop.
Save yiquncode/1592583 to your computer and use it in GitHub Desktop.
for the hd users who need a easy doc to study how to install LAMP
1. 安装准备
1) 系统约定
软件源代码包存放位置 /root/src
源码包编译安装位置(prefix) /usr/local/software_name
Apache 网站根目录 /data/www/wwwroot(可按情况设置)
Apache 运行账户 www:www (useradd -d /data/www/;chown www.www /data/www/wwwroot)
2) 系统环境部署及调整
检查系统是否正常
# ifconfig(检查网卡设置是否正确)
# ping www.google.com (检查网络是否正常)
检查SELINUX是否开启,如果开了则关闭
卸载已安装的LAMP环境
3) 使用 yum 程序安装所需开发包
# yum install ntp vim-enhanced gcc gcc-c++ gcc-g77 flex bison autoconf automake bzip2-devel \
ncurses-devel zlib-devel libjpeg-devel libpng-devel libtiff-devel freetype-devel libXpm-devel \
gettext-devel pam-devel kernel gd gd-devel libxml2 libxml2-devel libmcrypt-devel
#Install apache
./configure \
"--prefix=/usr/local/apache2" \
"--with-included-apr" \
"--enable-so" \
"--enable-deflate=shared" \
"--enable-expires=shared" \
"--enable-rewrite=shared" \
"--enable-static-support" \
"--disable-userdir"
make
make install
#Install PHP
./configure \
"--prefix=/usr/local/php" \
"--with-apxs2=/usr/local/apache2/bin/apxs" \
"--with-config-file-path=/usr/local/php/etc" \
"--with-mysql" \
"--with-libxml-dir" \
"--with-gd" \
"--with-jpeg-dir" \
"--with-png-dir" \
"--with-bz2" \
"--with-freetype-dir" \
"--with-iconv-dir" \
"--with-zlib-dir " \
"--with-mcrypt" \
"--enable-soap" \
"--enable-gd-native-ttf" \
"--enable-ftp" \
"--enable-mbstring" \
"--enable-exif" \
"--disable-ipv6" \
"--disable-cgi" \
"--disable-cli"
make
make install
mkdir /usr/local/php/etc
Apache
[root@localhost ~]# 获取程序版本信息
Server version: Apache/2.0.64
Server built: Jan 11 2012 15:56:14
PHP
[root@localhost ~]# 获取程序版本信息
Configuring for:
PHP Api Version: 20090626
Zend Module Api No: 20090626
Zend Extension Api No: 220090626
Mysql
检查是否能够启动
/etc/init.d
1)整合Apache与PHP
# vi /usr/local/apache2/conf/httpd.conf
找到:
AddType application/x-gzip .gz .tgz
在该行下面添加
AddType application/x-httpd-php .php
找到:
DirectoryIndex index.html
将该行改为
DirectoryIndex index.html index.htm index.php
2)在自己的机器上启动服务器并可以访问
启动服务器/usr/local/apache2/bin/httpd -k start
http://ip地址
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment