Skip to content

Install Apache Subversion & USVN on CentOS: A Step-by-Step Guide

Apache Subversion (also known as SVN) is a popular version control system that allows users to manage and track changes to files and directories. It is widely used in software development to keep track of code changes and collaborate with team members. USVN, on the other hand, is a web-based interface for SVN that makes it easier to manage repositories and users.

Before installing Apache Subversion and USVN on CentOS, there are a few prerequisites and system preparations that need to be done. This includes installing the necessary packages, configuring the firewall, and creating a dedicated user for SVN. Once these preparations are done, the installation process can begin.

Installing and configuring Apache Subversion and USVN on CentOS can be a daunting task for those who are new to it.

However, with the right guidance and instructions, it can be done easily and efficiently. In this article, we will provide a step-by-step guide on how to install and configure Apache Subversion and USVN on CentOS 7, 8, as well as answer some frequently asked questions.

Key Takeaways

  • Apache Subversion is a popular version control system used in software development to manage and track changes to files and directories.
  • USVN is a web-based interface for SVN that makes it easier to manage repositories and users.
  • Before installing Apache Subversion and USVN on CentOS, system preparations and prerequisites such as installing necessary packages, configuring the firewall, and creating a dedicated user for SVN need to be done.

Prerequisites and System Preparation

Updating System Packages

Before installing Apache Subversion and USVN on CentOS, it is recommended to update the system packages to their latest versions. This can be done by running the following command in the terminal:

sudo yum update

This command will update all the installed packages on the system to their latest versions, ensuring that the system is up-to-date and secure.

Installing Required Dependencies

To install Apache Subversion and USVN on CentOS, there are a few dependencies that need to be installed first. These dependencies include Apache, PHP, MySQL, and some additional PHP modules. These can be installed by running the following command:

sudo yum install httpd php php-mysql php-xml php-mbstring mysql-server

This command will install Apache, PHP, MySQL, and the required PHP modules on the system. Once the dependencies are installed, Apache Subversion and USVN can be installed on the system.

It is important to note that the above command will install the latest version of the packages available in the CentOS repository. If you need a specific version of any package, you can specify it using the package version number.

In conclusion, updating the system packages and installing the required dependencies are crucial steps in preparing the system for the installation of Apache Subversion and USVN. By following the above steps, the system will be ready for the installation of these software packages.

Installing Apache Subversion

Apache Subversion is a popular version control system that is widely used by software developers. This section will guide you through the process of installing Apache Subversion on CentOS.

Adding Subversion Repository

Before installing Apache Subversion, you need to add the Subversion repository to your system. You can do this by running the following command:

sudo yum install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm

Installing Subversion Packages

Once you have added the Subversion repository, you can install the Subversion packages using the following command:

sudo yum install -y subversion mod_dav_svn

This will install the Subversion client and server packages, as well as the Apache module for Subversion.

After the installation is complete, you can verify that Subversion is installed by running the following command:

svn --version

This will display the version of Subversion that is installed on your system.

In conclusion, installing Apache Subversion on CentOS is a simple process that involves adding the Subversion repository and installing the Subversion packages using yum.

Configuring Apache for Subversion

To use Subversion with Apache, it is necessary to enable certain modules and configure Apache to work with Subversion. This section will guide you through the process of configuring Apache for Subversion on CentOS.

Enabling Apache Modules

First, it is necessary to enable the necessary Apache modules. The following modules need to be enabled:

  • mod_dav
  • mod_dav_svn
  • mod_authz_svn

To enable these modules, use the following command:

sudo yum install httpd mod_dav_svn subversion mod_ssl

Setting Up Repository Directory

Next, it is necessary to create a directory to store the Subversion repositories. This directory should be owned by the Apache user and group. Use the following command to create the directory:

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

Configuring Subversion with Apache

Now, it is necessary to configure Apache to work with Subversion. This is done by editing the Apache configuration file.

First, open the Apache configuration file with the following command:

sudo vi /etc/httpd/conf/httpd.conf

Add the following lines to the end of the file:

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 Repository"
   AuthUserFile /etc/svn-auth-file
   Require valid-user
</Location>

Save and close the file.

Next, create the authentication file with the following command:

sudo htpasswd -c /etc/svn-auth-file svnuser

This will create a new authentication file and add a user named “svnuser” to it.

Finally, restart Apache with the following command:

sudo systemctl restart httpd

After completing these steps, Apache should be configured to work with Subversion. You can now use svnadmin create to create new repositories in the /var/www/svn directory, and access them through the URL http://yourserver/svn/repositoryname.

Setting Up Authentication and Permissions

Creating Users and Passwords

Before setting up authentication and permissions, it is necessary to create users and passwords for accessing the repository. This can be done using the htpasswd command.

To create a new user, run the following command:

htpasswd -c /path/to/authuserfile username

This will prompt you to enter a password for the new user. The -c flag is used to create a new file if one does not already exist. If the file already exists, you can add a new user to it using the following command:

htpasswd /path/to/authuserfile username

This will prompt you to enter a password for the new user.

Configuring Access Controls

Once users have been created, you can configure access controls for the repository using the authz file.

To allow a user to access the repository, add the following line to the authz file:

[/]
username = rw

This will give the user username read and write access to the entire repository.

To restrict access to specific directories within the repository, add the following lines to the authz file:

[repository:/path/to/directory]
username = rw

This will give the user username read and write access to the directory located at /path/to/directory.

To restrict access to a group of users, create a new group in the authz file and add the users to it:

[groups]
developers = username1, username2

[repository:/path/to/directory]
@developers = rw

This will give all users in the developers group read and write access to the directory located at /path/to/directory.

To require authentication for all users accessing the repository, add the following line to the .htaccess file:

Require valid-user

This will prompt users to enter their username and password before accessing the repository.

Overall, setting up authentication and permissions is an important step in securing the repository and ensuring that only authorized users have access to it. By creating users and passwords, configuring access controls, and requiring authentication, you can control who can access the repository and what they can do with it.

Finalizing Installation and Testing

Starting and Enabling Services

After successfully installing Apache Subversion and USVN on CentOS, it is important to start and enable the necessary services to ensure that the system is fully operational. The following commands can be used to start and enable the Apache and Subversion services:

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

These commands will start the Apache and Subversion services and enable them to start automatically upon system boot. It is important to note that the svnserve service is only necessary if you plan to use the svn:// protocol for accessing your Subversion repositories.

Accessing Subversion via Browser

Once the necessary services have been started and enabled, you can access your Subversion repositories via a web browser. To do so, simply enter the URL of the web interface into your browser’s address bar. The URL should be in the following format:

http://<server>/usvn/

Replace <server> with the hostname or IP address of your CentOS server. You should see the USVN login page, where you can enter your username and password to access your Subversion repositories.

It is important to note that the web interface only supports the http:// protocol for accessing your Subversion repositories. If you need to use the svn:// protocol, you will need to use a Subversion client such as TortoiseSVN.

Overall, by following these simple steps, you can successfully install and configure Apache Subversion and USVN on CentOS and start using it for version control.

Frequently Asked Questions

How can I install Subversion on CentOS 7 using Yum?

To install Subversion on CentOS 7 using Yum, you can use the following command:

sudo yum install subversion

This command will install the latest version of Subversion available in the CentOS repository.

What steps are required to set up an SVN server on CentOS 8?

To set up an SVN server on CentOS 8, you will need to install the Subversion package, create a repository, and configure access control. You can follow the steps outlined in our article to set up an SVN server on CentOS 8.

How do I verify the installation of Subversion on a CentOS system?

To verify the installation of Subversion on a CentOS system, you can use the following command:

svn --version

This command will display the version of Subversion installed on your system.

What is the process for installing Subversion on RHEL 7?

To install Subversion on RHEL 7, you can use the following command:

sudo yum install subversion

This command will install the latest version of Subversion available in the RHEL repository.

Can you provide guidance on setting up USVN with Apache on CentOS?

Yes, you can follow the steps outlined in our article to set up USVN with Apache on CentOS.

Where can I find the Subversion RPM package for CentOS?

The Subversion RPM package for CentOS can be found in the CentOS repository. You can use the following command to search for the package:

sudo yum search subversion

This command will display the available Subversion packages in the CentOS repository.

Last Updated on January 18, 2024 by admin

Share this post on social

Copyright 2022 Linuxguidehq.com. All rights reserved. No part of this website may be reproduced, distributed, or transmitted in any form or by any means, including photocopying, recording, or other electronic or mechanical methods, without the prior written permission of the copyright owner.