Posts Tagged ‘Subversion’

SVN installation with Apache

August 13th, 2010

1. First of all, install apache/httpd
* yum install httpd
2. Make sure you apache is running. You can also type ‘http://localhost’ at your browser and apache test page should appear if your apache is running
* /etc/init.d/httpd status
3. Make it start by default on startup
* chkconfig httpd on
4. Edit the apache configuration to suit your need. If not sure, leave the default setting as it is
* vi /etc/httpd/conf/httpd.conf
5. Install subversion and mod_dav_svn for apache
* yum install mod_dav_svn subversion
6. Go to subversion.conf in /etc/httpd/conf.d/. Edit as below
* cd /etc/httpd/conf.d/
* vi subversion.conf

1. This is the most basic configuration where anyone will have unrestricted access to the repos. Location is the name that will be used in the browser address bar. In this example it will be ‘http://localhost/svn/repos’

2. This is a configuration with username and password for the client

DAV svn

SVNListParentPath on

SVNParentPath /usr/local/svn/

AuthType Basic

AuthName “Subversion repositories”

AuthUserFile “/etc/httpd/conf.d/svnuserconf”

Require valid-user

1.
* htpasswd -cm /etc/httpd/conf.d/svnuserconf admin — This command is not needed for the first configuration. To create the first user with password
* htpasswd -m /etc/httpd/conf.d/svnuserconf pawan — use this command to add another user
2. Configure your repository
* mkdir /usr/local/svn — create folder svn
* cd /usr/local/svn — change diectory to the newly created svn directory
* svnadmin create repos — create svn repository named repos
* chown apache.apache -R repos — change ownership of ‘repos’ to apache
* /etc/init.d/httpd restart — restart apache
* If you are running different apache change port no from conf file.
3. Open you browser and type ‘http://localhost/svn/repos’. You can see that a page with ‘Revision 0:/’ will appear. Congratulation, you just completed the setup for svn server

Setting Up Subversion

April 11th, 2010

Introduction:-

# yum install subversion

Ok, that was pretty easy. I now have subversion installed on my system; both from a client and user’s perspective. Next I need to create a subversion 
repository location on my disk (/svn can be replaced with any location on your server).

# svnadmin create /svn

In /svn/conf/passwd add the following (it is in plaintext, but I am sure there is an encrypted solution):

[users]
achristopher = some secret, yet plaintext password

In the /svn/conf/svnserve.conf, you should set the following:

[general]
anon-access = read
auth-access = write

password-db = passwd

realm = Test Repo

There, our subversion repository has been set up. Now all we have to do is start the subversion daemon.

# svnserve -r /svn -d

We can test the subversion repo:

# mkdir /tmp/test

# svnserve -r /svn -d

# svn import /tmp/test svn://localhost/svn/test -m “Initial creation.”
Authentication realm: <svn://localhost:3690> Test Repo
Password for ‘root’:
Authentication realm: <svn://localhost:3690> Test Repo
Username: ravi
Password for ‘manoj’:

Committed revision 1.

[root@manojserver conf]# svnlook tree /svn
/
 svn/
  test/
We have just added a directory to our subversion repository. Now lets checkout this project, and get to work:

[root@manojserver conf]# rm -Rf /tmp/test
[root@manojserver conf]# svn checkout svn://localhost/svn/test
Checked out revision 1.
=======================================
Running Subversion From xinetd

Now that we have Subversion installed on our server, we really need some way to have it always available. We could run subversion in daemon mode but we would 
have to write init.d scripts which can get rather complex (especially if you are writing one properly, and not just hacking one together).

Instead, we will add subversion to xinetd. The benefit of this is that subversion is only running when we need access to the repository rather than running 
all the time. By default, subversion is not set up in xinetd, so the following is how I set it up:

First make sure that xinetd is installed.

# yum install xinetd

Next we want to add the following to our /etc/xinetd.d/svnserve

# default: off
# description: svnserve is the server part of Subversion.
service svn
{
  disable = no
  port = 3690
  socket_type = stream
  protocol = tcp
  wait = no
  user = root
  server = /usr/bin/svnserve
  server_args = -i -r /svn
}

Finally, lets restart xinetd:

/etc/init.d/xinetd restart

Now xinetd will start the subversion repository server every time a subversion request is made.

Thanks
Manoj Chauhan