1.InstallationsvnServer-side software
Download and install from the mirror server or YUM source SVN Server software: yum install subversion
mkdir /usr/local/svn //Create SVNinstallation directory
chmod -R 777 svn //Modify directory permissions to 777
svnadmin create /usr/local/svn/sunny //Create a SVNversion repositorysunny(sunny Can be customized )
cd /usr/local/svn/sunny/conf //Enter the configuration file directory under the sunny version repository
The three configuration files in this directory will be modified below
(1)vi svnserve.conf //Configure the repository information, the path of the user file and user password file, and the repository path, put
# anon-access = read
# auth-access = write
# password-db = passwd
//In these four lines, remove the preceding # signs and spaces (, please remove # should be written in top case , without leaving extra spaces ), become
anon-access = none //Anonymous access, change to none
auth-access = write
password-db = passwd
realm = sunny //Change to your own repository name
Save and exit
(2)vi authz //File,CreateSVNGroup and group user permissions
[group]
sunny = gep,wce //Create a group of sunny and specify two users gep and wce
[/] //Determine the permissions under the root directory
@sunny = rw //sunnyGroup user permissions are read and write
* = r //Other users only have read permission
Save and exit
(3) vi passwd //Create or modify user password
[users]
gep = 123456 //The password of the user named gep is 123456
wce = 123456 //. . .
Save and exit
StartSVNServer:
//This is started using a multi-version library
svnserve -d -r /usr/local/svn/
If it is a single version library, you can add a line
svnserve -d -r /usr/local/svn/sunny
Then set up auto-start
` Open the self-starting file and add it
/usr/bin/svnserve -d -r /usr/local/svn/
Now you can check out files from the server .
svn command:
netstat -tnl | grep :3690 Check whether svn is started
Installation successful!
ps aux |grep svn Find all processes started by svn
kill -9 2505 Kill 2505This found svnprocess
svn checkout svn://172.19.5.2/sunny /data0/htdocs/blog //Check out a version library file to the specified directory
svn up //
Automatic updateAdd in
vi /usr/local/svn/sunny/hooks/post-commit
#!/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
The right side of
SVN=
is changed to svn The command location generally defaults to /usr/bin/svn WEB=Change the right side to your actual
webdirectory Give executable permissions
chmod 777 /usr/local/svn/sunny/hooks/post-commitInstallation completed
================================================== ==========================
Other operations
#svn commit -m "Comment" xxx.php //Submit file
svn ci -m'aaa' test.php //Submit file
#svn add file //Create a new file and add it to svn
svn add *.php //(Add all phpfiles)
in the current directorysvn delete test.php //Deletetest.php
svn log test.php //View the test file’s log information
svn cleanup //Clean the current directory
svn switch --relocate svn://192.168.1.253 svn://172.19.10.250 //RelocateSVNRepository address
// SVN repository startup method, now there are sunny, under SVN test Two repositories
1: Single version library startup svnserve -d -r /usr/local/svn/sunny
2: Multi-version library startup svnserve -d -r /usr/local/svn
The difference lies in the directory specified by the startup parameter -r in the command when starting svn.
Restrict different users to operate different repositories, modify the authz file in the conf directory
Take configuring the sunny version library as an example
vi authz
[groups]
teacher = sunny,sunny1
[sunny:/] //Specify the permissions under the repository and directory
@teacher = rw //teacherGroup user permissions are read and 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