CentOS Stream 9
Sponsored Link

Subversion : Remote Access to Repositories2022/07/20

 
Access to Repositories from remote Hosts.
[1] Start [svnserve] service on a Host that Subversion repository exists.
[root@dlp ~]#
vi /etc/sysconfig/svnserve
# specify the top directory which SVN repositories exist
# default is like follows but possible to change for your requirements

# Specify the repository location in -r parameter:
OPTIONS="-r /var/svn"
[root@dlp ~]#
mkdir /var/svn

[root@dlp ~]#
systemctl enable --now svnserve
# create a test project

[root@dlp ~]#
mkdir -p /var/svn/repos/project

[root@dlp ~]#
svnadmin create /var/svn/repos/project

[root@dlp ~]#
svn mkdir file:///var/svn/repos/project/trunk -m "create"

[root@dlp ~]#
svn mkdir file:///var/svn/repos/project/branches -m "create"

[root@dlp ~]#
svn mkdir file:///var/svn/repos/project/tags -m "create"

[2] If Firewalld is running, allow SVN service. SVN uses [3690/TCP].
[root@dlp ~]#
firewall-cmd --add-service=svn

success
[root@dlp ~]#
firewall-cmd --runtime-to-permanent

success
[3] If SELinux is enabled, change policy.
On this example, SVN top directory is [/var/svn] but if you set another Path except [/var], you need to modify follows for your requirements.
[root@dlp ~]#
vi svn-server.te
# create new

module svn-server 1.0;

require {
        type svnserve_t;
        type var_t;
        class file { append create lock rename setattr unlink write };
        class dir { add_name create read remove_name rmdir write };
        class capability { chown dac_override fsetid };
}

#============= svnserve_t ==============
allow svnserve_t self:capability { chown dac_override fsetid };
allow svnserve_t var_t:dir { add_name create read remove_name rmdir write };
allow svnserve_t var_t:file { append create lock rename setattr unlink write };

[root@dlp ~]#
checkmodule -m -M -o svn-server.mod svn-server.te

[root@dlp ~]#
semodule_package --outfile svn-server.pp --module svn-server.mod

[root@dlp ~]#
semodule -i svn-server.pp

[4] Access to existing Subversion repository from another remote Host.
For example, Access to existing [/var/svn/repos/project] repository.
By the way, default access permission is read only, so it's impossible to execute [commit] or others like changing operation. For changing operation from remote Host, it needs to set access permission like the link.
# specify relative path name for SVN URI
# on this example
# SVN Top directory : [/var/svn]
# SVN repository directory : [/var/svn/repos/project]
# relative path : [repos/project]
# SVN URI : [svn://dlp.srv.world/repos/project]

[cent@node01 ~]$
svn list svn://dlp.srv.world/repos/project

branches/
tags/
trunk/

[cent@node01 ~]$
mkdir ./work

[cent@node01 ~]$
svn checkout svn://dlp.srv.world/repos/project ./work

A    work/branches
A    work/tags
A    work/trunk
Checked out revision 3.

[cent@node01 ~]$
ll work

total 0
drwxr-xr-x. 2 cent cent 6 Jul 20 14:51 branches
drwxr-xr-x. 2 cent cent 6 Jul 20 14:51 tags
drwxr-xr-x. 2 cent cent 6 Jul 20 14:51 trunk
[5] It's also possible to access via SSH without running [svnserve] service on Subversion Host.
[cent@node01 ~]$
svn ls svn+ssh://cent@dlp.srv.world/var/svn/repos/project

cent@dlp.srv.world's password:
branches/
tags/
trunk/

[cent@node01 ~]$
mkdir ./work2

[cent@node01 ~]$
svn co svn+ssh://cent@dlp.srv.world/var/svn/repos/project ./work2

cent@dlp.srv.world's password:
A    work2/branches
A    work2/tags
A    work2/trunk
Checked out revision 3.
Matched Content