关于svn:Linux-SVN-迁移

34次阅读

共计 3269 个字符,预计需要花费 9 分钟才能阅读完成。

linux SVN 服务迁徙, 指标服务器 Red Hat8

步骤如下:

  1. 进行 SVN 服务
  2. 装置
  3. 迁徙
  4. 配置
  5. 启动

装置

yum install php httpd subversion policycoreutils-python-utils mod_dav_svn -y

迁徙

  1. 将仓库文件拷贝到 /var/www/svn/repos
  2. 将 SVN 配置文件拷贝 /var/www/svn/config
  3. 将 SVNadmin 拷贝到 /var/www/html/svnadmin

配置

权限配置

chown -R apache.apache /var/www/html/svnadmin
chmod 777 /var/www/html/svnadmin/data
chown -R apache.apache /var/www/svn

Selinx 配置

  1. 简略粗犷 seenforce 0 长期敞开, 可用于测试是否是因为这个权限导致无法访问
  2. 配置平安上下文

    semanage fcontext -a -t  httpd_sys_content_t "/var/www(/.*)?"
    restorecon -Rv /var/www/html/svnadmin
    restorecon -Rv /var/www/svn

文件配置

1.

vi /etc/sysconfig/svnserve
OPTIONS="-r /var/www/svn/repos"

2.

vi /var/www/html/svnadmin/data/config.ini
[Common]
FirstStart=0
BackupFolder=./data/backup/

[Translation]
Directory=./translations/

[Engine:Providers]
AuthenticationStatus=basic
UserViewProviderType=passwd
UserEditProviderType=passwd
GroupViewProviderType=svnauthfile
GroupEditProviderType=svnauthfile
AccessPathViewProviderType=svnauthfile
AccessPathEditProviderType=svnauthfile
RepositoryViewProviderType=svnclient
RepositoryEditProviderType=svnclient

[ACLManager]
UserRoleAssignmentFile=./data/userroleassignments.ini

[Subversion]
SVNAuthFile=/var/www/svn/config/authz

[Repositories:svnclient]
SVNParentPath=/var/www/svn/repos
SvnExecutable=/usr/bin/svn
SvnAdminExecutable=/usr/bin/svnadmin

[Users:passwd]
SVNUserFile=/var/www/svn/config/passwd

[Users:digest]
SVNUserDigestFile=
SVNDigestRealm=SVN Privat

[Ldap]
HostAddress=ldap://192.168.136.130:389/
ProtocolVersion=3
BindDN=CN=Manuel Freiholz,CN=Users,DC=insanefactory,DC=com
BindPassword=root
CacheEnabled=false
CacheFile=./data/ldap.cache.json

[Users:ldap]
BaseDN=DC=insanefactory,DC=com
SearchFilter=(&(objectClass=person)(objectClass=user))
Attributes=sAMAccountName

[Groups:ldap]
BaseDN=DC=insanefactory,DC=com
SearchFilter=(objectClass=group)
Attributes=sAMAccountName
GroupsToUserAttribute=member
GroupsToUserAttributeValue=distinguishedName

[Update:ldap]
AutoRemoveUsers=true
AutoRemoveGroups=true

[GUI]
RepositoryDeleteEnabled=false
RepositoryDumpEnabled=false
AllowUpdateByGui=true

3.

vi /etc/httpd/conf.d/subversion.conf

LoadModule dav_svn_module     modules/mod_dav_svn.so
LoadModule authz_svn_module   modules/mod_authz_svn.so

#
# Example configuration to enable HTTP access for a directory
# containing Subversion repositories, "/var/www/svn".  Each repository
# must be both:
#
#   a) readable and writable by the 'apache' user, and
#
#   b) labelled with the 'httpd_sys_content_t' context if using
#   SELinux
#

#
# To create a new repository "http://localhost/repos/stuff" using
# this configuration, run as root:
#
#   # cd /var/www/svn
#   # svnadmin create stuff
#   # chown -R apache.apache stuff
#   # chcon -R -t httpd_sys_content_t stuff
#

#<Location /repos>
#   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 "Authorization Realm"
#      AuthUserFile /path/to/passwdfile
#      Require valid-user
#   </LimitExcept>
#</Location>

<Location /svn>
DAV svn
SVNParentPath /var/www/svn/repos
SVNLISTParentPath on
AuthType Basic
AuthName "Authorization Realm"
AuthUserFile /var/www/svn/config/passwd
AuthzSVNAccessFile /var/www/svn/config/authz
Require valid-user
</Location>

启动

systemctl enable svnserve
systemctl start svnserve
systemctl enable httpd
systemctl start httpd

问题

  1. svnadmin 拜访显示如下
vi /var/www/html/svnadmin/include/config.inc.php

正文掉如下代码

  1. svnadmin 拜访显示文件夹层级,而不是解析的 php 页面
    启动 php-fpm
  2. 能拜访到 /svn,然而不能拜访 /svn 下的我的项目

查看 authz 文件,权限可能有问题

正文完
 0