(Reproduced) Install svn server under Linux (Centos6.5), and pass http

1. Install svn

yum -y install mod_dav_svn

 

2. Install httpd

 

yum -y install httpd
 Under normal circumstances, the linux server has httpd service, you can check it, if not, install it.

Inspection Method:ls /etc/httpd/conf.d/subversion.conf

After installing svn, check whether the directory & file exists. If it exists, you do not need to install httpd.

 

3. Configure SVN

1) Configure the warehouse

mkdir -p /home/svn/repos1

svnadmin create /home/svn/repos1

mkdir -p /home/svn/repos2

svnadmin create /home/svn/repos2

2) SVN repository configuration file

 

vi /home/svn/repos1/conf/svnserve.conf

 

[general]
anon-access = none    
auth-access = write
password-db = /home/svn/conf/pwd.conf #Point to the user configuration file
authz-db = /home/svn/conf/authz.conf #Point to the permission configuration file
realm = repos1 #point to the svn warehouse address
 

 

Other warehouse configurations are the same as this configuration, only the warehouse path needs to be modified.

 

3), configure svn user and permissions

vim /home/svn/conf/pwd.conf

vim /home/svn/conf/authz.conf

#根据提示输入密码,第一个用户才需要加-c,后面的用户不需要-c

htpasswd -c /home/svn/conf/pwd.conf admin

htpasswd /home/svn/conf/pwd.conf test

vi /home/svn/conf/pwd.conf

在用户最上方加上[users]

 

[root@moshi ~]# vim /home/svn/conf/authz.conf The content of the file is as follows:
[groups]
admin=user1,user2
test=user3
[/]
@admin=rw
[repos1:/]
user3=r
 

 

Explanation: [groups] is a group definition, many users can be added under this group, and divided by ,
but the user data must be defined in /homd/svn/conf/pwd.conf,
[/] means below the root directory Permission definition
[repos1:/] indicates the permission definition under the warehouse.
If you want to divide the project, it is analogous to this rule:
For example: [repos1:/aaa] indicates the permission definition of the aaa project under the warehouse.
@admin indicates user permissions under the admin group.
user1=r indicates the permissions of the user user1.
Permission type: r, w, rw represent read-only, write-only, and read-write respectively. If it is user1= this empty case means no.
OK, now the svn configuration is complete. We can delete the default configuration file.

4), create a user to start svn
useradd svn #If it prompts that the svn account already exists, execute the following command
passwd svn ##Modify the password according to the prompt, it can't be too simple, you can use the common password
chown -R svn:svn /home/svn/ ##Allow user svn to access the repository
chmod –R o+rw /home/svn ##Solve Windows checkout commit prompt /home/svn/db/txn-current-lock' error
 5), configure the port of svn
vi /etc/httpd/conf/httpd.conf
Modify the port Listen 80
 6), configure httpd
vi /etc/httpd/conf.d/subversion.conf
 
Modify the content of the file to:

<Location /svn>
    DAV svn
    SVNListParentPath on
    SVNParentPath /home/svn
    AuthType Basic
    AuthName "Authorization"
    AuthUserFile /home/svn/conf/pwd.conf ##corresponds to your user configuration file
    AuthzSVNAccessFile /home/svn/conf/authz.conf ##Corresponding to your permission configuration file
    Require valid-user
</Location>

Save and exit!
 7), restart the httpd service
service httpd restart
 8), start svn
svnserve -d -r /home/svn/
 9), test
Enter in the browser: server Ip + port + <Location /svn> in the httpd configuration.
For example: http://192.168.1.1:888/svn
will prompt you to enter the username and password.
 
When configuring, I found that the wrong subversion was installed at the beginning, and I uninstalled it directly using the command:
yum remove subversion
 

Guess you like

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