Create yum repository (/etc/yum.repos.d/wandisco-svn.repo)
[WandiscoSVN]
name=Wandisco SVN
baseurl=http://opensource.wandisco.com/centos/7/svn-1.9/RPMS/$basearch/
enabled=1
gpgcheck=0
Remove previous version to avoid conflictsudo yum remove subversion sudo yum clean all
Installing subversion
sudo
yum install mod_dav_svn subversion
checking svnserve version
svnserve --version
or svn --version
Creating Respository
1. make a directory for repositories
sudo mkdir /srv/svn/repos
cd /srv/svn/repos
sudo svnadmin create TEST0001V0
Set file permission
sudo chown -R root:svngrp /srv/svn/repos sudo chmod -R g+rws /srv/svn/repos
2. Modified configuration files
2.1 TEST0001V0/conf/authz
[groups] rd2 = tony [/] tony = rw @rd2 = rw * = [repository:/] @test = r * =2.2 TEST0001V0/conf/passwd
[users] tony = tonypassword test = testpassword
2.3 TEST0001V0/conf/svnserve.conf
[general] anon-access = none auth-access = write password-db = passwd
check svn process (looking for svnserve)
sudo ps aux | grep svn
check svn service (default port 3690)
sudo netstat -ntlp | grep -i svn
stop svn server
sudo killall -9 svnserve
start svn server
sudo svnserve -d
How to start svnserve with systemctl systemd
1. /etc/systemd/system/svnserve.service[Unit]
Description=Subversion protocol daemon
After=syslog.target network.target
[Service]
Type=forking
RuntimeDirectory=svnserve
#PIDFile=/run/svnserve/svnserve.pid
EnvironmentFile=/etc/default/svnserve
#ExecStart=/usr/bin/svnserve $DAEMON_ARGS
#ExecStart=/usr/bin/svnserve -d -r /srv/svn/repos
ExecStart=/usr/bin/svnserve -d
User=svnuser
Group=svngrp
KillMode=control-group
Restart=on-failure
[Install]
WantedBy=multi-user.target
#Alias=svnserve.service
# svnserve options
DAEMON_ARGS="--daemon --pid-file /run/svnserve/svnserve.pid --root /srv/svn/repos --log-file /var/log/svnserve/svnserve.log"
3. log file
mkdir /var/log/svnserve
chown someone /var/log/svnserve
4. To end with log rotation configuration /etc/logrotate.d/svnserve/var/log/svnserve/*.log {
daily
missingok
rotate 14
compress
notifempty
create 640 svn adm
sharedscripts
postrotate
if /bin/systemctl status svnserve > /dev/null ; then \
/bin/systemctl restart svnserve > /dev/null; \
fi;
endscript
}
5. Edit /usr/lib/firewalld/services/svnserve.xml for subversion (add port 3690)
PS: svnserve.xml will add a "svnserve" item on firewalld GUI
<?xml version="1.0" encoding="utf-8"?>
<service>
<short>svnserve</short>
<description>This option allows you to access subversion (svn, svnserve).</description>
<port protocol="udp" port="3690"/>
<port protocol="tcp" port="3690"/>
</service>
6. Add svnserve service for firewalld and reload firewalld
sudo firewall-cmd --permanent --add-service=svnserve
sudo firewall-cmd --reload
sudo systemctl status firewalld
7. Stop and start svn again
stop svn server
sudo killall -9 svnserve
start svn server
sudo svnserve -d
8. check svn service (default port 3690) again
sudo netstat -ntlp | grep -i svn
Refer to:
1. https://stackoverflow.com/questions/38197727/how-to-start-svnserve-with-systemctl-systemd/40584047
2. http://www.voidcn.com/article/p-kwmdzbek-bbu.html
3. https://www.vultr.com/docs/how-to-setup-an-apache-subversion-svn-server-on-centos-7
沒有留言:
張貼留言