配置Subversion Apache tomcat 收藏
Subversion服务与客户端安装[Linux版]
一、基本组件及版本:
1、基本软件:
j2sdk-1_4_2-linux-i586.bin(http://java.sun.com/),jdk安装程序。
httpd-2.0.55.tar.gz(http://httpd.apache.org/),Apache安装程序
jakarta-tomcat-5.0.28.tar.gz(http://tomcat.apache.org/),Tomcat安装程序。
jakarta-tomcat-connectors-1.2.15-src.tar.gz(http://tomcat.apache.org/connectors-doc/),JK安装程序,用于集成Apache与Tomcat。
subversion-1.3.0.tar.gz(http://subversion.tigris.org/),Subversion安装程序。
svnwebclient-2.5.0.tar.gz(http://www.polarion.org/),SVN Web Client站点之.war文件,JSP代码。)
svn-1.2.3-setup.exe(http://subversion.tigris.org/),Subversion 的 Windows 安装程序。
TortoiseSVN-1.3.3.6219-svn-1.3.1.msi(http://tortoisesvn.tigris.org/),Subversion 的 Windows 客户端。
二、安装和配置
1、JDK安装与配置
将j2sdk-1_4_2-linux-i586.bin文件拷贝到/usr/local目录,执行以下命令:
# cd /usr/local/
# chmod +x j2sdk-1_4_2-linux-i586.bin
# ./j2sdk-1_4_2-linux-i586.bin
用vi /etc/profile命令,打开profile文件,添加如下内容:
JAVA_HOME=/usr/local/jdk/
CLASSPATH=/usr/local/jkd/lib/dt.jar:/usr/local/jdk/lib/tools.jar
PATH=/usr/local/jdk/bin:$PATH
export PATH JAVA_HOME CLASSPATH
2、Apache安装与配置
将httpd-2.0.55.tar.gz文件拷贝到/usr/local目录,执行以下命令:
# cd /usr/local/
# tar xvfz httpd-2.0.55.tar.gz
# cd httpd-2.0.55
#./configure --enable-module=so --enable-dav --enable-dav-fs
# make
# make install
安装完成后,配置Apache的Listen、ServerName和DirectoryIndex属性
# cd /usr/local/apache2/conf
# vi ./httpd.conf
将“Listen 80”修改为“Listen 192.168.1.5:80”(“192.168.1.5”对应修改为你的本机IP)
将“ServerName”修改为“ServerName Apache:80”(“Apache”对修改为你的本机名,不通过主机名访问,可任意填写)
在“DirectoryIndex”属性中,添加“index.jsp”和“logout.jsp”以支持JSP默认页面(“logout.jsp”是SVNWebClient的启动页面)
测试安装
# cd /usr/local/apache/bin/
# ./apachectl configtest
若显示“Syntax ok”,表明安装成功
启动Apache
#./apachectl start
访问本机80端口,查看端口是否正常
关闭Apache
# ./apachectl stop
3、 Tomcat安装与配置
将jakarta-tomcat-5.0.28.tar.gz文件拷贝到/usr/local目录,执行以下命令:
# cd /usr/local/
# tar xvfz jakarta-tomcat-5.0.28.tar.gz
# ln –s /usr/local/jakarta-tomcat-5.0.28 /usr/local/tomcat
手动添加环境变量
# vi /usr/local/tomcat/bin/catalina.sh
JAVA_HOME=/usr/local/jdk
中文支持
# vi /usr/local/tomcat/conf/server.xml
设置URIEncode为UTF-8,以支持中文
<Connector port="8080" URIEncoding="UTF-8" .../>
启动Tomcat
# /usr/local/tomcat/bin/startup.sh /startup.bat
访问本机8080端口,查看端口是否正常
关闭Tomcat
# /usr/local/tomcat/bin/shutdown.sh /shutdown.bat
4、 JK安装
将jakarta-tomcat-connectors-1.2.15-src.tar.gz文件拷贝到/usr/local目录,执行以下命令:
# cd /usr/local/
# tar xzvf jakarta-tomcat-connectors-1.2.15-src.tar.gz
# cd jakarta-tomcat-connectors-1.2.15-src/jk/native
# chmod 755 buildconf.sh
# ./buildconf.sh
# ./configure --with-apxs=/usr/local/apache2/bin/apxs
# make
# make install
安装完后,mod_jk.so已经拷贝到Apache的模块安装目录“/usr/local/apache2/modules”
给Apache安装JK模块时,确认mod_jserv.so模块未被加载。因为mod_jserv.so会与mod_jk.so冲突。
5、系统整合
配置Apache
# vi /usr/local/apache/conf/httpd.conf
1、在文件加载模块的位置加上如下语句
LoadModule jk_module modules/mod_jk.so
2、在文件最末尾加上如下语句
# Where to find workers.properties
JkWorkersFile conf/workers.properties
# Where to put jk logs
JkLogFile logs/mod_jk.log
# Set the jk log level [debug/error/info]
JkLogLevel info
# Select the log format
JkLogStampFormat "[%a %b %d %H:%M:%S %Y] "
# JkOptions indicate to send SSL KEY SIZE,
JkOptions +ForwardKeySize +ForwardURICompat -ForwardDirectories
# JkRequestLogFormat set the request format
JkRequestLogFormat "%w %V %T"
# Send servlet for context /examples to worker named ajp13
# JkMount /servlet/* ajp13
# Send JSPs for context /examples to worker named ajp13
JkMount /*.jsp ajp13
# Apache 虚拟主机配置
NameVirtualHost *:80
<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot "/usr/local/tomcat/webapps"
ServerName 192.168.1.5
ErrorLog logs/localhost-error_log
CustomLog logs/localhost-access_log common
</VirtualHost>
配置workers.properties文件
#vi /usr/local/apache/conf/workers.properties
在文件中添加如下内容:
worker.list=ajp13
worker.ajp13.port=8009
# 本机,若上面Tomcat主机不为localhost,作相应修改
worker.ajp13.host=192.168.1.5
# 类型
worker.ajp13.type=ajp13
# 代理数,不用修改
worker.ajp13.lbfactor=1
8009端口的中文支持
# vi /usr/local/tomcat/conf/server.xml
设置URIEncode为UTF-8,以支持中文
<Connector port="8009" URIEncoding="UTF-8" .../>
6、Subversion安装
将subversion-1.3.0.tar.gz文件拷贝到/usr/local目录,执行以下命令:
# cd /usr/local/
# tar xzvf subversion-1.3.0.tar.gz
# cd subversion-1.3.0
# ./configure --with-apxs=/usr/local/apache2/bin/apxs
# make
# make install
配制subversion的HTTP服务
# vi /usr/local/apache2/conf/httpd.conf
在httpd.conf文件最后添加如下内容:
<Location /svn>
DAV svn
# 要去掉路径最后的""或"/",否则会出错
SVNParentPath /home/svn
# HTTP认证
AuthType Basic
AuthName "Subversion Repository "
AuthUserFile /home/svn/passwd
# 告诉Apache什么样的客户端需要授权的指示
Require valid-user
</Location>
创建用户密码文件
# mkdir /home/svn
# cd /home/svn
# htpasswd -cm passwd harry
New password:*****
Re-type new password:*****
Adding password for user harry
# htpasswd -m passwd sally
New password:*****
Re-type new password:*****
Adding password for user sally
(htpasswd 命令,第一次用参数 -c 创建文件;参数 -m 是对密码进行MD5加密)
7、SVN Web Client安装
将svnwebclient-2.5.0.tar.gz文件拷贝到/usr/local目录,执行以下命令:
# cd /usr/local/
# tar xzvf svnwebclient-2.5.0.tar.gz
# cp ./svnwebclient-2.5.0/svnwebclient.war /usr/local/tomcat/webapps
配置SVN Web Client系统
# vi /usr/local/tomcat/webapps/svnwebclient/WEB-INF/web.xml
设置 RepositoryUrl 属性为SVN版本库路径:
<context-param>
<param-name>RepositoryUrl</param-name>
<param-value>http://192.168.1.103/svn/test/</param-value>
</context-param>
添加 ParentRepositoryDirectory 属性为SVN版本库父路径(路径最后一定要以“/”结尾):
<context-param>
<param-name>ParentRepositoryDirectory</param-name>
<param-value>http://192.168.1.103/svn/</param-value>
</context-param>
设置 DefaultEncoding 属性为 UTF-8:
<context-param>
<param-name>DefaultEncoding</param-name>
<param-value>UTF-8</param-value>
</context-param>