Set up the svn server in ubuntu and automatically update it to the web server ., Ubuntusvn

Source: Internet
Author: User

Set up the svn server in ubuntu and automatically update it to the web server ., Ubuntusvn

<Span style = "font-family: Arial, Helvetica, sans-serif; background-color: rgb (255,255,255);"> I have found many tutorials online, but I tried a lot. It is slightly rough and has many problems. After three days, we finally got it done. Let me sort it out and send it to you. We hope that Tao friends who have the same needs will take less detours. If you have any questions, please leave a message below. </Span>
<span style="font-family: Arial, Helvetica, sans-serif; background-color: rgb(255, 255, 255);"></span>
Operating System: elementary OS (a branch under Ubuntu)
Current Environment: lamp is installed (the directory of the web server is/var/www/), and svn server is installed (the startup script is in/usr/bin/svn)


Create a code repository

svnadmin create /home/svn/project  --fs-type fsfs

Three folders are generated under the project directory, and the conf directory contains three files: authz, passwd, and svnserve.
Authz
-------- Record the user's access permissions to each project in the warehouse (a warehouse may have multiple projects ).
Add the following content under [groups:
User Group name = user 1, user 2... [project:/] // root directory of the Repository @ user group name = rw // indicates permission * =

Example:

Test = chrisdowson, test [project:/] @ test = rw * = (<span style = "color: # ff0000;"> do not leave spaces on both sides of the equal sign, for example: test = chrisdowson, test </span>)

Passwd------- Stores the user name and password
Username = password .....

Example:

Test = 123456 chrisdowson = 123456 (<span style = "color: # ff0000;"> do not leave spaces on both sides of the equal sign, for example, test = 123456 </span>)

Svnserve ----- stores the path to verify the permission and password when the user attempts to log on (the usual path refers to the two files above), find each of the following options to remove the previous #

Anon-access = noneauth-access = writepassword-db = absolute path of the passwd file authz-db = absolute path of the authz file (spaces cannot be left at the beginning of each line)


Example:

anon-access=noneauth-access=writepassword-db=/home/svn/project/conf/passwdauthz-db=/home/svn/project/conf/authz



Start the server svnserve-d-r/home/svn (note that the path here is not the repository address yet. No project) I can't figure it out. I guess there may be multiple warehouses, so we need to start all the warehouses at each startup. If svnserve is prompted: server socket cannot be bound: if the address is already in use, use the killall svnserve command to kill the previous svnserve process and then run the preceding command again.

Then use svn co svn: // server IP Address/project to perform a test. If you can obtain it, it indicates that the build is successful.



Now we need to implement svn to automatically update the web server.


The current version of checkout in the web server directory. Then add a script to the post-commit file in the hooks folder of the svn project: Use the vi command to edit a new post-commit (it is clear that there is no suffix) do not use the post-commit file that comes with the hooks folder. Add the following content to the file:
#! /Bin/shWEB =/var/www/test // The project under the web server cannot have spaces. Export LANG = en_US.UTF-8svn update $ WEB -- username chrisdowson -- password 123456 // equivalent to the windows client update <span style = "font-family: Arial, Helvetica, sans-serif; background-color: rgb (255,255,255); "> operation (if you cannot determine whether the shell script you have written is wrong, run it in the hooks directory. /post-commit) </span>

Then grant the execution permission to the file chmod + x post-commit.

Now, we have achieved success. In win, we can use a turtle test to upload files to the server and check whether there are any changes on the web server.


Ps: I started linux for more than a week. I have no deep understanding of permissions and some commands. You can leave a message if you have any questions or suggestions. I'm also curious!

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.