Wednesday 23 May 2012

SVN server configuration on Linux step by step?

SVN server configuration on Linux step by step


Subversion Installation and configuration

check if subversion is installed or not

command rpm -qa | grep subverion

if not then install by yum command

command  yum install subversion

after installation create an directory where you want to configure projects reposatories

for exampel /home/subversion

command mkdir -p /home/subversion


to start the svn

command svnserv -d


to stop the svn

ps -aux | grep subversion

kill -9 <pid>
Creation of Project Using SVN (Subversion)

Creation of Project Using SVN (Subversion)

cd /home/subverion

svnadmin create <projectname> for example

svnadmin create test1


we can see test1 has been created in /home/subversion

cd test1/

there we can list list of files and folders

drwxr-xr-x 2 root root 4096 2010-04-06 10:36 conf
drwxr-xr-x 2 root root 4096 2008-11-08 00:19 dav
drwxr-xr-x 5 root root 4096 2009-08-13 11:28 db
-r--r--r-- 1 root root    2 2008-11-08 00:19 format
drwxr-xr-x 2 root root 4096 2008-11-08 00:19 hooks
drwxr-xr-x 2 root root 4096 2008-11-08 00:19 locks
-rw-r--r-- 1 root root  229 2008-11-08 00:19 README.txt


Conf


contains the configuratio file's like authz, passwd, svnserv.conf


       authz        : user authorization information
       passwd        : User password
       snvserv.conf    : main configuration for the project

db

Contains the list of verions that has been commetded by user's


after creation of project just enter in to conf folder say we have created test1 as project


cd /home/subversion/test1/conf

edit authz

[groups]
# harry_and_sally = harry,sally
admin = super.user
ycoregproject = svn.user1, svn.user2, svn.user3

[/]
@ycoregproject = rw    (where ycoregproject is an group name with read and write permission)
* =

[/]
@admin = rw             (Default admin who have read and write permission)
* =

[/beta]
@ycoregproject = r
* = r
[/version1.0]
@ycoregproject = r
* = r

save and close

edit passwd

super.user = sdfdsfdsf
svn.user1 = sfsdfsdf
svn.user2 = sfsdfs3fdef
svn.user3 = sdffdsf

save and quit

edit svnserve.conf

Orginal file

### This file controls the configuration of the svnserve daemon, if you
### use it to allow access to this repository.  (If you only allow
### access through http: and/or file: URLs, then this file is
### irrelevant.)

### Visit http://subversion.tigris.org/ for more information.

[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
[sasl]
### This option specifies whether you want to use the Cyrus SASL
### library for authentication. Default is false.
### This section will be ignored if svnserve is not built with Cyrus
### SASL support; to check, run 'svnserve --version' and look for a line
### reading 'Cyrus SASL authentication is available.'
# use-sasl = true
### These options specify the desired strength of the security layer
### that you want SASL to provide. 0 means no encryption, 1 means
### integrity-checking only, values larger than 1 are correlated
### to the effective key length for encryption (e.g. 128 means 128-bit
### encryption). The values below are the defaults.
# min-encryption = 0
# max-encryption = 256

modified file


### This file controls the configuration of the svnserve daemon, if you
### use it to allow access to this repository.  (If you only allow
### access through http: and/or file: URLs, then this file is
### irrelevant.)

### Visit http://subversion.tigris.org/ for more information.

[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 = none
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 conf directory.
### 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 conf
### directory.  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


********************************checkout of file from svn to live project directory*********************************

svn checkout file:///home/subverion/test1 /home/projects/test1.com

This we have to place in cron for every 1 minute.


to place in cron first

vi /bin/svnupdate-test1

set -x
svn checkout file:///home/svnrepository/test1 /home/projects/test1 > /tmp/cashforsvn.log
Counttest1=`cat /tmp/test1.log | wc -l`;
if [ "$Counttest1" -gt "1" ]
then
cat /tmp/cashtest1.log  | mail user1@ybrantlocal.com -cc user2@ybrantlocal.com user3@ybrantlocal.com  -s "test1 svn update details";
fi
echo " svn updated";


save and quit

chmod 700 /bin/svnupdate-test1

Note : make sure that for every svn you have included testing group id

crontab -e
*/1 * * * *  /bin/svnupdate-test1 >/dev/null 2>&1

save and quit

******************************************************************************************************************


****************************** information to Send mail for  individual users ********************************************


mysql details

db name :

db username :

db password :

svn.username :

svn.password

SVN URL : svn://server ip address/home/svnrepository/projectname

Phpmyadmin URL :""

******************************************************************************************************************


General Command

svn add <file name>
svn add *
svn commit -m “This is first file”
svn status
to remove files from svn
svn remove a aa
svn commit -m “”
svn checkout –revision 3 file:///home/subversion/xyz.com /home/project/ybrantdigital.com/
svn mkdir file:///home/subversion/xyz.com/rangarao/ -m “new dir”
svn copy file:///home/subversion/xyz.com file:////home/subversion

###############################################################################

No comments:

Post a Comment