How To Install Subversion Server
Apache Subversion, often abbreviated to SVN, is a version control system, distributed as open-source software.
Through Subversion, a complete history of the changes made to the files and folders of your server, managed with the versioning system can be accessed. Moreover, previous versions of your data can also be recovered while protecting their reversibility.
In this guide, you will find all the necessary steps to install and configure a SVN Subversion server on Apache Ubuntu 18.04.
Installing Apache
To access the Subversion server install the Apache web server:
sudo apt-get update
sudo apt-get install apache2 -y
Check the Apache status with the command:
sudo systemctl status apache2
If it is not running, enable it with the following command:
sudo systemctl start apache2
Now, enable Apache to start at system boot:
sudo systemctl enable apache2
Installing the Subversion server
Use the following command to install Subversion (SVN) and all the necessary dependencies:
sudo apt-get install subversion libapache2-mod-svn -y
After its installation, to make sure that the necessary modules are enabled, type:
sudo a2enmod dav dav_svn authz_svn
Then, restart the Apache service with the command:
sudo service apache2 restart
Configuring Apache Subversion
First, create a folder for all the Subversion files:
sudo mkdir -p /opt/svn
Create a repository for SVN (here called 'tutorial') and specify the owner:
sudo svnadmin create /opt/svn/tutorial
sudo chown -R /opt/svn/tutorial/
sudo chmod -R 775 /opt/svn/tutorial
At this point, create the authorized users to act on the repository. To do so, type:
sudo htpasswd -cm /etc/svn-auth-users user_name
A password to authenticate the user with the system will be required.
Repeat this step to create all the users who can access the repository.
Now, create a configuration file for the Apache Virtual Host.
Go to the "sites-available" folder of apache2:
cd /etc/apache2/sites-available/
Create a configuration file for the repository:
sudo nano tutorial.conf
Paste the following code in the file just created and opened:
ServerName svn.tutorial.com ServerAlias svn.tutorial.com DAV svn SVNParentPath /opt/svn AuthType Basic AuthName "Subversion Repository" AuthUserFile /etc/svn-auth-users Require valid-user ErrorLog ${APACHE_LOG_DIR}/svn.tutorial.com-error.log CustomLog ${APACHE_LOG_DIR}/svn.tutorial.com-access.log combined
Save and exit.
Disable and re-enable the Virtual Host, to make the configuration file just written effective, using the commands:
sudo a2dissite 000-default.conf
sudo a2ensite tutorial.conf
To verify that everything is written correctly, type the following command and verify that "Syntax OK" is written as the last line.
sudo apachectl -t
At this point, restart Apache with the command:
sudo systemctl restart apache2
Testing the Subversion server
Open your browser and type in the following URL: http://localhost/svn/tutorial
When required to enter your Username and Password, enter the data used when you created the users.
Go to the terminal and create a first project by typing:
svn mkdir file:///opt/svn/tutorial/project_name -m "added project_name repository"
The "project_name" chosen for this tutorial is "Project".
Inside the project, create the folders where to store the different files with the following command:
sudo svn mkdir file:///opt/svn/tutorial/project_name/folder_name -m "added folder_name to project_name"
To delete a folder or a project, use the following commands:
- Folder:
svn delete file:///opt/svn/tutorial/project_name/folder_name -m "delete folder_name folder"
- Project:
svn delete file:///opt/svn/tutorial/project_name -m "delete project_name repository"
Setting up Automatic Backups
Create a folder where to make backups:
sudo mkdir -p /etc/backups
Enter root mode and add a rule to the Crontab:
sudo su -
crontab -e
Add the following rule to Crontab to make backups run every day at midnight:
0 0 * * * svnadmin dump /opt/svn/tutorial> /etc/backups/backup-$(date +%Y%m%d).dump
A manual backup can also be performed, but to avoid file conflicts with the same name, rename the backup file. To have this backup version, type:
svnadmin dump /opt/svn/tutorial > /etc/backups/manual_backup_name.dump
Restoring a Repository from Backup
To restore a previous backup, create a new Repository and indicate it as where to restore the desired backup.
svnadmin create /opt/svn/restored_repository
svnadmin load /opt/svn/restored_repository < /etc/backups/svn_backup_name.dump
How To Install Subversion Server
Source: https://www.arubacloud.com/tutorial/managing-versions-with-apache-subversion-svn-on-ubuntu-18-04.aspx
Posted by: rockwellfook1949.blogspot.com
0 Response to "How To Install Subversion Server"
Post a Comment