# Installing and configuring Apache Subversion with modules on Ubuntu

## Procedure

1. Install the subversion, apache2 and libapache2-svn packages.
   ```
   # apt-get install subversion apache2 libapache2-svn
   ```
2. Create an svn directory, at the root of your system for example.
   ```
   # mkdir /svn
   ```
3. Change the owner of the directory to the webserver user, www-data by default.
   ```
   # chown www-data:www-data /svn
   ```
4. Switch to www-data user.
   ```
   # su -l www-data -s /bin/bash
   ```
5. Create a new SVN repository, my\_repo for example.
   ```
   $ svnadmin create /svn/my_repo
   ```
6. Create a user and a password.
   ```
   $ htpasswd -cmb /svn/passwd talend_admin secretpassword
   ```
7. Open the SVN configuration file.
   ```
   # vi /etc/apache2/mods-enabled/dav_svn.conf
   ```
8. Update it as follows:
   ```
   <Location /my_repo>
   DAV svn
   SVNPath /svn/my_repo
   AuthUserFile /svn/passwd
   Require valid-user
   AuthType basic
   AuthName "Subversion"
   </Location>
   ```
9. Restart Apache Subversion.
   ```
   # /etc/init.d/apache2 restart
   ```
10. If you have SELinux (Security-Enhanced Linux) enabled on your system and experience and get the Can't open file 'db/txn-current-lock': Permission denied error message, follow these steps:

    If you do not, you cannot create a project in Talend Administration Center and get an error in the log with these details:

    Information noteWarning:
    ```
    Save failed: org.talend.exception.BusinessException: svn: E204900: Can't open file '/var/www/svn/repository/db/txn-current-lock': Permission denied
    svn: E175002: PROJECTNAME of '/svn/!svn/act/283c5381-5301-0010-9f7f-495961e572c2': 500 Internal Server Error (http://SVN-URL) -- For more information see your log file
    ```
    1. Open the terminal.
    2. Check if SELinux is enabled on your system using the sestatus.

       If SELinux is enabled on your system, the result should look like the following:
       ```
       root@ip-172-31-9-208 ~]# sestatus
       SELinux status: enabled
       SELinuxfs mount: /sys/fs/selinux
       SELinux root directory: /etc/selinux
       Loaded policy name: targeted
       Current mode: enforcing
       Mode from config file: enforcing
       Policy MLS status: enabled
       Policy deny_unknown status: allowed
       Max kernel policy version: 28
       ```
    3. Complete the installation with the following commands:
       ```
       chcon -R -t httpd_sys_content_t /var/www/svn/repository
       chcon -R -t httpd_sys_rw_content_t /var/www/svn/repository
       ```