You are on page 1of 5

4 .

Version Control system setup and usage


I. Aim
To setup a version control system for managing files using svn. The system should be able to track
changes to the files/folders and a period of time and revert if necessary
II. Introduction of the concept/tool
Version control is the concept of managing all changes to a repository. The repository could be
containing any type of file.
In computer software engineering, revision control is any practice that tracks and provides control
over changes to source code. Software developers sometimes use revision control software to
maintain documentation and configuration files as well as source code.
As teams design, develop and deploy software, it is common for multiple versions of the same
software to be deployed in different sites and for the softwares developers to be working
simultaneously on updates. !ugs or features of the software are often only present in certain versions
"because of the fi#ing of some problems and the introduction of others as the program develops$.
Therefore, for the purposes of locating and fi#ing bugs, it is vitally important to be able to retrieve
and run different versions of the software to determine in which version"s$ the problem occurs. It may
also be necessary to develop two versions of the software concurrently "for instance, where one
version has bugs fi#ed, but no new features "branch$, while the other version is where new features
are worked on "trunk$.
At the simplest level, developers could simply retain multiple copies of the different versions of the
program, and label them appropriately. This simple approach has been used on many large software
pro%ects. &hile this method can work, it is inefficient as many near'identical copies of the program
have to be maintained. This re(uires a lot of self'discipline on the part of developers, and often leads
to mistakes. )onse(uently, systems to automate some or all of the revision control process have been
developed.
*oreover, in software development, legal and business practice and other environments, it has
become increasingly common for a single document or snippet of code to be edited by a team, the
members of which may be geographically dispersed and may pursue different and even contrary
interests. Sophisticated revision control that tracks and accounts for ownership of changes to
documents and code may be e#tremely helpful or even necessary in such situations.
+evision control may also track changes to configuration files, such as those typically stored in /etc or
/usr/local/etc on ,ni# systems. This gives system administrators another way to easily track changes
made and a way to roll back to earlier versions should the need arise.-./
III. Description of the exercise
In this e#ercise, we would be setting up version control using svn. &e would create a repository and
then access that repository over http.
!riefly, we would be doing the following
Install/setup svn repository
)onfigure apache for mod0svn access. &e would also password'protect svn access
)heck in code/files using svn commands
)heck out codes to another location
*odify/commit codes
+evert to an older version of the code
1
IV. Pre-requisite
1edora .2 installed with root access "root access for installation/configuration purposes$
3A4 connection
Apache &ebserver
selinu# disabled ' 5 setenforce 6 5 can be given at command line to disable it runtime and reboot th
machine
17SS 3ab server or internet connectivity for downloading packages from internet using yum
V. Detailed steps for the exercise-
Note: In the description "steps$, all greyed out lines are actual commands/configurations done on the server
Step - Installation of pac!a"es
The first thing to do is to install the packages re(uired for the setup of svn. &e also need to install/configure
packages re(uired for letting svn command be accessed over http
yum install mod0dav0svn subversion
Its recommended to install packages using yum as it will pull in any dependencies re(uired for the installation
Step # - $onfi"uration of the repositor%
a. The following commands create the necessary folder structure for the repository
mkdir /svn
mkdir /svn/repos
cd /svn/repos
chown '+ apache.apache ../repos
b. 4ow we need to initiali8e the svn structure and create a repository
9 svnadmin create svn'test
&ith this, the repository is configured
Step & - $reation of a local area for code
The purpose of this step is to have a staging area for code from where you would be doing some development.
This code can then be committed to the svn
a. $reate the local folder structure
9 mkdir /home/:user;/svn'test
9 cd /home/:user;/svn'test
b. $reate local directories as per requirement - 'his can be customi(ed to suit %our needs
9 mkdir configurations options main
c. )dit an% file as required
vim configurations/test.cfg
2
<dit and save any other file re(uired.
Step * : Import of the code area onto s+n
a. Import the initial structure onto s+n
9 svn import /home/:user;/svn'test/ file=///svn/repos/svn'test/ 'm >Initial Import>
Adding /root/svn'test/main
Adding /root/svn'test/configurations
Adding /root/svn'test/configurations/test.cfg
Adding /root/svn'test/options
)ommitted revision ..
This imports the files/folders onto the repo with a log message of 5Initial Import?
9 chown '+ apache.apache /svn/repos/
for fi#ing the permissions of the newly committed repo to be accessible by apache
Step , : $onfi"urin" Apache
a. )dit sub+ersion.conf at /etc/httpd/conf.d/subversion.conf and add the following lines
9 gedit /etc/httpd/conf.d/subversion.conf
:3ocation /repos;
@AV svn
SV4AarentAath /svn/repos
AuthType !asic
Auth4ame >Subversion repos>
Auth,ser1ile /etc/svn'auth'conf
+e(uire valid'user
:/3ocation;
The above line allow for a repo on /svn/repos to be accessible with a password contained in /etc/svn'auth'
conf
b. -estart apache to appl% the chan"es
9 /etc/init.d/httpd restart
c. confi"ure pass.ord for authentication
htpasswd 'cm /etc/svn'auth'conf :username;
for e#ample
9 htpasswd 'cm /etc/svn'auth'conf fedora
Alease enter the password twice to create the user
Step / - $hec!out the repo
a. &e can check out the repo into a third party area by doing the following steps
3
9cd /tmp/
9 svn ''usernameBfedora co http=//localhost=C6/repos/svn'test/
A svn'test/main
A svn'test/configurations
A svn'test/configurations/test.cfg
A svn'test/options
)hecked out revision ..
Step 0 : )ditin" and $ommittin"
a. )ditin"
9 cd /tmp/svn'test/
9 ls
configurations main options
9 vim configurations/test.cfg
<dit the file and make any changes/save them
b. $ommittin" the chan"es
9 svn commit 'm >Added a line to testconf..cfg.>
Sending configurations/test.cfg
Transmitting file data .
)ommitted revision 2.
c. Addin"/Deletin" Items
9 ls
configurations main options
9 cd configurations/
9 cp /etc/yum.conf .
9 svn add yum.conf
A yum.conf
9 svn commit 'm >Added yum conf>
Adding configurations/yum.conf
Transmitting file data .
)ommitted revision D.
d. -e+ertin" Items
i. 1istin" out all re+isions.
This step will give you all the checkpoints
9 svn log http=//localhost=C6/repos/svn'test/
Added the fedora repo
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
r2 E fedora E 26..'6F'2. 26=D6=22 G6HD6 "Thu, 2. Iul 26..$ E . line
Added a line to testconf..cfg.
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
r. E fedora E 26..'6F'2. 26=2J=J6 G6HD6 "Thu, 2. Iul 26..$ E . line
Initial Import
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
ii2 re+ertin"/chec!out to re+ision -
4
9 svn co 'r . http=//localhost=C6/repos/svn'test/
A svn'test/main
A svn'test/configurations
A svn'test/configurations/test.cfg
A svn'test/options
)hecked out revision ..
VI2 -eferences:
34 - http://en.wikipedia.org/wiki/Revision_control#Overview
[2] - http://svnbook.red-bean.com/en/1.1/index.html
5

You might also like