CentOS uses yum to install and configure svn server steps

It is very easy to use yum to install svn server in centos. We only need a few simple commands to quickly complete the installation and configuration of svn server.

 

 

 

Simple, install with yum:

#yum install subversion

After the installation is complete, use the following to check whether the installation is complete

#svn --version

Create an SVN repository, for example:

#mkdir -p /data/svn 

#svnadmin create opengeo

Then you will find that files or directories such as conf, db, format, hooks, locks, README.txt are automatically generated.

Modify the configuration files in the conf directory

In svnserve.conf, edit the configuration to:

[general] 

anon-access = none 

auth-access = write 

password-db = passwd 

authz-db = authz

In auth, configure groups and permissions as:

[groups] 

dev = user1,user2,user3 

[/] 

@dev = rw

Configure the username and password in passwd as:

[users] 

user1=pass1 

user2=pass2 

user3=pass3

After the above steps, the installation and configuration are completed, start svn and specify the corresponding directory:

#svnserve -d -r /data/svn/

Check if the service starts successfully

#netstat -nlp | grep svn

close svn service

#killall -9 svnserve

Then, you can access it at the following address, replacing {ip} with your SVN server IP address or domain name:

svn://{ip}/opengeo

SVN Server Detailed Configuration Manual

 

system environment

CentOS 5.8 minimal installation (closed iptables and selinux) + ssh + yum

First, install the necessary packages.

yum install subversion mysql-server httpd mod_dav_svn mod_perl sendmail wget gcc-c++ make unzip perl* ntsysv vim-enhanced

illustrate:

subversion (SVN server)

mysql-server (for codestriker)

httpd mod_dav_svn mod_perl (used to support WEB management of SVN server)

sendmail (used to configure email reminders after users submit code)

wget gcc-c++ make unzip perl* (required package)

ntsysv vim-enhanced (optional)

Second, the basic SVN server configuration

1. Create a new directory to store all SVN files

# mkdir /home/svn

2. Create a new version repository

# svnadmin create /home/svn/project

3. Initialize the directory in the version repository

# mkdir project project/server project/client project/test (create a temporary directory)

# svn import project/ file:///home/svn/project -m "initialize SVN directory"

# rm -rf project (delete temporarily created directory)

4. Add users

Adding an SVN user is as simple as adding an entry of the form "username=password" to the /home/svn/project/conf/passwd file. For testing, I added the following:

[users]

# harry = harryssecret

# sally = sallyssecret

pm = pm_pw

server_group = server_pw

client_group = client_pw

test_group = test_pw

5. Modify the user access policy

/home/svn/project/conf/authz records the user's access policy, the following is for reference:

[groups]

project_p = pm

project_s = server1,server2,server3

project_c = client1,client2,client3

project_t = test1,test1,test1

 

[project:/]

@project_p = rw

* =

[project:/server]

@project_p = rw

@project_s = rw

* =

[project:/client]

@project_p = rw

@project_c = rw

* =

[project:/doc]

@project_p = rw

@project_s = r

@project_c = r

@project_t = r

* =

Note: The above information indicates that only the project_p user group has read and write rights to the root directory. r indicates that the directory has read permission, w indicates that the directory has write permission, and rw indicates that the directory has read and write permission. The *= in the last line means that, except for the user group whose permissions are set above, no one else is allowed to access this directory. This is very important, be sure to add it!

6. Modify the svnserve.conf file to improve user and policy configuration.

The contents of svnserve.conf are as follows:

[general]

anon-access = none

auth-access = write

password-db = /home/svn/project/conf/passwd

authz-db = /home/svn/project/conf/authz

7. Start the server

# svnserve -d -r /home/svn

Note: If the svn configuration is modified, the svn service needs to be restarted. The steps are as follows:

# ps -aux|grep svnserve

# kill -9 ID号

# svnserve -d -r /home/svn

8. Test server

# svn co svn://192.168.60.10/project

Authentication realm: <svn://192.168.60.10:3690> 92731041-2dae-4c23-97fd-9e1ed7f0d18d

Password for 'root':

Authentication realm: <svn://192.168.60.10:3690> 92731041-2dae-4c23-97fd-9e1ed7f0d18d

Username: server_group

Password for 'server_group':

svn: Authorization failed (server_group does not have access to the root directory)

# svn co svn://192.168.60.10/project

Authentication realm: <svn://192.168.60.10:3690> 92731041-2dae-4c23-97fd-9e1ed7f0d18d

Password for ‘root’:

Authentication realm: <svn://192.168.60.10:3690> 92731041-2dae-4c23-97fd-9e1ed7f0d18d

Username: pm

Password for ‘pm’:

A    project/test

A    project/server

A    project/client

Checked out revision 1. (Test extraction succeeded)

# cd project/server

# vim main.c

# svn add main.c

# svn commit main.c -m "Test my C program, what to see, can't it??"

Adding         main.c

Transmitting file data .

Committed revision 2. (Test commit succeeded)

Third, configure the HTTP support of the SVN server

1. Convert the password of the SVN server

Since the password of the SVN server is in plain text and the HTTP server does not support it, it needs to be converted into a format supported by HTTP. I wrote a Perl script to do the job.

The content of the script is as follows:

# cd /home/svn/project/conf/

# vim PtoWP.pl

#!/usr/bin/perl # write by huabo, 2009-11-20  use warnings; use strict;  #open the svn passwd file open (FILE, "passwd") or die ("Cannot open the passwd file!!!n");  #clear the apache passwd file open (OUT_FILE, ">webpasswd") or die ("Cannot open the webpasswd file!!!n"); close (OUT_FILE);  #begin foreach (<FILE>) { if($_ =~ m/^[^#].*=/) { $_ =~ s/=//; `htpasswd -b webpasswd $_`; } }# chmod +x PtoWP.pl

# ./PtoWP.pl

Adding password for user pm

Adding password for user server_group

Adding password for user client_group

Adding password for user test_group

There will now be an additional webpasswd file in the directory.

2. Modify httpd.conf and add content about SVN server

Edit /etc/httpd/conf/httpd.conf and add the following information at the end:

<Location /project>

DAV svn

SVNPath /home/svn/project/

AuthType Basic

AuthName "svn for project"

AuthUserFile /home/svn/project/conf/webpasswd

AuthzSVNAccessFile /home/svn/project/conf/authz

Satisfy all

Require valid-user

</Location>

 

3. Modify the owner of the svn directory to be the apache account: chown -R apache.apache /home/svn/project/

(Note: This step is missing from the original text, and there will be permission problems.)

4. Restart the web server:

# /etc/init.d/httpd restart

Stopping httpd: [FAILED]

Starting httpd: [ OK ]

5. Visit http://192.168.60.10/project/server/test with a browser

Transfer: http://www.111cn.net/sys/CentOS/55316.htm

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=327011763&siteId=291194637