CentOS 7 on the deployment of Apache Subversion (SVN) server

CentOS 7 on the deployment of Apache Subversion (SVN) server

Apache Subversion (SVN) is a widely used version control solution that helps to store various versions of files such as source code and documentation.

In this article, I'll show you how to use Apache Subversion and Apache build SVN server on a CentOS 7 server instance.

1. Prerequisites

  • CentOS 7 (minimum installation, but not required).
  • A sudo user login (also directly from the root).

Make a non-root user before the command added  sudo .

2. Install Apache

Use YUM to install Apache:

yum install -y httpd
Bash

Delete the default Apache welcome page:

sed -i 's/^/#&/g' /etc/httpd/conf.d/welcome.conf
Bash

Apache prevent the  /var/www/html display files in the directory:

sed -i "s/Options Indexes FollowSymLinks/Options FollowSymLinks/" /etc/httpd/conf/httpd.conf
Bash

3. Installation SVN and mod_dav_svn module

To SVN conjunction with Apache, Apache module needs to be installed in addition to SVN  mod dav svn :

yum install -y subversion mod_dav_svn
Bash

Configuring SVN

  1. SVN modify configuration files

    vi /etc/httpd/conf.modules.d/10-subversion.conf
    
    cat >> /etc/httpd/conf.modules.d/10-subversion.conf <<EOF <Location /svn> DAV svn SVNParentPath /svn AuthName "SVN Repos" AuthType Basic AuthUserFile /etc/svn/svn-auth AuthzSVNAccessFile /svn/authz Require valid-user </Location> EOF
    Bash

    Note: In this configuration, we specify a file HTTP access authentication  /etc/svn/svn-auth and user access control file  /svn/authz . Both will be created in the future.

  2. Create a SVN repository

    mkdir /svn
    cd /svn
    svnadmin create repo1
    chown -R apache:apache repo1
    Bash
  3. SVN set up user accounts

    HTTP access authentication create a file using the following command  /svn/svn-auth and SVN user account  user001 :

    mkdir /etc/svn
    htpasswd -cm /etc/svn/svn-auth user001
    chown root:apache /etc/svn/svn-auth
    chmod 640 /etc/svn/svn-auth
    Bash

    If you want to create additional user accounts SVN, see the following command:

    htpasswd -m /etc/svn/svn-auth user002
    htpasswd -m /etc/svn/svn-auth user003
    Bash

    Warning: Do not use now  -c sign, otherwise it will rebuild the authentication files, and clear all user accounts previously set.

  4. Set permissions for users

    cp /svn/repo1/conf/authz /svn/authz
    vi /svn/authz
    Bash

    Assumptions:

    • The user  user001 is an administrator.
    • The user  user002 has read and write permissions.
    • Users  user003 can only read.

    You can then modify the following settings:

    [groups]
    admin=user001
    repo1_user=user002
    repo1_trainee=user003 [/] @admin=rw [repo1:/] @repo1_user=rw @repo1_trainee=r
    Bash

    Save and Exit:

    :wq
    Bash
  5. Start Apache and modify firewall rules

    Start Apache:

    systemctl start httpd.service
    systemctl enable httpd.service
    Bash

    Open the HTTP service port:

    firewall-cmd --zone=public --permanent --add-service=http
    firewall-cmd --reload
    Bash

    Finally, use the following path from the SVN SVN Client Access server repo  repo1 :

    http://<your-server-ip>/svn/repo1/
    Bash

The tutorial is over. thanks for reading.

Guess you like

Origin www.cnblogs.com/nullnullnull/p/11114545.html