Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to build svn environment in Linux system?

2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/03 Report--

The following is to introduce the Linux server to build a svn environment, I hope it is also helpful to the friends who need it!

1. Install the svn server

Sudo apt-get install subversion

2. Install the local client of svn in ubuntu

Sudo apt-get install libapache2-svn

3. Create a folder svn under the root directory home as the root directory of svn

Sudo mkdir / home/svn

4. Set up a ubuntu user group and an administrator

Sudo adduser svnuser (pick a user name here) sudo addgroup svngroup (here is a user group) sudo addgroup svnuser svngroup (add a user to a user group)

5. Then create a svn repository under the root directory of svn, and name it casually, such as pro

Sudo mkdir / home/svn/pro

6. Assign the permissions of the user group created above to the repository pro.

Sudo chown-R root:svngroup / home/svn/prosudo chmod-R g+rws / home/svn/pro

7. Import resources into the repository

Sudo svnadmin create / home/svn/pro

8. Enter the repository / home/svn/pro, and you can see several folders. Open the conf folder.

Svnserve.conf is the configuration file for svn passwd is the user file for svn authz is the permissions file for svn

9. Open svnserve.conf first, remove the # in front of the content, and check whether the following content matches or not.

Sudo gedit / home/svn/pro/conf/svnserve.conf- [general] anon-access = read (this is anonymous access, read-only) auth-access = write (this is authorized to operate, writable) password-db = passwd (this is the name of the user file, corresponding to the passwd of 8) auth-db = authz (this is the name of the user permissions file Authz corresponding to 8) realm = my project (this is the alias displayed during access, and you can name it as you like)

10. Open the passwd file to add a svn user, and add admin=123456 under [users].

Sudo gedit / home/svn/pro/conf/passwdadmin is the user name 123456 is the password

11. Open the authz file and add access rights to the user just now

Sudo gedit / home/svn/pro/conf/ authz [groups] root= admin (define a permission group root, add admin users to the permission group root) [/] @ root=rw (read-write permission for all users in root) * = r (read-only access for all other anonymous users)

12. Restart svn

Sudo killall svnservesudo svnserve-d-r / home/svn

13. Check the ip address of the local ubuntu

Sudo ifconfig

You can see 192.168.please. Please *

14. Then the svn of the virtual machine can be accessed on the local area network in our window host. I believe everyone has the tool of TortoiseSVN. Just write svn://192.168.***.***/pro in the address bar. Users can upload several test files, such as index.php, and write some php code to upload them for the admin=123456 established above.

15. At this time, php cannot be parsed to the resource index.php in our svn, so it is necessary to put the text in the svn repository

Synchronize it to the apache+php access directory of ubuntu and create a folder under / var/www/html

Sudo mkdir / var/www/html/bbssudo chmod-R 777 / var/www/html/bbssudo svn co svn://192.168.***.***/pro / var/www/html/bbs

16. Then we can visit http://192.168.***.***/bbs on the window host to see the contents of index.php, and then we need to let apache automatically synchronize the changed contents of svn's repository in order to achieve our effect.

There are many files ending in tmpl in the / home/svn/pro/hooks directory. Find post-commit.tmpl and use the command

Cd / home/svn/pro/hookssudo cp post-commit.tmpl post-commitsudo chmod + x post-commitsudo gedit post-commit

After opening the file, we see that the last few lines do not add #, add # to them all, because this is an example of sending mail, we can't use it, log them all out, and then add this code to the last line.

Svn up / var/www/html/bbs-username=admin-password=123456

So as long as we upload files from window to svn's repository, apache will automatically synchronize these files to our bbs folder, and then access our project in the address bar. In addition, very rarely, if there is a problem with the Chinese display, you can add export.UTF8 to the svn up code and try again.

These are the details of how to build a svn environment for Linux servers. Please pay more attention to other related articles!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report