Subversion (SVN) is a popular version control system that allows developers to manage and track changes to their code. It is widely used in software development teams to collaborate and keep track of revisions to codebases. In this article, we will walk you through the process of setting up a Subversion server on a GNU/Linux – specifically, Ubuntu.
Step 1: Install Apache and Subversion
Before setting up the SVN server, we need to make sure that Apache and Subversion are installed on our system. Apache is a web server that will serve as the platform for our SVN server. To install Apache and Subversion, open the terminal and run the following commands:
sudo apt-get update
sudo apt-get install apache2 subversion libapache2-mod-svn
Step 2: Create a Repository
A repository is a central location where all the code for a project is stored. To create a repository, we will use a command-line tool called svnadmin. First, navigate to the directory where you want to store your repository. Then, run the following command:
sudo svnadmin create repo
This will create a new repository named 'repo' in the current directory.
Step 3: Configure Apache
Next, we need to configure Apache to serve our repository. Open the Apache configuration file using the following command:
sudo nano /etc/apache2/mods-available/dav_svn.conf
Add the following lines to the end of the file, replacing "path/to/repo" with the actual path to your repository:
<Location /svn>
DAV svn
SVNPath path/to/repo
</Location>
Save and close the file. Then, restart Apache using the following command:
sudo systemctl restart apache2
Step 4: Create Users and Set Permissions
To access the repository, we need to create users and set permissions for them. First, create a user using the following command:
sudo htpasswd -c /etc/apache2/dav_svn.passwd user1
This will prompt you to enter a password for the user. Repeat the command to create more users.
Next, we need to set permissions for the users on the repository. Open the svnserve.conf file using the following command:
sudo nano /etc/apache2/dav_svn.authz
Add the following lines to the end of the file, replacing "path/to/repo" with the actual path to your repository and "user1" with the username you created earlier:
[repo:/]
user1 = rw
Save and close the file.
Step 5: Access the Repository
Now that everything is set up, we can access the repository using any SVN client. One popular client is TortoiseSVN, which is available for Windows. To access the repository with TortoiseSVN, right-click on the desktop and select "SVN Checkout." In the "URL of repository" field, enter the URL of your repository (e.g. http://localhost/svn). Then, enter the username and password of the user you created earlier and click "OK."
You can now access the repository and start managing your code with Subversion.
Conclusion
In this article, we have walked you through the process of setting up a Subversion server on GNU/Linux – specifically, Ubuntu. We have installed Apache and Subversion, created a repository, configured Apache, and set permissions for users. Now, you can use Subversion to manage your code and collaborate with your team in a more efficient and organized manner. Happy coding!