diff options
| author | Luke Smith <luke@lukesmith.xyz> | 2021-07-01 13:35:01 -0400 |
|---|---|---|
| committer | Luke Smith <luke@lukesmith.xyz> | 2021-07-01 13:35:01 -0400 |
| commit | 9a5222a2280c9b69978e4356104c6a818cceb3f3 (patch) | |
| tree | 916f2c32b3784a122824cf33d2dcb2889b90151f | |
| parent | a0057185e401b1a1f8040a2e64bd692248c522c5 (diff) | |
| parent | c2460482e0cf79e2ecde463a13700c73deed9e0f (diff) | |
Merge branch 'niharokz-master'
| -rw-r--r-- | dns.html | 2 | ||||
| -rw-r--r-- | gemini.html | 103 | ||||
| -rw-r--r-- | index.html | 1 |
3 files changed, 105 insertions, 1 deletions
@@ -115,7 +115,7 @@ <img src="pix/dns-ping.png" alt="Pinging landchad.net"> <p> - As you can see, our ping to <code>landchad.net</code> is now being directed to <code>104.238.126.105</code>. + As you can see, our ping to <code>landchad.net</code> is now being directed to <code>104.238.128.105</code>. That means we have successfully set up our DNS records! You can also run the command <code>host</code> if you have it, which will list both IPv4 and IPv6 addresses for a domain name. </p> diff --git a/gemini.html b/gemini.html new file mode 100644 index 0000000..aa6d83e --- /dev/null +++ b/gemini.html @@ -0,0 +1,103 @@ +<!DOCTYPE html> +<html lang=en> + <head> + <title>How to set up your own gemini server</title> + <meta charset="utf-8"/> + <link rel="shortcut icon" href="favicon.ico" type="image/x-icon" /> + <link rel='stylesheet' type='text/css' href='style.css'> + <meta name="viewport" content="width=device-width, initial-scale=1"> + <link rel='alternate' type='application/rss+xml' title='Land Chad RSS' href='/rss.xml'> + </head> +<body> + <header><h1> Creating and serving gemini capsules </h1></header> + <nav></nav> + <main> + <h2 id="whatis">What is Gemini?</h2> + <p><a href="https://gemini.circumlunar.space" target="_blank">Gemini</a> is a new internet protocol which is different from the HTTP and Gopher. It's much cleaner and has a growing community and audience of hackers.</p> + <h3>Why use gemini protocol?</h3> + <ul> + <li>Gemini capsules (webpages of gemini) are lightweight, minimal, and don't use many resources to operate.</li> + <li>It can run along with your websites. Gemini capsules use port 1965 by default. Your webserver can run at port 80 or 443 along with gemini server at port 1965. </li> + <li>By exploring an alternative protocol, you can check different ways to serve data and blogs.</li> + </ul> + <p>To access any gemini urls i.e. <code>gemini://example.org</code>, you can use any gemini client such as <a href="https://github.com/makeworld-the-better-one/amfora" target="_blank">amfora</a>, <a href="https://gmi.skyjake.fi/lagrange" target="_blank">lagrange</a>, <a href="https://thelambdalab.xyz/elpher/" target="_blank">elpher</a>, etc. + <h2 id="instructions">Instructions</h2> + <h3>Create a gemini user</h3> + <p> + It is most secure and clean to have a separate <code>gemini</code> user, so let's create one: + </p> + <pre><code>useradd -m -s /bin/bash gemini</code></pre> + <p>Now log in as <code>gemini</code> with the following command:</p> + <pre><code>su -l gemini</code></pre> + <p>To create and serve a gemini capsule, we need three basic steps:</p> + <ol> + <li>Content – the webpages in our capsule</li> + <li>TLS certificate – Gemini requires encrypted connection.</li> + <li>Gemini server – the program that makes our capsule available (similar to Nginx for HTTP)</li> + </ol> + <p>As the gemini user, we can create three different directories to simplify the process:</p> + <pre><code>mkdir -p ~/gemini/{content,certificate,server}</code></pre> + <h3>Content</h3> + <p>This will be the directory where you capsule files will be contained. Gemini uses text/gemini markup (in place of HTTP's equivalent HTML). It heavily borrows from Markdown. Similar to .html or .md, gemini uses .gmi as its extension.</p> + <p>To create one gemini file, go inside the <code>content</code> directory and create one <code>index.gmi</code> file.</p> + <pre><code>nano gemini/content/index.gmi</code></pre> + <p>We can add the content we want in our Gemini capsule here:</p> + <pre><code># This is Sample Gemini page +## With header 1 and header 2 +And a short paragraph like this. +=> /index.gmi Link to the same page</code></pre> + <h3>TLS certificate</h3> + <p>Go to the <code>certificate</code> directory which we created earlier and generate a TLS certificate using OpenSSL.</p> + <pre><code>cd ~/gemini/certificate/ +openssl req -new -subj "/CN=<strong>example.org</strong>" -x509 -newkey ec -pkeyopt ec_paramgen_curve:prime256v1 -days 3650 -nodes -out cert.pem -keyout key.pem</code></pre> + <h3>Gemini server</h3> + <h4>Download and prepare the server</h4> + <p>There are <a href="https://gemini.circumlunar.space/software">many gemini server software choices available</a>. + We will use <code>agate</code> server for now. This is a simple gemini server written in Rust.</p> + <p>It's a good idea to always get the most recent version, which you can see <a href="https://github.com/mbrubeck/agate/releases">on the agate releases page</a>. At the time of this writing, that is agate v3.1.0 which we will now download. We will download it to the <code>server</code> directory we made.</p> + <pre><code>cd ~/gemini/server +wget https://github.com/mbrubeck/agate/releases/download/v3.1.0/agate.x86_64-unknown-linux-gnu.gz</code></pre> + <p>Unzip the gz, then rename and make it executable:</p> + <pre><code>gunzip agate.x86_64-unknown-linux-gnu.gz +mv agate.x86_64-unknown-linux-gnu agate-server +chmod +x agate-server</code></pre> + <h4>Create a system service</h4> + <p>Now we need to create a systemd service to autostart and manage agate. + The gemini user does not have permission to do this, so press <code>ctrl-d</code> to log out of the gemini user and return to root. + As root, create the file below by opening it in your text editor (nano, vim, etc.):</p> + <pre><code>nano /etc/systemd/system/agate.service</code></pre> + <p>Add the following content to the file <strong>customizing highlighted text</strong> to your use.</p> + <pre><code>[Unit] +Description=agate +After=network.target + +[Service] +User=gemini +Type=simple +ExecStart=/home/gemini/gemini/server/agate-server --content /home/gemini/gemini/content --certs /home/gemini/gemini/certificate/ --hostname <strong>example.org</strong> --lang <strong>en-US</strong> + +[Install] +WantedBy=default.target</code></pre> + <p>Now we are ready to run server. Enable and run agate server.</p> + <pre><code>systemctl enable agate +systemctl start agate</code></pre> + <h4>Firewall</h4> + <p>Lastly, if you have a firewall running, remember to open port 1965, which is the port number used by gemini:</p> + <pre><code>ufw allow 1965</code></pre> + <h2>Finalization</h2> + <p>Now your server should be running. If everything went okay, you can access your gemini capsule via any gemini client with a url like this:</p> + <pre><code>gemini://<strong>example.org</strong></code></pre> + <p>Sample gemini site for reference:</p> + <pre><code>gemini://gemini.circumlunar.space</code></pre> + <p>Enjoy your first gemini capsule.</p> + <p> + For information about how to write in "gemtext" the markup language in Gemini, see this site: <a href="https://gemini.circumlunar.space/docs/gemtext.gmi">https://gemini.circumlunar.space/docs/gemtext.gmi</a>. + As you might guess it also has an analogous gemini capsule here: gemini://gemini.circumlunar.space/docs/gemtext.gmi + </p> + <hr> + <p><em>Written by <a href="https://nihar.page">nihar.page</a></em></p> + + </main> + <footer><a href="https://landchad.net">LandChad.net</a></br>Because Everyone should be an Internet LandChad.</br><li><a href="index.html"><img src="pix/chad.gif" alt="chad"></a></li><li><a href="rss.xml"><img src="pix/rss.svg" alt="RSS"></a></li><li><a href="pix/btc.png"><img src="pix/btc.svg" alt="BTC"></a></li><li><a href="pix/xmr.png"><img src="pix/xmr.svg" alt="XMR"></a></li><li><a href="https://github.com/lukesmithxyz/landchad"><img src="pix/git.svg" alt="Github"></a></footer> +</body> +</html> @@ -52,6 +52,7 @@ <li><a href="cron.html">Schedule tasks with Crontabs/Cronjobs.</a></li> <li><a href="tor.html">Mirror your site on <img src="pix/tor.svg">Tor.</a></li> <li><a href="auth.html">Password-protecting Webpages (HTTP Authentication)</a></li> + <li><a href="gemini.html">Create a Gemini Capsule.</a></li> </ul> <h3 id=platform>"Build your own platform!"</h3> |
