LAMP架设

注:以前转的。
对于Linux初学者来说,成长路千千万万,每个人各尽不同;首先不要有畏惧思想;若搭建成功了一次,在以后的学习中就会逐渐逐渐的摸索到甜头;好了,废话少说,下面看看。

首先需要准备好系统环境,这里就省略Linux Readhat 系统的安装了,其次要安装lamp环境,还需要以下软件包组合;

1.zlib-1.2.3.tar.gz
2.gd-2.0.33.tar.gz
3.jpegsrc.v6b.tar.gz
4.libpng-1.2.14.tar.gz
5.freetype-2.1.10.tar.gz
6.openssl-0.9.8g.tar.tar
7.libxml2-2.6.19.tar.gz
8.httpd-2.0.58.tar.gz
9.ZendOptimizer-3.2.0-linux-glibc21-i386.tar.gz
10.php-5.2.5.tar.gz
11.mysql-5.0.27.tar.gz

以下是安装命令(安装顺序不要颠倒):

#########################################
# INSTALL mysql-5.0.27
cd /opt
tar -zxf mysql-5.0.27.tar.gz
cd mysql-5.0.27
./configure --prefix=/usr/local/mysql --sysconfdir=/etc --localstatedir=/var/lib/mysql --with-extra-charsets=gbk
make
make install
groupadd mysql
useradd mysql -d /dev/null -g mysql -s /sbin/nologin
/usr/local/mysql/bin/mysql_install_db
chown -R mysql.mysql /var/lib/mysql
chown -R mysql.mysql /usr/local/mysql/
cp /usr/local/mysql/share/mysql/my-medium.cnf /etc/my.cnf
cp /opt/mysql-5.0.27/support-files/mysql.server /etc/rc.d/init.d/mysqld
chmod 700 /etc/rc.d/init.d/mysqld
/usr/local/mysql/bin/mysqld_safe --user=mysql &
/etc/rc.d/init.d/mysqld start
#########################################
# INSTALL zlib-1.2.3
cd /opt
tar zxvf zlib-1.2.3.tar.gz
cd zlib-1.2.3
./configure --prefix=/usr/local/zlib
make
make install
#########################################
# INSTALL openssl
cd /opt
tar zxvf openssl0.9.7g.tar.gz
cd openssl0.9.7g
./config --prefix=/usr/local/openssl
make
make test
make install
#########################################
# INSTALL httpd
cd /opt
tar zxvf httpd-2.0.58.tar.gz
cd httpd-2.0.58
./configure --prefix=/usr/local/apache --sysconfdir=/etc/httpd --enable-so --enable-ssl --with-ssl=/usr/local/openssl --

enable-track-vars --enable-rewrite  
make
make install
echo "/usr/local/apache/bin/apachectl start" >> /etc/rc.d/rc.local
#########################################
# INSTALL libpng-1.2.14
cd /opt
tar zxvf libpng-1.2.14.tar.gz   
cd libpng-1.2.14
cp scripts/makefile.linux makefile
make
make install
#########################################
# INSTALL freetype-2.1.10
cd /opt
tar -zvxf freetype-2.1.10.tar.gz
cd freetype-2.1.10
mkdir -p /usr/local/freetype
./configure --prefix=/usr/local/freetype
make;make install  
#########################################
# INSTALL jpegsrc.v6b
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 /opt
tar zxvf jpegsrc.v6b.tar.gz
cd jpeg-6b
./configure --prefix=/usr/local/jpeg6 --enable-shared --enable-static
make
make install  
make install-lib
#########################################
#INSTALL libxml2-2.6.19
cd /opt
tar -zxvf libxml2-2.6.19.tar.gz
cd libxml2-2.6.19
mkdir -p /usr/local/libxml2
./configure --prefix=/usr/local/libxml2
make; make install
cp xml2-config /usr/bin
#########################################
# INSTALL GD-2.0.33
cd /opt
tar -zvxf gd-2.0.33.tar.gz
mkdir -p /usr/local/gd2
cd gd-2.0.33
./configure --prefix=/usr/local/gd2 --with-jpeg=/usr/local/jpeg6 --with-png=/usr/local/lib --with-zlib=/usr/local/zlib/

--with-freetype=/usr/local/freetype
make;make install
############################################
# INSTALL php
cd /opt
tar -zxvf php-5.2.5.tar.gz
mkdir -p /usr/local/php
cd php-5.2.5
./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache/bin/apxs --with-mysql=/usr/local/mysql --with-

mysqli=/usr/local/mysql/bin/mysql_config --with-libxml-dir=/usr/local/libxml2 --with-png-dir=/usr/local/lib --with-jpeg-

dir=/usr/local/jpeg6 --with-zlib=/usr/local/zlib --with-freetype-dir=/usr/local/freetype --with-gd=/usr/local/gd2 --

enable-mbstring=all --enable-ftp --with-config-file-path=/usr/local/php --with-pdo-mysql=/usr/local/mysql
make
make install
cp php.ini-dist /usr/local/php/php.ini
#########################################
# INSTALL ZendOptimizer
cd /opt
tar -zxvf ZendOptimizer-3.2.0-linux-glibc21-i386.tar.gz
cd ZendOptimizer-3.2.0-linux-glibc21-i386
./install
echo "LINUX+MYSQL+APACHE2+PHP5+ZEND INSTALL OK"
###############################################

软件安装完毕;

下面谈谈配置:

Apache 配制目录是/etc/httpd
Apache默认存放主页的位置应该是:/usr/local/apache/htdocs
DocumentRoot "/usr/local/src/httpd/htdocs" 这个是存放网页的目录,我们应该把网页的目录指定到哪里,这样当访问网址时,就调用这个目录的文件。
<Directory "/opt/apache/htdocs" 这句应该和DocumentRoot 的目录保持一致。

#系统自动添加了这一行,如果没有则自己加入这一行。
   LoadModule php5_module        modules/libphp5.so
   找到: DirectoryIndex index.html index.html.var
   改为: DirectoryIndex index.html index.html.var index.php
   找到:#AddType application/x-tar .tgz
   加一行: AddType application/x-httpd-php .php(注意空格)
    注意:对存放网页的目录执行命令:chmod 755 目录名 chmod -R 755 目录名

然后用记事本保存下列内容为index.php。放在linux主页存放位置;访问看看。

<?
phpinfo();
?>

特殊需求:

A.若需要虚拟其它目录的办法:

http://192.168.8.240/1/index.php

只需要修改/etc/httpd/httpd.conf。添加

Alias /1 /var/www/1
然后重新启动Apache :/usr/local/apache/bin/apachectl restart

B.

http://hi.baidu.com/xiaoboma/blog/item/62c4c59532b1e74cd0135e95.html
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值