Difference between revisions of "SVN server installation (Linux)"
(→2. Adjust rights) |
(→2. Adjust rights) |
||
(21 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
− | + | [[Category:Linux]] | |
+ | [[Category:Development]] | ||
+ | |||
+ | SVN is used to managed file revisions, branches and application releases. | ||
You have to install a SVN server, then a client on each remote computer. | You have to install a SVN server, then a client on each remote computer. | ||
− | + | =Setup SVN server= | |
− | =SVN server= | ||
− | |||
==installation== | ==installation== | ||
Line 19: | Line 20: | ||
mkdir /var/svn/myRepository | mkdir /var/svn/myRepository | ||
</syntaxhighlight> | </syntaxhighlight> | ||
+ | |||
Set rights | Set rights | ||
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
Line 27: | Line 29: | ||
− | == | + | ==Automatic startup== |
===Create SVN startup script=== | ===Create SVN startup script=== | ||
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
− | vim /etc/init.d/ | + | vim /etc/init.d/subversionServer |
</syntaxhighlight> | </syntaxhighlight> | ||
Line 73: | Line 75: | ||
esac | esac | ||
</syntaxhighlight> | </syntaxhighlight> | ||
+ | |||
Set execution flags: | Set execution flags: | ||
+ | |||
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
− | chmod 750 /etc/init.d/ | + | chmod 750 /etc/init.d/subversionServer |
</syntaxhighlight> | </syntaxhighlight> | ||
+ | Create symlinks: | ||
− | |||
− | |||
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
− | ln -s /etc/init.d/ | + | ln -s /etc/init.d/subversionServer /usr/bin/subversionServer |
</syntaxhighlight> | </syntaxhighlight> | ||
+ | |||
+ | |||
+ | |||
+ | ===Update boot sequence=== | ||
+ | |||
+ | Register SVN server to server startup | ||
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
cd /etc/init.d | cd /etc/init.d | ||
− | update-rc.d | + | update-rc.d subversionServer defaults |
</syntaxhighlight> | </syntaxhighlight> | ||
− | ==Start SVN server== | + | ===Start SVN server=== |
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
− | /etc/init.d/ | + | /etc/init.d/subversionServer start |
</syntaxhighlight> | </syntaxhighlight> | ||
− | ==How to remove SVN from boot?== | + | ===How to remove SVN from boot?=== |
Just execute the following sequence | Just execute the following sequence | ||
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
− | update-rc.d -f | + | update-rc.d -f subversionServer remove |
</syntaxhighlight> | </syntaxhighlight> | ||
− | = | + | |
+ | =Create SVN repository= | ||
+ | |||
To do any advanced task, you've to use "svnadmin" | To do any advanced task, you've to use "svnadmin" | ||
To create repository you have to: | To create repository you have to: | ||
Line 115: | Line 126: | ||
− | + | ==1. Create root folder== | |
+ | |||
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
svnadmin create /var/svn/myRepo | svnadmin create /var/svn/myRepo | ||
Line 130: | Line 142: | ||
− | + | ==2. Adjust rights== | |
+ | |||
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
+ | mkdir -p /var/svn/myRepo/conf/ | ||
vim /var/svn/myRepo/conf/svnserve.conf | vim /var/svn/myRepo/conf/svnserve.conf | ||
</syntaxhighlight> | </syntaxhighlight> | ||
Line 137: | Line 151: | ||
Adjust values: | Adjust values: | ||
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
− | anon-access = none | + | anon-access = none |
− | auth-access = write | + | auth-access = write |
− | password-db = passwd | + | password-db = passwd |
− | realm = 'java' | + | realm = 'java' |
</syntaxhighlight> | </syntaxhighlight> | ||
− | + | ==3. Create users== | |
+ | |||
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
vim /var/svn/myRepo/conf/passwd | vim /var/svn/myRepo/conf/passwd | ||
Line 151: | Line 166: | ||
− | + | ==Repository access== | |
You can use the repository with the following SVN URL: svn://server/''java'' | You can use the repository with the following SVN URL: svn://server/''java'' | ||
− | |||
− | |||
− | |||
− | |||
+ | =Upgrade repository (Linux)= | ||
− | = | + | <syntaxhighlight lang="bash"> |
− | + | cd /var/svn/ | |
− | + | svnadmin upgrade myRepo | |
− | + | </syntaxhighlight> | |
− | |||
− | |||
− | |||
− | |||
+ | Then you can check the SVN repository version: | ||
− | |||
− | |||
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
− | + | cat /var/svn/myRepo/db/format | |
</syntaxhighlight> | </syntaxhighlight> |
Latest revision as of 20:29, 27 September 2016
SVN is used to managed file revisions, branches and application releases.
You have to install a SVN server, then a client on each remote computer.
Setup SVN server
installation
Required package
apt-get install subversion
Source folder You must indicate to subversion how it's going to work
mkdir /var/svn
mkdir /var/svn/myRepository
Set rights
chown -R www-data:www-data /var/svn/myRepository
chmod -R 777 /var/svn/myRepository
→ Use "www-data" user:group if you want to setup web access through HTTP(S) protocol later on.
Automatic startup
Create SVN startup script
vim /etc/init.d/subversionServer
Put the following content
#!/bin/sh
### BEGIN INIT INFO
# Provides: svn
# Required-Start: $remote_fs
# Required-Stop: $remote_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: SVN server
### END INIT INFO
do_start () {
svnserve -d -r /var/svn --pid-file /var/run/svnserve.pid
}
do_stop () {
start-stop-daemon --stop --quiet --pidfile /var/run/svnserve.pid
}
case "$1" in
start)
do_start
;;
stop)
do_stop
exit $?
;;
restart)
do_stop
sleep 1s
do_start
;;
*)
echo "Usage: $0 start|stop|restart" >&2
exit 3
;;
esac
Set execution flags:
chmod 750 /etc/init.d/subversionServer
Create symlinks:
ln -s /etc/init.d/subversionServer /usr/bin/subversionServer
Update boot sequence
Register SVN server to server startup
cd /etc/init.d
update-rc.d subversionServer defaults
Start SVN server
/etc/init.d/subversionServer start
How to remove SVN from boot?
Just execute the following sequence
update-rc.d -f subversionServer remove
Create SVN repository
To do any advanced task, you've to use "svnadmin" To create repository you have to: 1. Create folder 2. Defines rights 3. Creates users
1. Create root folder
svnadmin create /var/svn/myRepo
Create repo structure
cd /var/svn/myRepo
mkdir trunk
mkdir tags
mkdir branches
chmod -R 755 */
2. Adjust rights
mkdir -p /var/svn/myRepo/conf/
vim /var/svn/myRepo/conf/svnserve.conf
Adjust values:
anon-access = none
auth-access = write
password-db = passwd
realm = 'java'
3. Create users
vim /var/svn/myRepo/conf/passwd
Restart your server to use the new repository.
Repository access
You can use the repository with the following SVN URL: svn://server/java
Upgrade repository (Linux)
cd /var/svn/
svnadmin upgrade myRepo
Then you can check the SVN repository version:
cat /var/svn/myRepo/db/format