[Change Package Repository]
Open System -> Administration -> Synaptic Package Manager -> Settings -> Repositories
Select from the drop down Main server
Click OK
Press the Reload Button and wait for the packages to download
close the Synaptic Package Manager
[Create an svn user]
vi /etc/group
add
svn:x:1000:
or use an available number if 1000 is used
vi /etc/passwd
add
svn:x:1000:GROUP_ID:svn,,,:/home/svn:/bin/bash
replace 1000 with an available user id if 1000 is used
[Install Subversion]
sudo apt-get install subversion
Answer Y to the prompts
[Create Repository Root]
sudo mkdir /var/svn
[Assign SVN ownership to SVN user]
sudo chown -R svn:svn /var/svn
[Start SVN Server]
svnserve -d -r /var/svn
[Create Repository]
svnadmin create /var/svn/YOUR_REPO_NAME
[Modify SVN Server Config]
vi /var/svn/YOUR_REPO_NAME/conf/svnserve.confuncomment the line specifying that username/passwords are stored in a file named passwduncomment the line containing anon-access and set it to none
[Edit list of users]
vi /var/svn/YOUR_REPOSITORY_NAME/conf/passwd
After the line that says [users] you can add users by adding lines in the format
username = password
(optional)[Make SVN start at boot]
[Make SVN start at boot]
Create start script
sudo vi /etc/init.d/svnserve
Paste the following:
svnserve -d -r /var/svn/YOUR_REPOSITORY_NAME
OR
#! /bin/sh
PATH=/sbin:/bin:/usr/sbin:/usr/bin
DAEMON=/usr/bin/svnserve
NAME=svnserve
DESC="SVN Repository Server Daemon"
test -x $DAEMON || exit 0
# Set your repository root here!
OPTIONS="-d -r /var/svn"
# Get lsb functions
#. /lib/lsb/init-functions
. /etc/default/rcS
start() {
echo "Starting $DESC... "
# echo "Starting $DESC: "
if ! start-stop-daemon --chuid svn --start --quiet --oknodo --exec $DAEMON -- $OPTIONS
>/dev/null 2>&1; then
status=$?
echo $status
return $status
fi
log_end_msg 0
return 0
}
case "$1" in
start)
start
;;
stop)
echo "Stopping $DESC: "
start-stop-daemon --stop --quiet --oknodo --exec $DAEMON
echo $?
;;
restart|force-reload)
$0 stop
sleep 1
start
#echo "$NAME."
;;
*)
N=/etc/init.d/$NAME
echo "Usage: $N {start|stop|restart|force-reload}" >&2
exit 1
;;
esac
exit 0
Make the script executable:
sudo chmod +x /etc/init.d/svnserve
Add the script to the boot sequence:
sudo update-rc.d svnserve defaults
Key thing in the script is to make sure the svn serve user and group is correct or when svnserve runs it will not have permission to modify the repository
(optional) [Perform Initial Import]
sudo svn import /PATH/TO/FOLDER/TO/IMPORT file:///var/svn/YOUR_REPO_NAME -m "Initial Import"
(random) [Restart SVN Server]
sudo pkill -9 svnserve
sudo restart svnserve
You can access the SVN repository at
[Connect To Repository]
URL: svn://YOUR_HOSTNAME_OR_IP/YOUR_REPO_NAME
See http://svnbook.red-bean.com/en/1.1/ch05s02.html for more svnadmin create options
[User permissions]
Edit Users -> must be specified in svnserve.confvi /var/svn/YOUR_REPO_NAME/conf/passwd
Edit permissions -> must be enabled in svnserve.conf
vi /var/svn/YOUR_REPO_NAME/conf/authz
No comments:
Post a Comment