Subversion on Ubuntu Server

1. Environment Ubuntu Server 10.10 Subversion 1.6.6
2. Install Subversion [codesyntax lang="bash" lines="no" container="pre" tab_width="4"]
$ su root
$ apt-get install subversion
[/codesyntax]
3. Local Checkout [codesyntax lang="bash" lines="no" container="pre" tab_width="4"]
$ mkdir /home/svn
$ cd /home/svn
$ mkdir myproject
$ svnadmin create /home/svn/myproject
$ cd /var/www
$ svn co file://localhost/home/svn/myproject
[/codesyntax]
4. Local Commit and Update [codesyntax lang="bash" lines="no" container="pre" tab_width="4"]
$ cd /var/www/myproject
$ touch index.php
$ svn add index.php
$ svn ci index.php
$ rm index.php
$ svn up
[/codesyntax]
5. Http Checkout (based on apache) [codesyntax lang="bash" lines="no" container="pre" tab_width="4"]
$ su root
$ apt-get install apache2
$ apt-get install libapache2-svn
$ /usr/local/apache2/bin/httpd -l

$ groupadd svn
$ usermod -G subversion -a www-data;
$ usermod -G subversion -a kim;
$ usermod -G subversion -a root;
$ cd /home/svn
$ chown -R root:svn myproject
$ chmod -R g+rws myproject
[/codesyntax]
[codesyntax lang="bash" lines="no" container="pre" tab_width="4"]
$ vi /etc/apache2/mods-available/dav_svn.conf
[/codesyntax] <Location /svn/myproject>

DAV svn SVNPath /home/svn/myproject AuthType Basic AuthName "myproject subversion repository" AuthUserFile /etc/apache2/dav_svn.passwd

<LimitExcept GET PROPFIND OPTIONS REPORT>

Require valid-user

</LimitExcept>

</Location>
[codesyntax lang="bash" lines="no" container="pre" tab_width="4"]
$ htpasswd -c /etc/apache2/dav_svn.passwd kim
$ htpasswd /etc/apache2/dav_svn.passwd mypassword
[/codesyntax]
Checkout myproject with : http://yourhost/svn/myproject Commit using kim/mypassword
6. Https Checkout (based on apache and openssl)
(a) Install OpenSSL [codesyntax lang="bash" lines="no" container="pre" tab_width="4"]
$ su
$ apt-get install openssl
$ a2ensite default-ssl
$ a2enmod ssl
$ ls /etc/ssl
[/codesyntax]
(b) Create the RSA Key [codesyntax lang="bash" lines="no" container="pre" tab_width="4"]
$ cd /etc/ssl
$ openssl req -x509 -newkey rsa:1024 -keyout private/kim.key -out certs/kim.pem -nodes -days 3650 -subj "/C=CN/ST=BJ/L=BJ/O=zlex/OU=zlex/CN=192.168.0.129"
$ ls private/; ls certs/kim.pem
$ vi /etc/apache2/sites-available/default-ssl
[/codesyntax]

SSLCertificateFile /etc/ssl/certs/kim.pem SSLCertificateKeyFile /etc/ssl/private/kim.key


(c) Access from Outside (perhaps the ip address is 192.168.0.129) [codesyntax lang="bash" lines="no" container="pre" tab_width="4"]
$ /etc/init.d/apache2 restart
$ firefox https://192.168.0.129/
[/codesyntax]
7. Links
Posted in SVN| Tagged , |

Comments are closed.