您的位置:首页 > 运维架构 > Apache

How to install SVN server with USVN, Apache, mod_dav_svn on CentOS 6

2015-03-04 17:29 1166 查看


How
to install SVN server with USVN, Apache, mod_dav_svn on CentOS 6

July
31, 2014

Eugene
Vlasov


Introduction

Apache Subversion (SVN) is an open source version control system. It is used by developers to maintain versions of files such as source code, documents, web pages etc.

USVN stands for User-Friendly SVN. It is a web interface written in PHP used to configure subversion repositories. Its goal is to eliminate using command line interface for creation of new SVN projects and users.

In this guide we will install SVN server with Apache, mod_dav_svn and USVN web interface for user and repository management.

We can install SVN on your VPS or dedicated server just for $40. Click
here too order SVN server installation service.



Step 1: Install Basic Packages

We will install LAMP, additional module for Apache (mod_dav_svn), Subversion and several useful utilities like (wget and unzip).

We use the following software versions:

- Apache/2.2.15

- PHP 5.3.3

- mysql,version 5.1.73

- svn, version 1.6.11

- USVN, version: 1.0.7

1

[root@]#
yum install httpd php mysql-server mod_dav_svn subversion wget unzip

Set all services to start automatically after system reboot:

1

2

[root@]#
chkconfig httpd on

[root@]#
chkconfig mysqld on



Step 2: Create System User for USVN

1

2

3

4

5

6

[root@]#
useradd -m -d /home/usvnuser -s /sbin/nologin usvnuser

[root@]#
passwd usvnuser

Changing
password
for
user
usvnuser.

New
password:
******

Retype
new
password:
******

passwd:
all
authentication
tokens
updated
successfully.


Step 3: Download and Install USVN Code

1

2

3

4

5

6

7

[root@]#
cd /home/usvnuser/

[root@]#
mkdir public_html

[root@]#
wget https://github.com/usvn/usvn/archive/master.zip
[root@]#
unzip master.zip

[root@]#
cp -rp /home/usvnuser/usvn-master/src/* /home/usvnuser/public_html/

[root@]#
rm -rf /home/usvnuser/usvn-master

[root@]#
chown -R usvnuser:usvnuser /home/usvnuser/

Add “apache” user to “usvnuser” group:

1

[root@]#
gpasswd -a apache usvnuser


Step 4: Disable SELinux

1

2

[root@]#
vi /etc/selinux/config

SELINUX=disabled

and reboot your VPS.


Step 5: Configure Apache Virtual Host for USVN

Edit apache configuration file and put VirtualHost config for USVN there. Replace usvn.example.com with your domain.

1

[root@]#
vi /etc/httpd/conf/httpd.conf

1

2

3

4

5

6

7

8

9

10

11

12

13

<Virtualhost
*:80>

ServerAdmin
some@host.example.com

DocumentRoot
/home/usvnuser/public_html/public

ServerName
usvn.myexample.com

ServerAlias
www.usvn.myexample.com

ErrorLog
/var/log/httpd/usvn.myexample.com.error_log

CustomLog
/var/log/httpd/usvn.myexample.com.access_log
common

<Directory
/home/usvnuser/public_html/public>

AllowOverride
All

Order
allow,deny

Allow
from
all

</Directory>

</VirtualHost>

save httpd.conf file and restart httpd daemon:

1

[root@]#
/etc/init.d/httpd restart

To start the installation USVN via web-interface we need to fix a bug in app/bootstrap.php.

1

[root@]#
vi /home/usvnuser/public_html/app/bootstrap.php +72

find this line:

1

//exit(0);

and change it to:

1

exit(0);

Now, try opening URL http://usvn.myexample.com. If
everything is configured correctly you will see the setup wizard:





Step 6: Follow USVN Installation Wizard





Select your language and time zone:





Accept the CeCILL FREE SOFTWARE LICENSE:





Create directory named “files” in /home/usvnuser/public_html/, change owner to “usvnuser” and set 777 permissions to allow Apache write access to that directory.

1

2

3

[root@]#
mkdir /home/usvnuser/public_html/files/

[root@]#
chown usvnuser:usvnuser /home/usvnuser/public_html/files/

[root@]#
chmod 777 /home/usvnuser/public_html/files/

General configuration settings. You can keep default.






Step 7: Database Configuration

Login to mysql console as root, create new user, database and grant user privileges to access database:

1

2

3

4

5

[root@]#
mysql -uroot –p******

mysql>
CREATE
DATABASE
usvn_db;

mysql>
CREATE
USER
'usvn_us'@'localhost'
IDENTIFIED
BY
'******';

GRANT
ALL
PRIVILEGES
ON
usvn_db.*
to
usvn_us@localhost;

quit

Fill in database access details:





Create administrator account and setup password for it:





Choose whether you want USVN to checks for updates:





Copy and paste following lines at the end of your httpd.conf:





Add code below to the end of httpd.conf:

1

[root@]#vi
/etc/httpd/conf/httpd.conf

1

2

3

4

5

6

7

8

9

10

11

<location
/svn/>

ErrorDocument
404
default

DAV
svn

Require
valid-user

SVNParentPath
/home/usvnuser/public_html/files/svn

SVNListParentPath
off

AuthType
Basic

AuthName
"USVN"

AuthUserFile
/home/usvnuser/public_html/files/htpasswd

AuthzSVNAccessFile
/home/usvnuser/public_html/files/authz

</Location>

save file and restart apache:

1

[root@]#/etc/init.d/httpd
restart


Step 8: Creating Your First Repository

Login as admin at http://usvn.myexample.com/login/




Go to “Admin” >>> “Users” and create new user account (for example “test_user”):





Create new Project (for example “test_proj”):





Grant “test_user”access to the “test_proj” project. Go to “Admin” >>> “Groups”:





and click the selection:





In drop-down menu choose ”test_user” account and add it:





After those steps, you can try to access SVN repository using SVN client. I will be using SyncroSVN client.


Step 9: Accessing Repository via SVN client

Open Syncro SVN Client, go to the “Repository” >>> “New Repository Location…”

Repository URL is: http://usvn.myexample.com/svn/test_proj/trunk




Click OK and enter SVN username and password created above:





If all goes well, you will be connected to the repository:





Now you can try to upload some files into the repository. Go to the “Repository” >>> “Import” >>> “Import Folder Content …”:





You can monitor upload progress at “Console” tab. If everything is OK you will see “Operation successful” message:



内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: