Install SVN server under Linux (Centos6.5) and access via HTTP

Source: Internet
Author: User

Catalogue [-]

    • Installation:

    • Configuration:

Linux installation svn is actually very easy, personally feel difficult on the configuration, repeatedly configuration, pondering, find relevant information, finally is successful.

Installation:
    1. Installation of SVN, in general, the choice of Yum mode installation is relatively simple.

?

1 2 [[email protected] ~] # yum -y install mod_dav_svn #会自动安装mod_dav_svn及其依赖包:mod_dav_svn-1.6.11-9,neon-0.29.3-2,pakchois-0.4-3.2,subversion-1.6.11-9

Install this directly to get the SVN server directly KO.

2. Installing httpd

?

1 [[email protected] ~] # yum -y install httpd

In general, Linux servers have httpd services that you can check under, if not installed.

Check method:

?

1 [[email protected] ~] # vi /etc/httpd/conf.d/subversion.conf

After installing SVN to see if there is a directory & file, if there is no need to install httpd.

3. After installing SVN, the configuration is next.

Configuration:

1. Configure SVN repository

?

1 2 3 4 5 6 7 8 #创建svn目录 [[email protected] ~] # mkdir -p /home/svn/repos1  #仓库1 [[email protected] ~] # mkdir -p /home/svn/repos2  #仓库2 #可以任意配置,任意指定你喜欢的目录 #建立svn版本库 [[email protected] ~] # svnadmin create /home/svn/repos1 [[email protected] ~] # svnadmin create /home/svn/repos2 #有多少个仓库就执行多少次该命令,只需要换最后的名字即可

2. Modify the SVN repository configuration file

?

1 [[email protected] ~] # vi /home/svn/repos1/conf/svnserve.conf

The result of the modified file is as follows:

?

1 2 3 4 5 6 [general] anon-access = none     auth-access = write password-db = /home/svn/conf/pwd.conf    #指向用户配置文件 authz-db = /home/svn/conf/authz.conf     #指向权限配置文件 realm = repos1                           #指向svn仓库地址

Note: The other warehouse configuration is the same as the configuration, and only the warehouse path needs to be modified.

3. Configure SVN users and permissions

?

1 2 3 4 5 6 7 8 9 ten page [email  protected] ~] # vim /home/svn/conf/pwd.cof [[email protected ] ~] # vim /home/svn/conf/authz.conf #这是2个步骤, I'm here for better reading, written together 1. Configure Users Since this configuration is self-defined, VIM creates the file first, or it can be created in other ways. [[email protected] ~] # vim /home/svn/conf/pwd.conf # Save Exit [[email protected] ~] # htpasswd -c /home/svn/conf/ Pwd.conf admin #根据提示输入密码, the first user needs to add-C, and subsequent users do not need the-c [[email protected] ~] # htpasswd /home/svn/conf/pwd.conf test [[email protected] ~ ] # vi /home/svn/conf/pwd.conf at the top of the user add [users]

Add [Users] This step is very important, because the htpasswd way to add users will overwrite [users], so each time the user needs to go back to fill the node

?

1 2 3 4 5 6 7 8 9 10 2.配置权限 [[email protected] ~] # vim /home/svn/conf/authz.conf 文件内容如下: [groups] admin=user1,user2 test=user3 [/] @admin=rw [repos1:/] user3=r

Explanation:[groups] for the group definition, you can add a lot of users under the group, to, split,

However, the user data must be defined in the /homd/svn/conf/pwd.conf .

[/] represents a permission definition below the root directory

[repos1:/] represents a permission definition under a warehouse

If you want to sub-project, use this rule analogy:

For example,[REPOS1:/AAA] represents the permission definition for AAA items under the warehouse.

@admin represents the user rights under the Admin group.

User1=r represents user1 this user's permissions.

permission types: R,W,RW are read-only, write-only, read-write, respectively. If it is user1= this empty case is not .

OK, to this SVN configuration is complete. We can delete the default configuration file.

?

1 2 3 [[email protected] ~] # rm -rf /home/svn/repos1/conf/passwd [[email protected] ~] # rm -rf /home/svn/repos2/conf/authz ##多个仓库则删除多个仓库对应的文件即可

4. Create a user to start SVN

?

1 2 3 4 [[email protected] ~] # useradd svn                    #如果提示svn账户已存在,则执行以下命令 [[email protected] ~] # passwd svn                     ##根据提示修改下密码,不能过于简单,可使用常用密码 [[email protected] ~] # chown -R svn:svn /home/svn/    ##允许用户svn访问版本库 [[email protected] ~] # chmod –R o+rw /home/svn        ##解决windows检出提交提示/home/svn/db/txn-current-lock’错误

5. Configure the SVN port

?

1 [[email protected] ~] # vi /etc/httpd/conf/httpd.conf

Found it

#Listen 12.34.56.78:80 this line,

Listen 9999 # #9999就是svn的端口, the default is 80, you can change it to what you want. Using the default 80 port is not recommended

5. Configure httpd

?

1 [[email protected] ~] # vi /etc/httpd/conf.d/subversion.conf

Modify the contents of the file as:

<location/svn>

DAV SVN

Svnlistparentpath on

Svnparentpath /home/svn

AuthType Basic

AuthName "Authorization"

AuthUserFile /home/svn/conf/pwd.conf # #对应你的用户配置文件

Authzsvnaccessfile /home/svn/conf/authz.conf # #对应你的权限配置文件

Require Valid-user

</Location>

Save Exit!

Restart the httpd service.

?

1 2 3 [[email protected] ~] # service httpd restart 停止 httpd:                                               [确定] 正在启动 httpd:                                           [确定]

The configuration of the table name HTTPD has successfully started successfully when the above words appear.

6. Start SVN

?

1 [[email protected] ~] # svnserve -d -r /home/svn/

7. See if the SVN service is working

?

1 2 3 4 [[email protected] ~] # ps aux|grep svn ##出现以下内容说明svn服务已经成功启动 root      8610  0.0  0.0 152864   740 ?        Ss   11:25   0:00 svnserve -d -r /home/svn/repos1/ root     13128  0.0  0.0 103252   876 pts/0    S+   14:00   0:00 grep svn

8. Go to browser access.

Enter in the browser: <location/svn> in the server ip+ port +httpd configuration.

such as: HTTP://192.168.1.1:9999/SVN

You will be prompted to enter a user name password.


9. Summary

Well, there's not much to summarize, these are my results from the online synthesis of multiple posts, I hope to give you some help.


Install SVN server under Linux (Centos6.5) and access via HTTP

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.