What is subversion?
Subversion (SVN) is an open source version control tool based on a repository whose operation greatly resembles that of a file system. It is free software under an Apache/BSD type license.
It uses the concept of revision to save changes made to the repository. Between two revisions it only saves the set of modifications (delta), thus optimizing the use of disk space as much as possible. SVN allows the user to create, copy and delete folders with the same flexibility as they would if they were on their local hard drive. Given its flexibility, the application of good practices is necessary to carry out correct management of the versions of the generated software.
Facility:
root@subversion:~# apt-get install subversionWe create the folder where the repository will be hosted
root@subversion:~# mkdir /var/svnNext we create a project that in our case I will call redorbita
root@subversion:~# svnadmin create /var/svn/redorbitaWe start subversion
root@subversion:~# svnserve -d -r /var/subversion/We verify that it has started
root@subversion:~# ps -fea | grep subversion
root 3322 1 0 13:24 ? 00:00:00 svnserve -d -r /var/svn/We proceed to configure access to the storeroom. We will find this configuration in /var/subversion//conf/svnserve.conf
vi /var/svn/redorbita/conf/svnserve.conf
[general]
anon-access = none
auth-access = write
auth-access = read
password-db = passwdNext we configure a user and password in /var/subversion/conf/passwd in my case the user will be called rokitoh and his password will be 123456
vi /var/subversion/conf/passwd
[users]
rokitoh = 123456Using the svn info command we can obtain the repository information.
root@subversion:~# svn info svn://127.0.0.1/redorbita
Reino de autentificación: <svn://127.0.0.1:3690> bc22cd4a-76a7-45a2-9c12-3e529fba6b20
Clave de ‘root’:
Reino de autentificación: <svn://127.0.0.1:3690> bc22cd4a-76a7-45a2-9c12-3e529fba6b20
Usuario: rokitoh
Clave de ‘123456’:
———————————————————————–
ATTENTION! Your password for authentication realm:
<svn://127.0.0.1:3690> bc22cd4a-76a7-45a2-9c12-3e529fba6b20
can only be stored to disk unencrypted! You are advised to configure
your system so that Subversion can store passwords encrypted, if
possible. See the documentation for details.
You can avoid future appearances of this warning by setting the value
of the ‘store-plaintext-passwords’ option to either ‘yes’ or ‘no’ in
‘/root/.subversion/servers’.
———————————————————————–
Almacenar la clave sin cifrar (sí/no)? no
Ruta: redorbita
URL: svn://127.0.0.1/redorbita
Raíz del repositorio: svn://127.0.0.1/redorbita
UUID del repositorio: bc22cd4a-76a7-45a2-9c12-3e529fba6b20
Revisión: 0
Tipo de nodo: directorio
Revisión del último cambio: 0
Fecha de último cambio: 2015-02-18 13:23:50 +0100 (mié 18 de feb de 2015)Configure subversion to be able to access it through a web browser.
We install Apache and the subversion library
apt-get install apache2 libapache2-svn php5 libapache2-mod-php5We activate the modules
a2enmod dav_svn
a2enmod authz_svnWe add the modules
vi /etc/apache2/apache2.conf
LoadModule dav_svn_module modules/mod_dav_svn.so
LoadModule authz_svn_module modules/mod_authz_svn.soWe proceed to configure /etc/apache2/mods-available/dav_svn.conf in this file we will tell you where the repository is located
<Location /redorbita>
DAV svn
SVNPath /var/svn/redorbita
AuthType Basic
AuthName «Subversion Repository»
AuthUserFile /etc/apache2/dav_svn.passwd
Require valid-user
</Location>We create the user and the group
groupadd subversion
addgroup rokitoh subversionWe create the user intended for subversion
htpasswd -c /etc/apache2/dav_svn.passwd rokitoh
New password:
Re-type new password:
Adding password for user rokitoh
htpasswd /etc/apache2/dav_svn.passwd jenkinsWe configure both the /etc/hostname and /etc/hosts files as follows:
cat /etc/hostname
subversion.CDP.redorbita.com
cat /etc/hosts
127.0.0.1 localhost
127.0.1.1 subversion
192.168.1.57 subversion.CDP.redorbita.com subversion
127.0.0.1 localhost.subversion.CDP.redorbita.com localhost
192.168.1.57 subversion.CDP.redorbita.comWe create a script in /etc/init.d/ and configure it to start at system startup.
cat /etc/init.d/subversion
svnserve -d -r /var/svn
update-rc.d subversion defaults
update-rc.d: using dependency based boot sequencing
insserv: warning: script ‘K01jboss’ missing LSB tags and overrides
insserv: warning: script ‘subversion’ missing LSB tags and overridesWe check that access via http works correctly:
svn co –username rokitoh –password 123456 http://192.168.1.57/svn/redorbita PRUCHECKOUT
svn: OPTIONS de ‘http://192.168.1.57/svn/redorbita’: 200 OK (http://192.168.1.57)Greetings, rokoth!
:wq!
Comments