红联Linux门户
Linux帮助

Linux运行环境安装全解

发布时间:2006-09-20 00:41:15来源:红联作者:Explore
最新的软件包下载下来后,我开始正是编译安装:

一、编译安装Apache2.2.3。

[code]shell>tar xvf httpd-2.2.3.tar.gz
shell>cd httpd-2.2.3
shell>./configure --prefix=/usr/local/apache \
>--enable-rewrite=shared \
>--enable-speling=shared
shell>make
shell>make install
shell>vi /usr/local/apache /conf/httpd.conf
//进入usr/local/apache/bin
shell>./apachectl -k start
//这时候可以通过http://localhost/. 测试
shell>./apachectl -k stop[/code]

二、然后安装MYSQL5.0.22

[code]shell> groupadd mysql
shell> useradd -g mysql mysql
shell> tar zxvf mysql-5.0.22.tar.gz
shell> cd mysql-5.0.22
shell> ./configure --prefix=/usr/local/mysql
shell> make
shell> make install
shell> cp support-files/my-medium.cnf /etc/my.cnf
shell> cd /usr/local/mysql
shell> bin/mysql_install_db --user=mysql //创建MySQL授权表
shell> chown -R root .
shell> chown -R mysql var
shell> chgrp -R mysql .
shell> bin/mysqld_safe --user=mysql & //启动MYSQL服务器
shell>bin/mysqladmin -u root passwor "123456"//修改 mysql 的 root 密码[/code]

三、安装GD库(让PHP支持GIF,PNG,JPEG)
a.安装 jpeg6

建立目录:
[code]# 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

# tar -zvxf jpegsrc.v6b.tar.gz
# cd jpeg-6b
# ./configure --prefix=/usr/local/jpeg6/ --enable-shared --enable-static
# make; make install[/code]
b.安装libpng

[code]# tar -zvxf libpng-1.2.12.tar.gz
# cd libpng-1.2.12
# ./configure --prefix=/usr/local/libpng/
# make; make install[/code]
c.安装 freetype

[code]# tar -zvxf freetype-2.1.1.tar.gz
# cd freetype-2.1.1
# mkdir -p /usr/local/freetype
# ./configure --prefix=/usr/local/freetype
# make;make install[/code]
d.:安装zlib

[code]#tar -zxvf zlib-1.2.3.tar.gz
#cd zlib.1.2.3
# ./configure
# make;make install[/code]
e.安装GD库

[code]# 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/lib/
--with-freetype=/usr/local/freetype/
# make; make install[/code]
四、安装PHP5(安装libxml2 )

[code]# tar -zxf libxml2-2.6.24.tar.gz
# cd libxml2-2.6.24
# mkdir -p /usr/local/libxml2
# ./configure --prefix=/usr/local/libxml2
# make; make install[/code]

[code]# tar -zvxf php-5.1.4.tar.gz
# cd php-5.1.4
# ./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache/bin/apxs
--with-mysql=/usr/local/mysql/
--with-libxml-dir=/usr/local/libxml2
--with-expat-dir=/usr/lib --enable-soap
--with-gd=/usr/local/gd2/
--with-jpeg-dir=/usr/local/jpeg6/
--with-zlib-dir=/usr/local/lib/
--with-png=/usr/local/lib/
--with-freetype-dir=/usr/local/freetype/
# make
# make install
# cp php.ini-dist /usr/local/php/lib/php.ini[/code]
其中./configure 后的
[code]--prefix=/usr/local/php
--with-apxs2=/usr/local/apache/bin/apxs
--with-mysql=/usr/local/mysql/
--with-libxml-dir=/usr/local/libxml2[/code]
是必要的选项

[code]--with-gd=/usr/local/gd2/
--with-jpeg-dir=/usr/local/jpeg6/
--with-png=/usr/local/lib
--with-zlib-dir=/usr/lib
--with-freetype-dir=/usr/local/freetype[/code]
这是让PHP支持GD库的配置选项

--with-curl=/usr/local/curl 支持CURL库
--enable-ftp 打开FTP库函数支持

[code]--enable-soap --with-xsl=/usr/local/libxslt --enable-xslt[/code]
让PHP支持SOAP, 上面这些一般用得少, 可以去掉


五、重新配置apache2让他支持php。

配置 httpd.conf 让apache支持PHP
[code]# vi /usr/local/apache/conf/httpd.conf[/code]
找到 AddType application/x-gzip .gz .tgz 在其下添加如下内容
[code]AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps[/code]

重启apache
[code]# /usr/local/apache/bin/apachectl restart[/code]


六、安装ZendOptimizer加速PHP
[code]#tar zxvf ZendOptimizer-2.5.3-linux-glibc21-i386.tar.gz
#cd ZendOptimizer-2.5.3-linux-glibc21-i386
#./install.sh[/code]

注意:忘了mysql的root口令怎么办
[code]# /usr/local/mysql/support-files/mysql.server stop
# mysqld_safe --skip-grant-tables &
# mysqladmin -u user password 'newpassword'
# mysqladmin flush-privileges[/code]
文章评论

共有 0 条评论