There are a lot of online materials, but there are very few excellent products. Most of the Step documents are repeated, and some documents are still missing steps, leading to various installation problems.
This step-by-step document takes a lot of time to view materials online. Of course, it is mainly written in conjunction with your own installation process. I am not a master or a master, but I only want to cook a dish. The document is to record some of my learning results, and the second is to help people who encounter problems,ArticleThere may be relatively low-level sayings and technical errors, and so on. People who want to see them can leave an axe to make a comment.
If this document enables you to build the svn server after reading it, my task will be completed. (We all know that the process of building swords in ancient times is very good. Why is it lost? because many masters keep their hands, the more technology they leave, and the more they finally destroy it? It is a pity that everyone understands it, technology advances only when shared discussions are held! Of course, except for special industries, there are also special means to share and compare, and there is no improvement in closed doors)
Start
Installation environment
Ubuntu-desktop: 11.10
Virtualbox
1. Install the corresponding package
Sudo apt-Get install sub version libapache2-svn apache2
Of course you canSource codeCompile and install the software, pay tribute to all manual users, and pay close attention to the troubles of making.
2. Create a warehouse parent directory
Sudo mkdir/SVN
A. I created the myproject folder manually at the beginning. The browser reports the error "can not open SVN filesystem, if you carefully read the Apache Error Log, it is found that Apache will find a file named format. Because it is manually created, an error is reported if it does not exist. B. If you are creating a version library in an existing Directory, you do not need this step. For example: sudo svnadmin create/home/myproject)
3. Edit the configuration file
Sudo gedit/etc/apache2/mod-enabled/dav_svn.conf
(Or vim and Vim are used to reading)
<Location/SVN> Dav SVN # svnpath/SVN svnparentpath/svnauthtype basicauthname "Subversion repository" authuserfile/etc/apache2/dav_svn.passwd require valid-user </location> (note)
*** Important:Remove the comment '#' At the end of </location>. Otherwise, an error is returned. These are used by pairing.
Note that quotation marks are English characters. errors are reported for Chinese characters.
Note: (Row 2-3: At the beginning, the svn file system and 403forbidden errors cannot be read because this step is not clearly understood. As described in the document, only one of these two parameters is set and should not be used at the same time; if svnpath is used, you must specify the exact repository location. For example:/SVN/myproject. If svnparentpath is used, you can specify the parent directory. For example:/SVN, in addition, multiple repositories can be defined below. To make the parent directory visible, you must configure the directory permission in the svn permission file)
(Lines 4-6: these three lines are used for basic verification. Remove the '#' comment and remove the leading space of the line. In fact, this is not the case here, however, some configuration files are sensitive to spaces at the beginning of the line, such as the configuration file authz .)
3.2 view service running status
A, SVN: svnserve -- version if SVN is started, the version information is displayed.
B, apache2: browser address: http: // localhost
The result is: It works!
(If it cannot be run, check the directory permission CHMOD and pay attention to SELinux in centos. It is best to disable it first. Of course, if you want to use SELinux, you need to set a special file tag, it seems like this. Please refer to the relevant documentation)
4. Create a repository USER command
The command I saw in a reference document for a foreign language (refer to document 4) is htpasswd2, but it is not found in ubuntu11.10. It may be a version issue. I hope you can give me some advice.
Example:
Note: This command may not be available for htpasswd2. Replace it with htpasswd.
Sudo htpasswd2-CM/etc/apache2/dav_svn.passwd air
Return Value: new password:
Re-type new password:
Adding password for user air
=================================== ==========
5. Add a User Password File
Sudo htpasswd-C/etc/subversion/dav_svn.passwd air (current system user name) sudo htpasswd/etc/subversion/dav_svn.passwd www-Data
(Air is the current system user name, www-data is the Apache user name and group name under Ubuntu, centos series is Apache, and the service name is different, Ubuntu is called apache2, centos is called httpd)
* ** Note: The difference between the two commands is that one has-C, and the first time you create a user password, you need to create a file, so you need to add a-c parameter. You can add the user to this file. The hacker will prompt you to enter the password.
============================================== ==================
5. continue adding users
To add more users, run the following command:
Sudo htpasswd/etc/subversion/dav_svn.passwd otherusers
* ** Tip: do not set the-C parameter. Otherwise, the password file will be re-created, and the original user will be lost. At the same time, the location and name of these password files are self-developed, you only need to make the configurations consistent.
6. Create a version Library
Sudo mkdir/SVN (see the previous section 2, which has been done)
Correct method:
Sudo svnadmin create -- FS-type fsfs/SVN/myprojectsudo chown-r www-data.subversion/SVN/myproject
(Usually the root group, must be changed to the Subversion Group)
* Tip: I didn't configure the -- FS-type parameter in the early system, but now I want to configure it. Otherwise, the cocould not open the requested SVN filesystem error is prompted, the format file in the repository cannot be correctly generated. This parameter is normal after being added. Generally, fsfs is used by default and Berkely dB is not used.
Chmod-r g + RWS/SVN/myproject
(This step is important, otherwise the 403 error will not be reported for the permission)
7. Import to database
Sudo SVN import-M myproject/home/air/test file: // SVN/myproject
The previous version library may be incorrect. Therefore, the log information path is duplicated and the reconstruction version library is deleted:
Example:
Rm-RF/SVN/mytew.kdir-P/SVN/myprojectsvnadmin create/SVN/myproject
Create a version Library
Chown-r www-data.subversion myproject/
(Change the user group. Otherwise, insufficient permissions will be reported during subsequent import)
Import
SVN import-M test/home/air/test/http: // localhost/SVN/myproject
Command return:
P11-kit: Couldn't load module:/usr/lib/i386-linux-gnu/pkcs11/gnome-keyring-pkcs11.so:/usr/lib/i386-linux-gnu/pkcs11/gnome-keyring-pkcs11.so: Unable to open shared object file: there is no file or directory
Certification field: "Air" password:
Add/home/air/test/winetricks
Add/home/air/test/his
-----------------------------------------------------------------------
Note! Your password, for the authentication domain:
<Http: // localhost: 80> subversion Repository
Only files on disks can be stored in plain text! If possible, consider configuring your system to make Subversion
You can save the encrypted password. See the documentation for details.
You can set the option "store-plaintext-passwords" to "yes" or "no" in "/root/. Subversion/servers ",
To avoid this warning again.
-----------------------------------------------------------------------
Save Unencrypted Password (Yes/No )? No
The submitted version is 1.
The system prompts that the library file is missing. I may not have installed the corresponding package. It should be encrypted. SVN prompts that you can configure document 1 to obtain an encrypted storage disk. If not, plaintext is stored on the disk. Currently, this document does not support this operation. You are welcome to confirm this operation.
8. Restart Apache
Sudo/etc/init. d/apache2 restart or service apache2 restart
(Centos is httpd, saying that these two series of Linux are driving people crazy. AI, originally had a strong rival Windows, and split itself internally)
9. Now you can access
Http: // localhost/SVN/myproject/
Appendix: Use the IP address of this server in the production environment: IP/SVN/myproject
Common Errors:
1. the browser prompts:
Can not open SVN filesystem (to this effect)
Solution:
View the apache2 log file, which is usually in/var/log/apache2/error. log (centos may be different) will prompt, the general record is that the format file cannot be found, that is, there is no format file in your version library and a series of configuration files, the reason is that your svnadmin create/Your/repos/path initialization command is not correctly executed or meters are executed. Delete the version library and execute it again, if you do not delete it, you may encounter 3rd problems when executing the command again.
2. the browser prompts you That the 403 Forbidden error is returned. The corresponding/XXX/xxx directory cannot be accessed.
Solution:
A. You must enter the correct path and configure the access permission for the parent directory when accessing a path that is not your version library or the parent directory;
B. If your path is correct, check whether the user group in your version library directory is the svn user group and whether the permissions are correct. Use chown and CHMOD commands to modify the permissions, in this way, you should be able to access it correctly.
3. When you use the import command, the log information is path name, XXXXXXXX, and a large number of prompts are required to use -- force-log.
Solution:
This error is caused by the build of the version library. As for why, I have not understood it and there are not many online materials. I hope you can give me some advice, this error occurs when the old database version is deleted and the problem disappears after the database is created again.
4. If the "can't open file"/SVN/myproject/xxx-current-lock': Permission denied error occurs during the use of the import command
Cause:
Apache has no permission for the directory you created.
Solution:
Naturally, you should confirm the user group and permissions of the directory. Use chown and CHMOD commands to modify them. We recommend that you change it to 775. You can also add www-data to the directory to create a user group (centos Apache running user is Apache)
* ** If you still receive the 403 and cannot open SVN filesystem prompts after you confirm the preceding error:
*** important:
if your 403 and can not open SVN filesystem still appear after the above settings?
most of them are due to errors in your configuration file ,.
sudo gedit/etc/apache2/mods-enabled/dav_svn.conf
svnpath and svnparentpath have many differences, generally, if you want to create multiple version libraries in the parent directory, you need to use svnparentpath. If you want to use a version library, svnpath is suitable for you. If you use svnparentpath, if it is set to/SVN/myproject (the example in this article), it is a pity that the above 1 error must be reported because this is the value of svnpath,
:
svnpath:/SVN/myproject (/SVN error)
# svnparentpath:/SVN (/SVN/myproject error)
only one parameter can be configured.
5. access from the local machine is correct. Other machines cannot access SVN.
According to this document, the path to the password format file generated by the USER command is:
Sudo htpasswd-C/etc/subversion/dav_svn.passwd air
In fact, the correct method is the/etc/apache2/dav_svn.passwd user name. If the user is not created for the first time, the-C option should be removed. Otherwise, only the last user in the file is executed.
If you have already generated a password in subversion, copy it.
This article can be added at any time.
Reference:
Http://indian.blog.163.com/blog/static/108815820071127921148/
Http://www.svnforum.org/threads/31143-Forbidden-access-or-bad-repository
Http://blog.lixiphp.com/svn-could-not-open-the-requested-svn-filesystem-and-403-forbidden
Http://www.iteye.com/topic/293540