Home Linux & Systems Cybersecurity Cloud & DevOps Networks & Infrastructure SIEM & Monitoring DFIR & Threat Intel Development & Other All categories Projects About Tools

Install subversion server

Leer en espanol
Install subversion server

Table of contents

Subversion (SVN) is an open source version control tool based on a repository whose operation greatly resembles that of a file system. It's software ===

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:

Bash
root@subversion:~# apt-get install subversion

We create the folder where the repository will be hosted

Bash
root@subversion:~# mkdir /var/svn

Next we create a project that in our case I will call redorbita

Bash
root@subversion:~# svnadmin create /var/svn/redorbita

We start subversion

Bash
root@subversion:~# svnserve -d -r /var/subversion/

We verify that it has started

Bash
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

Bash
vi /var/svn/redorbita/conf/svnserve.conf

[general]
anon-access = none

auth-access = write

auth-access = read

password-db = passwd

Next 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

config
vi /var/subversion/conf/passwd

[users]

rokitoh = 123456

Using the svn info command we can obtain the repository information.

Bash
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

Bash
apt-get install apache2 libapache2-svn php5 libapache2-mod-php5

We activate the modules

text
a2enmod dav_svn

a2enmod authz_svn

 We add the modules

Bash
vi /etc/apache2/apache2.conf

LoadModule dav_svn_module modules/mod_dav_svn.so
LoadModule authz_svn_module modules/mod_authz_svn.so

We proceed to configure /etc/apache2/mods-available/dav_svn.conf in this file we will tell you where the repository is located

Apache
<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

text
groupadd subversion
addgroup rokitoh subversion

We create the user intended for subversion

text
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 jenkins

We configure both the /etc/hostname and /etc/hosts files as follows:

Bash
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.com

We create a script in /etc/init.d/ and configure it to start at system startup.

sql
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 overrides

We check that access via http works correctly:

text
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