Install and configure subversion in Linux
1. First, prepare the relevant installation packages. Here I use the following packages:
APR: apr-1.2.12 and apr-util-1.2.12
Apache: httpd-2.2.4.tar.gz
Subversion: subversion-1.4.5.tar.gz and subversion-deps-1.4.5.tar.gz
Note: during the installation process, you may be prompted to install other packages. Install the required packages according to the actual situation. If the installation process is successful, you are lucky!
Ii. installation and configuration steps:
1. Install apr-1.2.12
# Tar-zvxf apr-1.2.12.tar.gz
# Cd apr-1.2.12
#./Configure/* when no path is specified for installation, it is installed in/usr/local/APR by default.
# Make; make install
2. Install apr-util-1.2.12
# Tar-zvxf apr-util-1.2.12.tar.gz
# Cd apr-util-1.2.12
#./Configure--With-Apr =/usr/local/APR
# Make; make install
3. Install httpd-2.2.4.tar.gz
# Tar-zvxf httpd-2.2.4.tar.gz
# Cd httpd-2.2.4
#./Configure
--Prefix =/usr/local/Apache
-With-Apr =/usr/local/APR/bin/apr-1-config
-With-Apr-util =/usr/local/APR/bin/apu-1-config
--Enable-modules = So/* install Apache (or -- enable-So) in DSO Mode)
--Enable-Dav
--Enable-maintainer-Mode
--Enable-Rewrite
# Make; make install
Start Apache after installation
#/Usr/local/Apache/bin/apachectl-K start
Check http: // localhost/in the browser and obtain it works, indicating that Apache has been configured successfully.
4. install and configure Subversion
# Tar-zvxf subversion-1.4.5.tar.gz
# Tar-zvxf subversion-deps-1.4.5.tar.gz/* the two are automatically decompressed into a package subversion-1.4.5
# Cd subversion-1.4.5
# Rm-RF APR
# Rm-RF Apr-util
Note: The APR version on which SVN depends must be correct. If Apache is 2.0.x, the corresponding APR version should be 0.9.x; Apache is 2.2.x, and the corresponding APR version should be 1.2.x. Because the APR in the subversion-deps package is 0.9.x, You need to delete the APR and APR-util extracted from deps during SVN compilation. Instead, you can use the APR and APR-util provided in Apache 2.2. (This is specified as the APR directory for installation.) This is very important. I have not successfully installed it many times before, and now I understand that this is stuck, but I finally solved it. Learning and practice will keep you growing!
#./Configure
-- Prefix =/usr/local/SVN
-- With-apxs =/usr/local/Apache/bin/apxs
-- With-Apr =/usr/local/APR/bin/apr-1-config
-- With-Apr-util =/usr/local/APR/bin/apu-1-config
-- With-SSL
-- With-zlib
-- Enable-maintainer-Mode
# Make
# Make install
Check whether SVN is successfully installed.
#/Usr/local/SVN/bin/svnserve--version
The version information is displayed!
Check whether the related modules of Apache are loaded! As follows!
Loadmodule dav_svn_module modules/mod_dav_svn.so
Loadmodule authz_svn_module modules/mod_authz_svn.so
If it continues to work well, there will be almost no problem! Continue!
Start creating a version Library
#/Usr/local/SVN/bin/svnadmin create/SVN/project/www/* create a repository "www"
# Ls/SVN/project/www/* check if any files have been created. If some files are added, the version library has been created.
Import the project file to the version Library
The following statement imports the project files found in the path/share/WWW to the/SVN/project/WWW repository you created,
The submitted revision is 1.
#/Usr/local/SVN/bin/SVN import/share/WWW file: // SVN/project/www-m "Comment"
Configuration improves the security of SVN version Libraries
# Chmod-r 700/SVN/project/* do not allow others to access this directory
Note: directly using this chmod will cause the svn client to be inaccessible and you must modify the Apache configuration file. /CONF/httpd. CONF file. (If your level is not high enough, skip this step to avoid trouble! Wait until the service is fully done to further improve security.) the httpd. conf file contains the following content:
User daemon
Group daemon
Change the preceding content:
User Apache
Group Apache
(When installing Apache, my system automatically adds the Apache user and Apache Group. If your system does not have this user and group, add the user and group by yourself)
Modify the svn repository owner
# Chown-r Apache: Apache/SVN/Project
5. Configure Apache to support SVN
# Vi/usr/local/Apache/CONF/httpd. conf
Add
Dav SVN
Svnparentpath/SVN/Project (configure the root directory of your version library here)
Authtype basic (basic verification of connection type settings)
Authname "Hello welcome to here" (here the string content is changed to the title of the prompt dialog box)
Authuserfile/SVN/passwd (this is the file used to access the version library user,
Use the htpasswd command of Apache to generate)
Authzsvnaccessfile/SVN/auth. conf)
Require valid-user ("require valid-user" tells Apache that all users in AuthFile can access Apache.
Without it, only the first user can access the new database)
Save the file and exit!
Restart Apache
#/Usr/local/Apache/bin/apachectl-K restart
Check with your browser
Access http: // 192.168.0.1/SVN/WWW in a browser, and you will be prompted to enter the user name and password.
After completing the following steps, you can access the service. If something is displayed, the service is successful.
The following is the svn user and permission configuration management.
6. Configure SVN permission management (that is, the configuration of authz. conf)
1. Add a user:
#/Usr/local/Apache/bin/htpasswd-C/SVN/passwd user1
When you set a user for the first time, use-C to create a new user file. Press enter and enter the user password.
The second addition does not require the-C parameter, for example:
#/Usr/local/Apache/bin/htpasswd/SVN/passwd user2
2. Permission assignment:
# Vi/SVN/auth. conf
[Groups]/* Indicates group settings.
Admin = usr1, user2/* Indicates user1 and user2 members in the admin group.
Develop = u1, U2/* indicates the U1, U2 members in the develop group.
[Www:/]/* indicates the access permission under the root directory of the WWW repository.
User1 = RW/* WWW repository user1 users have read and write permissions
User2 = r/* WWW repository userl users only have read permission
@ Develop = RW/* indicates that all members of the group develop have read and write permissions.
[/]/* Indicates that it is in the root directory of all warehouses
* = R/* indicates that all users have the read permission.
Note: When editing authz. in the conf file, all rows must be written at the top and cannot be scaled down. Otherwise, an error is returned: "Access Denied: 'user1 '", you can add content based on your own needs. It does not have to be the same as what I wrote above!
7. Restart the apache service and start the svn service.
#/Usr/local/Apache/bin/apachectl-K restart
You can access the repository through the URL http: // 192.168.0.1/SVN/www. Of course, restricted permissions must be accessible by legal users and have the relevant permissions.
Finally, start SVN
#/Usr/local/SVN/bin/SVN-d-r/SVN/Project
-D Indicates running in daemon mode (running in the background)
-R/SVN/Project: Specify the root directory as/SVN/Project
Check whether the server is properly started:
# Ps-Ef | grep svnserve
If the following information is displayed, the instance is successfully started:
Root 6941 1 0? 00:00:00 svnserve-d -- listen-port 9999-r/SVN
Next, the client tortoisesvn is directly installed and the client computer is restarted.
OK. Now the setup of the Apache SVN server has been completed.