{"id":240,"date":"2013-03-02T12:10:31","date_gmt":"2013-03-02T11:10:31","guid":{"rendered":"http:\/\/blog.rabahi.net\/?page_id=240"},"modified":"2014-08-24T16:45:59","modified_gmt":"2014-08-24T14:45:59","slug":"mercurial","status":"publish","type":"page","link":"https:\/\/blog.rabahi.net\/?page_id=240","title":{"rendered":"Mercurial"},"content":{"rendered":"<h1>Prerequiste<\/h1>\n<p>I assume that you have a Centos installation.<\/p>\n<h1>Installation<\/h1>\n<p>You can copy\/paste this script and use it to configure automatically your server.<\/p>\n<pre class=\"bash\" style=\"font-family:monospace;\"><ol><li style=\"background: #fcfcfc;\"><div style=\"font-size: 12px;\"><span style=\"color: #666666; font-style: italic;\">#!\/bin\/bash<\/span><\/div><\/li><li style=\"background: #f0f0f0;\"><div style=\"font-size: 12px;\">&nbsp;<\/div><\/li><li style=\"background: #fcfcfc;\"><div style=\"font-size: 12px;\"><span style=\"color: #7a0874; font-weight: bold;\">echo<\/span> <span style=\"color: #ff0000;\">&quot;install tools mercurial, mod_wsgi&quot;<\/span><\/div><\/li><li style=\"background: #f0f0f0;\"><div style=\"font-size: 12px;\">dnf <span style=\"color: #660033;\">-y<\/span> <span style=\"color: #c20cb9; font-weight: bold;\">install<\/span> mercurial mod_wsgi<\/div><\/li><li style=\"background: #fcfcfc;\"><div style=\"font-size: 12px;\">&nbsp;<\/div><\/li><li style=\"background: #f0f0f0;\"><div style=\"font-size: 12px;\"><span style=\"color: #7a0874; font-weight: bold;\">echo<\/span> <span style=\"color: #ff0000;\">&quot;create trees in \/opt\/hg&quot;<\/span><\/div><\/li><li style=\"background: #fcfcfc;\"><div style=\"font-size: 12px;\"><span style=\"color: #c20cb9; font-weight: bold;\">mkdir<\/span> <span style=\"color: #660033;\">-p<\/span> <span style=\"color: #000000; font-weight: bold;\">\/<\/span>opt<span style=\"color: #000000; font-weight: bold;\">\/<\/span>hg<span style=\"color: #000000; font-weight: bold;\">\/<\/span>cgi-bin<\/div><\/li><li style=\"background: #f0f0f0;\"><div style=\"font-size: 12px;\"><span style=\"color: #c20cb9; font-weight: bold;\">mkdir<\/span> <span style=\"color: #660033;\">-p<\/span> <span style=\"color: #000000; font-weight: bold;\">\/<\/span>opt<span style=\"color: #000000; font-weight: bold;\">\/<\/span>hg<span style=\"color: #000000; font-weight: bold;\">\/<\/span>repos<\/div><\/li><li style=\"background: #fcfcfc;\"><div style=\"font-size: 12px;\"><span style=\"color: #c20cb9; font-weight: bold;\">mkdir<\/span> <span style=\"color: #660033;\">-p<\/span> <span style=\"color: #000000; font-weight: bold;\">\/<\/span>opt<span style=\"color: #000000; font-weight: bold;\">\/<\/span>hg<span style=\"color: #000000; font-weight: bold;\">\/<\/span>bin<\/div><\/li><li style=\"background: #f0f0f0;\"><div style=\"font-size: 12px;\">&nbsp;<\/div><\/li><li style=\"background: #fcfcfc;\"><div style=\"font-size: 12px;\"><span style=\"color: #7a0874; font-weight: bold;\">echo<\/span> <span style=\"color: #ff0000;\">&quot;copy hgweb.cgi to \/opt\/hg\/cgi-bin&quot;<\/span><\/div><\/li><li style=\"background: #f0f0f0;\"><div style=\"font-size: 12px;\"><span style=\"color: #c20cb9; font-weight: bold;\">cp<\/span> <span style=\"color: #000000; font-weight: bold;\">\/<\/span>usr<span style=\"color: #000000; font-weight: bold;\">\/<\/span>share<span style=\"color: #000000; font-weight: bold;\">\/<\/span>doc<span style=\"color: #000000; font-weight: bold;\">\/<\/span>mercurial-2.6.2<span style=\"color: #000000; font-weight: bold;\">\/<\/span>hgweb.cgi <span style=\"color: #000000; font-weight: bold;\">\/<\/span>opt<span style=\"color: #000000; font-weight: bold;\">\/<\/span>hg<span style=\"color: #000000; font-weight: bold;\">\/<\/span>cgi-bin<\/div><\/li><li style=\"background: #fcfcfc;\"><div style=\"font-size: 12px;\"><span style=\"color: #c20cb9; font-weight: bold;\">chmod<\/span> a+x <span style=\"color: #000000; font-weight: bold;\">\/<\/span>opt<span style=\"color: #000000; font-weight: bold;\">\/<\/span>hg<span style=\"color: #000000; font-weight: bold;\">\/<\/span>cgi-bin<span style=\"color: #000000; font-weight: bold;\">\/<\/span>hgweb.cgi<\/div><\/li><li style=\"background: #f0f0f0;\"><div style=\"font-size: 12px;\">&nbsp;<\/div><\/li><li style=\"background: #fcfcfc;\"><div style=\"font-size: 12px;\"><span style=\"color: #7a0874; font-weight: bold;\">echo<\/span> <span style=\"color: #ff0000;\">&quot;configure \/opt\/hg\/cgi-bin\/hgweb.cgi&quot;<\/span><\/div><\/li><li style=\"background: #f0f0f0;\"><div style=\"font-size: 12px;\"><span style=\"color: #c20cb9; font-weight: bold;\">sed<\/span> <span style=\"color: #660033;\">-i<\/span> <span style=\"color: #ff0000;\">&quot;s\/^\\(config\\s*=\\).*\/\\1<span style=\"color: #000099; font-weight: bold;\">\\&quot;<\/span>\\\/opt\\\/hg\\\/cgi-bin\\\/hgweb.config<span style=\"color: #000099; font-weight: bold;\">\\&quot;<\/span>\/&quot;<\/span> <span style=\"color: #000000; font-weight: bold;\">\/<\/span>opt<span style=\"color: #000000; font-weight: bold;\">\/<\/span>hg<span style=\"color: #000000; font-weight: bold;\">\/<\/span>cgi-bin<span style=\"color: #000000; font-weight: bold;\">\/<\/span>hgweb.cgi<\/div><\/li><li style=\"background: #fcfcfc;\"><div style=\"font-size: 12px;\">&nbsp;<\/div><\/li><li style=\"background: #f0f0f0;\"><div style=\"font-size: 12px;\"><span style=\"color: #7a0874; font-weight: bold;\">echo<\/span> <span style=\"color: #ff0000;\">&quot;create file \/opt\/hg\/cgi-bin\/hgweb.config&quot;<\/span><\/div><\/li><li style=\"background: #fcfcfc;\"><div style=\"font-size: 12px;\"><span style=\"color: #c20cb9; font-weight: bold;\">cat<\/span> <span style=\"color: #000000; font-weight: bold;\">&gt;<\/span> <span style=\"color: #000000; font-weight: bold;\">\/<\/span>opt<span style=\"color: #000000; font-weight: bold;\">\/<\/span>hg<span style=\"color: #000000; font-weight: bold;\">\/<\/span>cgi-bin<span style=\"color: #000000; font-weight: bold;\">\/<\/span>hgweb.config <span style=\"color: #000000; font-weight: bold;\">&lt;&lt;<\/span> <span style=\"color: #ff0000;\">&quot;EOF&quot;<\/span><\/div><\/li><li style=\"background: #f0f0f0;\"><div style=\"font-size: 12px;\"><span style=\"color: #7a0874; font-weight: bold;\">[<\/span>paths<span style=\"color: #7a0874; font-weight: bold;\">]<\/span><\/div><\/li><li style=\"background: #fcfcfc;\"><div style=\"font-size: 12px;\">myrepos = <span style=\"color: #000000; font-weight: bold;\">\/<\/span>opt<span style=\"color: #000000; font-weight: bold;\">\/<\/span>hg<span style=\"color: #000000; font-weight: bold;\">\/<\/span>repos<span style=\"color: #000000; font-weight: bold;\">\/**<\/span><\/div><\/li><li style=\"background: #f0f0f0;\"><div style=\"font-size: 12px;\">&nbsp;<\/div><\/li><li style=\"background: #fcfcfc;\"><div style=\"font-size: 12px;\"><span style=\"color: #7a0874; font-weight: bold;\">[<\/span>web<span style=\"color: #7a0874; font-weight: bold;\">]<\/span><\/div><\/li><li style=\"background: #f0f0f0;\"><div style=\"font-size: 12px;\">style = paper<\/div><\/li><li style=\"background: #fcfcfc;\"><div style=\"font-size: 12px;\">allow_push = <span style=\"color: #000000; font-weight: bold;\">*<\/span><\/div><\/li><li style=\"background: #f0f0f0;\"><div style=\"font-size: 12px;\">push_ssl = <span style=\"color: #c20cb9; font-weight: bold;\">false<\/span><\/div><\/li><li style=\"background: #fcfcfc;\"><div style=\"font-size: 12px;\">encoding = UTF-<span style=\"color: #000000;\">8<\/span><\/div><\/li><li style=\"background: #f0f0f0;\"><div style=\"font-size: 12px;\">descend = True<\/div><\/li><li style=\"background: #fcfcfc;\"><div style=\"font-size: 12px;\">collapse = True<\/div><\/li><li style=\"background: #f0f0f0;\"><div style=\"font-size: 12px;\">EOF<\/div><\/li><li style=\"background: #fcfcfc;\"><div style=\"font-size: 12px;\">&nbsp;<\/div><\/li><li style=\"background: #f0f0f0;\"><div style=\"font-size: 12px;\"><span style=\"color: #7a0874; font-weight: bold;\">echo<\/span> <span style=\"color: #ff0000;\">&quot;configure httpd (create \/etc\/httpd\/conf.d\/hg.conf)&quot;<\/span><\/div><\/li><li style=\"background: #fcfcfc;\"><div style=\"font-size: 12px;\"><span style=\"color: #c20cb9; font-weight: bold;\">cat<\/span> <span style=\"color: #000000; font-weight: bold;\">&gt;<\/span> <span style=\"color: #000000; font-weight: bold;\">\/<\/span>etc<span style=\"color: #000000; font-weight: bold;\">\/<\/span>httpd<span style=\"color: #000000; font-weight: bold;\">\/<\/span>conf.d<span style=\"color: #000000; font-weight: bold;\">\/<\/span>hg.conf <span style=\"color: #000000; font-weight: bold;\">&lt;&lt;<\/span> <span style=\"color: #ff0000;\">&quot;EOF&quot;<\/span><\/div><\/li><li style=\"background: #f0f0f0;\"><div style=\"font-size: 12px;\"> ScriptAliasMatch ^<span style=\"color: #000000; font-weight: bold;\">\/<\/span>hg<span style=\"color: #7a0874; font-weight: bold;\">&#40;<\/span>.<span style=\"color: #000000; font-weight: bold;\">*<\/span><span style=\"color: #7a0874; font-weight: bold;\">&#41;<\/span>$ <span style=\"color: #000000; font-weight: bold;\">\/<\/span>opt<span style=\"color: #000000; font-weight: bold;\">\/<\/span>hg<span style=\"color: #000000; font-weight: bold;\">\/<\/span>cgi-bin<span style=\"color: #000000; font-weight: bold;\">\/<\/span>hgweb.cgi<span style=\"color: #000000; font-weight: bold;\">\/<\/span><span style=\"color: #007800;\">$1<\/span><\/div><\/li><li style=\"background: #fcfcfc;\"><div style=\"font-size: 12px;\">&nbsp;<\/div><\/li><li style=\"background: #f0f0f0;\"><div style=\"font-size: 12px;\"> <span style=\"color: #000000; font-weight: bold;\">&lt;<\/span>Directory <span style=\"color: #ff0000;\">&quot;\/opt\/hg\/cgi-bin\/&quot;<\/span><span style=\"color: #000000; font-weight: bold;\">&gt;<\/span><\/div><\/li><li style=\"background: #fcfcfc;\"><div style=\"font-size: 12px;\">   SetHandler cgi-script<\/div><\/li><li style=\"background: #f0f0f0;\"><div style=\"font-size: 12px;\">   AllowOverride All<\/div><\/li><li style=\"background: #fcfcfc;\"><div style=\"font-size: 12px;\">   Options +ExecCGI <span style=\"color: #660033;\">-MultiViews<\/span> +SymLinksIfOwnerMatch<\/div><\/li><li style=\"background: #f0f0f0;\"><div style=\"font-size: 12px;\">   <span style=\"color: #666666; font-style: italic;\"># apache 2.2 (disabled)<\/span><\/div><\/li><li style=\"background: #fcfcfc;\"><div style=\"font-size: 12px;\">   <span style=\"color: #666666; font-style: italic;\">#Order allow,deny<\/span><\/div><\/li><li style=\"background: #f0f0f0;\"><div style=\"font-size: 12px;\">   <span style=\"color: #666666; font-style: italic;\">#Allow from all<\/span><\/div><\/li><li style=\"background: #fcfcfc;\"><div style=\"font-size: 12px;\">   <span style=\"color: #666666; font-style: italic;\"># apache 2.4<\/span><\/div><\/li><li style=\"background: #f0f0f0;\"><div style=\"font-size: 12px;\">   Require all granted<\/div><\/li><li style=\"background: #fcfcfc;\"><div style=\"font-size: 12px;\">  <span style=\"color: #000000; font-weight: bold;\">&lt;\/<\/span>Directory<span style=\"color: #000000; font-weight: bold;\">&gt;<\/span><\/div><\/li><li style=\"background: #f0f0f0;\"><div style=\"font-size: 12px;\">  ErrorLog <span style=\"color: #000000; font-weight: bold;\">\/<\/span>var<span style=\"color: #000000; font-weight: bold;\">\/<\/span>log<span style=\"color: #000000; font-weight: bold;\">\/<\/span>httpd<span style=\"color: #000000; font-weight: bold;\">\/<\/span>hg-error.log<\/div><\/li><li style=\"background: #fcfcfc;\"><div style=\"font-size: 12px;\">  CustomLog <span style=\"color: #000000; font-weight: bold;\">\/<\/span>var<span style=\"color: #000000; font-weight: bold;\">\/<\/span>log<span style=\"color: #000000; font-weight: bold;\">\/<\/span>httpd<span style=\"color: #000000; font-weight: bold;\">\/<\/span>hg-access.log common<\/div><\/li><li style=\"background: #f0f0f0;\"><div style=\"font-size: 12px;\">EOF<\/div><\/li><li style=\"background: #fcfcfc;\"><div style=\"font-size: 12px;\">&nbsp;<\/div><\/li><li style=\"background: #f0f0f0;\"><div style=\"font-size: 12px;\"><span style=\"color: #7a0874; font-weight: bold;\">echo<\/span> <span style=\"color: #ff0000;\">&quot;set selinux permissions. can check permission by using 'ls -alZ \/opt\/hg\/cgi-bin\/hgweb.cgi&quot;<\/span><\/div><\/li><li style=\"background: #fcfcfc;\"><div style=\"font-size: 12px;\">chcon <span style=\"color: #660033;\">--type<\/span>=httpd_sys_rw_content_t <span style=\"color: #000000; font-weight: bold;\">\/<\/span>opt<span style=\"color: #000000; font-weight: bold;\">\/<\/span>hg<span style=\"color: #000000; font-weight: bold;\">\/<\/span>cgi-bin<span style=\"color: #000000; font-weight: bold;\">\/<\/span>hgweb.cgi<\/div><\/li><li style=\"background: #f0f0f0;\"><div style=\"font-size: 12px;\">&nbsp;<\/div><\/li><li style=\"background: #fcfcfc;\"><div style=\"font-size: 12px;\"><span style=\"color: #7a0874; font-weight: bold;\">echo<\/span> <span style=\"color: #ff0000;\">&quot;create \/opt\/hg\/bin\/create.sh&quot;<\/span><\/div><\/li><li style=\"background: #f0f0f0;\"><div style=\"font-size: 12px;\"><span style=\"color: #c20cb9; font-weight: bold;\">cat<\/span> <span style=\"color: #000000; font-weight: bold;\">&gt;<\/span> <span style=\"color: #000000; font-weight: bold;\">\/<\/span>opt<span style=\"color: #000000; font-weight: bold;\">\/<\/span>hg<span style=\"color: #000000; font-weight: bold;\">\/<\/span>bin<span style=\"color: #000000; font-weight: bold;\">\/<\/span>create.sh <span style=\"color: #000000; font-weight: bold;\">&lt;&lt;<\/span> <span style=\"color: #ff0000;\">&quot;EOF&quot;<\/span><\/div><\/li><li style=\"background: #fcfcfc;\"><div style=\"font-size: 12px;\">hg init <span style=\"color: #000000; font-weight: bold;\">\/<\/span>opt<span style=\"color: #000000; font-weight: bold;\">\/<\/span>hg<span style=\"color: #000000; font-weight: bold;\">\/<\/span>repos<span style=\"color: #000000; font-weight: bold;\">\/<\/span><span style=\"color: #007800;\">$1<\/span><\/div><\/li><li style=\"background: #f0f0f0;\"><div style=\"font-size: 12px;\"><span style=\"color: #c20cb9; font-weight: bold;\">chown<\/span> <span style=\"color: #660033;\">-R<\/span> apache:apache <span style=\"color: #000000; font-weight: bold;\">\/<\/span>opt<span style=\"color: #000000; font-weight: bold;\">\/<\/span>hg<span style=\"color: #000000; font-weight: bold;\">\/<\/span>repos<span style=\"color: #000000; font-weight: bold;\">\/<\/span><span style=\"color: #007800;\">$1<\/span><\/div><\/li><li style=\"background: #fcfcfc;\"><div style=\"font-size: 12px;\"><span style=\"color: #c20cb9; font-weight: bold;\">chmod<\/span> <span style=\"color: #660033;\">-R<\/span> <span style=\"color: #000000;\">750<\/span> <span style=\"color: #000000; font-weight: bold;\">\/<\/span>opt<span style=\"color: #000000; font-weight: bold;\">\/<\/span>hg<span style=\"color: #000000; font-weight: bold;\">\/<\/span>repos<span style=\"color: #000000; font-weight: bold;\">\/<\/span><span style=\"color: #007800;\">$1<\/span><\/div><\/li><li style=\"background: #f0f0f0;\"><div style=\"font-size: 12px;\">EOF<\/div><\/li><li style=\"background: #fcfcfc;\"><div style=\"font-size: 12px;\"><span style=\"color: #c20cb9; font-weight: bold;\">chmod<\/span> a+x <span style=\"color: #000000; font-weight: bold;\">\/<\/span>opt<span style=\"color: #000000; font-weight: bold;\">\/<\/span>hg<span style=\"color: #000000; font-weight: bold;\">\/<\/span>bin<span style=\"color: #000000; font-weight: bold;\">\/<\/span>create.sh<\/div><\/li><li style=\"background: #f0f0f0;\"><div style=\"font-size: 12px;\">&nbsp;<\/div><\/li><li style=\"background: #fcfcfc;\"><div style=\"font-size: 12px;\"><span style=\"color: #7a0874; font-weight: bold;\">echo<\/span> <span style=\"color: #ff0000;\">&quot;create two samples repositories named 'myrepos' and 'myrepos2'&quot;<\/span><\/div><\/li><li style=\"background: #f0f0f0;\"><div style=\"font-size: 12px;\"><span style=\"color: #000000; font-weight: bold;\">\/<\/span>opt<span style=\"color: #000000; font-weight: bold;\">\/<\/span>hg<span style=\"color: #000000; font-weight: bold;\">\/<\/span>bin<span style=\"color: #000000; font-weight: bold;\">\/<\/span>create.sh myrepos<\/div><\/li><li style=\"background: #fcfcfc;\"><div style=\"font-size: 12px;\"><span style=\"color: #000000; font-weight: bold;\">\/<\/span>opt<span style=\"color: #000000; font-weight: bold;\">\/<\/span>hg<span style=\"color: #000000; font-weight: bold;\">\/<\/span>bin<span style=\"color: #000000; font-weight: bold;\">\/<\/span>create.sh myrepos2<\/div><\/li><li style=\"background: #f0f0f0;\"><div style=\"font-size: 12px;\">&nbsp;<\/div><\/li><li style=\"background: #fcfcfc;\"><div style=\"font-size: 12px;\"><span style=\"color: #7a0874; font-weight: bold;\">echo<\/span> <span style=\"color: #ff0000;\">&quot;Now restart httpd&quot;<\/span><\/div><\/li><li style=\"background: #f0f0f0;\"><div style=\"font-size: 12px;\">systemctl restart httpd.service<\/div><\/li><li style=\"background: #fcfcfc;\"><div style=\"font-size: 12px;\">&nbsp;<\/div><\/li><li style=\"background: #f0f0f0;\"><div style=\"font-size: 12px;\"><span style=\"color: #007800;\">myip<\/span>=<span style=\"color: #000000; font-weight: bold;\">`<\/span><span style=\"color: #c20cb9; font-weight: bold;\">hostname<\/span> -I<span style=\"color: #000000; font-weight: bold;\">`<\/span><\/div><\/li><li style=\"background: #fcfcfc;\"><div style=\"font-size: 12px;\"><span style=\"color: #7a0874; font-weight: bold;\">echo<\/span> <span style=\"color: #ff0000;\">&quot;Now meet you there: http:\/\/<span style=\"color: #007800;\">$myip<\/span>\/hg&quot;<\/span><\/div><\/li><li style=\"background: #f0f0f0;\"><div style=\"font-size: 12px;\">&nbsp;<\/div><\/li><\/ol><\/pre>\n<p>That&#8217;s all \ud83d\ude42<br \/>\n<img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/blog.rabahi.net\/wp-content\/uploads\/2013\/03\/Administration-\u2013-hg.png\" alt=\"Administration \u2013 hg\" width=\"1167\" height=\"201\" class=\"alignnone size-full wp-image-346\" \/><\/p>\n<h1>FAQ<\/h1>\n<p>Need some help? Have a look here: <a href=\"http:\/\/blog.rabahi.net\/?page_id=1225\" title=\"Mercurial Survival Guide\">Mercurial Survival Guide<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Prerequiste I assume that you have a Centos installation. Installation You can copy\/paste this script and use it to configure automatically your server. That&#8217;s all \ud83d\ude42 FAQ Need some help? Have a look here: Mercurial Survival Guide<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":233,"menu_order":3,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-240","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/blog.rabahi.net\/index.php?rest_route=\/wp\/v2\/pages\/240","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.rabahi.net\/index.php?rest_route=\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/blog.rabahi.net\/index.php?rest_route=\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/blog.rabahi.net\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.rabahi.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=240"}],"version-history":[{"count":20,"href":"https:\/\/blog.rabahi.net\/index.php?rest_route=\/wp\/v2\/pages\/240\/revisions"}],"predecessor-version":[{"id":1229,"href":"https:\/\/blog.rabahi.net\/index.php?rest_route=\/wp\/v2\/pages\/240\/revisions\/1229"}],"up":[{"embeddable":true,"href":"https:\/\/blog.rabahi.net\/index.php?rest_route=\/wp\/v2\/pages\/233"}],"wp:attachment":[{"href":"https:\/\/blog.rabahi.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=240"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}