diff options
| -rw-r--r-- | gemini.html | 75 | ||||
| -rw-r--r-- | index.html | 1 |
2 files changed, 46 insertions, 30 deletions
diff --git a/gemini.html b/gemini.html index 2962d09..aa6d83e 100644 --- a/gemini.html +++ b/gemini.html @@ -13,72 +13,87 @@ <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.</p> + <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://landchad.net</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. + <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</li> - <li>TLS certificate</li> - <li>Gemini server</li> + <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>We can create three different directories to simplify the process:</p> - <pre><code>mkdir -p gemini/{content,certificate,server}</code></pre> + <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>Gemini uses text/gemini markup. It heavily borrows from Markdown. Similar to .html or .md, gemini uses .gmi as its extension.</p> + <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>touch gemini/content/index.gmi</code></pre> - <p>Update the file content of index.gmi</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 have created earlier. Generate the TLS certificate using OpenSSL. Change YOURDOMAIN.COM to the domain of your gemini capsule.</p> - <pre><code>openssl req -new -subj "/CN=YOURDOMAIN.COM" -x509 -newkey ec -pkeyopt ec_paramgen_curve:prime256v1 -days 3650 -nodes -out cert.pem -keyout key.pem</code></pre> + <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> - <p>There are many gemini servers available. You can check the list of servers <a href="https://gemini.circumlunar.space/software" target="_blank">here</a>.</p> - <p>We will use <code>agate</code> server for now. This is a simple gemini server written in Rust. Go to <code>server</code> directory and download agate server.</p> - <pre><code>wget https://github.com/mbrubeck/agate/releases/download/v3.1.0/agate.x86_64-unknown-linux-gnu.gz</code></pre> - <p>Unzip the gz</p> - <pre><code>gunzip agate.x86_64-unknown-linux-gnu.gz</code></pre> - <p>Rename and make it executable</p> - <pre><code>mv agate.x86_64-unknown-linux-gnu agate-server + <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> - <p>Now we need to create a systemd service</p> - <pre><code>sudo touch /etc/systemd/system/agate.service</code></pre> - <p>Copy the below file and paste in agate.service.</p> + <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=USER +User=gemini Type=simple -ExecStart=/home/USER/gemini/agate-server --content /home/USER/gemini/content --certs /home/USER/gemini/certificate/ --hostname YOURDOMAIN.COM --lang en-US +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> - <ul> - <li>Change <code>/home/USER/gemini</code> to your gemini directory path.</li> - <li>Change <code>YOURDOMAIN.COM</code> to your domain without http/https.</li> - <li>Change <code>en-US</code> to your country language. en-IN for India, en-GB for UK, etc.</li> - </ul> <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 via any gemini client with this url</p> + <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> @@ -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> |
