====== Install and Use Subversion (svn) and ViewVC on Ubuntu ====== ===== Install Subversion with Web Access on Ubuntu ===== - To install subversion, open a terminal and run the following command: sudo apt-get install subversion libapache2-svn - To create a folder for the subversion repository in /svn, use sudo svnadmin create /svn - Edit the configuration file for the subversion webdav module. sudo nano /etc/apache2/mods-enabled/dav_svn.conf \\ The Location element in the configuration file dictates the root directory where subversion will be acessible from, for instance: http://128.143.XX.XX/svn \\ In the file uncomment the following lines DAV svn #The SVNPath line should be set to the same place #your created the repository with the svnadmin command. # Set this to the path to your repository SVNParentPath /svn # Uncomment the following 3 lines to enable Basic Authentication AuthType Basic AuthName “Subversion Repository” AuthUserFile /etc/apache2/dav_svn.passwd Require valid-user ## add this line - To create a user on the repository, use the following command: sudo htpasswd -cm /etc/apache2/dav_svn.passwd \\ Type in password when required. - If the password file exists, use the following command: sudo htpasswd -m /etc/apache2/dav_svn.passwd \\ Type in password when required. - Restart apache by running the following command: sudo /etc/init.d/apache2 restart - Now if you go in your browser to http://128.143.XX.XX/svn. Input username and password created when required. ==== Use SVN ==== - Create a repos using $ svnadmin create /svn/repos1 on the server - In the local computer, check out the repos1 by using svn checkout http://128.143.XX.XX/svn/repos1 - Now add a new or update a file on the server - Create a file nano test.txt - Add it to repos1 svn add test.txt - Upload it to the sever to repos1 svn commit test.txt -m "Initial readme file" ===== Install ViewVC on Ubuntu ===== - In the terminal sudo apt-get install viewvc - Edit SVN configuration file sudo nano /etc/apache2/mods-enabled/dav_svn.conf Add the following line in the file ScriptAlias /viewvc /usr/lib/cgi-bin/viewvc.cgi at the end of the file - Edit the file /etc/viewvc/viewvc.conf Change the root_parents to root_parents = /svn : svn - Restart apache by running the following command:sudo /etc/init.d/apache2 restart - Visit http://128.143.XX.XX/viewvc/viewvc.cgi ==== Access control for ViewVC ==== By default, anyone can access ViewVC. To control access using the rules for svn. Open the svn configure file using sudo nano /etc/apache2/mods-enabled/dav_svn.conf and add the following at the end AuthType Basic AuthName "ViewSVN" AuthUserFile /etc/apache2/dav_svn.passwd Require valid-user {{tag>Subversion, svn, ViewVC, Ubuntu, Version control}} ~~LINKBACK~~ ~~DISCUSSION~~