全部博文(107)
分类: 系统运维
2007-11-23 10:17:22
本人最近得到兄弟给的一份 安装linux+apache+mysql+php 的文档,十分高兴希望大家一起学习一下!
请大家装时一定要先看好文档!!!!!!!!!!
1安装linux5
(1)安装时,不安装任何服务,但是要安装开发库
(2)在安装到选择安装级别设置时选择禁止
2安装apache
安装的版本为httpd-2.2.4.tar
(1)解压缩
tar zxvf httpd-2.2.4.tar
cd httpd-2.2.4
(2)配置apache安装信息
./configure --prefix=/usr/local/apache2 --enable-module=so
(3)执行make安装
make
make install
完成安装后执行 /usr/local/apache2/bin/apachectl start
打开浏览器,输入本机ip,如果出现it work 证明安装成功
3安装mysql
安装的版本是mysql-5.0.27.tar.gz
(1) 即压缩
tar zxvf mysql-5.0.27.tar.gz
(2)配置Mysql安装信息
cd mysql-5.0.27
///这段代码为一行 注意 : 后面的 ./configure.....都为一行!!!!!!!!
./configure --prefix=/usr/local/mysql --localstatedir=/var/lib/mysql
--with-comment=Source --with-server-suffix=-Comsenz
--with-mysqld-user=mysql--without-debug --with-big-tables
--with-charset=utf8 --with-collation=utf8_general_ci
--with-extra-charsets=all
--with-pthread--enable-static--enable-thread-safe-client
--with-client-ldflags=-all-static
--with-mysqld-ldflags=-all-static--enable-assembler--without-isam--without-innodb--without-ndb-debug
///!!!!!!!!
(3)执行make安装
make
make install
(4) 建立mysql群组以及使用者,并以mysql的身份起动server
groupadd mysql
useradd mysql
cd /usr/local/mysql
bin/mysql_install_db --user=mysql
chown -R root:mysql .
chown -R mysql /var/lib/mysql
cp share/mysql/my-huge.cnf /etc/my.cnf
cp share/mysql/mysql.server /etc/rc.d/init.d/mysqld
chmod 755 /etc/rc.d/init.d/mysqld
chkconfig --add mysqld
/etc/rc.d/init.d/mysqld start
bin/mysql -u root password "password_for_root"
如果能够启动,说明安装成功
安装GD库(让PHP支持GIF,PNG,JPEG)
安装 jpeg6
建立目录
mkdir /usr/local/jpeg6
mkdir /usr/local/jpeg6/bin
mkdir /usr/local/jpeg6/lib
mkdir /usr/local/jpeg6/include
mkdir /usr/local/jpeg6/man
mkdir /usr/local/jpeg6/man/man1
///"#"为root命令提示符 !!!!!!!忽略不计
# tar -zxf jpegsrc.v6b.tar.gz
# cd jpeg-6b
# ./configure --prefix=/usr/local/jpeg6/ --enable-shared --enable-static
# make; make install
安装zlib (安装libpng和gd前需要先安装zlib)
# tar zxvfzlib-1.2.2.tar.gz
# cd zlib-1.2.2.tar.gz
# ./configure --prefix=/usr/local/zli
# make;make install
安装libpng
# cd /root/soft
# tar -jxf libpng-1.2.8.tar.bz2
# cd libpng-1.2.8.tar.bz2
# cp scripts/makefile.std makefile
# make; make install
安装 freetype
# cd /root/soft
# tar -zxf freetype-2.3.2.tar.gz
# cd freetype-2.3.2.tar.gz
# ./configure --makeprefix=/usr/local/freetype
# make;make install
安装最新的GD库
# cd /root/soft
# tar -zxf gd-2.0.33.tar.gz
# cd gd-2.0.33
#
./configure --prefix=/usr/local/gd2 --with-jpeg=/usr/local/jpeg6/
--with-png --with-zlib=/usr/local/zlib
--with-freetype=/usr/local/freetype/
# make; make install
安装最新的Curl库
# tar -zxf curl-7.15.0.tar.gz
# cd curl-7.15.0.tar.gz
# ./configure --prefix=/usr/local/curl
# make; make install
编译安装PHP
由于php5需libxml2的支持, 所以先下载并安装libxml2
# tar -zxf libxml2-2.6.19.tar.gz
# cd libxml2-2.6.19
# ./configure --prefix=/usr/local/libxml2
# make; make install
安装php
# tar xjvf php-5.2.1.tar.bz2
# cd php-5.2.1.tar.bz2
# ./configure --prefix=/usr/local/php
--with-apxs2=/usr/local/apache2/bin/apxs --with-mysql=/usr/local/mysql/
--with-curl=/usr/local/curl--enable-ftp
--with-libxml-dir=/usr/local/libxml2 --with-expat-dir=/usr/lib
--with-gd=/usr/local/gd2 --with-jpeg-dir=/usr/local/jpeg6/
--with-zlib-dir=/usr/local/zli/ --with-png=/usr/local/lib/
# make
# make install
# cp php.ini-dist /etc/php.ini
修改apache配置文件
1 DocumentRoot 为自己放置页面的路径
2
LoadModule php5_module modules/libphp5.so
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
3 DirectoryIndex 在此项后添加index.php
修改php.ini
register-golbals = On
将php.ini文件移动到etc下
谢谢兄弟的帮忙!!!