一些安装apche+php+tomcat+mysql心得

Posted on 2006-10-16 11:21 E.ven 阅读(1207) 评论(0)  编辑  收藏

core 1 下的安装
所有安装软件放到/opt下
所有安装位置在/usr/local/下
全部使用.bin安装文件安装

安装jdk(位置:/usr/local/j2sdk)
cd opt //进入安装文件所在目录
chmod +x jdk-1_5_0_05-linux-i586.bin  //使文件可执行
./jdk-1_5_0_05-linux-i586.bin  //进行安装
mv ./jdk1.5.0_05 /usr/local/j2sdk  //将安装好的文件放到自己需要的目录中
vi /etc/profile  //编辑此文件输入
export JAVA_HOME=/usr/local/j2sdk
export CLASSPATH=./:$CLASSPATH:$JAVA_HOME/lib/tools.jar:$JAVA_HOME/lib/dt.jar:.
export PATH=$JAVA_HOME/bin:$PATH

source /etc/profile  //使新编辑过的文件生效

安装tomcat(位置:/usr/local/tomcat-5.0)
cd opt //进入安装文件所在目录
tar zxvf jakarta-tomcat-5.0.29.tar.gz  //解压缩
mv ./jakarta-tomcat-5.0.29 /usr/local/tomcat  //将安装好的文件放到自己需要的目录中
vi /etc/profile  //编辑此文件输入
export CATALINA_HOME=/usr/local/tomcat  //

vi /usr/local/tomcat/conf/tomcat-users.xml  //可以使用tomcat管理工具,将密码更改为自己的!
<?xml version='1.0' encoding='utf-8'?>  //这句要加到文件第一行

<tomcat-users>
  <role rolename="tomcat"/>
  <role rolename="role1"/>
  <role rolename="manager"/>
  <role rolename="admin"/>
  <user username="tomcat" password="yhreport" fullName="" roles="tomcat"/>
  <user username="role1" password="yhreport" fullName="" roles="role1"/>
  <user username="both" password="yhreport" fullName="" roles="role1,tomcat"/>
  <user username="admin" password="yhreport" fullName="" roles="admin,manager"/>
</tomcat-users>
//记住要修改默认用户名密码
vi /usr/local/tomcat/bin/startup.sh  //加入系统启动
vi /usr/local/tomcat/bin/shutdown.sh  //加入系统启动
export JAVA_HOME=/usr/local/j2sdk
export CLASSPATH=./:$CLASSPATH:$JAVA_HOME/lib/tools.jar:$JAVA_HOME/lib/dt.jar:.
export PATH=$PATH:$JAVA_HOME/bin
export CATALINA_HOME=/usr/local/tomcat

vi /etc/rc.d/rc.local  //加入系统启动
/usr/local/tomcat/bin/startup.sh

安装AXIS
cd opt //进入安装文件所在目录
tar zxvf axis-bin-1_2_1.tar.gz  //解压缩
四个相关包
1.mail.jar
2.activation.jar
3.xerces.jar
4.xmlsec-1.2.1.jar
拷贝到/usr/local/tomcat/common/lib/
解压axis-bin-1_2_1.tar.gz,将压缩包里的webapps/axis拷到tomcat下webapps/ROOT
vi /usr/local/tomcat/conf/server.xml
在</Host>前加入: 
<Context path="/axis" docBase="/usr/local/tomcat/webapps/ROOT/axis" debug="0" reloadable="true" > </Context>


安装mysql(位置:/usr/local/mysql)
linux core4 可能需要linuxthreads-devel-2.3.5-10.i386.rpm,在第四张盘上
cd opt //进入安装文件所在目录
tar zxvf mysql-4.0.25.tar.gz  //解压缩
cd mysql-4.0.25
./configure --prefix=/usr/local/mysql  //配置mysql安装
make
make install
./scripts/mysql_install_db  //初始化数据库
useradd mysql  //建立mysql用户
下面进行权限设置
chown -R root /usr/local/mysql
chgrp -R mysql /usr/local/mysql
chown -R root /usr/local/mysql/bin
chgrp -R mysql /usr/local/mysql/bin
chown -R root /usr/local/mysql/var
chgrp -R mysql /usr/local/mysql/var
chmod 777 /usr/local/mysql/var
chown -R root /usr/local/mysql/var/mysql
chgrp -R mysql /usr/local/mysql/var/mysql
chmod 777 /usr/local/mysql/var/mysql
chown -R root /usr/local/mysql/var/mysql/*
chgrp -R mysql /usr/local/mysql/var/mysql/*
chmod 777 /usr/local/mysql/var/mysql/*
chmod 777 /usr/local/mysql/lib/mysql/libmysqlclient.a
vi /etc/rc.d/rc.local  //将守护进程加入系统启动
/usr/local/mysql/bin/mysqld_safe --user=mysql &  //使用用户mysql来运行Mysql守护进程

安装apache(位置:/usr/local/apache)
cd opt //进入安装文件所在目录
tar zxvf httpd-2.0.52.tar.gz  //解压缩
cd httpd-2.0.52
./configure --prefix=/usr/local/apache --with-mysql=/usr/local/mysql --enable-track-vars --enable-cgi --enable-so --enable-mods-shared=all --with-config-file-path=/usr/local/apache/conf
//
--prefix=/usr/local/apache 指定把apahce安装到/usr/local/apache目录中;
--enable-cgi 支持CGI;
--with-config-file-path=/usr/local/apache/conf 指定把apache的配制文件放在/usr/local/apache/conf中;比如httpd.conf配制文件就在这个目录中;
--enable-track-vars 为启动cookie的get/post等追踪功能
--enable-so DSO功能
--enable-mods-shared=all 包含所有的模块为DSO
如果需要更多的选项,可能通过下面的命令来查看; (./configure --help)
//
make
make install
vi /usr/local/apache/conf/httpd.conf
加一行 AddType application/x-httpd-php .php .phtml .php3 .inc 
# AddDefaultCharset后改为GB-2312
vi /etc/rc.d/rc.local  //将守护进程加入系统启动
/usr/local/apache/bin/apachectl start  //
禁止目录列表
vi httpd.conf
将:Options Indexes FollowSymlinks MultiViews
改为:Options FollowSymlinks MultiViews

PHP安装
cd opt //进入安装文件所在目录
tar xvfz php-5.0.2.tar.gz  //解压缩
cd php-5.0.2  //进入目录
./configure  --with-apxs2=/usr/local/apache/bin/apxs --enable-track-vars  --with-mysql=/usr/local/mysql  --with-zlib  //配置PHP apache与mysql的路径按照实际的路径写(如果apache的版本较低把2去掉)
make
make install
cp php.ini-dist /usr/local/lib/php.ini  //拷贝
vi /usr/local/apache/conf/httpd.conf
AddType application/x-httpd-php .php .phtml .php3 .inc
-------------------------------------------------
查找<IfModule mod_mime.c>

在此范围添加

AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
-------------------------------------------------
tomcat/apache/整合
tar xvfz jakarta-tomcat-connectors-jk2-src-current.tar.gz  //解压缩
cd jakarta-tomcat-connectors-jk2-2.0.4-src/jk/native2  //进入目录
./configure --with-apxs2=/usr/local/apache/bin/apxs  //配置
make
cd ../build/jk2/apache2
/usr/local/apache/bin/apxs -n jk2 -i mod_jk2.so

修改Apache的配置文件httpd.conf,如下:
vi /usr/local/apache/conf/httpd.conf
LoadModule jk2_module modules/mod_jk2.so

在/usr/local/apache/conf目录下新建workers2.properties,内容如下:
[channel.socket:localhost:8009]
port=8009
host=127.0.0.1

[ajp13:localhost:8009]
channel=channel.socket:localhost:8009

[uri:/jsp/*]
worker=ajp13:localhost:8009

//uri后面的路径可以自己建立
uri:/aieccs/*
uri:/swaieccs/*
uri:/actvaieccs/*

 

Redhat9+Apache+Mysql+PHP+GD2+Perl,先整理一下安装过程:

一、安装环境描述

操作系统:Linux RedHat 9.0
web服务软件:Apache httpd-2.0.53 下载:http://apache.linuxforum.net/dist/httpd/httpd-2.0.53.tar.gz

数据库软件:mysql-4.0.23a.tar 下载:http://dev.mysql.com/get/Downloads/MySQL-4.0/mysql-4.0.23a.tar.gz/from/pick

PHP脚本程序语言:php-4.3.10.tar.gz下载:http://cn2.php.net/get/php-4.3.10.tar.gz/from/cn.php.net/mirror

其它库文件:
ZLIB:zlib-1.2.2.tar.gz
wget http://www.zlib.net/zlib-1.2.3.tar.gz

FreeType:freetype-2.1.9.tar.gz http://sourceforge.net/projects/freetype/
wget http://umn.dl.sourceforge.net/sourceforge/freetype/freetype-2.1.9.tar.gz

PNG:libpng-1.2.5.tar.gz
wget http://prdownloads.sourceforge.net/png-mng/libpng-1.2.5.tar.gz?download(错误,需要下载后上传)

JPEG:jpegsrc.v6b.tar.gz http://freshmeat.net/projects/libjpeg/
wget http://freshmeat.net/redir/libjpeg/5665/url_tgz/jpegsrc.v6b.tar.gz

GD:gd-2.0.33.tar.gz
wget http://www.boutell.com/gd/http/gd-2.0.33.tar.gz

zend: www.zend.com

DBI-1.46.tar.gz 下载:http://search.cpan.org/~timb/DBI/

DBD-mysql-2.9005_3.tar.gz 下载:http://search.cpan.org/~rudy/DBD-mysql/

一、安装Redhat9

Redhat9的安装比较简单,需要注意的是Redhat9本身集成了Apache+Mysql+PHP,如果不想用集成的版本,安装时不要选择这些服务。

二、安装Mysql

用代码编译安装

三、安装APACHE

用代码编译安装

四、安装PHP

开始安装和编译代码:

A先安装支持包(注意安装顺序)

建立初始目录:

mkdir /usr/local/modules

#jpeg目录
mkdir /usr/local/modules/jpeg6
mkdir /usr/local/modules/jpeg6/bin
mkdir /usr/local/modules/jpeg6/lib
mkdir /usr/local/modules/jpeg6/include
mkdir /usr/local/modules/jpeg6/man
mkdir /usr/local/modules/jpeg6/man/man1 --> man1是1234的1

A1、安装zlib

tar xzvf zlib-1.2.3.tar.gz
cd zlib-1.2.3
#不要用--prefix自定义安装目录,影响gd的安装
./configure
make
make install

A2、安装freetype

tar xzvf freetype-2.1.9.tar.gz
cd freetype-2.1.9
./configure --prefix=/usr/local/modules/freetype
make
make install

A3、安装libpng

tar xzvf libpng-1.2.5.tar.gz
#不要用--prefix自定义安装目录,影响gd的安装
cd libpng-1.2.5
cp scripts/makefile.std makefile
make test
make install

A3、安装jpeg

tar xzvf jpegsrc.v6b.tar.gz
cd jpeg-6b/
./configure --prefix=/usr/local/modules/jpeg6 --enable-shared --enable-static
make
make install

A4、安装GD

tar xzvf gd-2.0.33.tar.gz
cd gd-2.0.33
./configure --prefix=/usr/local/modules/gd --with-jpeg=/usr/local/modules/jpeg6 --with-png --with-zlib --with-freetype=/usr/local/modules/freetype
make
make install

B、安装PHP
tar xvfz php-5.0.2.tar.gz  //解压缩
cd php-5.0.2  //进入目录
./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache/bin/apxs --with-mysql=/usr/local/mysql --enable-deflate --enable-mbstring --with-gd=/usr/local/modules/gd --with-zlib --with-png --with-jpeg-dir=/usr/local/modules/jpeg6 --with-freetype-dir=/usr/local/modules/freetype --enable-trace-vars --with-config-file-path=/usr/local/php/etc

一点说明:

--prefix=/usr/local/php 指定把php-5.0.2安装到/usr/local/php目录中;
--with-mysql=/usr/local/mysql 指定mysql数据服务器安装的位置;
--with-apxs2=/usr/local/apache/bin/apxs 这是加入apache中为DSO模块的位置;
-enable-track-vars 为启动cookie的get/post等追踪功能
--with-config-file-path=/usr/local/php/etc 指定php的配制文件存放的目录是/usr/local/php/etc目录,我们安装完成后,也要把php.ini复制到这个目录中来。

make
make install
cp php.ini-dist /usr/local/php/etc/php.ini

更改apache的配制文件:得加几行,目的是让apache能解释php程序。
查找AddType application/x-tar .tgz 行,在下面添加
AddType application/x-httpd-php .php
AddType application/x-httpd-php .php3
AddType application/x-httpd-php .phtml
AddType application/x-httpd-php-source .phps

找到下面一行在后面加上index.php,这表示网站的默认页也能够为index.php

DirectoryIndex index.html index.html.var index.php

进行php.ini文件的配置工作
查找safe_mode=Off,更改为safe_mode=On
1)查找max_execution_time = 30,更改为max_execution_time = 600
(2)查找max_input_time = 60,更改为max_input_time = 600
(3)查找memory_limit = 8M ,更改为memory_limit = 20M
(4)查找display_errors = On,更改为display_errors = Off
(5)查找register_globals = Off,更改为register_globals = On
(6)查找post_max_size = 8M,更改为post_max_size = 20M
(7)查找upload_max_filesize = 2M,更改为upload_max_filesize = 20M
(8)查找session.auto_start = 0,更改为session.auto_start = 1
保存后退出,从而完成了php.ini文件的配置工作。

五、安装Zend

解压后执行进入目录执行

./install.sh

一步一步下来,当出现:
Enter the location of your php.ini file
的提示时,输入:/usr/local/php/etc

六、安装Perl

1、RedHat 9.0集成了Perl5.8.0,不需要额外安装,支持.CGI和.PL需要将httpd.conf中#AddHandler cgi-script .cgi前的#去掉,并改为 AddHandler cgi-script .cgi .pl

2、安装支持mysql的DBI和DBD套件

tar zxvf DBI-1.46.tar.gz
cd DBI-1.46
perl Makefile.PL
make
make test
make install

ln -s /usr/bin/perl /usr/local/bin/perl
ln -s /usr/local/mysql/bin/mysql_config /sbin/mysql_config

tar zxvf DBD-mysql-2.9005_3.tar.gz
cd DBD-mysql-2.9005_3
perl Makefile.PL
make
make test
make install

OK,结束!


只有注册用户登录后才能发表评论。


网站导航:
 

posts - 27, comments - 15, trackbacks - 0, articles - 1

Copyright © E.ven