Skip to content

Install SVN Server

Ajmal Muhammad P edited this page Nov 11, 2021 · 1 revision
  • Install the subversion 1st
sudo apt-get install subversion
  • Now, we need to create a project
svnadmin create /home/pi/repos/helloworld
  • Let’s create a project that we’ll add to SVN
mkdir /home/pi/projects/helloworld
cd /home/pi/projects/helloworld
  • create a file called main.php
sudo nano main.php
  • add sample code
 <?php echo "Test message"; ?>
  • Save file [hit Ctrl + X]
  • Now we need to import it into svn
sudo svn import /home/pi/projects/helloworld/ file://localhost/home/pi/repos/helloworld/
  • Enter a commit message and press Ctrl+X to save
  • Now, we’ll need to set up the server part of it so you can access it remotely
sudo apt -y install apache2 libapache2-mod-svn
  • Now let’s edit the dav_svn.conf
sudo nano /etc/apache2/mods-available/dav_svn.conf
  • Add this to the bottom of the file
<Location /svn>
  DAV svn
  SVNParentPath /home/pi/repos
  SVNListParentPath On
  AuthType Basic
  AuthName "Subversion Repo"
  AuthUserFile /etc/apache2/dav_svn.passwd
  <LimitExcept GET PROPFIND OPTIONS REPORT>
    Require valid-user
  </LimitExcept>
 </Location>
  • Quit and save the file, then restart apache
sudo /etc/init.d/apache2 restart
  • Now we need to change the permissions of this folder
sudo chown -R www-data:www-data /home/pi/repos
  • Now you need to create an SVN user
sudo htpasswd -c /etc/apache2/dav_svn.passwd testuser

Remember only use -c the first time you add a user. If you run this with -c again it will delete existing users! This is for the first time only!

  • Now you can check your repo thru a web browser http://piserver/svn/helloworld/