There are upcoming maintenance events which may impact our services. Learn more

Install Subversion (SVN) Server Print

  • 7

Since programmers are already familiar with SVN instead of WebDAV, so I will need to setup a Subversion server  for them. By using PHP Designer 7 on Windows 7, they can connect SVN server viaTortoiseSVN plugin which available at http://tortoisesvn.tigris.org/.

Subversion is a full-featured version control system originally designed to be a better CVS. In layman term is it control the versioning of files being shared between users.In this case, I will use Subversion package which available in yum repo. Variables as below:

OS: CentOS 6.0 64bit
Server IP: 192.168.0.170
SVN directory for webproject1: /home/user1/webproject1
SVN user for webproject1: project1
SVN password for webproject1:  mypasswording1
SVN directory for webproject2: /home/user1/webproject2
SVN user for webproject2: project2
SVN password for webproject2:  mypasswording2

1. Firstly, we need to install SVN or subversion package via yum:

$ yum install subversion -y

2.  Create both project local directories:

$ mkdir -p /home/user1/webproject1
$ mkdir -p /home/user1/webproject2

3. Create both project SVN directories:

$ svnadmin create /home/user1/webproject1
$ svnadmin create /home/user1/webproject2

4. You should see following files and folders has been created under webproject1 directory (same goes towebproject2):

$ ls -1 /home/user1/webproject1/
conf
db
format
hooks
locks
README.txt

5. We need to configure the SVN service before we can use. Open the configuration file at /home/user1/webproject1/conf/svnserve.conf via text editor (repeat this step again for webproject2):

[general]
 
### These options control access to the repository for unauthenticated
### and authenticated users. Valid values are "write", "read",
### and "none". The sample settings below are the defaults.
 
anon-access = read
auth-access = write
 
### The password-db option controls the location of the password
### database file. Unless you specify a path starting with a /,
### the file's location is relative to the directory containing
### this configuration file.
### If SASL is enabled (see below), this file will NOT be used.
### Uncomment the line below to use the default password file.
 
password-db = passwd
 
### The authz-db option controls the location of the authorization
### rules for path-based access control. Unless you specify a path
### starting with a /, the file's location is relative to the the
### directory containing this file. If you don't specify an
### authz-db, no path-based access control is done.
### Uncomment the line below to use the default authorization file.
 
# authz-db = authz
 
### This option specifies the authentication realm of the repository.
### If two repositories have the same authentication realm, they should
### have the same password database, and vice versa. The default realm
### is repository's uuid.
 
realm = My First Repository

6. Then we create the user database to authorize which user we want to have read and write privileges for the repository. Using text editor, open the /home/user1/webproject1/conf/passwd and create the user:

project1:mypasswording1

7. SVN repository for webproject1 is completed. We need to do the same thing for webproject2. Open the /home/user1/webproject2/conf/passwd and create the user:

project2:mypasswording2

8. Lets start the SVN service as daemon:

$ svnserve -d

9. Lets check whether the SVN is running fine on default port 3690 (make sure your firewall has allowing this incoming port):

$ netstat -tulpn | grep svn
tcp 0 0 0.0.0.0:3690 0.0.0.0:* LISTEN 20412/svnserve

10. Lets say we already have web files for both projects located under /tmp directory in same server, so we might need to import the web files from local server to the SVN directory so SVN can start host the files. Before we start importing, we need to specify the default text editor that will be use by SVN:

$ export SVN_EDITOR=vim
$ cd /tmp/webproject1
$ svn import svn://project1@192.168.0.170/home/user1/webproject1
$ cd /tmp/webproject2
$ svn import svn://project2@192.168.0.170/home/user1/webproject2

Once the files ready in SVN, the SVN users can start using this service in their web developing process. Let me know if you have any problem using such way. Cheers!


Was this answer helpful?

« Back