Apache SVN: Install Subversion & USVN on CentOS 7 - CentLinux

Latest

Saturday, 14 July 2018

Apache SVN: Install Subversion & USVN on CentOS 7

Install Apache Subversion (SVN) Server & USVN on Linux

Apache Subversion (abbreviated as SVN) is a software versioning and revision control system distributed as open source under the Apache License. Software developers use Subversion to maintain current and historical versions of files such as source code, web pages, and documentation. Apache subversion is shipped with RHEL, CentOS, etc, and can be installed via yum repository.

User-Friendly SVN (or USVN) is a free web interface written in PHP used to configure Subversion repositories. It's goal is to ease the creation of new projects without having to use the command line interface, maybe without privileged access to the server. USVN will then generate the list of users allowed to access your source code. This enable the delegation of rights to administrate Subversion repositories.

In this post, we will install and configure a Central SVN Server on Red Hat Enterprise Linux (RHEL)/CentOS 7 for our Software developers. Software developers are continuously updating source code, and we use Apache Subversion to control revisions and versioning. We will also configure USVN for easy administration of our SVN Server.

 

This Article Provides:

     

    System Specification:

    Installation of Apache Subversion is an advance topic, therefore, we will skip the basic steps of networking, yum repository and other OS configurations. Although, we will provide helpful links for the readers.

    • Operating System - Red Hat Enterprise Linux (RHEL)/CentOS 7
    • Hostname - svnserver01.itlab.com
    • IP Address - 192.168.116.30/24
    • Gateway - 192.168.116.2
    • DNS Server - 192.168.116.2
    • Yum Repository - Local

    Read Also: Installation of Linux 7 Server
      Configure Network in RHEL/CentOS 7 using nmcli
      Configure Local Yum Repository using ISO in RHEL 7

     

    Installing Apache Subversion (SVN) on CentOS 7:

    USVN required a web server for deployment. Therefore, we will install Apache HTTP Server.

    [root@svnserver01 ~]# yum install -y httpd

    Start and enable httpd service.

    [root@svnserver01 ~]# systemctl start httpd ; systemctl enable httpd ln -s '/usr/lib/systemd/system/httpd.service' '/etc/systemd/system/multi-user.target.wants/httpd.service'

    Disable Welcome page of Apache HTTP Server.

    [root@svnserver01 ~]# mv /etc/httpd/conf.d/welcome.conf /etc/httpd/conf.d/welcome.conf.org

    Disable directory indexes in Apache HTTP Server configurations.

    [root@svnserver01 ~]# cp /etc/httpd/conf/httpd.conf /etc/httpd/conf/httpd.conf.org [root@svnserver01 ~]# sed -i "s/Options Indexes FollowSymLinks/Options FollowSymLinks/" /etc/httpd/conf/httpd.conf [root@svnserver01 ~]# systemctl restart httpd

    Allow http service through Linux firewall.

    [root@svnserver01 ~]# firewall-cmd --permanent --add-service=http ; firewall-cmd --reload success success

    USVN requires a MySQL database as it’s backend-database. Therefore, we will install mariadb database and php as well.

    [root@svnserver01 ~]# yum install -y php mariadb-server php-mysql

    Start and enable mariadb service.

    [root@svnserver01 ~]# systemctl start mariadb ; systemctl enable mariadb ln -s '/usr/lib/systemd/system/mariadb.service' '/etc/systemd/system/multi-user.target.wants/mariadb.service'

    Configure mariadb server.

    [root@svnserver01 ~]# mysql_secure_installation /usr/bin/mysql_secure_installation: line 379: find_mysql_client: command not found NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
          SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY! In order to log into MariaDB to secure it, we'll need the current
    password for the root user.  If you've just installed MariaDB, and
    you haven't set the root password yet, the password will be blank, so you should just press enter here. Enter current password for root (enter for none):
    OK, successfully used password, moving on... Setting the root password ensures that nobody can log into the MariaDB
    root user without the proper authorisation. Set root password? [Y/n] Y
    New password:
    Re-enter new password:
    Password updated successfully!
    Reloading privilege tables..
    ... Success! By default, a MariaDB installation has an anonymous user, allowing anyone
    to log into MariaDB without having to have a user account created for
    them.  This is intended only for testing, and to make the installation
    go a bit smoother.  You should remove them before moving into a
    production environment. Remove anonymous users? [Y/n] Y
    ... Success! Normally, root should only be allowed to connect from 'localhost'.  This
    ensures that someone cannot guess at the root password from the network. Disallow root login remotely? [Y/n] Y
    ... Success! By default, MariaDB comes with a database named 'test' that anyone can
    access.  This is also intended only for testing, and should be removed
    before moving into a production environment. Remove test database and access to it? [Y/n] Y
    - Dropping test database...
    ... Success!
    - Removing privileges on test database...
    ... Success! Reloading the privilege tables will ensure that all changes made so far
    will take effect immediately. Reload privilege tables now? [Y/n] Y
    ... Success! Cleaning up... All done!  If you've completed all of the above steps, your MariaDB
    installation should now be secure. Thanks for using MariaDB!

    Set timezone in php settings.

    [root@svnserver01 ~]# vi /etc/php.ini

    screenshot after editing in php.ini file is given below:

    [Date]
    ; Defines the default timezone used by the date functions
    ; http://php.net/date.timezone
    date.timezone = Asia/Karachi
    ; http://php.net/date.default-latitude
    ;date.default_latitude = 31.7667

    Install Apache Subversion and relevant Apache HTTP server module..

    [root@svnserver01 ~]# yum install -y subversion mod_dav_svn

     

    Installing User-Friendly SVN (USVN) on CentOS 7:

    Download and extract USVN application on Apache HTTP Server. You can also visit http://www.usvn.info to get a latest version.

    [root@svnserver01 html]# cd /var/www/html [root@svnserver01 html]# wget https://github.com/usvn/usvn/archive/1.0.7.tar.gz --2018-07-14 10:25:51--  https://github.com/usvn/usvn/archive/1.0.7.tar.gz
    Resolving github.com (github.com)... 192.30.253.113, 192.30.253.112, 192.30.253.113, ...
    Connecting to github.com (github.com)|192.30.253.113|:443... connected.
    HTTP request sent, awaiting response... 302 Found
    Location: https://codeload.github.com/usvn/usvn/tar.gz/1.0.7 [following]
    --2018-07-14 10:26:00--  https://codeload.github.com/usvn/usvn/tar.gz/1.0.7
    Resolving codeload.github.com (codeload.github.com)... 192.30.253.120, 192.30.253.121
    Connecting to codeload.github.com (codeload.github.com)|192.30.253.120|:443... connected.
    HTTP request sent, awaiting response... 200 OK
    Length: 4570697 (4.4M) [application/x-gzip]
    Saving to: â1.0.7.tar.gzâ
    100%[================================================================================>] 4,570,697    222KB/s   in 26s
    2018-07-14 10:26:34 (171 KB/s) - â1.0.7.tar.gzâ saved [4570697/4570697] [root@svnserver01 html]# tar xvf 1.0.7.tar.gz > /dev/null

    Create required directories and set necessary folder permissions.

    [root@svnserver01 html]# mv usvn-1.0.7 usvn [root@svnserver01 html]# cd usvn [root@svnserver01 usvn]# mkdir files [root@svnserver01 usvn]# chmod -R g+w {public,config,files} [root@svnserver01 usvn]# chgrp -R apache /var/www/html/usvn [root@svnserver01 usvn]# semanage fcontext -a -t httpd_sys_rw_content_t "/var/www/html/usvn/public(/.*)?" [root@svnserver01 usvn]# semanage fcontext -a -t httpd_sys_rw_content_t "/var/www/html/usvn/config(/.*)?" [root@svnserver01 usvn]# semanage fcontext -a -t httpd_sys_rw_content_t "/var/www/html/usvn/files(/.*)?" [root@svnserver01 usvn]# restorecon -R /var/www/html/usvn

    Deploy USVN application on Apache HTTP Server.

    [root@svnserver01 usvn]# cat >> /etc/httpd/conf.d/usvn.conf << EOF
    > <Directory /var/www/html/usvn/>
    >         AllowOverride All
    >         Require all granted
    > </Directory>
    > EOF
    [root@svnserver01 usvn]# systemctl restart httpd

    Open http://svnserver01.itlab.com/usvn/public/install.php in browser, and start USVN installation.

    usvn-installer-main-01

    Click on Next step.

    usvn-installer-system-check-01

    Installer performs System Check and produce warnings. If you have follow the exact steps above, then you won’t get any warning here.
    Click on Next step.

    usvn-installer-language-01

    Select your required language and timezone.
    Click on Next step.

    usvn-installer-license-01usvn-installer-license-02

    Check I understand and accept this license and Click on Next Step.

    usvn-installer-configuration-01

    No customization required here. Click on Next Step.

    usvn-installer-database-01

    Provide database password and make necessary customization as we made in the screenshot above.
    Click on Next Step.

    usvn-installer-admin-user-01

    Create a USVN Administrator here and click on Next Step.

    usvn-installer-updates-01

    Since, I am installing on an isolated network, I prefer to disable auto checks for updated versions of USVN.
    Click on Don’t check update.

    usvn-installer-finish-01

    Installation is completed. Copy the selected code and paste it at the end of /etc/httpd/conf.d/usvn.conf.
    Click on Connect to USVN.

    usvn-web-ui-login-01

    Login with admin user.

    usvn-web-ui-home-01

    We have successfully installed User Friendly SVN (USVN) Application and Apache Subversion (SVN) on our Red Hat Enterprise Linux (RHEL) 7 Server. Our USVN application is running in HTTP mode. Although, we can convert it to HTTPS easily, but we intentionally overlooked it because it is beyond the scope of this post. However, you may read our previous post Convert an Apache Website from HTTP to HTTPs to convert your USVN application from HTTP to HTTPS.

    2 comments:

    1. how can i finde my data on my computer in usvn ? it's browser in usvn but i can't go to directory on my computer and share all data . do you know about that?

      ReplyDelete
      Replies
      1. Hi,
        I need more detail about your problem. Please elaborate.

        Delete