参考文档:
Installing Subversion on Fedora Core
原以为通过参考文档可以搭建起来SVN服务器,没想到还是有些不同。
1、安装subversion、mod_dav_svn,subversion在fedora8中已经安装了,mod_dav_svn是svn的apache模块。
# yum install subversion
# yum install mod_dav_svn
2、创建代码仓库、访问用户、访问许可文件夹
# mkdir /svn
# mkdir /svn/repos
# mkdir /svn/users
# mkdir /svn/permissions
3、更改上述文件夹的访问权限,以便apache可以操作
# chown -R apache.apache /svn
4、利用subversion命令为具体的项目创建代码仓库。如项目为mydemo
# svnadmin create /svn/repos/mydemo
5、为访问subversion创建配置文件,主要用于关闭匿名访问、指定密码文件和访问域等项目。
vi /svn/repos/conf/svnserve.conf
以下代码为svnserve.conf的内容
non-access = none
password-db = pwdfile
realm = chenzugang.name
auth-access = write
6、创建用户、密码对配置文件。文件名为上一步所指定的password-db项。
vi pwdfile
pwdfile的内容格式如下:
[users]
username = password
7、至此,subversion已经配置完毕,可以启动服务了。
# svnserve -d --listen-port=3690
具体的启动参数可以查看文档。停止subversion服务的命令只有杀死进程一条路(
参考文献如是说)如下
killall svnserve
8、如果您没手停止subversion服务,另找一台机器,通过svn命令行以您在pwdfile中建立的用户访问一下您的svn服务,检查是否正常。命令如下
svn co --username=myusername svn://mydomain/svn/repos/mydemo
其中,mydomian为您svn服务器的IP或域名,如果正常,结果为:
取出版本 0。
之所以为0,是因为都是空的。
9、下面开始配置apache,使得web方式能访问代码库,就是这部分,和参考文档不同,搞的我花了一些时间,而且google之,没有一个管事,后来仔细分析了apache的配置习惯,才猜出来的。
编辑文档subversion.conf。
vi /etc/httpd/conf.d/subversion.conf
这个文档已经存在,因为您安装了mod_dav_svn,他会生成一个默认文档。我机器上默认文档大致如下,之所以是大致,是几经修改,已记不得原始的文档了:
LoadModule dav_svn_module modules/mod_dav_svn.so
LoadModule authz_svn_module modules/mod_authz_svn.so
#
# Example configuration to enable HTTP access for a directory
# containing Subversion repositories, "/var/www/svn". Each repository
# must be readable and writable by the 'apache' user. Note that if
# SELinux is enabled, the repositories must be labelled with a context
# which httpd can write to; this will happen by default for
# directories created in /var/www. Use "restorecon -R /var/www/svn"
# to label the repositories if upgrading from a previous release.
#
#
# To create a new repository "http://localhost/repos/stuff" using
# this configuration, run as root:
#
# # cd /var/www/svn
# # svnadmin create stuff
# # chown -R apache.apache stuff
#
#
#<Location /repos>
# DAV svn
# SVNParentPath /svn
#
# # Limit write permission to list of valid users.
# <LimitExcept GET PROPFIND OPTIONS REPORT>
# # Require SSL connection for password protection.
# # SSLRequireSSL
#
# AuthType Basic
# AuthName "xxxxxx"
# AuthUserFile /svn/users/svnpass
# Require valid-user
# </LimitExcept>
</Location>
因该修改为如下:
LoadModule dav_svn_module modules/mod_dav_svn.so
LoadModule authz_svn_module modules/mod_authz_svn.so
#
# Example configuration to enable HTTP access for a directory
# containing Subversion repositories, "/var/www/svn". Each repository
# must be readable and writable by the 'apache' user. Note that if
# SELinux is enabled, the repositories must be labelled with a context
# which httpd can write to; this will happen by default for
# directories created in /var/www. Use "restorecon -R /var/www/svn"
# to label the repositories if upgrading from a previous release.
#
#
# To create a new repository "http://localhost/repos/stuff" using
# this configuration, run as root:
#
# # cd /var/www/svn
# # svnadmin create stuff
# # chown -R apache.apache stuff
#
<Location /svn>
DAV svn
SVNListParentPath on
SVNParentPath /svn/repos
# SVNPath /svn/repos
#
# # Limit write permission to list of valid users.
# <LimitExcept GET PROPFIND OPTIONS REPORT>
# # Require SSL connection for password protection.
# # SSLRequireSSL
#
AuthType Basic
AuthName "chenzugang.name"
AuthUserFile /svn/users/svnpass
Require valid-user
# </LimitExcept>
</Location>
其中一个关键的参数为
AuthUserFile /svn/users/svnpass
这个是web访问认证的用户身份信息文件。需要创建。创建方法如下,使用htpasswd命令。
这个文件中的用户密码是否要与/svn/repos/conf/pwdfile里的用户密码对应,我目前还不清楚,下次再补上
htpasswd -cb /svn/users/svnpass username password
还需要创建一个svn访问读写权限的配置文件。svnauthz.conf
vi /svn/permissions/svnauthz.conf
该文件类容如下:
[/]
username1 = r
username2 = rw
r代表read,w当然就是write啰。
至此,一些于apache相关的配置文件已经完成。
修改SELINUX权限(
注:在SELINUX中,安全性得到了加强。若不进行这样的修改,客户端访问时就会报错“Could not open the requested SVN filesystem.”),修改的命令如下:
# chcon -R -h -u system_u -t httpd_sys_content_t /svn/repos
剩下的就是让apache重新装载一下配置文件。命令如下:
service httpd reload
打开浏览器,输入项目代码库地址
http://localhost/svn/mydemo
反正我的是搞定了。你的搞定了没有?
分享到:
相关推荐
Installing RAC on AIX
linux subversion的文件及依赖包,请看我的Linux subversion安装博客再下载
Installing MIUI on Meizu MX2
\Installing RAC on AIX 001.pdf
Installing Activ Test on Your PC
Microsoft Windows 2000 Scripting Guide - Installing Software on a Remote Computer
Installing STLinux on Ubuntu
Installing Your Driver on Windows Millennium INF File Guide
* Installing Fedora * Getting Productive with the Desktop * Using Linux Commands * Accessing and Running Applications * Publishing with Fedora * Music, Video, and Images in Linux * Using the Internet ...
Installing Oracle Database 11g on Linux
面是我在Ubuntu6.06 LTS 下源码编译安装samba主要安装过程,本人第一次用Ubuntu,刚装上去时候,没有gcc编译环境。郁闷了半天。找出这一过程发了不少的时间。可能还有些不妥,不过我经过这样的安装达到了向windows共享...
Installing Oracle 10G On Linux
Requirements For Installing Oracle10gR2 On RHEL 5&OEL 5 (x86_64)
2.4.1. General Notes on Installing MySQL on Mac OS X 2.4.2. Installing MySQL on Mac OS X Using Native Packages 2.4.3. Installing the MySQL Startup Item 2.4.4. Installing and Using the MySQL Preference...
installing oracle9i on redhat linux.rar 分布讲述在redhat上安装oracle9i的全过程和注意事项!
Installing SQL Server 2008 on a Windows Server 2008 Cluster
We have tracked the development of Fedora from very early on to make sure that the information contained in this book mirrors closely the development of the distribution. A full copy of Fedora is ...
Step By Step guide for installing Oracle RAC 11gR2 on Linux