Install SVN under ubuntu14.04
$sudo Apt-get Install Subversion
Perform this step on the installation is complete, in Ubuntu first installation is very convenient
After the installation is complete, create the repository directory, because it is the local environment, in a directory, if the real environment is equivalent to the directory on the server, because of the local, it is a server to simulate a repository
$sudo mkdir-p/OPT/SUBVERDION/SVN # # #创建版本库目录
$sudo svnadmin CREATE/OPT/SUBVERSION/SVN # # #创建版本库, generating the configuration file
Configure SVN, the configuration files are all in/OPT/SUBVERSION/SVN
1). Configure the user first
$sudo vim/opt/subversion/svn/conf/passwd
Add Format: User name = password
such as: XC = xc123
2). Configure permissions and groupings
$sudo Vim/opt/subversion/svn/conf/authz
[Groups] # # #分配组, no spaces at the beginning of the line
team1 = zhangsan,lisi # # #在组1中有zhangsan和lisi
team2 = Wangwu # # #在组2中只有wangwu
[svn:/] # # #分配权限,
Zhangsan = RW
@team1 = rw # # #在组名前需要加上 @ sign, do not need to add the @ symbol before the user, members in the TEAM1 group have ' Read and write ' permissions
@team2 = r # # #在team2组中的成员有 ' read ' permission
* = # # #其他用户没有任何权限
3). Configure the svnserve.conf file in the/opt/subversion/svn/conf directory to remove comments
$sudo vim/opt/subversion/svn/conf
Anon-access = none # # #将以前的read改成none
auth-access = Write
Password-db = passwd # # #
Authz-db = Authz
4). Turn on SVN service
$sudo svnserve-d-r/opt/subversion
-D: Specifies that the program runs in the background
-r: Specifies the SVN service directory, which is the repository directory
--listen-port Port: Set port, default is 3690
5). Verify that the success is turned on
$ sudo netstat-anp | grep svnserve
Returns the following information
TCP 0 0 0.0.0.0:3690 0.0.0.0:* LISTEN 18253/svnserve
6). How to turn off Svnserve
$sudo Pstree | grep svn #查看
$sudo Killall Svnserve #关闭
##############
The above six steps are equivalent to the settings on the server
When you are finished, do the following
##############
Set up a local directory in the home directory (relative to the server)
$mkdir-P Workspace/project
$CD/workspace/project
$sudo svn checkout svn://127.0.0.1/svn #和服务器上建立关联, the SVN directory is the SVN directory under/opt/subversion/
After entering the above command, a tab will pop up under ubuntu14.04, let you fill in the password user name of the thing, you can look at the fill on it
Then in the Workspace/project directory
$ll-A can see that there is a hidden folder. SVN, this directory is recorded by the user's various actions
##############
After the above steps, the SVN configuration is basically complete, then the SVN command can be manipulated.
The sudo update can be updated to see if the server's files are synchronized to the local no, you can see the SVN directory appears
* * Note: When using the SVN command under Ubuntu, sudo is generally performed
##############
/**************** First Error ***************************/
[Email protected]:~/workspace/project01$ svn add AAA
svn:e155004: Run "svn cleanup" delete lock (run "svn help Cleanup" for details)
svn:e155004: Working copy "/home/xc/workspace/project01" is locked
SVN:E200031:SQLITE[S8]: Attempt to write a readonly database
svn:e200031: Additional error:
SVN:E200031:SQLITE[S8]: Attempt to write a readonly database
******************/
The above should be used to log in as root, so that ordinary users will report the above error
/**************** a second error ***************************/
When svn:e155007 appears: "/opt/subversion" is not a working copy, this is because when configuring Authz permissions
[Groups]
team1 = Xc,lisi
TEAM2 = Lisi
[proj01:/] ##### #在这里冒号和/no spaces between
XC = RW
@team1 = RW
@team2 = R
* =
-----------------------------------------------------------------
common commands for SVN daily use under Linux
Find out how to get help with SVN, use SVN help for SVN, and use the SVN help command to look for assistance under a sub-command, such as SVN assist update
1). SVN checkout svn://127.0.0.1/svn # # #第一次登录到svn服务器时需输入, you don't need checkout anymore
2). SVN update can also be abbreviated as SVN up # # #将版本库的修改合并到工作副本中 to download the updated files on the server
3). Submit or modify the file
A. For newly created files
SVN add path/to/file # # #先添加文件至版本控制目录
SVN commit-m "xxxxx" # # #把本地的文件同步到服务器的版本库目录下,-M: Specify the log information, generally specify the log information, otherwise it will be error, SVN commit can also be written as SVN ci
B. For the modified file, submit directly
SVN commit path/to/file-m "xxxxxx" # # #直接提交
4). View the repository log, where the log records record the log information specified in the-m option of the Commit
SVN log
5). Restore the changed files to a previous version
A. Modified, but not submitted
$ sudo vim test.txt # # #修改文件
$ sudo svn revert test.txt # # #恢复文件
B. Modified and submitted to the server
$ sudo vim test.txt
$ sudo svn commit-m "test File"
$ sudo svn update
$ sudo svn diff-r old version: New version Svn://127.0.0.1/svn/test.txt # # #查看就版本与新版本之间的区别, such as sudo svn diff-r 3:4 svn://127.0.0.1/sv N/test.txt
$ sudo svn merge-r new version: Old version Svn://127.0.0.1/svn/test.txt # # #恢复至旧版本, such as: sudo svn merge-r 4:3 svn://127.0.0.1/svn/test.txt
6). list directory contents in the Repository
$ sudo list
7). Create a directory on the SVN server side
$ sudo svn mkdir svn://127.0.0.1/svn/xc [-M "xxxxx"]
8). Copy of the Catalog
$ sudo svn copy source file destination file
9). Remove files and directories from the repository
Local Delete: Rm-rf file
Server Delete: sudo del svn://127.0.0.1/svn/test.txt-m "del file"
10). rename file or directory Move (MV, rename, ren)
SVN move source file destination file
sudo svn mv Svn://127.0.0.1/proj01/xc svn://127.0.0.1/proj01/xxc
This article is from the "Small City Studio" blog, please be sure to keep this source http://xcroom.blog.51cto.com/7941996/1639926
Installation of SVN version management system under ubuntu14.04 and the use of common commands