Step 1: Create the svn user with SSH access
In the myVesta panel, create a new user named svn and grant SSH access.
We will execute some commands as root and others as svn.
Step 2: Install Subversion as root
Code: Select all
apt update
apt install subversion
svn --version # Verify SVN installation
Code: Select all
mkdir -p /srv/svn/repos
mkdir -p /var/log/svnserve
mkdir -p /run/svnserve
chown svn:svn /srv/svn/repos
chown svn:svn /var/log/svnserve
chown svn:svn /run/svnserve
- /srv/svn/repos: Repository storage location
- /var/log/svnserve: Directory for svnserve logs
- /run/svnserve: Runtime directory for the daemon
Switch to the svn user and create the repository:
Code: Select all
svnadmin create /srv/svn/repos/myapp
chown -R svn:svn /srv/svn/repos/myapp
Code: Select all
mcedit /srv/svn/repos/myapp/conf/svnserve.conf
Code: Select all
[general]
anon-access = none
auth-access = write
password-db = passwd
Code: Select all
mcedit /srv/svn/repos/myapp/conf/passwd
Code: Select all
[users]
username = password
Create the service unit:
Code: Select all
mcedit /etc/systemd/system/svnserve.service
Code: Select all
[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
User=svn
Group=svn
KillMode=control-group
Restart=on-failure
[Install]
WantedBy=multi-user.target
Code: Select all
mcedit /etc/default/svnserve
Code: Select all
DAEMON_ARGS="--daemon --pid-file /run/svnserve/svnserve.pid --root /srv/svn/repos --log-file /var/log/svnserve/svnserve.log"
Code: Select all
systemctl daemon-reload
systemctl enable svnserve
systemctl start svnserve
systemctl status svnserve
Allow SVN traffic on TCP port 3690:
Code: Select all
v-add-firewall-rule 'ACCEPT' '0.0.0.0/0' '3690' 'TCP' 'svn'
- Replace myapp with your preferred repository name.
- Use passwd to manage access credentials securely.
- Always test your configuration by connecting to svn://your-server/myapp.
- Monitor logs at /var/log/svnserve/svnserve.log for troubleshooting.
- This setup provides a clean and maintainable SVN server with access control and service management.