Labels

Android (1) bash (2) boost (2) C (34) C++ (2) cheatsheet (2) CLion (6) css (3) Debian (33) DL (17) Docker (2) Dreamweaver (2) Eclipse (3) fail2ban (4) git (5) GitHub (4) Hacking (3) html (8) http (1) iOS (1) iPad (1) IRC (1) Java (31) javascript (3) Linux (167) Mac (19) Machine Learning (1) mySQL (48) Netbeans (4) Networking (1) Nexus (1) OpenVMS (6) Oracle (1) Pandas (3) php (16) Postgresql (8) Python (9) raid (1) RedHat (14) Samba (2) Slackware (47) SQL (14) svn (1) tar (1) ThinkPad (1) Virtualbox (3) Visual Basic (1) Visual Studio (1) Windows (2)

Friday, 13 November 2020

SVN configuration

 Subversion HowTo

A simple guide to setting up svn on Slackware...


Subversion and its tools are installed by default in Slackware so;

Firstly, create a folder for the SVN repositories

mkdir -p /home/svn/repositories 

The above example was taken from the source at the bottom on this post, but I will most likely be using /var/svn/repositories

so in the following, substitute /home/svn/ for /var/svn/ if we choose to go this way.


To setup Apache;

Un-comment the following three lines in /etc/httpd/httpd.conf

LoadModule dav_module lib64/httpd/modules/mod_dav.so

LoadModule dav_svn_module lib64/httpd/modules/mod_dav_svn.so

LoadModule authz_svn_module lib64/httpd/modules/mod_authz_svn.so

While we're in the httpd.conf file, it's worth navigating to the extra configuration section (this is the section that points to the extra configuration files in /etc/httpd/extra) and adding an entry similar to;

Include /etc/httpd/extra/httpd-svn.conf

I thought the /etc/httpd/extra directory was included by default, obviously not.

Create /etc/httpd/extra/httpd-svn.conf

with the following content;

 <Location /svn>

    DAV svn

    SVNParentPath /home/svn/repositories

    AuthzSVNAccessFile /home/svn/.svn-policy-file

    AuthName "Test SVN Repo"

    AuthType Basic

    AuthUserFile /home/svn/.svn-auth-file

    Satisfy Any

    Require valid-user

 </Location>


To set up simple path based authentication;

Create /home/svn/.svn-policy-file

with the following content;

 [/]

 * = r

 

 [test:/]

 plisken = rw


In the above, the * gives read to all users and plisken has read/write access to a repository called test

We need to create a file .svn-auth-file as follows;

htpasswd -cs /home/svn/.svn-auth-file plisken

The first time we do this, we need to use -c this tells htpasswd to create the file, so going forward, we would remove the -c as follows;

htpasswd -s /home/svn/.svn-auth-file bob

Where bob is another user

Beyond the scope here but we may wish to consider using an alternitive to -s (sha1) such as htdigest [to look into]


To create a repository, do;

svnadmin create --fs-type fsfs /home/svn/repositories/test

The --fs-type fsfs (may or may not be needed) and where test is the name of the repository, as used in the /home/svn/.svn-policy-file above.


Give Apache permissions over it;

chown -R apache:apache /home/svn/repositories/test


To test;

we can goto http://<server>/svn/test


Sources

http://www.slackwiki.com/Subversion

https://docs.slackware.com/howtos:network_services:subversion


To backup and restore a repository;

The following is based on;

an existing repository: /home/svn/repositories/test

a new repository: /home/svn/repositories/test2

a backup location: /home/plisken/repo_BAC.bz2

current dir: /home/svn/repositories


Firstly, we can backup as follows;


sudo svnadmin dump -q test | bzip2 -9 > /home/plisken/repo_BAC.bz2

To restore;


We first need to create a folder, in this case test2

sudo svnadmin create test2

Omitting the --fs-type fsfs seems to have little adverse effect.
Anyway, now /home/svn/repositories/test2 exists.

We then cd into /home/svn/repositories and do;

sudo bzip2 -cd /home/plisken/repo_BAC.bz2 | sudo svnadmin load test2

Note the -9 is a compression thing and the -cd does not mean change directory, the c means decompress to stdout and the d means decompress.




No comments:

Post a Comment

Note: only a member of this blog may post a comment.