Integrated installation and configuration of Apache and subversion

Source: Internet
Author: User
Tags netbeans

Because of work needs, we need to set up a source code manager working with subversion and Apache. to facilitate collaborative work. so I found some information on the Internet and took some detours while searching for the information. So I sorted out the installation process and some precautions, hope to help you.
The ide I use here is netbeans6.0. In fact, it doesn't matter What ide I use, but netbeans has always been my favorite ide. So I would like to recommend it to you by the way.
Well, let's get down to the truth. The preparation is as follows:
1, apache_2.0.63-win32-x86-no_ssl.msi
Download: http://apache.mirror.phpchina.com/httpd/binaries/win32/apache_2.0.63-win32-x86-no_ssl.msi
2, svn-1.4.5-setup.exe
: Http://subversion.tigris.org/files/documents/15/39559/svn-1.4.5-setup.exe
Of course, you can also choose to install tortoisesvn. But I didn't install it, because my source code management is completed using netbeans.

Now, after downloading the two software, you can start to install it.
Install Apache first. Generally, click Next. When setting domain and host, set it to localhost. You can enter your own email by email, you can also enter one. when installing Apache, note that port 80 on your computer cannot be occupied; otherwise, your HTTP service cannot be started, and I have encountered this problem, because I used Skype, it opened ports 80 and 443 on the local machine to listen, which made me unable to start at first, later, it was discovered that Skype occupied port 80, so after the Skype settings were changed, Apache was reinstalled. after installing Apache, it is already running. You can enter http: // localhost in the address bar of your browser to check whether the installation is successful. If the installation is successful, in this case, a page is displayed in the browser.
Then install svn-1.4.5-setup.exe, which is also very simple. You can click Next step in one step. During the installation process, it selects some options by default, one option is whether to provide support for Apache's HTTP server. This option is checked by default. Do not select it. You can select other options. then SVN declared that the installation was successful. you can try the svn command under cmd. If there is output, it indicates that the installation is successful. If it prompts that SVN is not an internal or external command, it is not a running program or batch processing file. It indicates that the command is not installed or is not added to the path, so the best way is to go to the bin in the svn installation directory and check it.
After both of them are installed, configure them. Of course, the configuration is also the most important.
First, we need to build a data warehouse. We suppose that the data warehouse is built on an Elastic Block Storage (Elastic Block Storage), and it is better not to build a data warehouse on a C disk because the C disk will be reinstalled after the system is reinstalled. first, create a directory named svnroot under the e disk, and then create a directory under the svnroot, for example, myproject. therefore, we have this folder E:/svnroot/myproject under the e disk. Then we use the svnadmin command to convert this folder into our data warehouse. The command is as follows:
Svnadmin create E:/svnroot/myproject
If the operation is successful, nothing is output. At this time, we will go to the myproject folder, we will find several more folders and files, we open the conf folder, and then open svnserve. in the conf file, find the following line # password-DB = passwd, and then remove the # above it, indicating that the myproject requires password verification. but where should we set the password? In this case, open the passwd file under the conf folder and use a text editor. Add the user and password of the person we want to start under [users, for example
[Users]
Hadeslee = hadeslee1234
Tom = 1, 123456
In this case, we started two users, one is hadeslee, the password is hadeslee1234, the other is Tom, and the password is 123456. then we save the passwd file. then, create another file named access. auth, which sets the access permission for this file. The content is as follows:
[Myproject:/]
Hadeslee = RW
[Myproject:/module1]
Tom = RW
Hadeslee = RW
This means that hadeslee in all subdirectories of myproject has the permission to read and write, but Tom only has the permission to read and write the module1 directory under this project, and the access permissions of these sub-directories are more detailed. for settings under the myproject folder, we have come to an end. Now we are setting Apache so that it can work with subvertion.

First, go to the subersion installation directory and enter its bin directory. We will find the following two files:
Mod_authz_svn.so
Mod_dav_svn.so
Copy the two files and paste them to the modules file under the Apache installation directory. Then, open the conf folder under the Apache installation directory and open httpd. CONF file. add the following two rows:
Loadmodule dav_svn_module "C:/program files/subversion/bin/mod_dav_svn.so"
Loadmodule authz_svn_module "C:/program files/subversion/bin/mod_authz_svn.so"
Note: Because dav_svn requires the support of dav_module, make sure that the following line is not commented, and ensure that it is loaded before dav_svn:
Loadmodule dav_module modules/mod_dav.so
The setting of the module is complete. Next we need to set the svn directory so that Apache can know how to access different URLs, where to find the svn directory corresponding to this URL.
Add the following content to the httpd. conf file:
<Location/SVN/myproject>
Dav SVN
Svnpath E:/svnroot/myproject

Authzsvnaccessfile E:/svnroot/myproject/CONF/access. auth
Satisfy any
Require valid-user

Authtype basic
Authname "Subversion repositories"
Authuserfile E:/svnroot/myproject/CONF/users. auth
Require valid-user
</Location>

After adding the above, we will find access. auth was created just now, but users. auth is not created yet. how can I add it. don't worry. Now we will generate users. auth file.

Go to the bin folder of the Apache installation directory and enter the following command:

D:/program files/Apache Group/apache2/bin> htpasswd-CB users. Auth hadeslee hadeslee1234
Automatically using MD5 format.
Adding password for user hadeslee

D:/program files/Apache Group/apache2/bin>

We will find that users is generated in the bin directory. auth, we can see that the hadeslee user name has been added, and the password is encrypted with MD5. then we need to add more users. We can use the following method:
D:/program files/Apache Group/apache2/bin> htpasswd-B users. Auth Tom 123456
Automatically using MD5 format.
Adding password for user Tom

D:/program files/Apache Group/apache2/bin>

Only when the password is generated, a C parameter is removed, because C indicates that such a file is re-generated, and we need to add it for the first time, this C is not needed when we want to add users later. then open users. auth, we will find that both users are already in it. At this time, we put users. auth is moved to E:/svnroot/myproject/CONF/to make the above settings take effect.

At this time, our settings are complete. You can enter http: // localhost/SVN/myproject in the browser to try it out.

If we want to join other projects in the future, there are two solutions:
1. Import future projects to our myproject repository. You don't need to change the configuration.
2. Create a data warehouse, and then put the new <location...> Settings in httpd. conf according to the above steps.
Of course, the authentication file, access permission file, and SVN password must be set again by the above method.

I wish you a successful setup :)

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.