1.) Install subversion
shell> sudo apt-get install subversion
2.) Add a subversion group:
shell> sudo groupadd subversion
3.) Add your username and www-data to the group subversion:
shell> sudo gpasswd -a username subversion
shell> sudo gpasswd -a www-data subversion
shell> sudo gpasswd -a www-data subversion
4.) Create your repository. I chose mine to be created in /usr/local
shell> cd /usr/local
shell> mkdir svn/myproject ;: this is the name of my repository
shell> chown -R www-data:subversion svn/myproject
shell> chmod -R g+rws svn/myproject
shell> cd svn
shell> cd svn
shell> svnadmin create myproject ;: for organizational purposes, svn dir will hold different projects
5.) Import our project. I choose to create a trunk here.
The project here is empty or nonexisting yet. Also, you need to go out outside the /usr/local/svn directory
shell> cd /home/projects
shell> mkdir -p myproject/trunk
shell> svn import myproject file:///usr/local/svn/myproject -m "Initial import"
This will create project "myproject" in /svn/myproject thus creating you a directory structure in svn repo like /svn/myproject/trunk
5b.) If you need to import an existing project with existing files inside it do:
shell> cd /home/superman/www/myproject ;: assume this is my project location
shell> svn import . file:///usr/local/svn/myproject/trunk -m "Initial import of project Superproject"
Notice that I created a trunk directory via import command
6.) Lets install the WebDAV SVN module in apache.
shell> sudo apt-get libapache2-svn
shell> sudo vim /etc/apache2/mods-available/dav_svn.conf
7.) Add this:
<Location /svn/myproject>
DAV svn
SVNPath /usr/local/svn/myproject
AuthType Basic
AuthName "SVN Repo"
AuthUserFile /etc/subversion/passwd
<LimitExcept GET PROPFIND OPTIONS REPORT>
Require valid-user
</LimitExcept>
</Location>
8.) Now lets create the passwd file
shell> sudo htpasswd -c /etc/subversion/passwd username ;: -c to create the file
shell> sudo htpasswd /etc/subversion/passwd batman ;: add another user. no -c this time
shell> sudo apache2ctl restart
9.) NOTES: If you happen to have permissions problem like if you are using tortoise and trying to commit but wont let you do it do:
shell> sudo gpassswd -a www-data subversion :; make apache part of the group
shell> cd /usr/local/svn/myproject :; make sure myproject is owned by www-data
shell> sudo chown -R www-data:subversion . :; we did this earlier but just making sure
10.) OPTIONAL. If you have samba installed and want to add /usr/local/svn
shell>sudo vim /etc/samba/smb.conf
Then add this:[svn]
path = /usr/local/svn
writeable = yes
browseable = yes
valid users = username
guest ok = no
11.) Checking out your project
shell> cd /home/superman/projects/www
shell> mkdir myproject
shell> svn checkout file:///usr/local/svn/myproject/trunk myproject
12.) When checking out in Windows using Tortoise SVN use:
http://[ip of svn server]/svn/myproject/trunk
The above link is the one to use also for viewing your SVN tree structure via a web browser and will only work if you install the WebDAV module in Apache.