Setup svn » Historie » Revision 2
« Zurück |
Revision 2/9
(Vergleich)
| Weiter »
Jeremias Keihsler, 12.01.2017 14:17
Install SVN-Server¶
Requirements¶
To install svn you will need the following:- a installed and supported operating system (e.g. CentOS 7.x)
- root-access
- a fast internet connection
Preliminary note¶
most of this is taken from- [[http://www.if-not-true-then-false.com/2010/install-svn-subversion-server-on-fedora-centos-red-hat-rhel/]]
- [[http://www.petefreitag.com/item/665.cfm]]
- setup rules-file [[http://www.startupcto.com/server-tech/subversion/locking-a-branch-in-svn]]
ssh+svn
may be taken from [[http://www.startupcto.com/server-tech/subversion/setting-up-svn]]
This procedure is for a vanilla OS, ifApache
is already installed and configured you may have to rethink the configuration.
Install¶
yum install mod_dav_svn subversion
Configuration¶
/etc/http/conf.d/subversion.conf¶
modify the preinstalled etc/http/conf.d/subversion.conf
analogue to
LoadModule dav_svn_module modules/mod_dav_svn.so LoadModule authz_svn_module modules/mod_authz_svn.so <Location /svn> DAV svn SVNParentPath /var/www/svn AuthType Basic AuthName "Subversion repositories" AuthUserFile /etc/svn-auth-users AuthzSVNAccessFile /etc/svn-authz-users Require valid-user </Location>
Add SVN users¶
- first-time usage
htpasswd -cm /etc/svn-auth-users testuser
- follow up usage
htpasswd -m /etc/svn-auth-users testuser
Note: Use exactly same file and path name as used onsubversion.conf
file. This example use/etc/svn-auth-users
file.
Create SVN repository¶
mkdir /var/www/svn
cd /var/www/svn
svnadmin create testrepo
chown -R apache:apache testrepo
chcon -R -t httpd_sys_content_t /var/www/svn/testrepo
Following enables commits over http
chcon -R -t httpd_sys_rw_content_t /var/www/svn/testrepo
Configure SVN repository¶
To disable anonymous access and enable access control add following rows to testrepo/conf/svnserve.conf
## Disable anonymous access ## anon-access = none ## Enable access control ## authz-db = authz
Create trunk, branches and tags structure under testrepo¶
Create “template” directories with following command:
mkdir -p /tmp/svn-structure-template/{trunk,branches,tags}
Then import template to project repository using
svn import
command:svn import -m 'Initial import' /tmp/svn-structure-template/ http://localhost/svn/testrepo/
Setup User/Repo based access control¶
Create “template” directories with following command:
vim /etc/svn-authz-users
Then import template to project repository using
svn import
command:# Allow full access to all repos [/] * = master = rw [homepage:/] * = master = rw external_chk = r # Lock MyRepo Branch_A # Note that you only need the MyRepo: prefix if you have more than one repo [janus:/z_Deploy] * = r master = rw [janus:/11002] * = r master = rw developer = rw [ATX_Neuenstein:/] * = master = rw client = r # Lock all tags in all repos; only allow 'master' to create new tags. [/tags] * = r master = rw
Usage¶
open in your browser
http://localhost/svn/testrepo/
SSL secured web-server¶
see also http://wiki.centos.org/HowTos/Https
Backup/Restore SVN repositories¶
Backup¶
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:
svnadmin dump /path/to/repository > repo_name.svn_dump
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).
Restore¶
Now, simply transfer the dump file on to your new subversion server, and create an empty repository:
svnadmin create /path/to/repository
Next import your dump file:
svnadmin load /path/to/repository < repo_name.svn_dump
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.
That's it, you now have a replica of your old repository on your new server.
Von Jeremias Keihsler vor fast 8 Jahren aktualisiert · 2 Revisionen