Learn how to Set Up Subversion Model Management in Ubuntu

When growing a venture, you might need to use model management to be able to simply revert a file to the earlier revision to repair bugs or restore beforehand deleted recordsdata. In Ubuntu, a straightforward solution to do model management is to arrange a Subversion (SVN) server.

On the lookout for a extra in style model management? Take a look at our newbie’s information to Git.

What’s Subversion?

Subversion is an open supply model management software program. It lets you create variations of your code or tasks to simply seek advice from it sooner or later.

Subversion is just like Git, one other model management software program, although their inside workings are totally different from one another.

Subversion is simpler to study, with fewer instructions. You at all times work on a central Subversion repository when committing adjustments, which removes confusion between native and distant repositories. Nevertheless, should you don’t have entry to that central repository (in case you have no Web), you’ll be able to’t make commits. Subversion additionally lacks some qualit- of-life options that Git has. Additionally, don’t overlook that Git is now way more in style as a result of rise of the GitHub and GitLab web sites, so that you’d get extra worth out of studying Git as an alternative.

Setting Up Subversion

The very first thing to do is set up the Subversion software program.

  1. Open the Terminal utility with the default keyboard shortcut Ctrl + Alt + T.
  2. Replace the system:
  1. Set up the Apache server:
Ubuntu Set Up Subversion Sudo Apt Install Apache2
  1. Enter the command to put in subversion:
sudo apt set up subversion libapache2-mod-svn

Enter Y when prompted to proceed by the set up.

Ubuntu Set Up Subversion Install Libapache2 Mod Svn
  1. Create a listing to carry the server repository:
sudo svnadmin create /var/lib/svn
Ubuntu Set Up Subversion Create Var Lib Svn
  1. Replace the entry permissions to the repository:
sudo chown -R www-data:www-data /var/lib/svn
sudo chmod 770 -R /var/lib/svn
Ubuntu Set Up Subversion Chmod Permissions

Good to know: discover out the entire variations between Apache and Nginx.

Configure Apache for SVN Entry

Subsequent, arrange your Apache server with SVN.

  1. Open the Apache SVN configuration file:
sudo nano /and many others/apache2/mods-available/dav_svn.conf
Ubuntu Set Up Subversion Sudo Gedit Etc Apache2 Mods Available Dav Svn
  1. Discover the under strains and take away the ‘#’ in entrance of them to uncomment:
<Location /svn>
DAV svn
SVNPath /var/lib/svn
AuthType Fundamental
AuthName "Subversion Repository"
AuthUserFile /and many others/apache2/dav_svn.passwd
Require valid-user
  1. Set up utils for Apache:
sudo apt set up apache2-utils
Ubuntu Set Up Subversion Apache2 Utils Installation Complete
  1. Create a password on your username:
sudo htpasswd -cm /and many others/apache2/dav_svn.passwd yourusername

Bear in mind the password; you’ll want it to run SVN instructions later.

Ubuntu Set Up Subversion Sudo Htpasswd
  1. Restart apache with:
sudo /and many others/init.d/apache2 restart

Open your browser and go to http://localhost/svn. For those who see the next, your set up was profitable!

Ubuntu Set Up Subversion Localhost Svn Revision 0

Good to know: Apache additionally lets you host an internet site in your pc. Discover ways to put together Apache for top visitors to your web site.

Add Your Challenge Recordsdata to SVN

Now that you’ve an empty SVN repository, observe these steps to work with it.

  1. Obtain a working copy of the empty repository with:
svn checkout http://localhost/svn
Ubuntu Set Up Subversion Svn Checkout Localhost
  1. Navigate to the newly created “svn” folder and create or copy your venture recordsdata to it.
Ubuntu Set Up Subversion Make Files
  1. Use svn add * to pick all modified recordsdata in your working copy to be dedicated.
Ubuntu Set Up Subversion Svn Add Asterisk 1
  1. Enter svn commit -m "your commit message" to commit and add the recordsdata added within the earlier step to the SVN repository. You’ll have to enter the password you created earlier for this command.
Ubuntu Set Up Subversion Svn Commit
  1. Refresh http://localhost/svn. For those who see your new recordsdata and an elevated “Revision” quantity, you’ve succeeded!
Ubuntu Set Up Subversion Localhost Revision 1 Success

Picture credit score: Pexels. All screenshots by Brandon Li.