First chapter Installation
Here to install subversion-1.6.6 under RHEL5, for example
1. Download the source package
Download on http://archive.apache.org/dist/subversion/website
subversion-deps-1.6.6.tar.bz2
subversion-deps-1.6.12.tar.bz2
2. Installing dependent Packages
Required dependencies for installation: gcc gcc-c++ OpenSSL openssl-devel
If you do not install the OpenSSL-related package, the following error occurs when the./configure: Configure:error:We require OpenSSL; Try–with-openssl Configure failed for serf
The general GCC gcc-c++ Linux system is already installed. No re-installation required
For the OpenSSL openssl-devel package use the Yum method to install under administrator privileges, execute the following command:
Yum Install OpenSSL
Yum Install Openssl-devel
Enter Y to download the installation when prompted
3. Compiling
Unzip the file first
TAR-JXVF subversion-1.6.6.tar.bz2
TAR-JXVF subversion-deps-1.6.6.tar.bz2
Make sure that the two compressed packages are extracted to the same directory (typically the above commands are extracted to the same directory), or the problem will occur when compiling.
Execute the following command to compile and install
./configure--PREFIX=/OPT/SVN
Make
Make install
Note: If the "/usr/bin/ld:cannot Find-lexpat" error is reported when compiling, it is because the system is missing the expat package and needs to install the expat package.
Perform the yum command to install
Yum-y Install Expat-devel
Install it and then compile and execute make and makes install.
4. Setting Environment variables
Edit/etc/profile
Export Path=/opt/svn/bin: $PATH
or edit the ". Bash_profile" file in the appropriate user's home directory (note that the file is a hidden file), adding
Path=/opt/svn/bin: $PATH
Note that it is best to place =/opt/svn/bin in front of your environment variables, because if your Linux system already has an older version of SVN installed, and if you have deleted the original SVN, then it is possible that the original SVN program was actually executed. Placing the newly installed directory at the top of the environment variable guarantees that the actual execution must be the SVN you just installed.
5. Testing
Execute svn-h in any directory to see the SVN version and see if it becomes 1.6.6 If the installation is successful.
Chapter II Configuration
This system adopts the strategy of building a repository for each project separately. Configuration files, password files, access control files, etc. are all placed in the Conf directory of the repository. So each time you start a new project, you must create a new repository and reconfigure each configuration file. There is also a very important one, requiring the members to reconfigure the client, including server repository path, local path and other information.
1. Create a repository directory (you can create multiple, and the following items will need to be reconfigured after you create a new library.) Note the difference between the installation directory and the repository directory, the following is the Repository directory)
1 |
mkdir –p /opt/svndata/repos |
2. Create the SVN repository (corresponding to the above directory)
1 |
svnadmin create /opt/svndata/repos |
After executing this command, SVN automatically adds the necessary configuration files under the Repos directory.
Note: The repository differs from the normal folder, the new file cannot be identified by SVN directly on the operating system , and the file must be imported into the repository using commands such as import.
This is the SVN internal directive, create for the new repository. Please use SVN help to see the detailed instructions.
3. Modifying a repository configuration file
1 |
vi /opt/svndata/repos/conf/svnserve.conf |
Each parameter function is described in the comments in the configuration file, which is configured as follows:
[General]
Anon-access = none # makes non-authorized users inaccessible
auth-access = Write # Enables authorized users to have write permissions
Password-db =/opt/svndata/repos/conf/pwd.conf # indicates password file path
authz-db =/opt/svndata/repos/conf/authz.conf # access Control file
Realm =/opt/svndata/repos # authentication namespace, Subversion is displayed in the authentication prompt and as a keyword for credential caching.
The other uses the default configuration. Each statement must be shelf write, the left can not leave a blank, otherwise there will be an error.
Where pwd.conf and authz.conf are not created automatically when creating a new repository, they need to be created by themselves.
Instruction Description: This is the SVN configuration file format, please write in the format described above.
4. Configure the user
1 |
vi /opt/svndata/repos/conf/ pwd .conf |
Enter the following:
[Users]
username1 = Password1
UserName2 = Password2
You can add multiple, this is the user name password pair.
5. Configure permissions
Vi/opt/svndata/repos/conf/authz.conf
Instruction brief: This profile takes the path-based authorization policy, specifying the path in parentheses, and the following lists the authorizations for each user. Includes read-only R, read-write RW. If no users are listed, access is not allowed. You can also group users, please refer to the SVN manual, the following is a simple example:
[/opt/svndata/repos]
User1 = RW
User2 = R
6. import files using Import
The new repository is empty and needs to be imported into the working directory.
1 |
$ svnadmin create /usr/ local /svn/newrepos |
2 |
$ svnimport mytree file :///usr/ local /svn/newrepos/some/project |
However, after the import, the directory tree used is not converted to a working copy, and in order to get started, it is necessary to run SVN checkout to export a working copy. Because the files are in a special form in the DB folder in the repository after import, they cannot be viewed in clear text. You must use SVN checkout to export your working copy (workcopy) in order to view it in the normal way.
1 |
svn checkout file :///usr/ local /svn/newrepos/some/project workcopy |
7. Start the service
Executes the svnserve–d–r/opt/svndata/repos/startup service and runs in Deamon mode.
This system adopts svnserve way, which is the recommended method of small team project. This approach minimizes maintenance and is the simplest to configure.
Instruction Description: This command is used to start the SVN service,-D indicates to run in daemon mode, SVN automatically listens on port 3690. 3690 is the default port, you can use "–listen-port=" or "–listen-host=" to specify a different port. The-r option is used to specify the root directory of the SVN service so that the user can access it using a relative path instead of providing a full path.
Check out using the following command: (svnserver mode)
1 |
svn checkout svn://127.0.0.1/ dir |
The above is an example. IP needs to be adjusted according to the situation, dir is the repository path and can be omitted if it is specified at startup.
The repository information is in the Repository folder, so deleting the repository only requires deleting the folder where the repository is located.
In addition, the working copy is a folder that is maintained by itself, which can be deleted directly by Windows and has no effect on others. Never use the repository's Delete command, otherwise the contents of the repository will be deleted.
Installation of subversion under Linux