Find us on facebook

Jul 3, 2015

Install Subversion Using Yum CentOS 6.x

yum install mod_dav_svn subversion

sudo vim /etc/httpd/conf.d/subversion.conf

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

   # Limit write permission to list of valid users.
   #<LimitExcept GET PROPFIND OPTIONS REPORT>
      # Require SSL connection for password protection.
      # SSLRequireSSL

      AuthType Basic
      AuthName "Subversion repositories"
      AuthUserFile /etc/svn-auth-users
      Require valid-user
   #</LimitExcept>
</Location>

apachectl configtest
sudo service httpd restart

================================
sudo yum install mod_auth_mysql
sudo vi /etc/httpd/conf.d/subversion.conf
    AuthType Basic
    AuthName "svn repository"
    Require valid-user
    AuthMySQLEnable on
    AuthMySQLPwEncryption sha1
    AuthMySQLHost localhost
    AuthMySQLUser username(of redmine)
    AuthMySQLPassword password
    AuthMySQLDB redmine
    AuthMySQLNameField login
    AuthMySQLPasswordField hashed_password
    AuthMySQLUserTable "users"
apachectl configtest
sudo service httpd restart
===============================
Next we have to actually create the password file that you specified in the previous step. Initially you'll use the -cm arguments. This creates the file and also encrypts the password with MD5. If you need to add users make sure you simply use the -m flag, and not the -c after the initial creation.

## Create testuser ##
htpasswd -cm /etc/svn-auth-users testuser
New password:
Re-type new password:
Adding password for user testuser

## Create testuser2 ##
htpasswd -m /etc/svn-auth-users testuser2
New password:
Re-type new password:
Adding password for user testuser2

mkdir /var/www/svn
cd /var/www/svn

sudo chown -R apache:apache /var/www/svn

svnadmin create testrepo
sudo chown -R apache.apache testrepo

## If you have SELinux enabled (you can check it with "sestatus" command) ##
## then change SELinux security context with chcon command ##

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

## Fedora 21/20/19/18 and CentOS/Red Hat (RHEL) 7 ##
systemctl restart httpd.service

## CentOS/Red Hat (RHEL) 6.6/5.11 ##
service httpd restart
## OR ##
/etc/init.d/httpd restart

Goto http://localhost/svn/testrepo address and you should see popup to enter username and password:

Then Configure repository
To disable anonymous access and enable access control add following rows to testrepo/conf/svnserve.conf file:

## 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:
Shell

svn import -m 'Initial import' /tmp/svn-structure-template/ http://localhost/svn/testrepo/
Adding         /tmp/svn-structure-template/trunk
Adding         /tmp/svn-structure-template/branches
Adding         /tmp/svn-structure-template/tags

Committed revision 1.

Import online project to SVN folder
svn import /var/www/vhosts/xxx.cf/httpdocs/yyy http://xx.xxx.xxx.xx/svn/testrepo2 -m "first import"

Go to domain/httpdocs and use following command to get first repo to this folder
svn co http://88.208.221.72/svn/testrepo2

After each commit, to update online site,
Go to domain/httpdocs and use following command
svn co http://88.208.221.72/svn/testrepo2

No comments:

Post a Comment