Build svn server in Linux

Source: Internet
Author: User
1. install the svn server yuminstallsubversion. download and install the svn server from the image. If & ldquo; svnadmincreateusrlocalsvnsunny & rdquo; the following error occurs: & ldquo; commandnotfound & rdquo; mou 1. install the svn server
Yum install subversion: Download and install the svn server from the image. if "svnadmin create/usr/local/svn/sunny" is executed, the following error occurs: "command not found ", put the "mount/dev/cdrom/media/cdrom/" sentence before "yum install subversion"
Cd/usr/local // enter the directory to create the svn Directory
Mkdir svn // Create a svn Directory
Chmod-R 777 svn // modify the directory permission to 777
Svnadmin create/usr/local/svn/sunny // create a svn version repository sunny (sunny can be named at will !!!!

Cd svn/sunny/conf // enter the configuration file directory under the sunny repository

Modify the three configuration files in this directory.
(1) vi svnserve. conf // Configure the version library information, user file and user password file path, and version library path

Set
# Anon-access = read
# Auth-access = write
# Password-db = passwd
// Remove the # and space in front of the four rows (note that the # must be written in the top level, and do not leave any extra space ).
Anon-access = none // change to none
Auth-access = write
Password-db = passwd
Realm = sunny // change it to your own version Library
Save

(2) vi authz // File, create svn group and group user permissions
[Group]
Sunny = gep, wce // Create a sunny group and specify two users gep and wce

[/] // Specify permissions under the root directory
@ Sunny = rw // The sunny group user permission is read/write.
* = R // Other users only have read permission
Save and exit

(3) vi passwd // create or modify the user password
[Users]
Gep = 123456 // the password of the user whose username is gep is 123456
Wce = 123456 // the password of the user whose username is wce is 123456
Save and exit

Start svn:
Svnserve-d-r/usr/local/svn // use a multi-version library to start svnserve-d-r/usr/local/svn/ sunny
Add a row
Set auto-start
Vi/etc/rc. local
/Usr/bin/svnserve-d-r/usr/local/svn/

So far, the file can be checked out from the server.

Svn command:
Netstat-tnl | grep: 3690 check whether svn is started
Ps aux | grep 'svn 'to find all svn-started processes
Kill-9 2505 kill the svn process found in 2505

Svn checkout svn: // 172.19.5.2/sunny/data0/htdocs/blog // Check out a version library file to the specified directory
Svn up // update the file

Automatic Update
In vi/usr/local/svn/sunny/hooks/post-commit, add

#! /Bin/sh
# Set some variables
SVN =/usr/bin/svn
WEB =/home/testsvn # directory to be updated
Export LANG = en_US.UTF-8
$ SVN update $ WEB -- username xxx -- password xxx

SVN = the svn command location on the right is usually/usr/bin/svn by default.
WEB = change to your actual web directory on the right
Grant executable permissions
Chmod 777/usr/local/svn/sunny/hooks/post-commit
Installation complete
========================================================== ======================================
Other operations

# Svn commit-m "comment" xxx. php // submit a file
Svn ci-m'aaa' test. php // submit a file


# Svn add file // create a file and add it to svn
Svn add *. php // (add all php files in the current directory)
Svn delete test. php // delete test. php
Svn log test. php // view the log information of the test file
Svn cleanup // clear the current directory


Svn switch -- relocate svn: // 192.168.1.253 svn: // 172.19.10.250 // locate the SVN repository address


// SVN version Library startup mode. now there are two versions of SVN: sunny and test.
1: Start svnserve-d-r/usr/local/svn/sunny for a single version
2: Start svnserve-d-r/usr/local/svn for multi-version libraries
The difference is that the directory specified by the startup parameter-r in the command to start svn.


Restrict the operation permissions of different users on different version libraries, and modify the authz files under the conf directory in the version Library.


Take sunny version Library configuration as an example
Vi authz
[Groups]
Teacher = sunny, sunny1
[Sunny: //] // specify the permission under the version library and Directory
@ Teacher = rw // The user permission of the teacher group is read/write.
* = R // Other users only have read permission
Save and exit


Vi passwd: Set the account and password of the user in the group
[Users]
Sunny = 123456
Sunny1 = 123456

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.