<!doctype html><htmllang=en-us><head><metacharset=utf-8><metahttp-equiv=x-ua-compatiblecontent="ie=edge"><metaname=viewportcontent="width=device-width,initial-scale=1,shrink-to-fit=no"><linkrel=preloadas=fonthref=/fonts/vendor/jost/jost-v4-latin-regular.woff2type=font/woff2crossorigin><linkrel=preloadas=fonthref=/fonts/vendor/jost/jost-v4-latin-700.woff2type=font/woff2crossorigin><linkrel=stylesheethref=/main.f4e82f75f039986a07346a99687f11e3218d588abe9b9daa7d0673b1a7aaee5b689ec69619c26a2962d5a124bed33807d58bd84180c249bbb8eddc33c5ef5baa.cssintegrity="sha512-9OgvdfA5mGoHNGqZaH8R4yGNWIq+m52qfQZzsaeq7ltonsaWGcJqKWLVoSS+0zgH1YvYQYDCSbu47dwzxe9bqg=="crossorigin=anonymous><noscript><style>img.lazyload{display:none}</style></noscript><metaname=robotscontent="index, follow"><metaname=googlebotcontent="index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1"><metaname=bingbotcontent="index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1"><title>Deploy bare metal - mCaptcha</title><metaname=descriptioncontent="Bare metal deployment is tedious, most of this will be automated with a script in the future."><linkrel=canonicalhref=/docs/self-hosted/bare-metal/><metaname=twitter:cardcontent="summary_large_image"><metaname=twitter:imagecontent="/icon.png"><metaname=twitter:titlecontent="Deploy bare metal"><metaname=twitter:descriptioncontent="Bare metal deployment is tedious, most of this will be automated with a script in the future."><metaname=twitter:sitecontent="@"><metaname=twitter:creatorcontent="@"><metaproperty="og:title"content="Deploy bare metal"><metaproperty="og:description"content="Bare metal deployment is tedious, most of this will be automated with a script in the future."><metaproperty="og:type"content="article"><metaproperty="og:url"content="/docs/self-hosted/bare-metal/"><metaproperty="og:image"content="/icon.png"><metaproperty="article:modified_time"content="2022-08-01T20:24:18+05:30"><metaproperty="og:site_name"content="mCaptcha"><metaproperty="article:publisher"content="https://www.facebook.com/"><metaproperty="article:author"content="https://www.facebook.com/"><metaproperty="og:locale"content="en_US"><scripttype=application/ld+json>{"@context":"http://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"\/"},{"@type":"ListItem","position":2,"name":"Docsself Hostedbare Metal","item":"\/docsself-hostedbare-metal\/"}]}</script><metaname=theme-colorcontent="#fff"><linkrel=apple-touch-iconsizes=180x180href=/apple-touch-icon.png><linkrel=icontype=image/pngsizes=32x32href=/favicon-32x32.png><linkrel=icontype=image/pngsizes=16x16href=/favicon-16x16.png><linkrel=manifesthref=/site.webmanifest></head><bodyclass="docs single"><divclass="header-bar fixed-top"></div><headerclass="navbar fixed-top navbar-expand-md navbar-light"><divclass=container><inputclass="menu-btn order-0"type=checkboxid=menu-btn>
</code></pre></div><h3id=2-create-new-user-for-running-mcaptcha>2. Create new user for running <code>mcaptcha</code><ahref=#2-create-new-user-for-running-mcaptchaclass=anchoraria-hidden=true>#</a></h3><divclass=highlight><prestyle=color:#f8f8f2;background-color:#282a36;-moz-tab-size:4;-o-tab-size:4;tab-size:4><codeclass=language-bashdata-lang=bash><spanstyle="margin-right:.4em;padding:0 .4em;color:#7f7f7f">1</span>$ sudo useradd -b /srv -m -s /usr/bin/zsh mcaptcha
</code></pre></div><h3id=3-create-new-user-in-postgres>3. Create new user in Postgres<ahref=#3-create-new-user-in-postgresclass=anchoraria-hidden=true>#</a></h3><divclass=highlight><prestyle=color:#f8f8f2;background-color:#282a36;-moz-tab-size:4;-o-tab-size:4;tab-size:4><codeclass=language-bashdata-lang=bash><spanstyle="margin-right:.4em;padding:0 .4em;color:#7f7f7f">1</span>$ sudo -iu postgres <spanstyle=color:#6272a4># switch to `postgres` user</span>
<spanstyle="margin-right:.4em;padding:0 .4em;color:#7f7f7f">3</span><spanstyle=color:#8be9fd;font-style:italic>postgres</span><spanstyle=color:#ff79c6>=</span><spanstyle=color:#6272a4># CREATE USER mcaptcha WITH PASSWORD 'my super long password and yes you need single quote`;</span>
<spanstyle="margin-right:.4em;padding:0 .4em;color:#7f7f7f">4</span>$ createdb -O mcaptcha mcaptcha <spanstyle=color:#6272a4># create db 'mcaptcha' with 'mcaptcha' as owner</span>
</code></pre></div><h3id=4-install-and-load-mcaptchacachehttpsgithubcommcaptchacache-module>4. Install and load <ahref=https://github.com/mCaptcha/cache><code>mCaptcha/cache</code></a> module:<ahref=#4-install-and-load-mcaptchacachehttpsgithubcommcaptchacache-moduleclass=anchoraria-hidden=true>#</a></h3><p>See <ahref=https://github.com/mCaptcha/cache><code>mCaptcha/cache</code></a> for more
details.</p><h3id=4-build-mcaptcha>4. Build <code>mcaptcha</code><ahref=#4-build-mcaptchaclass=anchoraria-hidden=true>#</a></h3><p>To build <code>mcaptcha</code>, you need the following dependencies:</p><ol><li>rust</li><li>node(<code>v14.16.0</code>)</li><li>yarn(JavaScript package manager)</li><li>make</li></ol><h2id=how-to-build>How to build<ahref=#how-to-buildclass=anchoraria-hidden=true>#</a></h2><ol><li>Install Cargo using <ahref=https://rustup.rs/>rustup</a> with:</li></ol><divclass=highlight><prestyle=color:#f8f8f2;background-color:#282a36;-moz-tab-size:4;-o-tab-size:4;tab-size:4><codeclass=language-bashdata-lang=bash><spanstyle="margin-right:.4em;padding:0 .4em;color:#7f7f7f">1</span>$ curl --proto <spanstyle=color:#f1fa8c>'=https'</span> --tlsv1.2 -sSf https://sh.rustup.rs | sh
</code></pre></div><olstart=2><li><p>Install node(<code>v14.16.0</code>)</p></li><li><p>Install yarn(JavaScript package manager)</p></li><li><p>Build with make:</p></li></ol><divclass=highlight><prestyle=color:#f8f8f2;background-color:#282a36;-moz-tab-size:4;-o-tab-size:4;tab-size:4><codeclass=language-bashdata-lang=bash><spanstyle="margin-right:.4em;padding:0 .4em;color:#7f7f7f">1</span>$ make dev-env <spanstyle=color:#ff79c6>&&</span><spanstyle=color:#f1fa8c>\
</span><spanstyle="margin-right:.4em;padding:0 .4em;color:#7f7f7f">2</span><spanstyle=color:#f1fa8c></span> make release
</code></pre></div><h3id=6-systemd-service-configuration>6. Systemd service configuration:<ahref=#6-systemd-service-configurationclass=anchoraria-hidden=true>#</a></h3><ol><li>Copy the following to <code>/etc/systemd/system/mcaptcha.service</code>:</li></ol><divclass=highlight><prestyle=color:#f8f8f2;background-color:#282a36;-moz-tab-size:4;-o-tab-size:4;tab-size:4><codeclass=language-systemddata-lang=systemd><spanstyle="margin-right:.4em;padding:0 .4em;color:#7f7f7f"> 1</span><spanstyle=color:#ff79c6>[Unit]</span>
<spanstyle="margin-right:.4em;padding:0 .4em;color:#7f7f7f"> 2</span><spanstyle=color:#50fa7b>Description</span><spanstyle=color:#ff79c6>=</span><spanstyle=color:#f1fa8c>mCaptcha: a CAPTCHA system that gives attackers a run for their money</span>