Install Apache + subversion in centos

Source: Internet
Author: User
Tags svn update
Directory:
1. Install APR and APR-util
Ii. Install the Apache server
Iii. Install Subversion
4. Configure Subversion
5. Configure httpd. conf of Apache
6. Verify Installation
7. import data to the database
8. Synchronization of version library servers (newly added)
Appendix: problems encountered during installation
 

1. Install Apr, APR-util, and zlib
1. Download APR and APR-util
Apr-1.3.3.tar.gz apr-util-1.3.4.tar.gz zlib-1.2.3.tar.gz
2. Extract
Tar zvxf apr-1.3.3.tar.gz
Tar zvxf apr-util-1.3.4.tar.gz
Tar zvxf zlib-1.2.3.tar.gz
3. Install
CD apr-1.3.3
./Configure -- prefix =/usr/local/APR
Make & make install

CD apr-util-1.3.4
./Configure -- With-Apr =/usr/local/APR
Make & make install

CD zlib-1.2.3
./Configure -- prefix =/usr/local/zlib
Make & make install

Ii. Install the Apache server:
1. download the latest Apache 2.2.9
Httpd-2.2.9.tar.gz
2. Extract
Tar zvxf htt-2.2.9.tar.gz
3. Install
./Configure \
"-- Prefix =/usr/local/apache2 "\
"-- Enable-So "\
"-- Enable-Dav "\
"-- With-Apr =/usr/local/APR/bin/apr-1-config "\
"-- With-Apr-util =/usr/local/APR/bin/apu-1-config"
Make
Make install

Note: -- prefix specifies the installation directory. Note that -- enable-so must be added to ensure that the core can load DSO and -- enable-Dav install mod_dav_svn.so and mod_authz_svn.so.
4. Test
Open the browser and enter http: // server IP address.
It works!
Apache installation successful

Iii. Install Subversion
1. download the latest subversion-1.5.2
Subversion-1.5.2.tar.gz
2. Installation
./Configure \
"-- Prefix =/usr/local/subversion "\
"-- With-apxs =/usr/local/apache2/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 =/usr/local/zlib "\
"-- Enable-maintainer-mode"
Make
Make install

3. To facilitate the use of the Subversion command, add the bin directory under the Subversion installation directory to the path
VI/etc/profile
Last added:
Svn_home =/usr/local/Subversion
Path = $ path: $ svn_home/bin:
Export susbversion path

4. Configure Subversion
1. Create an account password file
Htpasswd-C/data/SVN/passwd. conf Apache
Enter the password and confirm the password twice.
NOTE: For the first time you set the user password, you need to add the-C parameter, and then you will not need to use it.
2. Create a database
First, create a database (I use a single database) and use svnadmin to add a database.
CD/usr/local/subversion/bin
./Svnadmin create/data/SVN/svnroot/WWW
Check whether there are more files at www. If there are more files, it means the creation is successful.
3. Create a permission File
Touch-P/data/SVN/authz. conf
VI authz. conf
[Groups] # Group
Admin = Apache # Members of the Admin group
[Ggg:/] # permission of the version library ggg
@ Admin = RW # The Admin group has the read and write permissions.
Test1 = RW # test1 has read and write permissions
[Www:/]
@ Admin = RW
Test2 = RW
[/]
* = R # all SVN parent directories and Read Permissions
Note: The final [/] should be set. The permission settings here allow you to have the same permissions for the ggg and WWW version libraries. Generally, do not do the same.

5. Configure httpd. conf of Apache
Open the conf/httpd. conf file of Apache. After the Subversion is installed, the module is automatically added to the conf/httpd. conf file of Apache.
Loadmodule dav_svn_module modules/mod_dav_svn.so
Loadmodule authz_svn_module modules/mod_authz_svn.so

The corresponding so file is also automatically copied to Apache/modules. You don't have to do this on your own.

You need to modify httpd. conf in Apache and add the following content.
[For parameter descriptions, see the figure below]

Single version Library:
<Location/SVN>
Dav SVN
Svnpath/data/SVN/svnroot/WWW
Authtype basic
Authname "Subversion repository"
Authuserfile/data/SVN/passwd. conf
Authzsvnaccessfile/data/SVN/authz. Cong

Require valid-user
</Location>

Multiple version libraries:
<Location/SVN>
Dav SVN
Svnlistparentpath on
Svnparentpath/data/SVN/svnroot
Authtype basic
Authname "Subversion repository"
Authuserfile/data/SVN/passwd. conf
Authzsvnaccessfile/data/SVN/authz. conf
Require valid-user
</Location>

Note:
(1) A single version library is svnpath/data/SVN/svnroot/WWW and the./svnadmin create/data/SVN/svnroot/WWW directory should be the same, or you will not be busy ...... [This is for a single version library]. Multiple version Libraries know the main directory of SVN. This is svnparentpath/data/SVN/svnroot.
(2) authzsvnaccessfile is a permission control file, which is not required for a single version library. You must set permissions for different version libraries for multiple version libraries.
(3) set the svnroot directory permission to 755.

Note: The test results of a single version library are shown in section 6 and section 7 below. Multiple version libraries are similar!

6. Verify Installation
Open your browser and enter the address http: // server IP Address/SVN
In the login window, enter the user name and password,

If the above page can be opened normally, the installation and configuration are normal and can be used properly. On the page, we can see that the content is blank because there is no content in the database.

7. import data to the database
CD/usr/local/subversion/bin
./SVN import/directory file to be imported: // data/SVN/svnroot-M "description text"
Open the browser again, enter the address http: // server IP Address/SVN, and enter the user name and password.

All right, successful!

8. Synchronization of version library servers

1. synchronization between a single version Library and the server directory:
Go to the hooks under the version library.
SVN checkout file: // version library directory/local directory to be retrieved
CD/data/SVN/svnroot/www/hookd
VI post-commit

#! /Bin/sh
SVN =/usr/local/subversion/bin/SVN
Web =/data/WWW # The web directory to update the synchronized directory
$ SVN update -- username Apache -- passwd 123456 $ web # the username and password must have the read and write permissions.

Chmod 757 post-commit # Give it executable right
2. Synchronize directories on servers of multiple versions
Go to the hooks under the version library.
SVN checkout file: // version library directory/local directory to be retrieved
CD/data/SVN/svnroot/www/hookd
VI post-commit

#! /Bin/sh
SVN =/usr/local/subversion/bin/SVN
$ SVN update -- username Apache -- passwd 123456/home # the username and password must have the read and write permissions.

Chmod 757 post-commit # Give it executable right

Note: (pay attention to the red font)
1. SVN checkout file: // directory of the version Library/directory to be retrieved locally --> This step must not be modified synchronously.
2. The directory location must be properly matched. Otherwise, the directory will be exhausted ......


Appendix: problems encountered during installation

1. Less expat library appears during subversion Compilation
Solution: Download expat-2.0.0.tar.gz and install it all.
2. When the Subversion is installed, a section appears at the end of compilation.
Configure: warning: we have configured without bdb filesystem support
Probably, you cannot create database versions in dB format.
Solution: this does not matter, and generally does not have much impact.
3. Make is okay when you install subversion.
/Usr/local/src/subversion-1.5.2/subversion/svnversion /. libs/LT-svnversion: Error while loading shared libraries: libexpat. so.1: cannot open shared object file: no such file or directory
The file libexpat. so.1 cannot be found.
Run whereis libexpat. so.1
Libexpat. So:/lib/libexpat. so.0/usr/local/lib/libexpat. So/usr/local/lib/libexpat. so.1
Solution: VI/etc/lD. So. conf
Add libexpat. so.1 directory/usr/local/lib/Save and quit
Run ldconfig
4. [This problem occurs when I create a single version library] After the installation is complete, open http: // server IP Address/SVN in the browser. The logon page does not appear:
<D: Error> <C: Error/> <m: human-readable errcode = "2"> cocould not open the requested SVN filesystem </m: human-readable> </D: Error>
Solution: The svnpath in <locate SVN> in httpd. conf points to an error and does not indicate the created database.
What I emphasize at the end of Step 4
5. This is an error during installation. ARP cannot be found during subversion installation.
Solution: add it when compiling Subversion
-- With-Apr =/usr/local/APR/bin/apr-1-config
-- With-Apr-util =/usr/local/APR/bin/apu-1-config
6. insert an introduction to the relationship between access methods and Server installation methods:

Http://hi.baidu.com/gyl4802959/blog/item/fcfe7e02cb737a094bfb5196.html

Http://www.cnblogs.com/agileryan/archive/2011/04/05/2005922.html

Related Article

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.