Tuesday, December 11, 2012

SVN in Steps


svn server configuration on Linux step by step
1. Subversion Installation and configuration :-
a. check if subversion is installed or not
# rpm -qa | grep subverion
b. if not then install by yum command
# yum install subversion
c. After installation create an directory where you want to configure projects repositories for example “/home/project”
# mkdir -p /home/project
d. Start the svn
# svnserv -d
e. Stop the svn
# ps -aux | grep subversion
# kill -9 <pid>
2. Creation of Project Using SVN (Subversion)
a. Create a project
# cd /home/project
# svnadmin create trunk1
# cd trunk1
Here we have conf, db, main folders.
Conf=> contains the configuration file's like authz, passwd, svnserv.conf
authz=> user authorization information
passwd=> User password
svnserv.conf=> main configuration for the project
db=>contains the list of versions that has been commented by users.
b. After creation of project just enter in to conf folder say we have created trunk1 as project
# cd /home/project/trunk1/conf
Edit authz
[groups]
# harry_and_sally = harry,sally
admin = super.user
projectgroup = svn.user1, svn.user2, svn.user3
[/]
@projectgroup = 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 = password
svn.user1 = password
svn.user2 = password
svn.user3 = password
save and quit
Edit svnserve.conf
Add these lines
anon-access = none
auth-access = write
password-db = passwd
authz-db = authz
save and exit
3. Checkout of file from svn to live project directory
# svn checkout file:///home/project/trunk1 /home/web/example.com
Note:- This we have to place in cron for every 1 minute
4. To place in cron first
#vi /bin/svnupdate-trunk1
#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 fi
echo " svn updated";
save and quit
# chmod 700 /bin/svnupdate-trunk1
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
5. 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 :""
6. 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/project/trunk1 /home/web/example.com/
#svn mkdir file:///home/project/trunk1/beta/ -m “new dir”
#svn copy file:///home/project/trunk file:///home/project