Installation and configuration of SVN on Ubuntu System 1, installation
#sudo apt-get install subversion
2. Create a version library
#sudo mkdir /home/svn#sudo svnadmin create /home/svn/suc
3. Go to the repository to modify the relevant configuration file
#cd /home/svn/suc/#dir
Conf db format Hooks Locks README.txt
Our main concern is the Conf and DB files, the Conf folder is the main configuration file and user, permission location, db folder is stored in the SVN dump data.
#cd conf/#dir
Authz Hooks-env.tmpl passwd svnserve.conf
Authz file is to set user rights, passwd file is to store users and passwords, svnserve.conf is the master profile, first configure the master configuration file.
Configuring the Repository
# sudo vi svnserve.conf
Remove the comments from the following parameters
[General]
Anon-access = None #匿名访问权限, default Read,none to not allow access
auth-access = Write #认证用户权限
Password-db = passwd #用户信息存放文件, the default is below the repository/conf, you can also specify the file location by absolute path
Authz-db = Authz
# sudo vi passwd
Format is user name = password, with clear text password
[Users]
TestName = Testpassword
# sudo vi authz
[Groups] #定义组的用户
Manager = TestName
[/]
@manager = RW
4. Start SVN service
# sudo svnserve -d -r /home/svn
To see if the boot was successful, watch the 3690 port
# sudo netstat -antp |grep svnserve
TCP 0 0 0.0.0.0:3690 0.0.0.0:* LISTEN
If you want to turn off the service, you can use Pkill svnserve
5. Synchronize the code directory on the server to a local directory
#sudo svn checkout svn://*******/suc –username testname --password testpassword
Do not specify synchronization to a local directory (/SVN) By default is the current directory, or you can not specify a user name and password, you need to enter manually. Or use shorthand sudo svn co svn://.../suc
6. Update the code to the latest version
Update all files in the code catalog to the latest version
#svn update
To restore a file to a version
update -r 50 filename
50 is the revision number
7. Implement SVN Automatic Update Web server
Checkout the current version in the Web server directory first, Then add the script in the Post-commit file in the Hooks folder of the SVN project: Edit a new post-commit with the VI command (see clearly no suffix) do not use the Post-commit file that comes with the Hooks folder.
#cd /home/svn/suc/hooks#sudo vi post-commit
Add the following content to the file:
#!/bin/shREPOS="$1"REV="$2"WEB=/var/www/suc //web服务器下的项目不能有空格。export LANG=en_US.UTF-8$WEB --username testname --password testpassword
and assign this file to execute permissions.
# sudo chmod +x post-commit
This blog content from the online search and practice, for reference only
Installation and configuration of SVN server on Ubuntu system