We will show you how to install SVN in Linux. Subversion, or commonly abbreviated as SVN is an open source software versioning and revision control system. It allows users to maintain current and historical versions of files such as source code, web pages, documents and other electronic data. Installing SVN in Linux, is not so complicated, just follow the steps in the tutorial below and you should have it done in 10 minutes. We are also going to show you, some basic SVN commands in Linux.
1. Connect via SSH
In order to install SVN, connect to your Linux VPS via SSH.
ssh [email protected] -p2222
Please remember to replace 184.108.40.206 with the IP address of your server and 2222 with the listening port of your server’s SSH daemon.
2. Update the OS Packages and Install SVN in Linux
If you are using an Ubuntu VPS, update the OS packages and install SVN on your server using the commands below:
sudo apt-get update sudo apt-get install svn
If you are using a CentOS VPS, you can use the following command to update the OS packages and install SVN:
yum update yum install svn
3. Check SVN Version
To check the version of SVN installed on your server, use the following command:
# svn --version svn, version 1.7.14 (r1542130)
4. Create a system user account
Create a system user account and switch to that user:
useradd -M someuser
Replace ‘someuser’ with the actual username.
su someuser cd ~
5. Create a new directory for your project/application/website files:
mkdir -p svn/myapp
Create an SVN repository using the following command:
sudo svnadmin create /home/someuser/svn/myapp
6. Configure permissions
Set the proper file permissions. On Debian based distributions, run:
chown -R www-data:subversion myapp chmod -R g+rws myproject
On RPM based distributions (if using Apache as a web server), run:
chown -R apache:subversion myapp chmod -R g+rws myproject
7. Create a ‘passwd’ file
Create a ‘passwd’ file to the /home/someuser/svn/myapp/conf/passwd directory on your server which contains user authentication details:
sudo htpasswd -c /home/someuser/svn/myapp/conf/passwd someuser
If you want to add additional users, use the same command, but without the ‘-c’ switch to avoid overwriting the passwd file.
Assign permissions to SVN users using the authz file (/home/someuser/svn/myapp/conf/authz):
8. Create the conceptual groups, configure permissions
Create the conceptual groups you want, then add people to it:
[groups] allaccess = someuser someaccess = someuser2
Choose what access they have from both the permissions and project level:
To give read and write permissions to ‘allaccess’ users, add:
[/] @allaccess = rw
To only give read-only access to ‘someaccess’ users to some lower level project, add:
[/someproject] @someaccess = r
9. Other Commands for SVN in Linux
In order to copy an unversioned tree of your project/website files and begin tracking in your SVN repository and create intermediate directories, use the following command:
svn import -m "Initial import" local/path/ https://svn.yourdomain.com/path/to/svn/repo/
You can create a single repository for each project/website at some central place where all the history is and which you checkout and commit into.
To create a working copy to another local directory, use:
svn co https://svn.yourdomain.com/path/to/svn/repo/ /local/path/directory2
In order to send changes from your working copy to the repository, use:
svn commit -m "add short info about changes here">
Use ‘svn add /path/file’ command to add a file from the working copy to the repository). File will be added to the repository when you do an svn commit.
To delete a file from the working copy (or repository), use:
svn delete /path/file
and the file will be deleted from the repository after the svn commit command.
To update changes from the repository into a working copy, use:
If there are multiple authors working on the project/website and they have local working copies on multiple machines, always run the ‘svn update’ command before making changes to files available in your working copy. After that, make changes to files, then commit changes to the repository once the files are done being modified.
In order to apply the differences between two sources to a working copy path, use:
To see the differences between the two specific revisions of a file, use:
svn diff -r revision1:revision2 filename
Of course, you don’t have to Install SVN in Linux, if you use one of our Subversion Hosting services, in which case you can simply ask our expert Linux admins to install and configure SVN in Linux for you. They are available 24×7 and will take care of your request immediately.
PS. If you liked this post on how to install SVN in Linux, please share it with your friends on the social networks using the buttons on the left or simply leave a reply below. Thanks.