| Setup
an SVN Server on Ubuntu |
- Start by installing SVN on Ubuntu
- sudo apt-get update
- sudo apt-get install subversion
- Now create a repository. The repository is where all of your projects will be stored.
- NOTE: You may choose whatever directory location you want, /var is a good place
- sudo svnadmin create /var/svn
- At
this time, we need to add a user to the repository. This user
will be the owner of the files in the repository. When we add the
user, we are also adding the group.
- sudo adduser svn
- However, this user is NOT a valid user to login to the system so we need to disable this account
- First, edit /etc/passwd and set the login shell to /bin/false
- sudo vi /etc/passwd
- Locate the svn line, and change /bin/bash to /bin/false
- Now we need to change the ownership of the svn repo to our new svn user account
- cd /var
- sudo chown -R svn.svn svn
- We now need to add each user to the svn group
- sudo adduser <yourusername> svn
- To make access to the SVN repository easier, you can create a symbolic link from the / to the repo
- cd /
- sudo ln -s /var/svn svn
- And set the permissions for access to your repo
- sudo vi /svn/conf/svnserve.conf
- Add add the following lines
- anon-access = none
- auth-access = write
- password-db = passwd
- sudo vi /svn/conf/passwd
- Add the following
- <username>=userpassword
- Save the file, and then
- sudo chmod 600 passwd
- We
are now ready to make our first repository. A test repository is
nice because it lets you try out the various SVN commands without
impacting anything legitimate.
- svn ls file:///svn (which shows an empty repo)
- sudo svn mkdir file:///svn/testrepo -m "test repo" (to create a repo names "testrepo")
- svn ls file:///svn (which now shows our first repo)
- Setup svnserver to automatically start whenever your Ubuntu system starts
- cd /etc/init.d
- sudo vi svnserve
- svnserve -d -r /svn
- sudo chmod +x svnserve
- sudo update-rc.d svnserve defaults
- sudo svnserve -d -r /svn (to start the svn server prior to reboot)
- If you are on a Windows client, then tortoisesvn is what you want
- http://tortoisesvn.net/
- Then right click in windows explorer, choose 'svn checkout', and type in the URL as
- svn://<servername>/testrepo
- I made a simple script to create a repo automatically
- vi mkrepo.sh
- #!/bin/bash
- echo "Enter name of repo:"
- read -e repo
- echo "Press <ENTER> when ready to continue"
- read -e junk
- sudo svn mkdir --parents file:///svn/$repo/{trunk,tags,branches} -m "initial repository creation"
- chmod +x mkrepo.sh
|
|