Install SVN sudo apt-get install subversion www.2cto.com on the ubuntu Virtual Machine of virtualbox. Configure the SVN server through an automatic script in the following steps: 1. Create SVN users and SVN user groups on ubuntu 2. Create SVN root directory and project directory 3. Create SVN Data Warehouse 4. modify directory permissions 5. Import initial data (optional) 6. Configure SVN user permissions. a bash script is provided to complete the first five steps of the above six steps. "Configure SVN User Permissions" will be further described in the next section: www.2cto.com 01 #! /Bin/bash02 ################################## 03 # V1.004 # function: finished. SVN database initialization has passed the test on Ubuntu 05 # usage: You can directly enter sudo init_svn_server.sh on the terminal to run this script, if 06 # You want to modify some key settings, such as the user name or something, you can modify 07 # Author: jackey77681571@126.com08 ################################### 09 10 # key variable definition 11SVN_USER = svnuser12SVN_GROUP = subversion13SVN_ROOT =/home/svn14PROJECT_DIR = svn_manager15IS_IMPORT = FALSE16 # soruce file directory17LOCAL_DIR =/ Home/daydayup/work/project/svnmanager/src/source18RES_STR = 'grep $ SVN_USER/etc/passwd '19 20 # Add svn management user and Management Group 21if [-e "$ RES_STR" ]; then22 echo "------------ Add svn user -------------" 23 sudo adduser "$ SVN_USER" 24 sudo addgroup "$ SVN_GROUP" 25 sudo addgroup "$ SVN_USER" "$ SVN_GROUP" 26else27 echo "The user :( $ SVN_USER ), is exist. "28fi29 30RES_STR = 'grep $ SVN_GROUP/etc/group' 31if [-e" $ RES_STR "]; then32 Echo "------------ Add Group -------------" 33 sudo addgroup "$ SVN_GROUP" 34 sudo addgroup "$ SVN_USER" "$ SVN_GROUP" 35else36 echo "The group :( $ SVN_GROUP), is exist. "37fi38 39RES_STR = 'grep" $ SVN_GROUP :. *: $ SVN_USER "/etc/group '40if [-e" $ RES_STR "]; then41 echo "------------ Add user to group -------------" 42 sudo addgroup "$ SVN_USER" "$ SVN_GROUP" 43else44 echo "The user :( $ SVN_USER), has been readly in gro Up :( $ SVN_GROUP ). "45fi46 47 # create the project directory 48if [-d" $ SVN_ROOT "]; then49 echo" SVN Root :( $ SVN_ROOT), is exist. "50else51 echo" ------------ Create svn root directory! ------------- "52 sudo mkdir" $ SVN_ROOT "53fi54cd" $ SVN_ROOT "55 56if [-d" $ PROJECT_DIR "]; then57 echo" Project :( $ PROJECT_DIR), is exist. "58else59 echo" ------------ Create svn project directory! ------------- "60 sudo mkdir" $ PROJECT_DIR "61 # create SVN File Repository 62 echo" create: "" $ SVN_ROOT/$ PROJECT_DIR "63 sudo svnadmin create" $ SVN_ROOT/$ PROJECT_DIR "64 65 sudo chown-R" root: $ SVN_GROUP "" $ PROJECT_DIR "66 sudo chmod-R g + rws" $ PROJECT_DIR "67 68fi69 70if [-d" $ LOCAL_DIR "]; then71 72 if ["TRUE" = "$ IS_IMPORT"]; then73 # In the way the LOCAL_DIR will not become the work space.74 svn import-m "init impo Rt "" $ LOCAL_DIR "" file: // $ SVN_ROOT/$ PROJECT_DIR "75 else76 sudo svn co" file: // $ SVN_ROOT/$ PROJECT_DIR "" $ LOCAL_DIR "77 fi78fi79 80 exit 0 3. Enter the SVN project directory. The project directory generated by the script in the previous section is "/home/svn/svn_manager". There is a subdirectory named "conf" under the project directory. The permission setting mainly involves modifying three files in the subdirectory: authzpasswdsvnserve. conf svnserve. conf. It is mainly used to set the file name of the user information file and anonymous access permissions. We open svnserve. after the conf file, you usually need to go to "password-db = passwd" and "authz-db = authz" first. Just comment the preceding two sentences (note that the spaces are also removed) password-db = passwd is used to specify the password information file as the "passwd" file under the same Directory, which is also the default password file. Authz-db = authz, which specifies the information file. The difference between "password-db" and the setting method is different. Next, set the permissions of the authentication user and the non-authenticated user. The comment is also required: anon-access = readauth-access = write but we usually change it to the following: anon-access = noneauth-access = write so that non-authenticated users do not have any access permissions. The passwd file is mainly used to set the table corresponding to the user name and password. For more information about the settings, see the examples in this document. Set permissions for users and user groups in the authz file, as well as operation directories. For more information about the settings, see the examples in this document. If you set virtualbox port forwarding, you should already know the key points of the settings. Here we will only describe that the "subsystem IP" is the IP address found in the virtual system. You can enter "ifconfig" in the terminal for query. "Host port" and "subsystem port" do not need to be the same, but I just set it to the same for convenience. 5. Start the SVN service sudo svnserve-d-r [Service root directory] -- listen-port [listening port number]-d [-- daemon]: background mode-r [-- root] ARG: Service root directory -- listen-port ARG: Listener port I started the service in this way: www.2cto.com sudo svnserve-d-r/home/svn/-- listen-port 8036 six checkout code svn checkout svn: // 127.0.0.1/svn_manager -- username mysvnuser -- password mypassword