Monday, February 22, 2010

Installing Subversion(SVN) Repository




INTERLUDE:

The tutorials aims to discuss and share the HowTos of installing and deploying a repository which is accessible via web.Another method of storage-repository which has a lot of feauture and add-ons compare to the old CV's and an options to choose database backend such as Berkerly MIT FSFS or Berkeley(Oracle) BDB.

REQUIREMENTS:
Oracle BDB 4.X.X
Apache 2.X
SVN


DOWNLOADS & INSTALLATIONS:

Install Berkeley DB
1)Download BerkeleyDB 4.X.X
2)Extract the BerkeleyDB compressed file
3)Copy all the files into the base directory just extracted
4)cd into the build_unix directory in the extracted directory
root.localhost#
build_unix
5)Configure Berkerly DB
root.localhost# ../dist/configure

6)Compile Berkerly DB
root.localhost# make
7) Ensure you’re logged in as root and run…

root.localhost# make install(installs to /usr/local/BerkeleyDB.4.8)
8) Add the line /usr/local/BerkeleyDB.4.8/lib to the file/etc/ld.so.conf
root.localhost# vi /etc/ld.so.conf
9) Run ldconfig to update the library cache with the BerkeleyDB libraries

Install Apache
1) Ensure that the following packages are installed. If they’re not just do an apt-get install to download and install them.
root.localhost# autoconf libtool openssl libssl-dev zlib1g zlib1g-dev
2) Download tha latest version of Apache 2 from http://httpd.apache.org/download.cgi
3) Extract the Apache compressed file
4) cd in the extracted directory
5) Configure Apache

root.localhost# ./configure –enable-dav –enable-so –enable-ssl –with-dbm=db4 –with-berkeley-db=/usr/local/BerkeleyDB.4.8 –enable- deflate
6) Compile Apache
root.localhost#
make

7) Ensure you’re logged in as root and install now Apache
root.localhost#
make install
(installs to /usr/local/apache2)
8) Edit the file "httpd.conf"
roor.localhost# /
usr/local/apache2/conf/httpd.conf

9)
Update the User & Group tags to www-data (Assuming of course that you have that user & group)

Install SQLite
1) Download the latest version of SQLite http://www.sqlite.org/download.html
2) Uncompressed the file
localhost.root# tar -zxvf sqlite-3.6.23.1.tar.gz

3) Move the file in preferred directory (in my case)
localhost.root# mv sqlite-3.6.23.1 /usr/local/sqlite
4) localhost.root# cd /usr/local/sqlite
5)localhost.root# ./configure --prefix=/usr/local/sqlite
6)localhost.root# make
7)localhost.root# make install


Install Zlib
1) Download the latest version of Zlib http://www.zlib.net/
2) zlib-1.2.5.tar.gz format (532K, MD5 checksum c735eab2d659a96e5a594c9e8541ad63):
3) localhost.root# tar -zxvf zlib-1.2.5.tar.gz
4) localhost.root# mv zlib-1.2.5 /usr/local/zlib
5) localhost.root# cd /usr/local/zlib
6) localhost.root# ./configure --prefix=/usr/local/zlib
7) localhost.root# make clean
8) localhost.root# ./configure --prefix=/usr/local/zlib --shared
9) localhost.root# make test
10) localhost.root# make install


Install Subversion
1) Download the latest version of Subversion from http://subversion.tigris.org/getting_subversion.html
2) Extract the Subversion compressed file
root.localhost# tar -zxvf svn.x.x.tar.gz
3) Configure Subversion
root.localhost# /configure –with-ssl –with-berkeley-db=/usr/local/BerkeleyDB.4.8 –with-zlib
4) Compile Subversion

root.localhost#
make

5) Ensure you’re logged in as root and run…
root.localhost#
make install


Install Extra files for SVN

1) Yum install the ff: files
Downloading Packages:
apr-util-mysql-1.2.7-11.el5.i386.rpm | 14 kB 00:03
cyrus-sasl-plain-2.1.22-5.el5_4.3.i386.rpm | 27 kB 00:00
apr-util-devel-1.2.7-11.el5.i386.rpm | 53 kB 00:04
expat-1.95.8-8.3.el5_4.2.i386.rpm | 77 kB 00:01
apr-1.2.7-11.el5_3.1.i386.rpm | 123 kB 00:03
cyrus-sasl-lib-2.1.22-5.el5_4.3.i386.rpm | 127 kB 00:07
expat-devel-1.95.8-8.3.el5_4.2.i386.rpm | 132 kB 00:11
apr-util-docs-1.2.7-11.el5.i386.rpm | 228 kB 00:06
apr-devel-1.2.7-11.el5_3.1.i386.rpm | 231 kB 00:06
apr-docs-1.2.7-11.el5_3.1.i386.rpm | 531 kB 00:43
cyrus-sasl-2.1.22-5.el5_4.3.i386.rpm | 1.2 MB 01:10
cyrus-sasl-devel-2.1.22-5.el5_4.3.i386.rpm | 1.4 MB 00:56




SVN SERVER CONFIGURATIONS:

1)Create a directory to hold your repositories, something like /Repo/SVN/ folder
root.localhost# /usr/local/Repos/SVN

2)Change the ownership on the directory to the www-user user (or whoever you set the User tag to
in httpd.conf)
http://localhost/Repos/SVN
http://IP_address/Repos/SVN

3)Add users to Apache using this command…htpasswd -cm /etc/svn-auth-file . Leave out the c switch if the file already exists
root.localhost# htpasswd -cm /etc/svn-auth-file

4)Add the following section to
root.localhost# /usr/local/apache2/conf/httpd.conf

_______________________________________________________________________________________________

LoadModule dav_svn_module modules/mod_dav_svn.so
DeflateFilterNote Input instream
DeflateFilterNote Output outstream
DeflateFilterNote Ratio ratio LogFormat '"%r" %{outstream}n/%{instream}n (%{ratio}n%%)' deflate
CustomLog logs/deflate_log deflate

DAV svn
SVNParentPath /usr/local/svn
AuthUserFile /etc/svn-auth-file
Require valid-user SetOutputFilter
DEFLATE SetInputFilter DEFLATE
_____________________________________________________________________________________
Ensure These config entries will password protect your repository ana allow for data sent between clients and apache to be compressed.
Note:** (This is optional- a simple authentication will do)
5)The next step is to try and get Apache using SSL because Basic authentication uses plain text when transmitting the password from the client to the server.

SVN CLIENTS:

OpenTortoise:
OpenSVN:

1)Download
2) Install
3)Configure

4) Testing

RUNNING SVN REPOSITORY:
1)STARTING APACHE
Ensure you’re logged in as root and run Apache
root.localhost#
/usr/local/apache2/bin/apachectl start

2)SVN URL
Browsing a WEB for SVN
http://localhost/svn/repos

3)SVN CLIENTS ACCESS
Access through SVN clients:


Moving a SVN repository from one server to another:

Our server is now full of data base with our pilot SVN ,hence we used SVN instead of CVs,so I need to move our main Subversion repository to a new server .

Here is a sample tutorial on how to move a Subversion repository from one system/server to another. To begin go to the source system and at a command prompt or terminal/shell window type:

root.localhost# svnadmin dump /path/to/repository > repository-name.dmp

Note:**

If the dump file is rather large you can compress it with your favorite zip utility. Now you need to get the dump to your new server, so simply transfer the file via FTP, local share, CD, thumbdrive or whatever it takes.A couple of small things to note – the dump file will be rather large as it represents every commit made on your repository. If your repository is rather large and mature, this file could get quite large.
Once the dump file is on the new machine and uncompressed, you need to set up and load the new repo by typing:
     root.localhost# cd /path/to/new-repository

root.localhost# svnadmin create repository-name
root.localhost#
svnadmin load repository-name<>

**This tutorials works across platforms, so moving from Linux to UNIX or Windows and visa-versa are also possible.


FSFS to BDB CONVERSION & VISE VERSA:
Say you have a repository, /svn/myrepos, which is using the BDB backend and you would like to switch to using the FSFS backend. Follow these steps to make the change:

Step by step procudes in FSFS to BDB conversions:
Dumping /loading from the old format to the new one:
1.) Close down your server so that the data cannot change during this procedure.
2. )Make a new repository specifying the fsfs backend (it is the default from 1.2 onwards), e.g., svnadmin create /svn/myreposfsfs --fs-type fsfs.

3. )Pipe the output of a dump from /svn/myrepos to the input of a load into /svn/myreposfsfs, e.g., svnadmin dump /svn/myrepos -q | svnadmin load /svn/myreposfsfs. Windows users should dump to a file and load from that file in two separate steps.


Copying the hook scripts:
1.)Copy any hook scripts that are active in /svn/myrepos/hooks into /svn/myreposfsfs/hooks. Don't mindlessly copy everything, as the templates generated by Subversion may have changed.
2.)Compare the template scripts that the svnadmin create command put in /svn/myreposfsfs/hooks with those in /svn/myrepos/hooks and incorporate any changes that you would like into your active hook scripts.

Copy the configuration files:

1.) Copy configuration files from /svn/myrepos/conf into /svn/myreposfsfs/conf (and don't forget a password file, if you use one). Or you might instead want to merge the changes that you made to your configuration files into the new default ones.
2.) Rename /svn/myrepos to /svn/myreposbdb and then /svn/myreposfsfs to /svn/myrepos, ensuring that the file permissions are the same as those that the BDB version had.
3. )Restart the server.


To do the reverse and migrate from FSFS to BDB, change the svnadmin create command to specify BDB.
Once you are happy that all is well with your new repository, delete the old one.


Detail(1)

REMARKS:


CONCLUSIONS:

No comments:

Post a Comment