查了几天中文资料,按照步骤均未把subversion安装部署成功。看了一篇英文文章,迅速安装成功,特在此分享。有问题的可留言我。

1. System

 

CentOS 4.x/RHEL 4

CentOS 5.1/RHEL 5

 

2. References

 

Subversion:

Version Control with Subversion:
 

 

3. Installation

 

 

[root@lucifer ~]# yum install mod_dav_svn subversion

 

The first thing to do is to install the packages I mentioned above. If you don't have Apache installed already, it'll go ahead and drag that down as well.

When you install from yum, there's a longer list than the two packages above that will automatically resolve themselves. Some other things will be installed automatically. Depending on your packages, your mileage may vary.

 

4. Configurations

 

 

4.1. Apache

 

Before you delve into the deep end, you need to ensure Apache is set up first. I'm assuming this is a virgin installation, so if you already have Apache things going...be careful what you change. I'm also going to explain setting this up with basic password protection. You can easily let this out, however, if you want to allow access to the repos from everyone.

First thing is make sure you open up /etc/httpd/conf/httpd.conf and at least change the directive. If you need more help or more complex configurations, then consult the Apache docs please.

 

[root@lucifer ~] vim /etc/httpd/conf/httpd.conf -- Edit what you need and save the file[root@lucifer ~] service httpd start[root@lucifer ~] chkconfig httpd on

 

Browse to your machine on the network and see if you get your test page, which you should: . Working? Great, let's move along to more fun things.

 

4.2. Subversion's Apache configs

 

The next step is to setup some settings within Apache so Subversion and Apache play nice together. Get yourself to the example configuration file Subversion installed for you.

 

[root@lucifer ~] cd /etc/httpd/conf.d/[root@lucifer ~] vim subversion.conf# Make sure you uncomment the following if they are commented outLoadModule dav_svn_module     modules/mod_dav_svn.soLoadModule authz_svn_module   modules/mod_authz_svn.so# Add the following to allow a basic authentication and point Apache to where the actual# repository resides.<Location /repos>        DAV svn        SVNPath /var/www/svn/repos        AuthType Basic        AuthName "Subversion repos"        AuthUserFile /etc/svn-auth-conf        Require valid-user</Location>

 

The location is what Apache will pass in the URL bar. For instance: points to the SVNPath that you have specified. My examples are just that, so feel free to put things where you want. Make sure you save the file when you are finished editing.

Next we have to actually create the password file that you specified in the previous step. Initially you'll use the -cm arguments. This creates the file and also encrypts the password with MD5. If you need to add users make sure you simply use the -m flag, and not the -c after the initial creation.

 

[root@lucifer ~] htpasswd -cm /etc/svn-auth-conf yourusernameNew password:Re-type new password:Adding password for user yourusername[root@lucifer ~] htpasswd -m /etc/svn-auth-conf anotherusernameNew password:Re-type new password:Adding password for user anotherusername

 

 

4.3. Configure your repository

 

The next thing you need to do is to create the actual repository from which you will check in and out your files. This is simple to do with some of the included svn tools.

 

[root@lucifer ~] cd /var/www/ -- Or wherever you placed your path above[root@lucifer ~] mkdir svn[root@lucifer ~] cd svn[root@lucifer ~] svnadmin create repos[root@lucifer ~] chown -R apache.apache repos[root@lucifer ~] service httpd restart

 

Go test out whether or not you can access your repository from a web browser: . You should get a popup box asking for a username and password. If so, type in your credentials and you should be displayed with a Revision 0:/ page. If so, that's it for setting up a repo. If you want multiple repos, check out the docs from the links provides above. This sets up one repository and shows you how to start using them. Speaking of, let's move on to just that.