Difference between revisions of "Tutorials and How-tos/Install Subversion"
(Created page with 'Subversion is a very good for developers to have. I will expand and old ''how to'', that can be found from the forum: [http://forum.excito.net/viewtopic.php?f=8&t=557 h...') |
m |
||
(One intermediate revision by one other user not shown) | |||
Line 5: | Line 5: | ||
The reason for this how to is to make sure the source code that is checked in is always backed up and safe. By setting up the Subversion server on Bubba and store the important data on another server that runs raid but not Subversion, we can combine the best things.<br> | The reason for this how to is to make sure the source code that is checked in is always backed up and safe. By setting up the Subversion server on Bubba and store the important data on another server that runs raid but not Subversion, we can combine the best things.<br> | ||
'''HINT''': <u>''Before you begin with this make sure the share on the QNAP server is setup with the name DevRepositories on example shown here this QNAP server IP is 172.16.10.30.''</u><br> | '''HINT''': <u>''Before you begin with this make sure the share on the QNAP server is setup with the name DevRepositories on example shown here this QNAP server IP is 172.16.10.30.''</u><br> | ||
Enough talk now let's get started.<br> | Enough talk now let's get started.<br> | ||
Line 11: | Line 11: | ||
<br> | <br> | ||
=== Installation (One time only)<br> === | === Installation (One time only)<br> === | ||
---- | ---- | ||
<br> | <br> | ||
1. First we need to do is to install subversion.<br> | 1. First we need to do is to install subversion.<br> | ||
Line 23: | Line 23: | ||
2. The next thing we need to do is add a subversion group.<br> | 2. The next thing we need to do is add a subversion group.<br> | ||
# | # groupadd svn | ||
3. Followd by a new user.<br> | 3. Followd by a new user.<br> | ||
Line 61: | Line 61: | ||
# cd Projects/conf | # cd Projects/conf | ||
12. With you favorite editor edit the passwd file. I will use nano editor. <br> | 12. With you favorite editor edit the passwd file. I will use nano editor. <br> | ||
Add a new svn user to the file and save the file when done.<br> | Add a new svn user to the file and save the file when done.<br> | ||
Line 91: | Line 91: | ||
#!/bin/sh | #!/bin/sh | ||
# Start/stop the subversion daemon. | # Start/stop the subversion daemon. | ||
case "$1" in | test -f /usr/bin/svnserve || exit 0 | ||
case "$1" in | |||
start) echo -n "Starting Subversion server" | start) echo -n "Starting Subversion server" | ||
start-stop-daemon --start --chuid svn:svn --exec /usr/bin/svnserve --quiet -- -d -r /home/svn/DevRepositories | |||
echo "." | |||
;; | |||
stop) echo -n "Stopping Subversion server" | stop) echo -n "Stopping Subversion server" | ||
start-stop-daemon --stop --exec /usr/bin/svnserve --quiet | |||
echo "." | |||
;; | |||
restart) echo -n "Restarting Subversion" | restart) echo -n "Restarting Subversion" | ||
start-stop-daemon --stop --retry 5 --exec /usr/bin/svnserve --quiet | |||
start-stop-daemon --start --chuid svn:svn --exec /usr/bin/svnserve --quiet -- -d -r /home/svn/DevRepositories | |||
echo "." | |||
;; | |||
*) echo "Usage: /etc/init.d/subversion start|stop|restart" | *) echo "Usage: /etc/init.d/subversion start|stop|restart" | ||
exit 1 | |||
;; | |||
esac | esac | ||
exit 0 | exit 0 | ||
Line 125: | Line 127: | ||
<br> | <br> | ||
=== Recovery Process<br> === | === Recovery Process<br> === | ||
---- | ---- | ||
''To recover the repository if something happen. Follow the instructions below. ''<br> | ''To recover the repository if something happen. Follow the instructions below. ''<br> | ||
<br> | |||
1. Follow the above instruction to step no. 9.<br> | 1. Follow the above instruction to step no. 9.<br> | ||
2. Instead of svnadmin create. Use svnadmin recover.<br> | 2. Instead of svnadmin create. Use svnadmin recover.<br> | ||
# svnadmin recover DevRepositories/Projects | # svnadmin recover DevRepositories/Projects | ||
Line 141: | Line 143: | ||
3. Now follow the steps 15 - 17 to add the start/stop script, it is recommended to add the script to auto start (step 18). <br> | 3. Now follow the steps 15 - 17 to add the start/stop script, it is recommended to add the script to auto start (step 18). <br> | ||
<br> | <br> | ||
This should be all, everything should be back to normal!<br> | This should be all, everything should be back to normal!<br> |
Latest revision as of 20:55, 4 February 2012
Subversion is a very good for developers to have. I will expand and old how to, that can be found from the forum: http://forum.excito.net/viewtopic.php?f=8&t=557
This extended installation is depending on a second server ( I use a Qnap-TS639 Pro ).
The reason for this how to is to make sure the source code that is checked in is always backed up and safe. By setting up the Subversion server on Bubba and store the important data on another server that runs raid but not Subversion, we can combine the best things.
HINT: Before you begin with this make sure the share on the QNAP server is setup with the name DevRepositories on example shown here this QNAP server IP is 172.16.10.30.
Enough talk now let's get started.
Installation (One time only)
1. First we need to do is to install subversion.
# apt-get install subversion
2. The next thing we need to do is add a subversion group.
# groupadd svn
3. Followd by a new user.
# useradd -m -d /home/svn -s /bin/bash -g svn svn
4. Now let us add a secure password for the subversion user.
# passwd svn
5.Now we can go to the new user svn home directory.
# cd /home/svn
6. Now we need to create the repository directory.
# mkdir DevRepositories
7. Now to acctully combine the Qnap server with the Bubba|Two server we need to do a network mount.
# mount -t nfs -o nolock 172.16.10.30:/DevRepositories DevRepositories/
8. Now let us go in to the repository directory.
# cd DevRepositories
9. Now we need to be the user svn. To achive this we can run the following command.
# su svn
10. Now we need to create the repository.
# svnadmin create Projects
11. Now we need to setup the configurations. First let us go to the folder.
# cd Projects/conf
12. With you favorite editor edit the passwd file. I will use nano editor.
Add a new svn user to the file and save the file when done.
# nano passwd
13. When you have add the user(s) you need to edit the svnserve.conf file. I will use nano editor.
# nano svnserve.conf
14. Edit the following lines in the svnserve.conf file. Save the file and logout (CTRL+D) the svn user.
# anon-access = none # auth-access = write # password-db = passwd
15. Now we need to create the auto start script so when the Bubba|Two server reboot it will start the subversion server.
Start with creating the file and make it executable.
# touch /etc/init.d/subversion # chmod +x /etc/init.d/subversion
16. Edit the new created file /etc/init.d/subversion I will use nano to edit the file.
# nano /etc/init.d/subversion
17. Modify the file to look like this (This script was copied from the this forum post:http://forum.excito.net/viewtopic.php?f=8&t=557)
#!/bin/sh # Start/stop the subversion daemon.
test -f /usr/bin/svnserve || exit 0
case "$1" in
start) echo -n "Starting Subversion server" start-stop-daemon --start --chuid svn:svn --exec /usr/bin/svnserve --quiet -- -d -r /home/svn/DevRepositories echo "." ;; stop) echo -n "Stopping Subversion server" start-stop-daemon --stop --exec /usr/bin/svnserve --quiet echo "." ;; restart) echo -n "Restarting Subversion" start-stop-daemon --stop --retry 5 --exec /usr/bin/svnserve --quiet start-stop-daemon --start --chuid svn:svn --exec /usr/bin/svnserve --quiet -- -d -r /home/svn/DevRepositories echo "." ;; *) echo "Usage: /etc/init.d/subversion start|stop|restart" exit 1 ;; esac exit 0
18. [Recommended] To add the script to autostart run the following command.
# update-rc.d /etc/init.d/subversion defaults
19. [Optional] To remove the autostart run the following command.
# update-rc.d /etc/init.d/subversion remove
Recovery Process
To recover the repository if something happen. Follow the instructions below.
1. Follow the above instruction to step no. 9.
2. Instead of svnadmin create. Use svnadmin recover.
# svnadmin recover DevRepositories/Projects
3. Now follow the steps 15 - 17 to add the start/stop script, it is recommended to add the script to auto start (step 18).
This should be all, everything should be back to normal!