首页 Linux运行环境安装全解
文章
取消

Linux运行环境安装全解

最新的软件包下载下来后,我开始正是编译安装:
一、编译安装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/](http://localhost/). 测试 shell>./apachectl -k stop

二、然后安装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 密码

三、安装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

b.安装libpng

CODE:
# tar -zvxf libpng-1.2.12.tar.gz # cd libpng-1.2.12 # ./configure –prefix=/usr/local/libpng/ # make; make install

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

d.:安装zlib

CODE:
#tar -zxvf zlib-1.2.3.tar.gz #cd zlib.1.2.3 # ./configure # make;make install

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

四、安装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:
# 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 其中./configure 后的

–prefix=/usr/local/php
–with-apxs2=/usr/local/apache/bin/apxs
–with-mysql=/usr/local/mysql/
–with-libxml-dir=/usr/local/libxml2
是必要的选项

–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
这是让PHP支持GD库的配置选项

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

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

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

配置 httpd.conf 让apache支持PHP

vi /usr/local/apache/conf/httpd.conf

找到 AddType application/x-gzip .gz .tgz 在其下添加如下内容
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps

重启apache

/usr/local/apache/bin/apachectl restart

六、安装ZendOptimizer加速PHP

#tar zxvf ZendOptimizer-2.5.3-linux-glibc21-i386.tar.gz

#cd ZendOptimizer-2.5.3-linux-glibc21-i386

#./install.sh

注意:忘了mysql的root口令怎么办

/usr/local/mysql/support-files/mysql.server stop

mysqld_safe –skip-grant-tables &

mysqladmin -u user password ‘newpassword’

mysqladmin flush-privileges

本文由作者按照 CC BY-NC-SA 4.0 进行授权
热门标签

RHEL AS4U3+httpd2.2+tomcat5.5+mysql5.0+php5.1

限制APACHE的进程

Comments powered by Disqus.

热门标签