The version control system (VCS) is necessary for any software development, especially when it comes to dealing with different versions of code, tracking changes, and resolving conflicts. Although it’s hard to imagine effortless collaboration within a team without version control, not everyone knows how to start it. Today, we’ll tackle one of the most popular open source VCSs, the Subversion (SVN), and look at how to start SVN on linux in this step-by-step guide.
Step 1: Install Subversion
To install Subversion on Linux, open up a terminal window and execute the following command:
“` shell
$ sudo apt-get install subversion
This command will install all the necessary binaries and libraries to enable Subversion on your system.
Step 2: Create a Repository
The first step in setting up a Subversion repository is to create the directory which will store the project's versioned files. This directory will be called a repository. To create a repository, first, create the new directory:
``` shell
$ sudo mkdir -p /repository/
Now, you need to create the repository itself. To do that, execute the following command in the terminal:
“` shell
$ sudo svnadmin create /repository/my_repository
“`
Here, my_repository is the name of the repository.
Step 3: Configure Repository Access
The next step is to configure the access permissions to your repository. This can be done by editing two configuration files: authz and passwd.
The authz file will store authorization rules while the passwd file will store the authentication configuration settings. To create the authz and passwd files, first, navigate to the repository location:
“` shell
$ cd /repository/my_repository/conf
“`
Next, create both files using the touch command:
“` shell
$ sudo touch authz passwd
Step 4: Configure Authentication
The authentication configuration is stored in the passwd file. This configuration contains details such as usernames and passwords. To setup authentication, open the passwd file in a text editor like the nano command line editor and add the authentication credentials:
[users]
user_one = password_one
user_two = password_two
user_three = password_three
Save the file and exit the editor.
Step 5: Configure Authorization
The authorization rules can be configured in the authz file. This file contains details such as which user can access which paths in the repository. To configure authorization, open up the authz file in an editor, and add the following rules:
[groups]
dev_team = user_one, user_two, user_three
[/]
@dev_team =rw
“`
This rule will give read and write permission to the members of the dev_team for all files and directories in the repository. Once done, save the file and exit the editor.
Step 6: Start the Subversion Server
Finally, the Subversion server can be started by running the following command in the terminal:
“`shell
$ sudo svnserve -d -r /repository/my_repository
The above command will start the server as a daemon process. You can access your repository using the following URL:
svn:///my_repository
Congratulations, you have successfully setup Subversion on Linux. Now, you can start using the repository and experience the power of version control. Happy coding!