Thursday, November 20, 2014

Setting Up an SVN Repository Server

More than 4 years ago, I wrote a blog post about setting up an SVN (subversion) client in an Ubuntu system because I had to use the version control  system maintained by the lab for research project works. After such a long time period, finally a week ago I had to install an SVN server in a newly settled server for the lab. Keeping  the tradition, I'm writing down the steps of this installation for the benefit of me in the future and also for the rest of the world.

First of all, we should login to the sever where we need to configure SVN server using SSH. Then we can follow the command sequence given below.

# installing svn application
apt-get install subversion

# template for a project repository directory structure
mkdir /var/svn/
mkdir /var/svn/tmpproject
mkdir /var/svn/tmpproject/branches
mkdir /var/svn/tmpproject/tags
mkdir /var/svn/tmpproject/trunk

# creating a real project repository and copy the template content into it
svnadmin create /var/svn/myproject --fs-type fsfs
svn import /var/svn/tmpproject file:///var/svn/myproject -m "initial import"

# add new users to the system to be a client of the repository
adduser asanka
adduser chamath


# starting svnserve deamen. Not necessary if users access with SSH I think.
svnserve -d

Now we are done at the server side. We should logout from the server and now check whether we can access the repository from the client side. There are various  ways of providing user access to an SVN repository but in my configuration, I'm only allowing the users who have a  user account in the server to access the repository. Follow the  given command sequence to access the SVN repository in the server.
 
svn co svn+ssh://chamath@192.248.xxx.xxx/var/svn/temproject/
svn add some_file.txt
svn commit trunk/ --message "My initial messsage"

In this way, we can start using our newly initialized SVN repository server. I'm not sure whether  I missed any important step because I compiled these steps after trying various other ways. In case I have missed something, please be kind to point out :-)

No comments:

Post a Comment