Subversion is a commonly used central version control system for software development. There are currently still a large number of organizations that rely upon it, many have since moved on to Git.
-
sudo apt-get install apache2 apache2-utils
-
sudo apt-get install subversion subversion-tools libapache2-svn
-
sudo mkdir /home/svn
-
svnadmin create /home/svn/test
-
Create a group for subversion users:
sudo groupadd subversion
-
sudo adduser USERNAME
-
Add a user to the group:
sudo useradd -G USERNAME subversion
-
sudo chown -R www-data:subversion /home/svn/test
-
sudo chmod -R g+rws /home/svn/test
-
sudo a2enmod dav_svn
-
To create/clobber a new file for the first user:
sudo htpasswd -c /etc/apache2/.htpasswd YOURUSER
-
To add additional users:
sudo htpasswd /etc/apache2/.htpasswd YOURUSER
(repeat for new users without the -c as that creates/clobbers the file) -
sudo vi /etc/apache2/sites-available/000-default.conf
Then add to the bottom:
(NOTE1: the LimitExcept can be enabled to allow anonymous access):
(NOTE2: the LimitXMLRequestBody can be uncomment to allow large commits)
<Location /svn>
DAV svn
SVNParentPath /home/svn
AuthType Basic
AuthName "Subversion Repository"
# AuthUserFile /etc/svn-auth
AuthUserFile /etc/apache2/.htpasswd
#LimitXMLRequestBody 0
#<LimitExcept GET PROPFIND OPTIONS REPORT>
Require valid-user
#</LimitExcept>
</Location>
-
sudo service apache2 reload
-
sudo service apache2 restart
NOTE: At this point you should be able to browse and do a remote checkout of the code from another machine….
http://YOUR-IP-OR-HOSTNAME/svn
and
svn co http://YOUR-IP-OR-HOSTNAME/svn/test --username YOURUSER --password YOURPASS
-
sudo vi /etc/init/svnserve.conf
Add the following:
# svnserve - Subversion server
description "Subversion server"
start on (local-filesystems and net-device-up IFACE=lo and started udev-finish)
stop on runlevel [06]
chdir /home/svn
respawn
respawn limit 2 3600
exec /usr/bin/svnserve --foreground --daemon --config-file /home/svn/repos/conf/svnserve.conf --root /home/svn/repos/
-
Then execute:
sudo initctl start svnserve
-
Back on the client side…
Create a new folder inside your user folder:
cd ~/test
-
Check out the project into this folder:
svn checkout http://YOUR-IP-OR-HOSTNAME/svn/test
-
Let us just add a new HTML index file to the folder:
vi index.html
-
Add it to version control:
svn add index.html
Commit the new file:
svn commit -m "commit message"
Update:
svn up
- That should cover most cases for you…
REFERENCES: