<!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.60c01f8e4587d713b944a8a0acde263887dd938acaa06c1d283db35e4ce18008340510c4a66b77a38e97377e97a7a3c8fb6ebfead61e11e97ee3a8a5539f6d10.cssintegrity="sha512-YMAfjkWH1xO5RKigrN4mOIfdk4rKoGwdKD2zXkzhgAg0BRDEpmt3o46XN36Xp6PI+26/6tYeEel+46ilU59tEA=="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="2021-07-21T15:49:53+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><preclass=chroma><codeclass=language-bashdata-lang=bash>$ 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><preclass=chroma><codeclass=language-bashdata-lang=bash>$ sudo -iu postgres <spanclass=c1># switch to `postgres` user</span>
$ psql
<spanclass=nv>postgres</span><spanclass=o>=</span><spanclass=c1># CREATE USER mcaptcha WITH PASSWORD 'my super long password and yes you need single quote`;</span>
$ createdb -O mcaptcha mcaptcha <spanclass=c1># 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><preclass=chroma><codeclass=language-bashdata-lang=bash>$ curl --proto <spanclass=s1>'=https'</span> --tlsv1.2 -sSf https://sh.rustup.rs <spanclass=p>|</span> 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><preclass=chroma><codeclass=language-bashdata-lang=bash>$ make dev-env <spanclass=o>&&</span><spanclass=se>\
</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><preclass=chroma><codeclass=language-systemddata-lang=systemd><spanclass=k>[Unit]</span>
<spanclass=na>Description</span><spanclass=o>=</span><spanclass=s>mCaptcha: a CAPTCHA system that gives attackers a run for their money</span>