In this guide we will go through the steps required to get your very own subversion revision control system installed and running on a CentOS 5 VPS server. This guide introduces the basic concepts and does not provide any advanced user information. Please consult the Subversion site for more information.
Want a CentOS VPS server to get your very own Subversion source control setup? Why not sign-up to our CentOS VPS packages today?
Sign UpGetting started
To get started, you will need to grab a copy of PuTTY and have a fresh/clean installation of CentOS 5.x. This guide does not provide information on how to use PuTTY, so please consult the documentation available on the PuTTY site for how to configure and connect to your server through SSH.
Prerequisites
- A fresh installation of CentOS 5.x with SSH enabled
- Working installation of yum on your CentOS 5.x machine
- Working installation of PuTTY on your local machine
First we will need to make sure our yum packages are all up to date:
[root@test ~]# yum update
Installing Apache
The next step is to install the Apache web server. YUM provides an easy means of installing Apache quickly and without requiring a lot of configuration changes and is a great way to get a basic installation on your CentOS VPS server.
So let’s get started and install Apache:
[root@test ~]# yum install httpd httpd-devel -y
You should see YUM go through lots of steps and finally a message indicating the installation was a success.
Now that Apache has been successfully installed we need to start up the service:
[root@test ~]# service httpd start Starting httpd: [ OK ]
Now we’ll head over to our site to check that Apache is up and running and serving the default CentOS 5.x Apache test page.
You can do this by visiting http://[ipaddress], replacing [ipaddress] with the main IP address of your server. You should be presented with a default CentOS Apache welcome screen, similar to below:
Ok, so it looks as though Apache is up and running on our server so back to our SSH terminal (via PuTTY) to install nano, a text editor that’s easy to use (compared to VI).
Installing Nano
Although not necessarily required to get your Subversion server up and running, Nano is a great text editor to have handy on your CentOS server; Nano is actually a derivative of Pico – and provides an easy to use (slightly more visual) means of editing files.
So let’s get started and install via YUM package manager:
[root@test ~]# yum install nano -y
That’s it! You should then see a message indicating whether the installation was a success or not.
We’ve now successfuly prepared our environment for installation of Subversion onto our CentOS installation. To quickly recap we have performmed the following:
- Installed Apache web server
- Verified Apache web server is working by visited test page
- Installed nano text editor for easy editting
Installing Subversion
Thanks to the yum package manager installing Subversion is relatively straight forward. Execute the following command to kick off the installation:
[root@test ~]# yum install mod_dav_svn subversion -y
Now we’ll open up the Apache configuration file, and we should at least change the ServerName directive. To open the configuration file (httpd.conf) enter the following:
[root@test ~]# nano /etc/httpd/conf/httpd.conf
When you’re happy with the file, simply restart Apache to pick up any configuration changes made:
[root@test ~]# service httpd restart
And finally execute the following command to ensure Apache always starts when the machine is rebooted:
[root@test ~]# chkconfig httpd on
Configuring Apache to work with Subversion
Now that we have both Apache configured and Subversion installed, let’s make the two systems work in harmony. To do this, we’ll need to create a Subversion specific configuraiton file under our Apache custom configuration folder.
Firstly we’ll need to change to the Apache custom configuration folder:
[root@test /]# cd /etc/httpd/conf.d/
And now we will create a file called subversion.conf:
[root@test conf.d]# nano subversion.conf
And paste the following text within this file:
LoadModule dav_svn_module modules/mod_dav_svn.so LoadModule authz_svn_module modules/mod_authz_svn.so DAV svn SVNListParentPath on SVNParentPath /var/www/svn/repos AuthType Basic AuthName "Subversion" AuthUserFile /etc/svn-auth-conf Require valid-user
Now we have configured our Subversion specific configuration for Apache, we now need to create our password files to secure our Subversion repositories that are exposed to the web.
Run the following command, and follow the on-screen instructions; feel free to change svnuser to a user that makes sense to you.
[root@test conf.d]# htpasswd -cm /etc/svn-auth-conf svnuser New password: Re-type new password: Adding password for user svnuser
The next step is to create our new Subversion repository folder, as per the configuration file we saved earlier (SVNParentPath /var/www/svn/repos). Execute the following commands to create this new folder:
[root@test /]# cd /var/www [root@test www]# mkdir svn [root@test www]# cd svn
We’ll need to use the svnadmin command (part of Subversion) to create our repos base folder (as per our SVNParentPath):
[root@test svn]# svnadmin create repos
Now lets give apache permissions (recursively) to all files/folders under the repos folder:
[root@test svn]# chown -R apache.apache repos
Now that we’re done with configuring Apache, let’s restart apache to pick up all of our changes:
[root@test svn]# service httpd restart Stopping httpd: [ OK ] Starting httpd: [ OK ]
Finally if you navigate to http://[ipaddress]/repos (replacing [ipaddress] with the main IP address of your server) you should be presented with a password authentication challenge. Enter the username svnuser along with the password you configured for your user and you should be presented with a list of folders entitled, “Collection of repositories”.
Creating our first project repository
We will now create our own project within our repository:
[root@test svn]# cd repos [root@test repos]# svnadmin create myproject
The following files/folders are created when we create our new project folder:
drwxr-xr-x 7 root root 4096 Jan 16 02:15 . drwxr-xr-x 4 root root 4096 Jan 16 02:15 .. drwxr-xr-x 2 root root 4096 Jan 16 02:15 conf drwxr-xr-x 2 root root 4096 Jan 16 02:15 dav drwxr-sr-x 5 root root 4096 Jan 16 02:15 db -r--r--r-- 1 root root 2 Jan 16 02:15 format drwxr-xr-x 2 root root 4096 Jan 16 02:15 hooks drwxr-xr-x 2 root root 4096 Jan 16 02:15 locks -rw-r--r-- 1 root root 229 Jan 16 02:15 README.txt
Edit the new repository’s svnserve.conf file:
[root@test myproject]# nano /var/www/svn/repos/myproject/conf/svnserve.conf
And paste the following text into this file:
[general] auth-access = write password-db = /etc/svn-auth-conf realm = My Project
Now we need to tell the Subversion daemon to serve all repositories (recursively) under our repository collection base path:
[root@test myproject]# svnserve -d -r /var/www/svn/repos
And hey presto! We have our very own Subversion project repository. Simply navigate to http://[ipaddress]/repos/myproject (replacing [ipaddress] with the main IP address of your server) and you will be presented with a password auth challenge. Enter the username svnuser along with the password you configured for your user and you should be presented with a list of folders.
Want a CentOS VPS server to get your very own Subversion source control setup? Why not sign-up to our CentOS VPS packages today?
Sign Up




