Apache + subversion + centos

Source: Internet
Author: User
Tags svn client ssh access tortoisesvn
I. first introduce the relationship between subversion and Apache, APR, and APR-util.


Many of my friends did not understand the relationship between subversion and Apache when they first came into contact with subversion.
Here I will briefly describe how to install the svn server and client.

1.1 servers


The Subversion server does not require Apache, but you can use Apache to select it based on the actual situation.
1. If you only need to access the service through file: // or SVN: //, you only need to install SVN without using Apache and use svnserve as the service.
2. If you want to create a version database server that can be accessed through http: // or https: //, you need to use Apache.

1.2 Client


In Windows, no matter what type of server you want to access, you only need to install tortoisesvn. The developer has done everything for you.
In a Linux-like system, if you access it through file: // or SVN: //, you only need to compile and install SVN,
If it is accessed through http: //, it must be compiled with neon,
If you use https: // for access, you need to compile it with SSL-supported neon,
In any case, it must be compiled with APR and APR-util.
Bytes
For access to foreign sites slow friends, download subversion and client, you can go to the http://www.iUseSVN.com, because of limited bandwidth and traffic, the website is only open to registered users to download, this is a bit of trouble, but it is worth it, first, the download speed is indeed quite fast, and second, there are many subversion fans who are interested in communicating with you.

Ii. Erection

 

2.1 First, prepare the relevant installation packages. Here I use the following packages


APR: apr-1.5.0.tar.gz and apr-util-1.5.3.tar.gz
Apache: httpd-2.4.6.tar.gz
Subversion: subversion-1.7.14.tar.gz
Note: Apache and subversion versions are sometimes incompatible, if it is not compatible, we recommend that you replace the subversion or apache version. During the installation process, you may be prompted to install other packages and install the required packages according to the actual situation, if the installation process is successful, you are lucky!

2.2 installation and configuration steps: 1. Install the apr-1.2.12
# Tar-zvxf apr-1.5.0.tar.gz # cd apr-1.5.0.tar.gz #./configure -- prefix =/Server/APR # Install to/Server/APR # Make & make install by default when the path is not specified

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=/server/apr --prefix=/server/apu # make & make install

3. Install httpd-2.4.6.tar.gz

# tar -zxvf httpd-2.4.6.tar.gz# cd httpd-2.4.6./configure --prefix=/server/apache --enable-mods-shared=most --enable-so --enable-module=so --enable-cache --enable-file-cache --enable-mem-cache --enable-disk-cache --enable-ssl --enable-dav --enable-maintainer-mode --with-ssl=/usr/include/openssl --with-apr=/server/apr/bin/apr-1-config --with-apr-util=/server/apr-util/bin/apu-1-config --with-pcre=/server/pcre --with-mpm=prefork # make & make install

4. install and configure Subversion

# tar -zxvf subversion-1.7.14.tar.gz
# ./configure --prefix=/server/svnserver --with-apxs=/server/apache2/bin/apxs --with-apr=/server/apr/bin/apr-1-config --with-apr-util=/server/apu/bin/apu-1-config --with-ssl --enable-maintainer-mode --with-zlib --with-sqlite=/server/sqlite --without-berkeley-db# make && make install

Note: The -- enable-so and -- enable-Dav parameters of Apache must be included. Otherwise, an error is reported during SVN startup,


Check whether SVN is successfully installed.

#/server/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.soLoadModule authz_svn_module modules/mod_authz_svn.so

If the Apache configuration file HTTP. conf does not have these two lines. Go to the svn installation directory and copy the mod_dav_svn.so and mod_authz_svn.so files (these two files are generated during the svn compilation process) to create a version library.

#/Server/SVN/bin/svnadmin create/SVN/project/www/* create a repository "www" # ls/SVN/project/www/* check whether the repository has 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.

#/Server/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/Server/Apache/CONF/httpd. conf
Add
Dav SVN
Svnparentpath/SVN/Project (configure your version library root directory here) -- note that this is not svnpath
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
#/Server/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:
#/Server/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:
#/Server/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.


#/Server/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
#/Server/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.

Iii. Appendix:


In Linux, run the command line to check whether Apache is installed, path, and version.
SSH access to remote Linux. How can I check whether Apache is installed, the installation path, and the current version.
If you are asking about the automatic installation of Apache in Linux, you can directly use the apachectl-V command. If you do not have this method, you can know that the system has not installed Apache, if you have already installed Apache, the Apache version is displayed. You can use apachectl-C to check the installation directory.
The prerequisites for using apachectl also require you to know the full path of Apache source code installation, which is generally/Server/apache2/bin/apachectl. If the RPM package is used for installation, you can check whether the rpm-Q httpd has been installed.

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.