Check all articles

Installation of SVN in CentOS 7

Many times we need to have a file repository; either, for source code when we are developing computer systems for saving the versions of the different programs or when we are working on a project with a large library of documents, with the advantage of keeping track of the changes.

Another advantage, in having a repository of files, is to get a backup of our programs or documents in case there is an unexpected incident with our computer.

There are several software solutions for this need, they are tools that work as a file system to keep the changes in the repository. Such as: CVS (discontinued), Visual Source Safe (discontinued), SVN, Git, Bazaar, Mercurial, among others.

Today, we are going to install Apache Subversion, known as SVN, which is an open source version control system. The first deploy of this tool was in the year 2000 and has had a wide acceptance at the business level so far.

This kind of version control tools is multi-user type client-server, we will perform the server-side installation and as a client we could use our favourite Integrated Development Environment (IDE), which surely has a plugin for SVN or we could install TortoiseSVN, software that integrates with "Windows File Explorer".

It is necessary for this installation to have the following knowledge of linux: user creation, installation of software packages in CentOS, granting privileges over directories, network configuration, creating rules in the firewall, configuring SELinux and configuring applications for CentOS. These tasks are not part of this guide but they are necessary for a correct installation.

The installation is performing using a server with the operating system CentOS 7.5.1804, follow these steps (with root user or with a sudo user for login):

Install the SVN software

Using the yum command, install the necessary package.

#yum –y install subversion

Create a location for the repository

We are going to create a directory where our files will be allocated /project01/repository

#cd /
#mkdir project01
#cd project01
#mkdir repository

Create the repository

For this we must set the directory for the repository.

#svnadmin create /project01/repository

Verify the new repository in SVN

After creating the repository, go to the directory /project01/repository, list and verify the existence of the following directories: db, conf, hooks, locks and the files: format and README.txt

#cd /project01/repository
#ls -lth

Create a temporary directory

In this folder we will place the files to be imported into the repository as an initial load.

#mkdir /tmp/project01

Copy all the files

Copy the directories and files that we want to put in the SVN repository temporarily at the location /tmp/project01.

Import the repository

The tree hierarchy that we use in /tmp/project01, will be keep in the repository.

#svn import /tmp/project01 file:///project01/repository -m "initial load"

Remove temporary files

As the files were already imported into the SVN repository, we can delete the temporary directory.

#cd /tmp/project01
#rm *
#cd /tmp
#rmdir project01

Start the SVN service

In order to be available the repository, init the service as follows:

#svnserve -d --listen-port=3690 –r /project01/repository

And ready!!!!

The repository can be accessed using: