Install and configure SVN in Centos7

Source: Internet
Author: User
Tags install openssl

Install and configure SVN in Centos7

This practice uses Baidu server CentOS/7.1 x86_64 (64bit)
Svnserve, version 1.7.14

Install svn

Yum install subversion
View version
Svnserve-version

Returned results

[Root @ chinamobile2016 ~] # Svnserve-version
Svnserve, version 1.7.14
(R1542130) compiled Nov 20 2015, 19:25:09

Copyright (C) 2013 The Apache Software Foundation. This software
Consists of contributions made by Province people; see the NOTICE file
More information. Subversion is open source software, see
Http://subversion.apache.org/

The following repository back-end (FS) modules are available:

  • Fs_base: Module for working with a Berkeley DB repository.
  • Fs_fs: Module for working with a plain file (FSFS) repository.

Cyrus SASL authentication is available.

Create SVN version Library

Cd/storage
Mkdir svn
Cd svn
Mkdir project
Svnadmin create/storage/svn/project/
Ls project/
A generated version library file is found.

Configure svn Information

Conf/authz

Cd conf
Vi authz
Add a user group under [groups]
Admin = admin (user group name = user name)
Add User Group Permissions under [repository:/baz/fuz]
[Project:/]
@ Admin = rw

Conf/passwd

Add under [users]
Admin = test (username = PASSWORD)

Conf/svnserve. conf

Uncomment the following items
Anon-access = none
Auth-access = write
Password-db = passwd
Authz-db = authz
Realm = project

Modify/root/. subversion/server

Uncomment store-plaintext-passwords = yes and modify

Confirm openssl and openssl-devel Installation

Yum install openssl-devel

Enable, connect, and disable

Enable

Svnserve-d-r/storage/svn/

Import files in the project repo

Svn import xxxx svn: // xxx. xxx/project/-m "admin"
Enter the root password
Enter the account password of the repo you just created
Successful

Close

Ps-aux | grep svn
Kill pid

Some common operations

Note: most operations must be performed under the svn version control folder.

Checkout (alias: co) command

Command Description: cut out the available working directories in the version library;
Usage: checkout URL [@ REV]… [PATH];
Example: [root @ samba/] # svn co svn: // 192.168.31.131/svntest/trunk
In this process, the code is downloaded from the server to ensure the version is consistent.

Add command

Command Description: Put files and directories under version control, scheduling them for addition to repository. They will be added in next commit.
Usage: add PATH ...;
Example: [root @ xxx] # svn add *. Java (wildcards can be used)

This process adds new files and folders to version control. During the next commit, the files and folders will be imported to the version library for synchronization.

Commit (alias: ci) command

Command Description: Submit your changes from your SVN working directory to the version library;
Usage: commit PATH ...;
Example: [root @ xxx] # svn ci-m "commit dir and file" test (wildcards can be used to submit directories and files simultaneously)

Lock command

Command Description: The SVN working directory or version library URL will be locked so that no one can submit the change information of the directory or file;
Usage: lock TARGET ...;
Instance used: [root @ xxx] # svn lock-m "lock dir and file"
Test. java (wildcards can be used, for example, T *.*)

Unlock Command

Command Description: unlocks the SVN working directory or version library URL. Usage: unlock TARGET ...;
Example: [root @ xxx] # svn
Unlock-m "lock dir and file" Test. java (wildcards can be used, for example, T *.*)

Note: If you lock or unlock the instance locally, submit it to the server.

Delete (alias: del, remove, rm) command

Command Description: delete a file or directory from SVN version control;
Usage: delete PATH ...;
Example: [root @ samba test] # svn delete Test. java (wildcards can be used, for example, T *. *)-delete an object
[Root @ samba test] # svn delete test (wildcards can be used, such as: t *)-delete a directory

Note: To run the preceding command, only files under SVN version control can be deleted, but directories cannot be deleted. Therefore, rm commands of Linux (Unix) systems should be used to delete directories, after deletion, remember to submit.

Move (alias: mv, rename, ren) command

Command Description: Move or rename the SVN working directory or version library;
Usage: move SRC... DST
Example: [root @ samba test] # svn move Test. java Test2.java [root @ sambatest] # svn move-m "ss" svn: // 192.168.31.131/svntest/trunk/src/com/ant/test/Test2.java svn: // 192.168.31.131/svntest/trunk/src/com/ant/test/Test3.java

Note: Execute the first instance command and submit it. The second command is to directly modify the Server File name without submitting the file.

Log command

Command Description: displays the log information of the version library file.
Usage: log [PATH] log URL [@ REV] [PATH…]
Example: [root @ samba test] # svn log T * (do not use wildcards unless there is only one file in the file directory)
[Root @ samba test] # svn log svn: // 192.168.31.131/svntest/trunk/src/com/ant/test/Test3.java

Info command

Command Description: displays detailed information about local or remote server files.
Usage: info [TARGET [@ REV]…]
Example: [root @ xxx test] # svn info Test. java (wildcards can be used)

List (alias: ls) command:

Command Description: displays the objects in the version library directory, including subdirectories and files in the directory.
Usage: list [TARGET [@ REV]…];
Example: [root @ samba ant] # svn list [test] (Wildcards are not recommended unless the letters at the beginning of your directory are unique, otherwise, the owner of the files in the directory is unclear)

Help (alias :?, H) command

Command Description: A description of svn commands or programs.
Usage: help [SUBCOMMAND…];
Instance used: [root @ samba ~] # Svn ci-help (wildcards cannot be used)

Mkdir command:

Command Description: create a directory under SVN version control.
Usage: mkdir PATH ...; Mkdir URL...
Example: [root @ xxx] # svn mkdir test3 (wildcards cannot be used)
[Root @ samba ant] # svn mkdir-m "create dir" svn: // 192.168.31.131/svntest/trunk/src/com/ant/test4

Note: after creating a directory in the first method, you need to submit it. In the second method, you can directly create the directory in the URL of the version library without submitting it. Add the-m parameter when submitting a directory or file. Otherwise, the following error is prompted:

Status (alias: stat, st) command

Command Description: prints the SVN working directory and file status.
Usage: status [PATH…];
Example: [root @ samba ant] # svn status-v * (wildcards can be used)

Note: When executing the status command, we recommend that you add the "-v" command parameter. The first column is the same, the second column is the working version number, and the last modified modifier in the third column, the version number of the last modification in column 4.

Copy (alias: cp) command

Command Description: Backup history.
Usage: copy SRC [@ REV]… DST;
Example: [root @ samba test] # svn cp Test3.java Test4.java (wildcards cannot be used)
[Root @ samba test] # svn cp-m "ss" Test3.java svn: // 192.168.31.131/svntest/trunk/src/com/ant/test2/Test4.java

Note: The first method must be submitted manually, and the second method can be submitted automatically.

Update (alias: up) command

Command Description: Introduce server changes to a local project.
Usage: update [PATH…];
Example: [root @ samba test] # svn up t * (wildcards can be used)

Diff (alias: di) command:

Command Description: Compare the differences between the two versions.
Usage: diff [-c M |-r N [: M] [TARGET [@ REV]…];
Diff [-r N [: M]-old = OLD-TGT [@ OLDREV] [-new = NEW-TGT [@ NEWREV] [PATH…]
Diff OLD-URL [@ OLDREV] NEW-URL [@ NEWREV]
Example: [root @ samba test] # svn di T * (wildcards can be used) [root @ samba test] # svn di-r 20:18 T * (wildcards can be used)

Note: The first case is to compare with the local version, and the second case is to display the comparison of the specified version.

Merge command

Command Description: merges two specified version differences into the current working directory file.
Usage: merge sourceURL1 [@ N] sourceURL2 [@ M] [WCPATH]; merge sourceWCPATH1 @ N sourceWCPATH2 @ M [WCPATH];
Merge [-c M [, N…] |-R N: M…] SOURCE [@ REV] [WCPATH]
Example: [root @ samba test] # svn merge-r 20:18 Test3.java (Wildcards are not recommended)

Note: When two files conflict, you must first handle the conflict and then execute the merge command.

Revert command

Command Description: restore the original unchanged working copy file (recover most local modifications ).
Usage: revert PATH...
Example: [root @ samba test] # svn revert Test3.java (Wildcards are not recommended) [root @ samba test] # echo "dd" Test3.java (data preparation)

Blame (alias: praise, annotate, ann) command

Command Description: output the content of the specified file with the version number and the author's online information.
Usage: blame TARGET [@ REV]…
Example: [root @ samba test] # svn blame Test. * (wildcards can be used)

Note: Only files can be executed, but directories cannot be executed.

Export command:

Command Description: Creates a tree that is not under SVN version control by means of replication.
Usage: export [-r REV] URL [@ PEGREV] [PATH]
Export [-r REV] PATH1 [@ PEGREV] [PATH2]
Example: [root @ samba ant] # svn export. test5 (wildcards cannot be used)

Note: After creation, you need to submit.

Import command:

Command Description: Submit a tree or file that is not under version control to the version library.
Usage: import [PATH] URL
Example: [root @ samba ant] # svn import-m "sss" svn: // 192.168.31.131/svntest/trunk/src/com/ant/test5 (wildcards cannot be used)

Cat command:

Command Description: output the content of the specified file (URLs must also be specified to the file type ).
Usage: cat TARGET [@ REV]…
Example: [root @ samba ant] # svn cat svn: // 192.168.31.131/svntest/trunk/src/com/ant/test Test3.java (wildcards can be used)

Note: The file or file type must be specified.

Changelist (alias: cl) command:

Command Description: List of file associations with names.
Usage: changelist clname target... Changelist-remove TARGET...
Example: [root @ samba test] # svn changelist T * (wildcards can be used)

Switch (alias: sw) command:

Command Description: List of file associations with names.
Usage: switch URL [@ PEGREV] [PATH] switch-relocate
From to [PATH…]
Example: [root @ samba trunk2] # svn switch svn: // 192.168.31.131/svntest/trunk/. (Wildcards are not recommended)
[Root @ samba/] # svn mkdir trunk2 (directory preparation)
[Root @ samba/] # cd trunk2 (directory preparation)

Note: The purpose of this command is to back up a working directory, similar to the soft connection of files.

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.