Setup svn » Historie » Version 1
Jeremias Keihsler, 13.01.2017 13:05
1 | 1 | Jeremias Keihsler | h1. Install SVN-Server |
---|---|---|---|
2 | |||
3 | h2. Requirements |
||
4 | |||
5 | To install pgadmin3 you will need the following: |
||
6 | * a installed and supported operating system (e.g. CentOS 6.x) |
||
7 | * root-access |
||
8 | * a fast internet connection |
||
9 | |||
10 | h2. Preliminary note |
||
11 | |||
12 | most of this is taken from |
||
13 | * [[http://www.if-not-true-then-false.com/2010/install-svn-subversion-server-on-fedora-centos-red-hat-rhel/]] |
||
14 | * [[http://www.petefreitag.com/item/665.cfm]] |
||
15 | |||
16 | * setup rules-file [[http://www.startupcto.com/server-tech/subversion/locking-a-branch-in-svn]] |
||
17 | * @ssh+svn@ may be taken from [[http://www.startupcto.com/server-tech/subversion/setting-up-svn]] |
||
18 | This procedure is for a vanilla OS, if @Apache@ is already installed and configured you may have to rethink the configuration. |
||
19 | |||
20 | h2. Install |
||
21 | |||
22 | <pre><code class="bash"> |
||
23 | yum install mod_dav_svn subversion |
||
24 | </code></pre> |
||
25 | |||
26 | h2. Configuration |
||
27 | |||
28 | h3. /etc/http/conf.d/subversion.conf |
||
29 | |||
30 | modify the preinstalled @etc/http/conf.d/subversion.conf@ analogue to |
||
31 | <pre> |
||
32 | LoadModule dav_svn_module modules/mod_dav_svn.so |
||
33 | LoadModule authz_svn_module modules/mod_authz_svn.so |
||
34 | |||
35 | <Location /svn> |
||
36 | DAV svn |
||
37 | SVNParentPath /var/www/svn |
||
38 | AuthType Basic |
||
39 | AuthName "Subversion repositories" |
||
40 | AuthUserFile /etc/svn-auth-users |
||
41 | AuthzSVNAccessFile /etc/svn-authz-users |
||
42 | Require valid-user |
||
43 | </Location> |
||
44 | </pre> |
||
45 | |||
46 | h3. Add SVN users |
||
47 | |||
48 | * first-time usage |
||
49 | <pre><code class="bash"> |
||
50 | htpasswd -cm /etc/svn-auth-users testuser |
||
51 | </code></pre> |
||
52 | * follow up usage |
||
53 | <pre><code class="bash"> |
||
54 | htpasswd -m /etc/svn-auth-users testuser |
||
55 | </code></pre> |
||
56 | Note: Use exactly same file and path name as used on @subversion.conf@ file. This example use @/etc/svn-auth-users@ file. |
||
57 | |||
58 | h3. Create SVN repository |
||
59 | |||
60 | <pre><code class="bash"> |
||
61 | mkdir /var/www/svn |
||
62 | cd /var/www/svn |
||
63 | |||
64 | svnadmin create testrepo |
||
65 | chown -R apache:apache testrepo |
||
66 | |||
67 | chcon -R -t httpd_sys_content_t /var/www/svn/testrepo |
||
68 | </code></pre> |
||
69 | Following enables commits over http |
||
70 | <pre><code class="bash"> |
||
71 | chcon -R -t httpd_sys_rw_content_t /var/www/svn/testrepo |
||
72 | </code></pre> |
||
73 | |||
74 | h3. Configure SVN repository |
||
75 | |||
76 | To *disable anonymous access* and enable *access control* add following rows to @testrepo/conf/svnserve.conf@ |
||
77 | <pre> |
||
78 | ## Disable anonymous access ## |
||
79 | anon-access = none |
||
80 | |||
81 | ## Enable access control ## |
||
82 | authz-db = authz |
||
83 | </pre> |
||
84 | |||
85 | h3. Create trunk, branches and tags structure under testrepo |
||
86 | |||
87 | Create “template” directories with following command: |
||
88 | <pre><code class="bash"> |
||
89 | mkdir -p /tmp/svn-structure-template/{trunk,branches,tags} |
||
90 | </code></pre> |
||
91 | Then import template to project repository using @svn import@ command: |
||
92 | <pre><code class="bash"> |
||
93 | svn import -m 'Initial import' /tmp/svn-structure-template/ http://localhost/svn/testrepo/ |
||
94 | </code></pre> |
||
95 | |||
96 | h2. Usage |
||
97 | |||
98 | open in your browser |
||
99 | <pre><code class="bash"> |
||
100 | http://localhost/svn/testrepo/ |
||
101 | </code></pre> |
||
102 | |||
103 | h2. SSL secured web-server |
||
104 | |||
105 | see also http://wiki.centos.org/HowTos/Https |
||
106 | |||
107 | h2. Backup/Restore SVN repositories |
||
108 | |||
109 | h3. Backup |
||
110 | |||
111 | The first thing you need when moving from one server to another is a dump of your subversion repository. Hopefully you are already creating dump's with a backup script, but if not here's how you can create a subversion dump file: |
||
112 | |||
113 | <pre><code class="bash"> |
||
114 | svnadmin dump /path/to/repository > repo_name.svn_dump |
||
115 | </code></pre> |
||
116 | |||
117 | The dump file contains all the revisions you have ever made to your svn repository, so it will probably be quite large (it even includes files you may have deleted in a previous revision). |
||
118 | |||
119 | h3. Restore |
||
120 | |||
121 | Now, simply transfer the dump file on to your new subversion server, and create an empty repository: |
||
122 | |||
123 | <pre><code class="bash"> |
||
124 | svnadmin create /path/to/repository |
||
125 | </code></pre> |
||
126 | |||
127 | Next import your dump file: |
||
128 | |||
129 | <pre><code class="bash"> |
||
130 | svnadmin load /path/to/repository < repo_name.svn_dump |
||
131 | </code></pre> |
||
132 | |||
133 | You may want to force subversion to use the same UUID for the new repository as the old repository. To do this add @--force-uuid@ to your @svnadmin load@ command. In my case I wanted to do this. If you have already loaded your repository, there is a way to set the UUID at a later date, check the docs. |
||
134 | |||
135 | That's it, you now have a replica of your old repository on your new server. |