{"id":157,"date":"2023-03-23T09:27:50","date_gmt":"2023-03-23T01:27:50","guid":{"rendered":"https:\/\/www.aqrboyblog.top\/?p=157"},"modified":"2023-05-06T09:43:38","modified_gmt":"2023-05-06T01:43:38","slug":"svn%e5%ae%89%e8%a3%85","status":"publish","type":"post","link":"https:\/\/www.aqrboyblog.top\/?p=157","title":{"rendered":"SVN\u5b89\u88c5 \u4f7f\u7528"},"content":{"rendered":"\n<p><strong>\u91c7\u7528yum\u5b89\u88c5\u65b9\u5f0f\uff1a<\/strong><\/p>\n\n\n\n<p>1\u3001rpm -qa subversion \/\/\u68c0\u67e5\u662f\u5426\u5b89\u88c5\u4e86\u4f4e\u7248\u672c\u7684SVN<\/p>\n\n\n\n<p>2\u3001yum remove subversion \/\/\u5982\u679c\u5b58\u50a8\u65e7\u7248\u672c\uff0c\u5378\u8f7d\u65e7\u7248\u672cSVN<\/p>\n\n\n\n<p>3\u3001\u5f00\u59cb\u5b89\u88c5yum -y install subversion<\/p>\n\n\n\n<p>\u5b89\u88c5\u597d\u540e\u67e5\u770b\u7248\u672csvnserve &#8211;version<\/p>\n\n\n\n<p>4\u3001\u521b\u5efa\u7248\u672c\u4ed3\u5e93\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>mkdir -p \/data\/svn\/myproject                                \nsvnadmin create \/data\/svn\/myproject\/\n<\/code><\/pre>\n\n\n\n<p>\u67e5\u770b\/data\/svn\/myproject \u6587\u4ef6\u5939\u53ef\u4ee5\u53d1\u73b0\u6709conf, db,format,hooks, locks, README.txt\u7b49\u6587\u4ef6\uff0c\u8bf4\u660e\u4e00\u4e2aSVN\u5e93\u5df2\u7ecf\u5efa\u7acb\u3002<\/p>\n\n\n\n<p>5\u3001\u914d\u7f6e\u6743\u9650<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>cd \/data\/svn\/myproject\/conf\/            \/\/\u8fdb\u5165\u914d\u7f6e\u76ee\u5f55\n\nvim svnserve.conf                    \/\/\u7f16\u8f91\u914d\u7f6e\u6587\u4ef6,\u52a0\u5165\u4e0b\u9762\u4e94\u884c\u5185\u5bb9\n\nanon-access = none\nauth-access = write\npassword-db = passwd\nauthz-db = authz\nrealm = \/data\/svn\/myproject<\/code><\/pre>\n\n\n\n<p>6\u3001\u7f16\u8f91\u5bc6\u7801\u6587\u4ef6,\u6dfb\u52a0\u7528\u6237admin\u5bc6\u7801123456\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>vim passwd  \n\nlocaluser = 123456\ndefaultuser = 123456<\/code><\/pre>\n\n\n\n<p>7\u3001\u7f16\u8f91\u6743\u9650\u6587\u4ef6\uff0c\u6dfb\u52a0\u7528\u6237test\u6743\u9650<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>vim authz\n\n&#91;groups]\nroot = defaultuser \n# harry_and_sally = harry,sally\n# harry_sally_and_joe = harry,sally,&amp;joe\n&#91;\/]\n@root = rw\nlocaluser = rw<\/code><\/pre>\n\n\n\n<p>8.\u542f\u52a8SVN<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># svn\u7aef\u53e3\u9ed8\u8ba4\u662f3690 \u8fd9\u91cc\u4f7f\u752810102\nsvnserve -d  --listen-port 10102  -r  \/data\/svn\/   <\/code><\/pre>\n\n\n\n<p><strong>\u4e8c\u3001\u7ed9svn\u6dfb\u52a0\u94a9\u5b50\u540c\u6b65\u6587\u4ef6\u5230PHP\u6d4b\u8bd5\u73af\u5883 \uff08\u8fd9\u91ccPHP\u9879\u76ee\u76ee\u5f55\u4e3a\/var\/www\/html\/project\/\uff09<\/strong><\/p>\n\n\n\n<p>1\u3001\u8fdb\u5165\u7248\u672c\u5e93\u4e0b\u7684hooks\u76ee\u5f55<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>cd \/data\/svn\/hooks\/<\/code><\/pre>\n\n\n\n<p>2\u3001\u5c06post-commit.tmpl \u590d\u5236\u4e3a post-commit<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>cp post-commit.tmpl post-commit<\/code><\/pre>\n\n\n\n<p>\u7ed9post-commit\u53ef\u6267\u884c\u6743\u9650<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>chmod 0777 post-commit<\/code><\/pre>\n\n\n\n<p>4\u3001\u7f16\u8f91post-commit\uff0c\u6ce8\u91ca\u6389#mailer.py&#8230;&#8230;\u8fd9\u4e00\u884c\uff0c\u6dfb\u52a0\u4e0b\u9762\u56db\u884c\uff0c\u7f16\u7801\u95ee\u9898\uff0c\u5982\u679c\u9519\u8bef\u7684\u8bdd\u53ef\u80fd\u5bfc\u81f4\u65e0\u6cd5\u540c\u6b65 \u6210\u529f\uff0c\u53ef\u9009\u7684\u6709en_US.UTF-8\u3001zh_CN.UTF-8\u3001zh_CN.GB2312\uff0c\u53ef\u4ee5\u4e00\u4e2a\u4e2a\u8bd5\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>vi post-commit\n\n#mailer.py commit \"$REPOS\" \"$REV\" \/path\/to\/mailer.conf\nexport LC_ALL=en_US.UTF-8\nSVN=\/usr\/bin\/svn\nSTATIC_DIR=\/www\/wwwroot\/\n${SVN} update  ${STATIC_DIR} --username \"localuser\" --password \"123456\"<\/code><\/pre>\n\n\n\n<p>5\u3001\u5728\u63d0\u4ea4\u4e4b\u524d\uff0c\u8fdb\u884c\u4e00\u6b21checkout\u4ee3\u7801\u5230\u6307\u5b9a\u76ee\u5f55<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>svn checkout svn:\/\/localhost\/ \/www\/wwwroot\/<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>5\u3001\u67e5\u770b \u5173\u95ed\u8fdb\u7a0b <\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>ps -aux | grep svnserve\n kill -9 \u7aef\u53e3\u53f7\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">\u4e09.\u8bbe\u7f6e\u5f00\u673a\u542f\u52a8<\/h3>\n\n\n\n<p>\u67e5\u770b\u670d\u52a1 ps aux|grep svnserve<\/p>\n\n\n\n<p>\u67e5\u770b pid\u4e0b\u9762\u4f1a\u7528\u5230  pidof svnserve<\/p>\n\n\n\n<p>\u6253\u5f00 svnserve.pid \u6dfb\u52a0\u4e0a\u9762\u7684pid <\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>vi \/run\/svnserve\/svnserve.pid\ncat svnserve.pid<\/code><\/pre>\n\n\n\n<p>\u7f16\u8f91 svnserve.service \u66ff\u6362ExecStart\u5185\u5bb9 <\/p>\n\n\n\n<pre id=\"block-d614e071-c042-4a11-8e81-9fd9dafc2d9f\" class=\"wp-block-code\"><code><\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>vim  \/lib\/systemd\/system\/svnserve.service\nExecStart=\/usr\/bin\/svnserve --daemon --pid-file=\/run\/svnserve\/svnserve.pid -d --listen-port 10102 -r \/data\/svn<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"800\" height=\"301\" src=\"https:\/\/www.aqrboyblog.top\/wp-content\/uploads\/2023\/05\/\u5fae\u4fe1\u622a\u56fe_20230506093408.png\" alt=\"\" class=\"wp-image-278\" srcset=\"https:\/\/www.aqrboyblog.top\/wp-content\/uploads\/2023\/05\/\u5fae\u4fe1\u622a\u56fe_20230506093408.png 800w, https:\/\/www.aqrboyblog.top\/wp-content\/uploads\/2023\/05\/\u5fae\u4fe1\u622a\u56fe_20230506093408-600x226.png 600w, https:\/\/www.aqrboyblog.top\/wp-content\/uploads\/2023\/05\/\u5fae\u4fe1\u622a\u56fe_20230506093408-300x113.png 300w, https:\/\/www.aqrboyblog.top\/wp-content\/uploads\/2023\/05\/\u5fae\u4fe1\u622a\u56fe_20230506093408-150x56.png 150w, https:\/\/www.aqrboyblog.top\/wp-content\/uploads\/2023\/05\/\u5fae\u4fe1\u622a\u56fe_20230506093408-768x289.png 768w\" sizes=\"auto, (max-width: 800px) 100vw, 800px\" \/><\/figure>\n\n\n\n<p>svnserve.service \u670d\u52a1<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>systemctl enable svnserve.service #\u5f00\u673a\u81ea\u542f\nsystemctl start svnserve.service #\u542f\u52a8\u670d\u52a1\nsystemctl stop svnserve.service #\u505c\u6b62\u670d\u52a1\nsystemctl status svnserve.service #\u505c\u6b62\u670d\u52a1<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p class=\"text-justify\">\u91c7\u7528yum\u5b89\u88c5\u65b9\u5f0f\uff1a 1\u3001rpm -qa s [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-157","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/www.aqrboyblog.top\/index.php?rest_route=\/wp\/v2\/posts\/157","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.aqrboyblog.top\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.aqrboyblog.top\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.aqrboyblog.top\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.aqrboyblog.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=157"}],"version-history":[{"count":18,"href":"https:\/\/www.aqrboyblog.top\/index.php?rest_route=\/wp\/v2\/posts\/157\/revisions"}],"predecessor-version":[{"id":282,"href":"https:\/\/www.aqrboyblog.top\/index.php?rest_route=\/wp\/v2\/posts\/157\/revisions\/282"}],"wp:attachment":[{"href":"https:\/\/www.aqrboyblog.top\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=157"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.aqrboyblog.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=157"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.aqrboyblog.top\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=157"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}