{"id":114143,"date":"2024-08-14T01:16:46","date_gmt":"2024-08-14T01:16:46","guid":{"rendered":"\/tutorials\/?p=114143"},"modified":"2026-03-10T10:05:02","modified_gmt":"2026-03-10T10:05:02","slug":"how-to-create-a-mastodon-server","status":"publish","type":"post","link":"\/my\/tutorials\/how-to-create-a-qr-code-for-wedding-rsvp-19","title":{"rendered":"How to create a Mastodon server"},"content":{"rendered":"<p>Mastodon has become a popular alternative to traditional social media platforms. As a decentralized, open-source social network, Mastadon empowers users to operate their own servers, giving them complete control to customize their social media experience.<\/p><p>In this article, you&rsquo;ll learn how to set up a Mastodon server on a virtual private server (VPS), from establishing an SMTP server to downloading the Mastodon installer and inviting users to join your instance.<\/p><p>By the end of this guide, you&rsquo;ll have your own Mastodon server up and running, ready to connect with your community.<\/p><p>\n\n\n\n<\/p><h2 class=\"wp-block-heading\" id=\"h-prerequisites\">Prerequisites<\/h2><p>To host a Mastodon server, you should prepare a couple of key components.<\/p><p>First and foremost, you require a Linux VPS running on <strong>Ubuntu 22.04<\/strong> or <strong>Debian 11<\/strong>. While multiple hosting providers are available, choose a reliable one for optimal server performance.<\/p><p><a href=\"\/my\/vps\/mastodon-hosting\">Hostinger&rsquo;s Mastodon VPS service<\/a> is an excellent choice for installing a Mastodon server. With up to <strong>8<\/strong> CPU cores, <strong>32 GB<\/strong> of RAM, and <strong>400 GB<\/strong> of disk space, it provides powerful hardware to handle Mastodon server&rsquo;s demands.<\/p><p>Additionally, our Mastodon VPS plans grant you root access so you can customize your own server to fit your specific needs. With just a few clicks, you can install various Linux distributions, including different versions of Ubuntu and Debian.<\/p><p>This service implements advanced security measures to protect your server, including a Monarx-powered malware scanner to prevent malicious attacks and firewall and DDoS protection to safeguard your hosted sites against suspicious traffic.<\/p><p>Our Mastodon hosting is also scalable. We suggest getting the <strong>KVM 2<\/strong> plan, which includes a dual-core CPU, <strong>8 GB<\/strong> of RAM, and <strong>100 GB<\/strong> of storage. You can then scale up as your Mastodon server grows and needs more resources.<\/p><?xml encoding=\"utf-8\" ?><figure class=\"wp-block-image size-large\"><a href=\"\/my\/vps-hosting\" target=\"_blank\" rel=\"noreferrer noopener\"><img decoding=\"async\" width=\"1024\" height=\"300\" src=\"https:\/\/www.hostinger.com\/tutorials\/wp-content\/uploads\/sites\/2\/2023\/02\/VPS-hosting-banner-1024x300.png\" alt=\"\" class=\"wp-image-77934\" srcset=\"https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2023\/02\/VPS-hosting-banner.png 1024w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2023\/02\/VPS-hosting-banner-300x88.png 300w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2023\/02\/VPS-hosting-banner-150x44.png 150w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2023\/02\/VPS-hosting-banner-768x225.png 768w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure><p>In addition to a VPS, you&rsquo;ll need a domain name so people can easily find and join your Mastodon instance. We recommend getting one from the same provider so you can manage your VPS and domain in one place.<\/p><p>If you purchase a domain from Hostinger, follow our tutorial on <a href=\"\/my\/tutorials\/dns\/how-to-point-domain-to-vps\">pointing it to your VPS<\/a>. After that, ensure the DNS records propagate worldwide, which you can verify using an online tool like <a href=\"https:\/\/dnschecker.org\" target=\"_blank\" rel=\"noopener\">DNS Checker<\/a>.<\/p><p>    <div class=\"mb-50 mt-50 domain-checker domain-checker__bg\">\n        <h3 class=\"m-0 text-center text-white pb-10\">Domain Name Checker<\/h3>\n        <p class=\"pb-40 text-center text-white\">Instantly check domain name availability.<\/p>\n        <form id=\"domain-checker-form\" class=\"d-flex w-100 position-relative flex-column flex-sm-row align-items-center\" action=\"\/my\/domain-checker\">\n            <input\n                    class=\"domain-checker__input label text-light-black\"\n                    name=\"domain\" type=\"text\"\n                    placeholder=\"Enter your desired domain name\"\n                    value=\"\"\n            \/>\n            <input id=\"domain-submit\"\n                   type=\"submit\"\n                   value=\"Check\"\n                   class=\"domain-checker__button hb--danger new-h-button-primary button text-white float-right\"\/>\n        <\/form>\n    <\/div>\n\n\n<\/p><h2 class=\"wp-block-heading\" id=\"h-how-to-host-a-mastodon-server\">How to host a Mastodon server<\/h2><p>With all prerequisites in place, you can proceed with the Mastodon instance setup. For this tutorial, we&rsquo;ll use a VPS running <strong>Ubuntu 22.04<\/strong>.<\/p><h3 class=\"wp-block-heading\" id=\"h-1-set-up-a-relay-smtp-server\">1. Set up a relay SMTP server<\/h3><p>A relay SMTP server is an essential component for any Mastodon server. It automatically sends emails, such as confirmation links, to your users. We&rsquo;ll set up an SMTP server using Brevo. It offers a free plan to send up to 300 emails daily.<\/p><p>Here are the steps:<\/p><ol class=\"wp-block-list\">\n<li>Access the <a href=\"https:\/\/www.brevo.com\" target=\"_blank\" rel=\"noopener\">Brevo homepage<\/a> and sign up for a new account.<\/li>\n\n\n\n<li>Once registered, go to your profile in the top right corner and click <strong>Senders, Domains &amp; Dedicated IPs<\/strong>.\n<ul class=\"wp-block-list\">\n<li>Select <strong>Senders<\/strong> and follow the on-screen instructions to enter and verify your email address. This email will be used to send emails to your users.<\/li>\n\n\n\n<li>Similarly, access the <strong>Domains<\/strong> menu to authenticate your domain name by completing the provided steps.<\/li>\n<\/ul>\n<\/li>\n<\/ol><div class=\"wp-block-image\"><figure data-wp-context='{\"imageId\":\"69e0ab8013d46\"}' data-wp-interactive=\"core\/image\" class=\"aligncenter size-large wp-lightbox-container\"><img decoding=\"async\" width=\"1024\" height=\"420\" data-wp-class--hide=\"state.isContentHidden\" data-wp-class--show=\"state.isContentVisible\" data-wp-init=\"callbacks.setButtonStyles\" data-wp-on-async--click=\"actions.showLightbox\" data-wp-on-async--load=\"callbacks.setButtonStyles\" data-wp-on-async-window--resize=\"callbacks.setButtonStyles\" src=\"\/tutorials\/wp-content\/uploads\/sites\/2\/2024\/08\/brevo-senders-domains-dedicated-ips-1024x420.png\" alt=\"Brevo's Senders and Domains options\" class=\"wp-image-114144\" srcset=\"https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2024\/08\/brevo-senders-domains-dedicated-ips-1024x420.png 1024w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2024\/08\/brevo-senders-domains-dedicated-ips-300x123.png 300w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2024\/08\/brevo-senders-domains-dedicated-ips-150x61.png 150w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2024\/08\/brevo-senders-domains-dedicated-ips-768x315.png 768w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2024\/08\/brevo-senders-domains-dedicated-ips-1536x629.png 1536w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2024\/08\/brevo-senders-domains-dedicated-ips-2048x839.png 2048w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><button class=\"lightbox-trigger\" type=\"button\" aria-haspopup=\"dialog\" aria-label=\"Enlarge\" data-wp-init=\"callbacks.initTriggerButton\" data-wp-on-async--click=\"actions.showLightbox\" data-wp-style--right=\"state.imageButtonRight\" data-wp-style--top=\"state.imageButtonTop\">\n\t\t\t<svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"12\" height=\"12\" fill=\"none\" viewbox=\"0 0 12 12\">\n\t\t\t\t<path fill=\"#fff\" d=\"M2 0a2 2 0 0 0-2 2v2h1.5V2a.5.5 0 0 1 .5-.5h2V0H2Zm2 10.5H2a.5.5 0 0 1-.5-.5V8H0v2a2 2 0 0 0 2 2h2v-1.5ZM8 12v-1.5h2a.5.5 0 0 0 .5-.5V8H12v2a2 2 0 0 1-2 2H8Zm2-12a2 2 0 0 1 2 2v2h-1.5V2a.5.5 0 0 0-.5-.5H8V0h2Z\"><\/path>\n\t\t\t<\/svg>\n\t\t<\/button><\/figure><\/div><ol start=\"3\" class=\"wp-block-list\">\n<li>Go to the <strong>SMTP &amp; API<\/strong> menu. Note each SMTP setting, including server, port, login, and password. These are necessary to install the SMTP server on Ubuntu.<\/li>\n<\/ol><div class=\"wp-block-image\"><figure data-wp-context='{\"imageId\":\"69e0ab8015a98\"}' data-wp-interactive=\"core\/image\" class=\"aligncenter size-large wp-lightbox-container\"><img decoding=\"async\" width=\"1024\" height=\"520\" data-wp-class--hide=\"state.isContentHidden\" data-wp-class--show=\"state.isContentVisible\" data-wp-init=\"callbacks.setButtonStyles\" data-wp-on-async--click=\"actions.showLightbox\" data-wp-on-async--load=\"callbacks.setButtonStyles\" data-wp-on-async-window--resize=\"callbacks.setButtonStyles\" src=\"\/tutorials\/wp-content\/uploads\/sites\/2\/2024\/08\/brevo-smtp-api-smtp-selected-1024x520.png\" alt=\"Brevo's SMTP &amp; API menu\" class=\"wp-image-114145\" srcset=\"https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2024\/08\/brevo-smtp-api-smtp-selected-1024x520.png 1024w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2024\/08\/brevo-smtp-api-smtp-selected-300x152.png 300w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2024\/08\/brevo-smtp-api-smtp-selected-150x76.png 150w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2024\/08\/brevo-smtp-api-smtp-selected-768x390.png 768w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2024\/08\/brevo-smtp-api-smtp-selected-1536x781.png 1536w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2024\/08\/brevo-smtp-api-smtp-selected-2048x1041.png 2048w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><button class=\"lightbox-trigger\" type=\"button\" aria-haspopup=\"dialog\" aria-label=\"Enlarge\" data-wp-init=\"callbacks.initTriggerButton\" data-wp-on-async--click=\"actions.showLightbox\" data-wp-style--right=\"state.imageButtonRight\" data-wp-style--top=\"state.imageButtonTop\">\n\t\t\t<svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"12\" height=\"12\" fill=\"none\" viewbox=\"0 0 12 12\">\n\t\t\t\t<path fill=\"#fff\" d=\"M2 0a2 2 0 0 0-2 2v2h1.5V2a.5.5 0 0 1 .5-.5h2V0H2Zm2 10.5H2a.5.5 0 0 1-.5-.5V8H0v2a2 2 0 0 0 2 2h2v-1.5ZM8 12v-1.5h2a.5.5 0 0 0 .5-.5V8H12v2a2 2 0 0 1-2 2H8Zm2-12a2 2 0 0 1 2 2v2h-1.5V2a.5.5 0 0 0-.5-.5H8V0h2Z\"><\/path>\n\t\t\t<\/svg>\n\t\t<\/button><\/figure><\/div><ol start=\"4\" class=\"wp-block-list\">\n<li>Open your preferred terminal emulator, SSH client application like <a href=\"\/my\/tutorials\/how-to-use-putty-ssh\">PuTTY<\/a>, or Hostinger&rsquo;s <strong>Browser terminal<\/strong> to access your server. For Hostinger VPS customers, you&rsquo;ll find your login credentials in hPanel by navigating to <strong>VPS &rarr; Manage &rarr; SSH access<\/strong>.<\/li>\n<\/ol><div class=\"wp-block-image\"><figure data-wp-context='{\"imageId\":\"69e0ab8017170\"}' data-wp-interactive=\"core\/image\" class=\"aligncenter size-large wp-lightbox-container\"><img decoding=\"async\" width=\"1024\" height=\"439\" data-wp-class--hide=\"state.isContentHidden\" data-wp-class--show=\"state.isContentVisible\" data-wp-init=\"callbacks.setButtonStyles\" data-wp-on-async--click=\"actions.showLightbox\" data-wp-on-async--load=\"callbacks.setButtonStyles\" data-wp-on-async-window--resize=\"callbacks.setButtonStyles\" src=\"\/tutorials\/wp-content\/uploads\/sites\/2\/2024\/08\/hpanel-vps-overview-ssh-access-terminal-highlighted-1-1024x439.png\" alt=\"Hostinger VPS' SSH credentials\" class=\"wp-image-114146\" srcset=\"https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2024\/08\/hpanel-vps-overview-ssh-access-terminal-highlighted-1-1024x439.png 1024w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2024\/08\/hpanel-vps-overview-ssh-access-terminal-highlighted-1-300x129.png 300w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2024\/08\/hpanel-vps-overview-ssh-access-terminal-highlighted-1-150x64.png 150w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2024\/08\/hpanel-vps-overview-ssh-access-terminal-highlighted-1-768x330.png 768w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2024\/08\/hpanel-vps-overview-ssh-access-terminal-highlighted-1-1536x659.png 1536w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2024\/08\/hpanel-vps-overview-ssh-access-terminal-highlighted-1-2048x879.png 2048w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><button class=\"lightbox-trigger\" type=\"button\" aria-haspopup=\"dialog\" aria-label=\"Enlarge\" data-wp-init=\"callbacks.initTriggerButton\" data-wp-on-async--click=\"actions.showLightbox\" data-wp-style--right=\"state.imageButtonRight\" data-wp-style--top=\"state.imageButtonTop\">\n\t\t\t<svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"12\" height=\"12\" fill=\"none\" viewbox=\"0 0 12 12\">\n\t\t\t\t<path fill=\"#fff\" d=\"M2 0a2 2 0 0 0-2 2v2h1.5V2a.5.5 0 0 1 .5-.5h2V0H2Zm2 10.5H2a.5.5 0 0 1-.5-.5V8H0v2a2 2 0 0 0 2 2h2v-1.5ZM8 12v-1.5h2a.5.5 0 0 0 .5-.5V8H12v2a2 2 0 0 1-2 2H8Zm2-12a2 2 0 0 1 2 2v2h-1.5V2a.5.5 0 0 0-.5-.5H8V0h2Z\"><\/path>\n\t\t\t<\/svg>\n\t\t<\/button><\/figure><\/div><ol start=\"5\" class=\"wp-block-list\">\n<li>Install Postfix and SASL modules by running the following command:<\/li>\n<\/ol><pre class=\"wp-block-preformatted\">apt install postfix libsasl2-modules<\/pre><ol start=\"6\" class=\"wp-block-list\">\n<li>You&rsquo;ll be prompted to choose the mail configuration. Select <strong>Internet Site<\/strong> by navigating with the <strong>arrow keys<\/strong>, pressing <strong>Space<\/strong> to select it, then using <strong>Tab<\/strong> to highlight <strong>OK<\/strong> and <strong>Enter<\/strong> to confirm.<\/li>\n<\/ol><div class=\"wp-block-image\"><figure data-wp-context='{\"imageId\":\"69e0ab8018a17\"}' data-wp-interactive=\"core\/image\" class=\"aligncenter size-large wp-lightbox-container\"><img decoding=\"async\" width=\"1024\" height=\"762\" data-wp-class--hide=\"state.isContentHidden\" data-wp-class--show=\"state.isContentVisible\" data-wp-init=\"callbacks.setButtonStyles\" data-wp-on-async--click=\"actions.showLightbox\" data-wp-on-async--load=\"callbacks.setButtonStyles\" data-wp-on-async-window--resize=\"callbacks.setButtonStyles\" src=\"\/tutorials\/wp-content\/uploads\/sites\/2\/2024\/08\/terminal-postfix-configuration-internet-site-highlighted-1024x762.png\" alt=\"Postfix's Internet Site option\" class=\"wp-image-114147\" srcset=\"https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2024\/08\/terminal-postfix-configuration-internet-site-highlighted-1024x762.png 1024w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2024\/08\/terminal-postfix-configuration-internet-site-highlighted-300x223.png 300w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2024\/08\/terminal-postfix-configuration-internet-site-highlighted-150x112.png 150w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2024\/08\/terminal-postfix-configuration-internet-site-highlighted-768x571.png 768w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2024\/08\/terminal-postfix-configuration-internet-site-highlighted-1536x1143.png 1536w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2024\/08\/terminal-postfix-configuration-internet-site-highlighted-2048x1524.png 2048w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><button class=\"lightbox-trigger\" type=\"button\" aria-haspopup=\"dialog\" aria-label=\"Enlarge\" data-wp-init=\"callbacks.initTriggerButton\" data-wp-on-async--click=\"actions.showLightbox\" data-wp-style--right=\"state.imageButtonRight\" data-wp-style--top=\"state.imageButtonTop\">\n\t\t\t<svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"12\" height=\"12\" fill=\"none\" viewbox=\"0 0 12 12\">\n\t\t\t\t<path fill=\"#fff\" d=\"M2 0a2 2 0 0 0-2 2v2h1.5V2a.5.5 0 0 1 .5-.5h2V0H2Zm2 10.5H2a.5.5 0 0 1-.5-.5V8H0v2a2 2 0 0 0 2 2h2v-1.5ZM8 12v-1.5h2a.5.5 0 0 0 .5-.5V8H12v2a2 2 0 0 1-2 2H8Zm2-12a2 2 0 0 1 2 2v2h-1.5V2a.5.5 0 0 0-.5-.5H8V0h2Z\"><\/path>\n\t\t\t<\/svg>\n\t\t<\/button><\/figure><\/div><p>Then, enter your domain name in the dedicated field to set the system mail name.<\/p><div class=\"wp-block-image\"><figure data-wp-context='{\"imageId\":\"69e0ab801a620\"}' data-wp-interactive=\"core\/image\" class=\"aligncenter size-large wp-lightbox-container\"><img decoding=\"async\" width=\"1024\" height=\"357\" data-wp-class--hide=\"state.isContentHidden\" data-wp-class--show=\"state.isContentVisible\" data-wp-init=\"callbacks.setButtonStyles\" data-wp-on-async--click=\"actions.showLightbox\" data-wp-on-async--load=\"callbacks.setButtonStyles\" data-wp-on-async-window--resize=\"callbacks.setButtonStyles\" src=\"\/tutorials\/wp-content\/uploads\/sites\/2\/2024\/08\/terminal-postfix-configuration-system-mail-name-1024x357.png\" alt=\"Postfix's System mail name field\" class=\"wp-image-114148\" srcset=\"https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2024\/08\/terminal-postfix-configuration-system-mail-name-1024x357.png 1024w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2024\/08\/terminal-postfix-configuration-system-mail-name-300x104.png 300w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2024\/08\/terminal-postfix-configuration-system-mail-name-150x52.png 150w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2024\/08\/terminal-postfix-configuration-system-mail-name-768x267.png 768w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2024\/08\/terminal-postfix-configuration-system-mail-name-1536x535.png 1536w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2024\/08\/terminal-postfix-configuration-system-mail-name-2048x713.png 2048w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><button class=\"lightbox-trigger\" type=\"button\" aria-haspopup=\"dialog\" aria-label=\"Enlarge\" data-wp-init=\"callbacks.initTriggerButton\" data-wp-on-async--click=\"actions.showLightbox\" data-wp-style--right=\"state.imageButtonRight\" data-wp-style--top=\"state.imageButtonTop\">\n\t\t\t<svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"12\" height=\"12\" fill=\"none\" viewbox=\"0 0 12 12\">\n\t\t\t\t<path fill=\"#fff\" d=\"M2 0a2 2 0 0 0-2 2v2h1.5V2a.5.5 0 0 1 .5-.5h2V0H2Zm2 10.5H2a.5.5 0 0 1-.5-.5V8H0v2a2 2 0 0 0 2 2h2v-1.5ZM8 12v-1.5h2a.5.5 0 0 0 .5-.5V8H12v2a2 2 0 0 1-2 2H8Zm2-12a2 2 0 0 1 2 2v2h-1.5V2a.5.5 0 0 0-.5-.5H8V0h2Z\"><\/path>\n\t\t\t<\/svg>\n\t\t<\/button><\/figure><\/div><ol start=\"7\" class=\"wp-block-list\">\n<li>Open the Postfix configuration file using the <a href=\"\/my\/tutorials\/how-to-install-and-use-nano-text-editor\">nano text editor<\/a>:<\/li>\n<\/ol><pre class=\"wp-block-preformatted\">nano \/etc\/postfix\/main.cf<\/pre><p>Find the <strong>relayhost =<\/strong> line and replace it with the following:<\/p><pre class=\"wp-block-preformatted\"># outbound relay configurations\nsmtp_sasl_auth_enable = yes\nsmtp_sasl_password_maps = hash:\/etc\/postfix\/sasl_passwd\nsmtp_sasl_security_options = noanonymous\nsmtp_tls_security_level = may\nheader_size_limit = 4096000<\/pre><p>Save the file and close <strong>nano<\/strong> by pressing <strong>Ctrl + X &rarr; Y &rarr; Enter<\/strong>.<\/p><ol start=\"8\" class=\"wp-block-list\">\n<li>Create a new file named <strong>sasl_passwd<\/strong>:<\/li>\n<\/ol><pre class=\"wp-block-preformatted\">nano \/etc\/postfix\/sasl_passwd<\/pre><p>Add the SMTP relay host, username, and password as below. Replace <strong>smtp_username<\/strong> and <strong>smtp_password<\/strong> with your details:<\/p><pre class=\"wp-block-preformatted\">[smtp-relay.brevo.com]:587   smtp_username:smtp_password<\/pre><ol start=\"9\" class=\"wp-block-list\">\n<li>Once you&rsquo;ve saved the changes, execute these commands to create the corresponding database file, restart Postfix, and set proper permissions:<\/li>\n<\/ol><pre class=\"wp-block-preformatted\">postmap \/etc\/postfix\/sasl_passwd\nsystemctl restart postfix\nchmod 0600 \/etc\/postfix\/sasl_passwd \/etc\/postfix\/sasl_passwd.db<\/pre><ol start=\"10\" class=\"wp-block-list\">\n<li>Send a test email using the commands below. Replace <strong>from-address<\/strong> with your configured sender email in Brevo and <strong>to-address<\/strong> with the recipient&rsquo;s email address:<\/li>\n<\/ol><pre class=\"wp-block-preformatted\">apt install bsd-mailx\necho \"This is a test email.\" | mailx -r from-address -s hello to-address<\/pre><p>Check your recipient&rsquo;s inbox to see if the email was indeed sent.<\/p><h3 class=\"wp-block-heading\" id=\"h-2-secure-the-server\">2. Secure the server<\/h3><p>You need to set up strong security measures to safeguard your Mastodon server from unauthorized access and maintain its integrity. Here&rsquo;s how:<\/p><ol class=\"wp-block-list\">\n<li><a href=\"\/my\/tutorials\/ssh\/how-to-set-up-ssh-keys\">Configure SSH keys<\/a> instead of using passwords for authentication. SSH keys provide a more secure method of accessing your VPS with a pair of cryptographic keys. Open a new terminal window without connecting to the server and type:<\/li>\n<\/ol><pre class=\"wp-block-preformatted\">ssh-keygen -t rsa -b 4096<\/pre><p>After generating the keys, copy the public key to your server. Replace <strong>username<\/strong> and <strong>your_server_ip<\/strong> with your credentials:<\/p><pre class=\"wp-block-preformatted\">ssh-copy-id username@your_server_ip<\/pre><ol start=\"2\" class=\"wp-block-list\">\n<li>Switch back to the terminal window connected to your server. Update your system package list and upgrade installed packages to patch vulnerabilities and improve stability:<\/li>\n<\/ol><pre class=\"wp-block-preformatted\">apt update &amp;&amp; apt upgrade -y<\/pre><ol start=\"3\" class=\"wp-block-list\">\n<li><a href=\"\/my\/tutorials\/fail2ban-configuration\">Install Fail2ban<\/a> to protect your server from brute-force attacks. This software monitors log files and bans IP addresses showing malicious behavior.<\/li>\n<\/ol><pre class=\"wp-block-preformatted\">apt install fail2ban<\/pre><p>Configure it by creating a local configuration file:<\/p><pre class=\"wp-block-preformatted\">nano \/etc\/fail2ban\/jail.local<\/pre><p>Then, add these lines inside the file:<\/p><pre class=\"wp-block-preformatted\">[DEFAULT]\ndestemail = your@email.here\nsendername = Fail2Ban\n[sshd]\nenabled = true\nport = 22\nmode = aggressive<\/pre><p>Restart Fail2ban to apply the changes:<\/p><pre class=\"wp-block-preformatted\">systemctl restart fail2ban<\/pre><ol start=\"4\" class=\"wp-block-list\">\n<li><a href=\"\/my\/tutorials\/iptables-tutorial\">Install iptables<\/a> to allow only SSH, HTTP, and HTTPS ports:<\/li>\n<\/ol><pre class=\"wp-block-preformatted\">apt install -y iptables-persistent<\/pre><p>During the installation, you&rsquo;ll be asked to save the current IPv4 and IPv6 rules. Select <strong>No<\/strong> for both.<\/p><div class=\"wp-block-image\"><figure data-wp-context='{\"imageId\":\"69e0ab8025e13\"}' data-wp-interactive=\"core\/image\" class=\"aligncenter size-large wp-lightbox-container\"><img decoding=\"async\" width=\"1024\" height=\"276\" data-wp-class--hide=\"state.isContentHidden\" data-wp-class--show=\"state.isContentVisible\" data-wp-init=\"callbacks.setButtonStyles\" data-wp-on-async--click=\"actions.showLightbox\" data-wp-on-async--load=\"callbacks.setButtonStyles\" data-wp-on-async-window--resize=\"callbacks.setButtonStyles\" src=\"\/tutorials\/wp-content\/uploads\/sites\/2\/2024\/08\/terminal-configuring-iptables-persistent-ipv4-no-highlighted-1024x276.png\" alt=\"iptables' IPv4 rules prompt\" class=\"wp-image-114149\" srcset=\"https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2024\/08\/terminal-configuring-iptables-persistent-ipv4-no-highlighted-1024x276.png 1024w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2024\/08\/terminal-configuring-iptables-persistent-ipv4-no-highlighted-300x81.png 300w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2024\/08\/terminal-configuring-iptables-persistent-ipv4-no-highlighted-150x40.png 150w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2024\/08\/terminal-configuring-iptables-persistent-ipv4-no-highlighted-768x207.png 768w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2024\/08\/terminal-configuring-iptables-persistent-ipv4-no-highlighted-1536x414.png 1536w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2024\/08\/terminal-configuring-iptables-persistent-ipv4-no-highlighted-2048x552.png 2048w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><button class=\"lightbox-trigger\" type=\"button\" aria-haspopup=\"dialog\" aria-label=\"Enlarge\" data-wp-init=\"callbacks.initTriggerButton\" data-wp-on-async--click=\"actions.showLightbox\" data-wp-style--right=\"state.imageButtonRight\" data-wp-style--top=\"state.imageButtonTop\">\n\t\t\t<svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"12\" height=\"12\" fill=\"none\" viewbox=\"0 0 12 12\">\n\t\t\t\t<path fill=\"#fff\" d=\"M2 0a2 2 0 0 0-2 2v2h1.5V2a.5.5 0 0 1 .5-.5h2V0H2Zm2 10.5H2a.5.5 0 0 1-.5-.5V8H0v2a2 2 0 0 0 2 2h2v-1.5ZM8 12v-1.5h2a.5.5 0 0 0 .5-.5V8H12v2a2 2 0 0 1-2 2H8Zm2-12a2 2 0 0 1 2 2v2h-1.5V2a.5.5 0 0 0-.5-.5H8V0h2Z\"><\/path>\n\t\t\t<\/svg>\n\t\t<\/button><\/figure><\/div><div class=\"wp-block-image\"><figure data-wp-context='{\"imageId\":\"69e0ab802810c\"}' data-wp-interactive=\"core\/image\" class=\"aligncenter size-large wp-lightbox-container\"><img decoding=\"async\" width=\"1024\" height=\"280\" data-wp-class--hide=\"state.isContentHidden\" data-wp-class--show=\"state.isContentVisible\" data-wp-init=\"callbacks.setButtonStyles\" data-wp-on-async--click=\"actions.showLightbox\" data-wp-on-async--load=\"callbacks.setButtonStyles\" data-wp-on-async-window--resize=\"callbacks.setButtonStyles\" src=\"\/tutorials\/wp-content\/uploads\/sites\/2\/2024\/08\/terminal-configuring-iptables-persistent-ipv6-no-highlighted-1024x280.png\" alt=\"iptables' IPv6 rules prompt\" class=\"wp-image-114150\" srcset=\"https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2024\/08\/terminal-configuring-iptables-persistent-ipv6-no-highlighted-1024x280.png 1024w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2024\/08\/terminal-configuring-iptables-persistent-ipv6-no-highlighted-300x82.png 300w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2024\/08\/terminal-configuring-iptables-persistent-ipv6-no-highlighted-150x41.png 150w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2024\/08\/terminal-configuring-iptables-persistent-ipv6-no-highlighted-768x210.png 768w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2024\/08\/terminal-configuring-iptables-persistent-ipv6-no-highlighted-1536x421.png 1536w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2024\/08\/terminal-configuring-iptables-persistent-ipv6-no-highlighted-2048x561.png 2048w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><button class=\"lightbox-trigger\" type=\"button\" aria-haspopup=\"dialog\" aria-label=\"Enlarge\" data-wp-init=\"callbacks.initTriggerButton\" data-wp-on-async--click=\"actions.showLightbox\" data-wp-style--right=\"state.imageButtonRight\" data-wp-style--top=\"state.imageButtonTop\">\n\t\t\t<svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"12\" height=\"12\" fill=\"none\" viewbox=\"0 0 12 12\">\n\t\t\t\t<path fill=\"#fff\" d=\"M2 0a2 2 0 0 0-2 2v2h1.5V2a.5.5 0 0 1 .5-.5h2V0H2Zm2 10.5H2a.5.5 0 0 1-.5-.5V8H0v2a2 2 0 0 0 2 2h2v-1.5ZM8 12v-1.5h2a.5.5 0 0 0 .5-.5V8H12v2a2 2 0 0 1-2 2H8Zm2-12a2 2 0 0 1 2 2v2h-1.5V2a.5.5 0 0 0-.5-.5H8V0h2Z\"><\/path>\n\t\t\t<\/svg>\n\t\t<\/button><\/figure><\/div><ol start=\"5\" class=\"wp-block-list\">\n<li>Create a new file to store IPv4 configurations:<\/li>\n<\/ol><pre class=\"wp-block-preformatted\">nano \/etc\/iptables\/rules.v4<\/pre><p>Copy these lines into the file:<\/p><pre class=\"wp-block-preformatted\">*filter\n#&nbsp; Allow all loopback (lo0) traffic and drop all traffic to 127\/8 that doesn't use lo0.\n-A INPUT -i lo -j ACCEPT\n-A INPUT ! -i lo -d 127.0.0.0\/8 -j REJECT\n#&nbsp; Accept all established inbound connections.\n-A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT\n#&nbsp; Allow all outbound traffic; you can modify this to only allow certain traffic.\n-A OUTPUT -j ACCEPT\n#&nbsp; Allow HTTP and HTTPS connections from anywhere, including standard ports for websites and SSL.\n-A INPUT -p tcp --dport 80 -j ACCEPT\n-A INPUT -p tcp --dport 443 -j ACCEPT\n#&nbsp; Allow HTTP\/3 connections from anywhere (optional).\n-A INPUT -p udp --dport 443 -j ACCEPT\n#&nbsp; Allow SSH connections.\n#&nbsp; The -dport number should be the same port number you set in sshd_config.\n-A INPUT -p tcp -m state --state NEW --dport 22 -j ACCEPT\n#&nbsp; Allow ping.\n-A INPUT -p icmp -m icmp --icmp-type 8 -j ACCEPT\n#&nbsp; Allow destination unreachable messages, especially code 4 (fragmentation required) is required or PMTUD breaks.\n-A INPUT -p icmp -m icmp --icmp-type 3 -j ACCEPT\n#&nbsp; Log iptables denied calls.\n-A INPUT -m limit --limit 5\/min -j LOG --log-prefix \"iptables denied: \" --log-level 7\n#&nbsp; Reject all other inbound; default deny unless explicitly allowed policy.\n-A INPUT -j REJECT\n-A FORWARD -j REJECT\nCOMMIT<\/pre><ol start=\"6\" class=\"wp-block-list\">\n<li>Create a new IPv6 configuration file as well:<\/li>\n<\/ol><pre class=\"wp-block-preformatted\">nano \/etc\/iptables\/rules.v6<\/pre><p>Then, add the following lines:<\/p><pre class=\"wp-block-preformatted\">*filter\n#&nbsp; Allow all loopback (lo0) traffic and drop all traffic to 127\/8 that doesn't use lo0.\n-A INPUT -i lo -j ACCEPT\n-A INPUT ! -i lo -d ::1\/128 -j REJECT\n#&nbsp; Accept all established inbound connections.\n-A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT\n#&nbsp; Allow all outbound traffic; you can modify this to only allow certain traffic.\n-A OUTPUT -j ACCEPT\n#&nbsp; Allow HTTP and HTTPS connections from anywhere, including the standard ports for websites and SSL.\n-A INPUT -p tcp --dport 80 -j ACCEPT\n-A INPUT -p tcp --dport 443 -j ACCEPT\n#&nbsp; Allow HTTP\/3 connections from anywhere (optional).\n-A INPUT -p udp --dport 443 -j ACCEPT\n#&nbsp; Allow SSH connections.\n#&nbsp; The -dport number should be the same port number you set in sshd_config.\n-A INPUT -p tcp -m state --state NEW --dport 22 -j ACCEPT\n#&nbsp; Allow ping.\n-A INPUT -p icmpv6 -j ACCEPT\n#&nbsp; Log iptables denied calls.\n-A INPUT -m limit --limit 5\/min -j LOG --log-prefix \"iptables denied: \" --log-level 7\n#&nbsp; Reject all other inbound; default deny unless explicitly allowed policy.\n-A INPUT -j REJECT\n-A FORWARD -j REJECT\nCOMMIT<\/pre><ol start=\"7\" class=\"wp-block-list\">\n<li>Manually load both configuration files during boot time:<\/li>\n<\/ol><pre class=\"wp-block-preformatted\">iptables-restore &lt; \/etc\/iptables\/rules.v4\nip6tables-restore &lt; \/etc\/iptables\/rules.v6<\/pre><h3 class=\"wp-block-heading\" id=\"h-3-prepare-the-system-environment\">3. Prepare the system environment<\/h3><p>Next, set up the Mastodon server environment. This involves configuring system repositories and packages, creating a dedicated user, and installing necessary software.<\/p><p>Here&rsquo;s the guide:<\/p><ol class=\"wp-block-list\">\n<li>Install essential tools and utilities:<\/li>\n<\/ol><pre class=\"wp-block-preformatted\">apt install -y curl wget gnupg apt-transport-https lsb-release ca-certificates<\/pre><ul class=\"wp-block-list\">\n<li><a href=\"\/my\/tutorials\/curl-command-with-examples-linux\">curl<\/a> &ndash; a tool to transfer data from or to a server.<\/li>\n\n\n\n<li><a href=\"\/my\/tutorials\/wget-command-examples\">wget<\/a> &ndash; a command-line utility to download files from the web.<\/li>\n\n\n\n<li><strong>gnupg<\/strong> &ndash; a free implementation of the OpenPGP standard to secure communication and data storage.<\/li>\n\n\n\n<li><strong>apt-transport-https<\/strong> &ndash; allows the package manager to retrieve packages via HTTPS.<\/li>\n\n\n\n<li><strong>lsb-release<\/strong> &ndash; provides Linux Standard Base (LSB) information about the installed distribution.<\/li>\n\n\n\n<li><strong>ca-certificates<\/strong> &ndash; provides a set of trusted CA certificates.<\/li>\n<\/ul><ol start=\"2\" class=\"wp-block-list\">\n<li>Add the Node.js repository to your VPS to ensure you have the latest version:<\/li>\n<\/ol><pre class=\"wp-block-preformatted\">curl -fsSL https:\/\/deb.nodesource.com\/gpgkey\/nodesource-repo.gpg.key | gpg --dearmor -o \/etc\/apt\/keyrings\/nodesource.gpg\necho \"deb [signed-by=\/etc\/apt\/keyrings\/nodesource.gpg] https:\/\/deb.nodesource.com\/node_20.x nodistro main\" | tee \/etc\/apt\/sources.list.d\/nodesource.list<\/pre><ol start=\"3\" class=\"wp-block-list\">\n<li>Similarly, add the PostgreSQL repository using the commands below:<\/li>\n<\/ol><pre class=\"wp-block-preformatted\">wget -O \/usr\/share\/keyrings\/postgresql.asc https:\/\/www.postgresql.org\/media\/keys\/ACCC4CF8.asc\necho \"deb [signed-by=\/usr\/share\/keyrings\/postgresql.asc] http:\/\/apt.postgresql.org\/pub\/repos\/apt $(lsb_release -cs)-pgdg main\"&gt; \/etc\/apt\/sources.list.d\/postgresql.list<\/pre><ol start=\"4\" class=\"wp-block-list\">\n<li>Update your package list and install the necessary packages:<\/li>\n<\/ol><pre class=\"wp-block-preformatted\">apt update\napt install -y \nimagemagick ffmpeg libpq-dev libxml2-dev libxslt1-dev file git-core \ng++ libprotobuf-dev protobuf-compiler pkg-config gcc autoconf \nbison build-essential libssl-dev libyaml-dev libreadline6-dev \nzlib1g-dev libncurses5-dev libffi-dev libgdbm-dev \nnginx nodejs redis-server redis-tools postgresql postgresql-contrib \ncertbot python3-certbot-nginx libidn11-dev libicu-dev libjemalloc-dev<\/pre><ul class=\"wp-block-list\">\n<li><strong>imagemagick<\/strong> &ndash; a software suite to create, edit, compose, or convert digital images.<\/li>\n\n\n\n<li><strong>ffmpeg<\/strong> &ndash; a tool to record, convert, and stream audio and video.<\/li>\n\n\n\n<li><strong>libpq-dev<\/strong> &ndash; PostgreSQL C client library and headers.<\/li>\n\n\n\n<li><strong>nginx<\/strong> &ndash; a high-performance HTTP server and <a href=\"\/my\/tutorials\/how-to-set-up-nginx-reverse-proxy\">reverse proxy<\/a>.<\/li>\n\n\n\n<li><strong>nodejs<\/strong> &ndash; a JavaScript runtime built on Chrome&rsquo;s V8 engine.<\/li>\n\n\n\n<li><a href=\"\/my\/tutorials\/how-to-install-and-setup-redis-on-ubuntu\">redis-server<\/a> &ndash; an in-memory key-value store used as a database, cache, and message broker.<\/li>\n\n\n\n<li><strong>certbot<\/strong> &ndash; a tool to automatically use Let&rsquo;s Encrypt certificates.<\/li>\n<\/ul><ol start=\"5\" class=\"wp-block-list\">\n<li>Enable Corepack and set the <a href=\"\/my\/tutorials\/how-to-install-yarn\">Yarn<\/a> package manager version:<\/li>\n<\/ol><pre class=\"wp-block-preformatted\">corepack enable\nyarn set version classic<\/pre><ol start=\"6\" class=\"wp-block-list\">\n<li>Create a new user named <strong>mastodon<\/strong> or a name of your choice to run Mastodon:<\/li>\n<\/ol><pre class=\"wp-block-preformatted\">adduser --disabled-login mastodon<\/pre><p>Switch to the <strong>mastodon<\/strong> user:<\/p><pre class=\"wp-block-preformatted\">su - mastodon<\/pre><ol start=\"7\" class=\"wp-block-list\">\n<li>Set up <strong>rbenv<\/strong> to manage Ruby versions:<\/li>\n<\/ol><pre class=\"wp-block-preformatted\">git clone https:\/\/github.com\/rbenv\/rbenv.git ~\/.rbenv\necho 'export PATH=\"$HOME\/.rbenv\/bin:$PATH\"' &gt;&gt; ~\/.bashrc\necho 'eval \"$(rbenv init -)\"' &gt;&gt; ~\/.bashrc\nexec bash\ngit clone https:\/\/github.com\/rbenv\/ruby-build.git \"$(rbenv root)\"\/plugins\/ruby-build<\/pre><p>Once done, install Ruby and set it as the global version:<\/p><pre class=\"wp-block-preformatted\">RUBY_CONFIGURE_OPTS=--with-jemalloc rbenv install 3.2.3\nrbenv global 3.2.3<\/pre><ol start=\"8\" class=\"wp-block-list\">\n<li>Install Bundler, a Ruby gem dependency manager:<\/li>\n<\/ol><pre class=\"wp-block-preformatted\">gem install bundler --no-document<\/pre><h3 class=\"wp-block-heading\" id=\"h-4-set-up-the-database\">4. Set up the database<\/h3><p>A crucial part of hosting a dedicated Mastodon server is <a href=\"\/my\/tutorials\/how-to-install-postgresql-on-ubuntu\">creating a PostgreSQL database<\/a>, which stores your instance&rsquo;s essential data. Follow the instructions below:<\/p><ol class=\"wp-block-list\">\n<li>Return to the <strong>root<\/strong> user to configure the database with the necessary privileges:<\/li>\n<\/ol><pre class=\"wp-block-preformatted\">exit<\/pre><ol start=\"2\" class=\"wp-block-list\">\n<li>Enter the PostgreSQL interactive terminal:<\/li>\n<\/ol><pre class=\"wp-block-preformatted\">sudo -u postgres -i psql<\/pre><ol start=\"3\" class=\"wp-block-list\">\n<li>Create a database for Mastodon:<\/li>\n<\/ol><pre class=\"wp-block-preformatted\">CREATE DATABASE mastodon;<\/pre><ol start=\"4\" class=\"wp-block-list\">\n<li>Create a dedicated PostgreSQL user for your Mastodon instance and assign a strong password. Replace <strong>your_preferred_password<\/strong> with a unique password of your choice:<\/li>\n<\/ol><pre class=\"wp-block-preformatted\">CREATE USER mastodon;\nALTER USER mastodon WITH ENCRYPTED PASSWORD 'your_preferred_password';<\/pre><ol start=\"5\" class=\"wp-block-list\">\n<li>Make sure the user has the correct permissions to manage the database:<\/li>\n<\/ol><pre class=\"wp-block-preformatted\">ALTER USER mastodon createdb;\nALTER DATABASE mastodon OWNER TO mastodon;<\/pre><ol start=\"6\" class=\"wp-block-list\">\n<li>Quit the PostgreSQL terminal by typing:<\/li>\n<\/ol><pre class=\"wp-block-preformatted\">q<\/pre><h3 class=\"wp-block-heading\" id=\"h-5-install-mastodon\">5. Install Mastodon<\/h3><p>It&rsquo;s time to download the installer, set up necessary Mastodon dependencies, and run the setup wizard to configure your instance. Here are the steps to complete the Mastodon installation:<\/p><ol class=\"wp-block-list\">\n<li>Switch back to the <strong>mastodon<\/strong> user to ensure all Mastodon-related files and processes are isolated from the rest of the system:<\/li>\n<\/ol><pre class=\"wp-block-preformatted\">su - mastodon<\/pre><ol start=\"2\" class=\"wp-block-list\">\n<li>Use these <a href=\"\/my\/tutorials\/basic-git-commands\">Git commands<\/a> to download the Mastodon installer from the official repository:<\/li>\n<\/ol><pre class=\"wp-block-preformatted\">git clone https:\/\/github.com\/mastodon\/mastodon.git live &amp;&amp; cd live\ngit checkout $(git tag -l | grep '^v[0-9.]*$' | sort -V | tail -n 1)<\/pre><ol start=\"3\" class=\"wp-block-list\">\n<li>Install additional Ruby and JavaScript dependencies:<\/li>\n<\/ol><pre class=\"wp-block-preformatted\">bundle config deployment 'true'\nbundle config without 'development test'\nbundle install -j$(getconf _NPROCESSORS_ONLN)\nyarn install --pure-lockfile<\/pre><ol start=\"4\" class=\"wp-block-list\">\n<li>Run the Mastodon setup wizard:<\/li>\n<\/ol><pre class=\"wp-block-preformatted\">RAILS_ENV=production bundle exec rake mastodon:setup<\/pre><p>The wizard will ask you a series of questions:<\/p><ul class=\"wp-block-list\">\n<li><strong>Domain name<\/strong> &ndash; enter the domain name that is connected to your VPS.<\/li>\n\n\n\n<li><strong>Do you want to enable single-user mode?<\/strong> &ndash; answer <strong>n<\/strong> to let users register on your server.<\/li>\n\n\n\n<li><strong>Are you using Docker to run Mastodon?<\/strong> &ndash; answer <strong>n.<\/strong><\/li>\n\n\n\n<li><strong>PostgreSQL host<\/strong> &ndash; enter <strong>127.0.0.1<\/strong>.<\/li>\n\n\n\n<li><strong>PostgreSQL port<\/strong> &ndash; enter <strong>5432<\/strong>.<\/li>\n\n\n\n<li><strong>Name of PostgreSQL database<\/strong> &ndash; enter <strong>mastodon<\/strong>.<\/li>\n\n\n\n<li><strong>Name of PostgreSQL user<\/strong> &ndash; enter <strong>mastodon<\/strong>.<\/li>\n\n\n\n<li><strong>Password of PostgreSQL user<\/strong> &ndash; enter the database password you configured earlier.<\/li>\n\n\n\n<li><strong>Do you want to store uploaded files on the cloud?<\/strong> &ndash; answer <strong>n<\/strong> to store files locally on the server.<\/li>\n\n\n\n<li><strong>Do you want to send emails from localhost?<\/strong> &ndash; answer <strong>y<\/strong> since you&rsquo;ve created an SMTP server before.<\/li>\n\n\n\n<li><strong>E-mail address to send e-mails &ldquo;from&rdquo;<\/strong> &ndash; enter the email address you set up earlier as the sender.<\/li>\n\n\n\n<li><strong>Send a test e-mail with this configuration right now?<\/strong> &ndash; answer <strong>y.<\/strong><\/li>\n\n\n\n<li><strong>Send test e-mail to<\/strong> &ndash; enter the recipient email address.<\/li>\n\n\n\n<li><strong>Save configuration?<\/strong> &ndash; answer <strong>y<\/strong>.<\/li>\n\n\n\n<li><strong>Prepare the database now?<\/strong> &ndash; answer <strong>y<\/strong>.<\/li>\n\n\n\n<li><strong>Compile the assets now?<\/strong> &ndash; answer <strong>y<\/strong>.<\/li>\n\n\n\n<li><strong>Would you like to create an admin user right now?<\/strong> &ndash; answer <strong>y<\/strong>.<\/li>\n\n\n\n<li><strong>Username<\/strong> &ndash; enter the desired username for your admin account.<\/li>\n\n\n\n<li><strong>E-mail<\/strong> &ndash; enter the email address for this admin account.<\/li>\n<\/ul><p>Once done, you&rsquo;ll be given a generated admin password. Store this password securely to log in as the server owner later.<\/p><h3 class=\"wp-block-heading\" id=\"h-6-configure-the-web-server\">6. Configure the web server<\/h3><p>After installing Mastodon on your VPS, you need to configure the NGINX web server, issue an SSL certificate for secure connections, and set up <strong>systemd<\/strong> services to manage the Mastodon processes. Here are the steps:<\/p><ol class=\"wp-block-list\">\n<li>Switch to the <strong>root<\/strong> user once again:<\/li>\n<\/ol><pre class=\"wp-block-preformatted\">exit<\/pre><ol start=\"2\" class=\"wp-block-list\">\n<li>Get a free SSL certificate using Certbot, replacing <strong>example.com<\/strong> with your own domain name:<\/li>\n<\/ol><pre class=\"wp-block-preformatted\">certbot certonly --nginx -d example.com<\/pre><p>Follow the on-screen instructions to configure SSL automatically.<\/p><ol start=\"3\" class=\"wp-block-list\">\n<li>Copy the configuration template for NGINX from the Mastodon directory:<\/li>\n<\/ol><pre class=\"wp-block-preformatted\">cp \/home\/mastodon\/live\/dist\/nginx.conf \/etc\/nginx\/sites-available\/mastodon\nln -s \/etc\/nginx\/sites-available\/mastodon \/etc\/nginx\/sites-enabled\/mastodon\nrm \/etc\/nginx\/sites-enabled\/default<\/pre><ol start=\"4\" class=\"wp-block-list\">\n<li>Edit the NGINX configuration file:<\/li>\n<\/ol><pre class=\"wp-block-preformatted\">nano \/etc\/nginx\/sites-available\/mastodon<\/pre><p>Uncomment the <strong>ssl_certificate<\/strong> and <strong>ssl_certificate_key<\/strong> lines. Then, find every instance of <strong>example.com<\/strong> with <strong>Ctrl + W <\/strong>and replace them with your domain name.<\/p><div class=\"wp-block-image\"><figure data-wp-context='{\"imageId\":\"69e0ab802b65b\"}' data-wp-interactive=\"core\/image\" class=\"aligncenter size-large wp-lightbox-container\"><img decoding=\"async\" width=\"1024\" height=\"495\" data-wp-class--hide=\"state.isContentHidden\" data-wp-class--show=\"state.isContentVisible\" data-wp-init=\"callbacks.setButtonStyles\" data-wp-on-async--click=\"actions.showLightbox\" data-wp-on-async--load=\"callbacks.setButtonStyles\" data-wp-on-async-window--resize=\"callbacks.setButtonStyles\" src=\"\/tutorials\/wp-content\/uploads\/sites\/2\/2024\/08\/terminal-nginx-sites-available-mastodon-ssl-certificate-ssl-certificate-key-highlighted-1024x495.png\" alt=\"NGINX' configuration file\" class=\"wp-image-114151\" srcset=\"https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2024\/08\/terminal-nginx-sites-available-mastodon-ssl-certificate-ssl-certificate-key-highlighted-1024x495.png 1024w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2024\/08\/terminal-nginx-sites-available-mastodon-ssl-certificate-ssl-certificate-key-highlighted-300x145.png 300w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2024\/08\/terminal-nginx-sites-available-mastodon-ssl-certificate-ssl-certificate-key-highlighted-150x73.png 150w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2024\/08\/terminal-nginx-sites-available-mastodon-ssl-certificate-ssl-certificate-key-highlighted-768x371.png 768w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2024\/08\/terminal-nginx-sites-available-mastodon-ssl-certificate-ssl-certificate-key-highlighted-1536x742.png 1536w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2024\/08\/terminal-nginx-sites-available-mastodon-ssl-certificate-ssl-certificate-key-highlighted-2048x990.png 2048w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><button class=\"lightbox-trigger\" type=\"button\" aria-haspopup=\"dialog\" aria-label=\"Enlarge\" data-wp-init=\"callbacks.initTriggerButton\" data-wp-on-async--click=\"actions.showLightbox\" data-wp-style--right=\"state.imageButtonRight\" data-wp-style--top=\"state.imageButtonTop\">\n\t\t\t<svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"12\" height=\"12\" fill=\"none\" viewbox=\"0 0 12 12\">\n\t\t\t\t<path fill=\"#fff\" d=\"M2 0a2 2 0 0 0-2 2v2h1.5V2a.5.5 0 0 1 .5-.5h2V0H2Zm2 10.5H2a.5.5 0 0 1-.5-.5V8H0v2a2 2 0 0 0 2 2h2v-1.5ZM8 12v-1.5h2a.5.5 0 0 0 .5-.5V8H12v2a2 2 0 0 1-2 2H8Zm2-12a2 2 0 0 1 2 2v2h-1.5V2a.5.5 0 0 0-.5-.5H8V0h2Z\"><\/path>\n\t\t\t<\/svg>\n\t\t<\/button><\/figure><\/div><p>Once done, save the file and exit the text editor.<\/p><ol start=\"5\" class=\"wp-block-list\">\n<li>Reload NGINX to apply the changes:<\/li>\n<\/ol><pre class=\"wp-block-preformatted\">systemctl reload nginx<\/pre><ol start=\"6\" class=\"wp-block-list\">\n<li>Copy the <strong>systemd<\/strong> service files for Mastodon:<\/li>\n<\/ol><pre class=\"wp-block-preformatted\">cp \/home\/mastodon\/live\/dist\/mastodon-*.service \/etc\/systemd\/system\/<\/pre><ol start=\"7\" class=\"wp-block-list\">\n<li>Reload the <strong>systemd<\/strong> daemon and enable the Mastodon services:<\/li>\n<\/ol><pre class=\"wp-block-preformatted\">systemctl daemon-reload\nsystemctl enable --now mastodon-web mastodon-sidekiq mastodon-streaming<\/pre><p>Check their statuses:<\/p><pre class=\"wp-block-preformatted\">systemctl status --now mastodon-web mastodon-sidekiq mastodon-streaming<\/pre><p>You should see an output indicating that all services are active and running without issues:<\/p><div class=\"wp-block-image\"><figure data-wp-context='{\"imageId\":\"69e0ab802d96e\"}' data-wp-interactive=\"core\/image\" class=\"aligncenter size-large wp-lightbox-container\"><img decoding=\"async\" width=\"1024\" height=\"640\" data-wp-class--hide=\"state.isContentHidden\" data-wp-class--show=\"state.isContentVisible\" data-wp-init=\"callbacks.setButtonStyles\" data-wp-on-async--click=\"actions.showLightbox\" data-wp-on-async--load=\"callbacks.setButtonStyles\" data-wp-on-async-window--resize=\"callbacks.setButtonStyles\" src=\"\/tutorials\/wp-content\/uploads\/sites\/2\/2024\/08\/terminal-mastodon-services-active-running-1024x640.png\" alt=\"Mastodon services' active and running statuses\" class=\"wp-image-114152\" srcset=\"https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2024\/08\/terminal-mastodon-services-active-running-1024x640.png 1024w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2024\/08\/terminal-mastodon-services-active-running-300x188.png 300w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2024\/08\/terminal-mastodon-services-active-running-150x94.png 150w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2024\/08\/terminal-mastodon-services-active-running-768x480.png 768w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2024\/08\/terminal-mastodon-services-active-running-1536x960.png 1536w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2024\/08\/terminal-mastodon-services-active-running-2048x1280.png 2048w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><button class=\"lightbox-trigger\" type=\"button\" aria-haspopup=\"dialog\" aria-label=\"Enlarge\" data-wp-init=\"callbacks.initTriggerButton\" data-wp-on-async--click=\"actions.showLightbox\" data-wp-style--right=\"state.imageButtonRight\" data-wp-style--top=\"state.imageButtonTop\">\n\t\t\t<svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"12\" height=\"12\" fill=\"none\" viewbox=\"0 0 12 12\">\n\t\t\t\t<path fill=\"#fff\" d=\"M2 0a2 2 0 0 0-2 2v2h1.5V2a.5.5 0 0 1 .5-.5h2V0H2Zm2 10.5H2a.5.5 0 0 1-.5-.5V8H0v2a2 2 0 0 0 2 2h2v-1.5ZM8 12v-1.5h2a.5.5 0 0 0 .5-.5V8H12v2a2 2 0 0 1-2 2H8Zm2-12a2 2 0 0 1 2 2v2h-1.5V2a.5.5 0 0 0-.5-.5H8V0h2Z\"><\/path>\n\t\t\t<\/svg>\n\t\t<\/button><\/figure><\/div><ol start=\"8\" class=\"wp-block-list\">\n<li>Allow access to the core files so the CSS and JS files can load correctly:<\/li>\n<\/ol><pre class=\"wp-block-preformatted\">chown mastodon:www-data \/home\/mastodon\/\nchmod 0710 -v \/home\/mastodon\/<\/pre><h3 class=\"wp-block-heading\" id=\"h-7-run-and-customize-the-server\">7. Run and customize the server<\/h3><p>You can now open your new Mastodon server and customize it to your needs, ensuring your instance can host users and manage content. Here are the instructions:<\/p><ol class=\"wp-block-list\">\n<li>Open your web browser and access the server via your domain. Log in using the admin account credentials you set up during the Mastodon server configuration.<\/li>\n<\/ol><div class=\"wp-block-image\"><figure data-wp-context='{\"imageId\":\"69e0ab802faac\"}' data-wp-interactive=\"core\/image\" class=\"aligncenter size-large wp-lightbox-container\"><img decoding=\"async\" width=\"1024\" height=\"681\" data-wp-class--hide=\"state.isContentHidden\" data-wp-class--show=\"state.isContentVisible\" data-wp-init=\"callbacks.setButtonStyles\" data-wp-on-async--click=\"actions.showLightbox\" data-wp-on-async--load=\"callbacks.setButtonStyles\" data-wp-on-async-window--resize=\"callbacks.setButtonStyles\" src=\"\/tutorials\/wp-content\/uploads\/sites\/2\/2024\/08\/mastodon-server-homepage-1024x681.png\" alt=\"Mastodon server's homepage\" class=\"wp-image-114153\" srcset=\"https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2024\/08\/mastodon-server-homepage-1024x681.png 1024w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2024\/08\/mastodon-server-homepage-300x199.png 300w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2024\/08\/mastodon-server-homepage-150x100.png 150w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2024\/08\/mastodon-server-homepage-768x511.png 768w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2024\/08\/mastodon-server-homepage-1536x1021.png 1536w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2024\/08\/mastodon-server-homepage-2048x1362.png 2048w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><button class=\"lightbox-trigger\" type=\"button\" aria-haspopup=\"dialog\" aria-label=\"Enlarge\" data-wp-init=\"callbacks.initTriggerButton\" data-wp-on-async--click=\"actions.showLightbox\" data-wp-style--right=\"state.imageButtonRight\" data-wp-style--top=\"state.imageButtonTop\">\n\t\t\t<svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"12\" height=\"12\" fill=\"none\" viewbox=\"0 0 12 12\">\n\t\t\t\t<path fill=\"#fff\" d=\"M2 0a2 2 0 0 0-2 2v2h1.5V2a.5.5 0 0 1 .5-.5h2V0H2Zm2 10.5H2a.5.5 0 0 1-.5-.5V8H0v2a2 2 0 0 0 2 2h2v-1.5ZM8 12v-1.5h2a.5.5 0 0 0 .5-.5V8H12v2a2 2 0 0 1-2 2H8Zm2-12a2 2 0 0 1 2 2v2h-1.5V2a.5.5 0 0 0-.5-.5H8V0h2Z\"><\/path>\n\t\t\t<\/svg>\n\t\t<\/button><\/figure><\/div><ol start=\"2\" class=\"wp-block-list\">\n<li>Click <strong>Preferences<\/strong> to explore the admin dashboard. Here, you can manage server settings, user accounts, content moderation, configure instance-wide policies, and customize user interface options.<\/li>\n<\/ol><div class=\"wp-block-image\"><figure data-wp-context='{\"imageId\":\"69e0ab8031874\"}' data-wp-interactive=\"core\/image\" class=\"aligncenter size-large wp-lightbox-container\"><img decoding=\"async\" width=\"1024\" height=\"998\" data-wp-class--hide=\"state.isContentHidden\" data-wp-class--show=\"state.isContentVisible\" data-wp-init=\"callbacks.setButtonStyles\" data-wp-on-async--click=\"actions.showLightbox\" data-wp-on-async--load=\"callbacks.setButtonStyles\" data-wp-on-async-window--resize=\"callbacks.setButtonStyles\" src=\"\/tutorials\/wp-content\/uploads\/sites\/2\/2024\/08\/mastodon-admin-dashboard-1024x998.png\" alt=\"Mastodon's admin dashboard\" class=\"wp-image-114154\" srcset=\"https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2024\/08\/mastodon-admin-dashboard-1024x998.png 1024w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2024\/08\/mastodon-admin-dashboard-300x292.png 300w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2024\/08\/mastodon-admin-dashboard-150x146.png 150w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2024\/08\/mastodon-admin-dashboard-768x748.png 768w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2024\/08\/mastodon-admin-dashboard-1536x1496.png 1536w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2024\/08\/mastodon-admin-dashboard.png 1548w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><button class=\"lightbox-trigger\" type=\"button\" aria-haspopup=\"dialog\" aria-label=\"Enlarge\" data-wp-init=\"callbacks.initTriggerButton\" data-wp-on-async--click=\"actions.showLightbox\" data-wp-style--right=\"state.imageButtonRight\" data-wp-style--top=\"state.imageButtonTop\">\n\t\t\t<svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"12\" height=\"12\" fill=\"none\" viewbox=\"0 0 12 12\">\n\t\t\t\t<path fill=\"#fff\" d=\"M2 0a2 2 0 0 0-2 2v2h1.5V2a.5.5 0 0 1 .5-.5h2V0H2Zm2 10.5H2a.5.5 0 0 1-.5-.5V8H0v2a2 2 0 0 0 2 2h2v-1.5ZM8 12v-1.5h2a.5.5 0 0 0 .5-.5V8H12v2a2 2 0 0 1-2 2H8Zm2-12a2 2 0 0 1 2 2v2h-1.5V2a.5.5 0 0 0-.5-.5H8V0h2Z\"><\/path>\n\t\t\t<\/svg>\n\t\t<\/button><\/figure><\/div><ol start=\"3\" class=\"wp-block-list\">\n<li>Change the admin password periodically to ensure your account remains secure. Select <strong>Account &rarr; Account settings<\/strong> and fill in the current and new passwords. Then, click <strong>SAVE CHANGES<\/strong>.<\/li>\n<\/ol><div class=\"wp-block-image\"><figure data-wp-context='{\"imageId\":\"69e0ab803e7db\"}' data-wp-interactive=\"core\/image\" class=\"aligncenter size-large wp-lightbox-container\"><img decoding=\"async\" width=\"1024\" height=\"562\" data-wp-class--hide=\"state.isContentHidden\" data-wp-class--show=\"state.isContentVisible\" data-wp-init=\"callbacks.setButtonStyles\" data-wp-on-async--click=\"actions.showLightbox\" data-wp-on-async--load=\"callbacks.setButtonStyles\" data-wp-on-async-window--resize=\"callbacks.setButtonStyles\" src=\"\/tutorials\/wp-content\/uploads\/sites\/2\/2024\/08\/mastodon-account-account-settings-selected-1024x562.png\" alt=\"Mastodon's Account settings menu\" class=\"wp-image-114155\" srcset=\"https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2024\/08\/mastodon-account-account-settings-selected-1024x562.png 1024w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2024\/08\/mastodon-account-account-settings-selected-300x165.png 300w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2024\/08\/mastodon-account-account-settings-selected-150x82.png 150w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2024\/08\/mastodon-account-account-settings-selected-768x421.png 768w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2024\/08\/mastodon-account-account-settings-selected-1536x842.png 1536w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2024\/08\/mastodon-account-account-settings-selected-2048x1123.png 2048w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><button class=\"lightbox-trigger\" type=\"button\" aria-haspopup=\"dialog\" aria-label=\"Enlarge\" data-wp-init=\"callbacks.initTriggerButton\" data-wp-on-async--click=\"actions.showLightbox\" data-wp-style--right=\"state.imageButtonRight\" data-wp-style--top=\"state.imageButtonTop\">\n\t\t\t<svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"12\" height=\"12\" fill=\"none\" viewbox=\"0 0 12 12\">\n\t\t\t\t<path fill=\"#fff\" d=\"M2 0a2 2 0 0 0-2 2v2h1.5V2a.5.5 0 0 1 .5-.5h2V0H2Zm2 10.5H2a.5.5 0 0 1-.5-.5V8H0v2a2 2 0 0 0 2 2h2v-1.5ZM8 12v-1.5h2a.5.5 0 0 0 .5-.5V8H12v2a2 2 0 0 1-2 2H8Zm2-12a2 2 0 0 1 2 2v2h-1.5V2a.5.5 0 0 0-.5-.5H8V0h2Z\"><\/path>\n\t\t\t<\/svg>\n\t\t<\/button><\/figure><\/div><ol start=\"4\" class=\"wp-block-list\">\n<li>Optionally, administrator and moderator accounts can be created to help manage the server. Multiple administrators and moderators let you distribute responsibilities, ensure a healthy community, and foster a diverse and balanced management team.<\/li>\n<\/ol><p>To create these accounts, go back to your terminal and access the Mastodon root directory:<\/p><pre class=\"wp-block-preformatted\">su - mastodon\ncd \/home\/mastodon\/live<\/pre><p>Then, run the following commands to create a new Mastodon account:<\/p><pre class=\"wp-block-preformatted\">RAILS_ENV=production bin\/tootctl accounts create \nalice \n--email alice@example.com \n--confirmed \n--role Owner<\/pre><p>Replace <strong>alice<\/strong>, <strong>alice@example.com<\/strong>, and <strong>Owner<\/strong> with the new account&rsquo;s desired username, email, and role. Here are brief explanations of each role:<\/p><ul class=\"wp-block-list\">\n<li><strong>Owner<\/strong> &ndash; has full access to all administrative functions and settings.<\/li>\n\n\n\n<li><strong>Admin<\/strong> &ndash; can manage server settings and user accounts but can&rsquo;t access certain functions reserved for the owner.<\/li>\n\n\n\n<li><strong>Moderator<\/strong> &ndash; Responsible for content moderation and managing user interactions but can&rsquo;t access functions belonging to admins and owners.<\/li>\n<\/ul><h3 class=\"wp-block-heading\" id=\"h-8-invite-and-manage-users\">8. Invite and manage users<\/h3><p>Once your Mastodon server is set up and running, you can invite users to join your instance. This process involves generating invite links, allowing users to sign up via said links, and moderating user activities.<\/p><p><strong>Generate invite links<\/strong><\/p><p>You can quickly generate invite links via the Mastodon admin dashboard by following these steps:<\/p><ol class=\"wp-block-list\">\n<li>Go to <strong>Preferences<\/strong> &rarr; <strong>Invite people<\/strong>.<\/li>\n\n\n\n<li>Limit the link&rsquo;s number of uses or expiration time. Once done, click <strong>GENERATE INVITE LINKS<\/strong>.<\/li>\n\n\n\n<li>Copy the generated link and share it with the users you invite. You can monitor how often the link is used and deactivate it if necessary.<\/li>\n<\/ol><div class=\"wp-block-image\"><figure data-wp-context='{\"imageId\":\"69e0ab804018c\"}' data-wp-interactive=\"core\/image\" class=\"aligncenter size-large wp-lightbox-container\"><img decoding=\"async\" width=\"1024\" height=\"600\" data-wp-class--hide=\"state.isContentHidden\" data-wp-class--show=\"state.isContentVisible\" data-wp-init=\"callbacks.setButtonStyles\" data-wp-on-async--click=\"actions.showLightbox\" data-wp-on-async--load=\"callbacks.setButtonStyles\" data-wp-on-async-window--resize=\"callbacks.setButtonStyles\" src=\"\/tutorials\/wp-content\/uploads\/sites\/2\/2024\/08\/mastodon-invite-people-selected-1024x600.png\" alt=\"Mastodon's Invite people menu\" class=\"wp-image-114156\" srcset=\"https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2024\/08\/mastodon-invite-people-selected-1024x600.png 1024w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2024\/08\/mastodon-invite-people-selected-300x176.png 300w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2024\/08\/mastodon-invite-people-selected-150x88.png 150w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2024\/08\/mastodon-invite-people-selected-768x450.png 768w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2024\/08\/mastodon-invite-people-selected-1536x901.png 1536w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2024\/08\/mastodon-invite-people-selected-2048x1201.png 2048w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><button class=\"lightbox-trigger\" type=\"button\" aria-haspopup=\"dialog\" aria-label=\"Enlarge\" data-wp-init=\"callbacks.initTriggerButton\" data-wp-on-async--click=\"actions.showLightbox\" data-wp-style--right=\"state.imageButtonRight\" data-wp-style--top=\"state.imageButtonTop\">\n\t\t\t<svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"12\" height=\"12\" fill=\"none\" viewbox=\"0 0 12 12\">\n\t\t\t\t<path fill=\"#fff\" d=\"M2 0a2 2 0 0 0-2 2v2h1.5V2a.5.5 0 0 1 .5-.5h2V0H2Zm2 10.5H2a.5.5 0 0 1-.5-.5V8H0v2a2 2 0 0 0 2 2h2v-1.5ZM8 12v-1.5h2a.5.5 0 0 0 .5-.5V8H12v2a2 2 0 0 1-2 2H8Zm2-12a2 2 0 0 1 2 2v2h-1.5V2a.5.5 0 0 0-.5-.5H8V0h2Z\"><\/path>\n\t\t\t<\/svg>\n\t\t<\/button><\/figure><\/div><p><strong>Register a user account<\/strong><\/p><p>Users will be directed to the signup page when they click the invite link. After entering a username, password, and email address, your server will automatically send a verification email so users can complete their registration.<\/p><div class=\"wp-block-image\"><figure data-wp-context='{\"imageId\":\"69e0ab8041808\"}' data-wp-interactive=\"core\/image\" class=\"aligncenter size-large wp-lightbox-container\"><img decoding=\"async\" width=\"1024\" height=\"610\" data-wp-class--hide=\"state.isContentHidden\" data-wp-class--show=\"state.isContentVisible\" data-wp-init=\"callbacks.setButtonStyles\" data-wp-on-async--click=\"actions.showLightbox\" data-wp-on-async--load=\"callbacks.setButtonStyles\" data-wp-on-async-window--resize=\"callbacks.setButtonStyles\" src=\"\/tutorials\/wp-content\/uploads\/sites\/2\/2024\/08\/mastodon-email-verify-email-address-highlighted-1024x610.png\" alt=\"Mastodon's verification email example\" class=\"wp-image-114157\" srcset=\"https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2024\/08\/mastodon-email-verify-email-address-highlighted-1024x610.png 1024w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2024\/08\/mastodon-email-verify-email-address-highlighted-300x179.png 300w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2024\/08\/mastodon-email-verify-email-address-highlighted-150x89.png 150w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2024\/08\/mastodon-email-verify-email-address-highlighted-768x458.png 768w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2024\/08\/mastodon-email-verify-email-address-highlighted-1536x915.png 1536w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2024\/08\/mastodon-email-verify-email-address-highlighted-2048x1220.png 2048w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><button class=\"lightbox-trigger\" type=\"button\" aria-haspopup=\"dialog\" aria-label=\"Enlarge\" data-wp-init=\"callbacks.initTriggerButton\" data-wp-on-async--click=\"actions.showLightbox\" data-wp-style--right=\"state.imageButtonRight\" data-wp-style--top=\"state.imageButtonTop\">\n\t\t\t<svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"12\" height=\"12\" fill=\"none\" viewbox=\"0 0 12 12\">\n\t\t\t\t<path fill=\"#fff\" d=\"M2 0a2 2 0 0 0-2 2v2h1.5V2a.5.5 0 0 1 .5-.5h2V0H2Zm2 10.5H2a.5.5 0 0 1-.5-.5V8H0v2a2 2 0 0 0 2 2h2v-1.5ZM8 12v-1.5h2a.5.5 0 0 0 .5-.5V8H12v2a2 2 0 0 1-2 2H8Zm2-12a2 2 0 0 1 2 2v2h-1.5V2a.5.5 0 0 0-.5-.5H8V0h2Z\"><\/path>\n\t\t\t<\/svg>\n\t\t<\/button><\/figure><\/div><p><strong>Moderate user accounts<\/strong><\/p><p>Mastodon provides tools to manage user interactions, address inappropriate behavior, and enforce community guidelines. Here are some tips to effectively moderate your community:<\/p><ul class=\"wp-block-list\">\n<li>In the admin dashboard, navigate to <strong>Moderation<\/strong> &rarr; <strong>Reports<\/strong> to review any reports of inappropriate behavior.<\/li>\n\n\n\n<li>Use the <strong>Accounts<\/strong> section to view all registered users. You can suspend or silence any accounts that violate community rules.<\/li>\n<\/ul><div class=\"wp-block-image\"><figure data-wp-context='{\"imageId\":\"69e0ab8043209\"}' data-wp-interactive=\"core\/image\" class=\"aligncenter size-large wp-lightbox-container\"><img decoding=\"async\" width=\"1024\" height=\"974\" data-wp-class--hide=\"state.isContentHidden\" data-wp-class--show=\"state.isContentVisible\" data-wp-init=\"callbacks.setButtonStyles\" data-wp-on-async--click=\"actions.showLightbox\" data-wp-on-async--load=\"callbacks.setButtonStyles\" data-wp-on-async-window--resize=\"callbacks.setButtonStyles\" src=\"\/tutorials\/wp-content\/uploads\/sites\/2\/2024\/08\/mastodon-moderation-accounts-selected-1024x974.png\" alt=\"Mastodon's Moderation options\" class=\"wp-image-114158\" srcset=\"https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2024\/08\/mastodon-moderation-accounts-selected-1024x974.png 1024w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2024\/08\/mastodon-moderation-accounts-selected-300x285.png 300w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2024\/08\/mastodon-moderation-accounts-selected-150x143.png 150w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2024\/08\/mastodon-moderation-accounts-selected-768x730.png 768w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2024\/08\/mastodon-moderation-accounts-selected-1536x1461.png 1536w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2024\/08\/mastodon-moderation-accounts-selected.png 1678w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><button class=\"lightbox-trigger\" type=\"button\" aria-haspopup=\"dialog\" aria-label=\"Enlarge\" data-wp-init=\"callbacks.initTriggerButton\" data-wp-on-async--click=\"actions.showLightbox\" data-wp-style--right=\"state.imageButtonRight\" data-wp-style--top=\"state.imageButtonTop\">\n\t\t\t<svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"12\" height=\"12\" fill=\"none\" viewbox=\"0 0 12 12\">\n\t\t\t\t<path fill=\"#fff\" d=\"M2 0a2 2 0 0 0-2 2v2h1.5V2a.5.5 0 0 1 .5-.5h2V0H2Zm2 10.5H2a.5.5 0 0 1-.5-.5V8H0v2a2 2 0 0 0 2 2h2v-1.5ZM8 12v-1.5h2a.5.5 0 0 0 .5-.5V8H12v2a2 2 0 0 1-2 2H8Zm2-12a2 2 0 0 1 2 2v2h-1.5V2a.5.5 0 0 0-.5-.5H8V0h2Z\"><\/path>\n\t\t\t<\/svg>\n\t\t<\/button><\/figure><\/div><ul class=\"wp-block-list\">\n<li>Use other sections like <strong>Federation<\/strong>, <strong>Blocked e-mail domains<\/strong>, and <strong>IP rules<\/strong> to control external interactions and enhance your instance&rsquo;s security.<\/li>\n<\/ul><h3 class=\"wp-block-heading\" id=\"h-9-install-additional-features\">9. Install additional features<\/h3><p>Installing additional features like Elasticsearch and hCaptcha on your Mastodon instance can significantly improve user experience and security. Here&rsquo;s how to configure these features.<\/p><p><strong>Install Elasticsearch<\/strong><\/p><p>Mastodon supports full-text search with Elasticsearch so that users can find public statuses, their posts, mentions, favorites, bookmarks, and account details.<\/p><ol class=\"wp-block-list\">\n<li>Elasticsearch requires a Java runtime. Install it if you haven&rsquo;t done so:<\/li>\n<\/ol><pre class=\"wp-block-preformatted\">apt install openjdk-17-jre-headless<\/pre><ol class=\"wp-block-list\">\n<li>Add the Elasticsearch official repository:<\/li>\n<\/ol><pre class=\"wp-block-preformatted\">wget -O \/usr\/share\/keyrings\/elasticsearch.asc https:\/\/artifacts.elastic.co\/GPG-KEY-elasticsearch\necho \"deb [signed-by=\/usr\/share\/keyrings\/elasticsearch.asc] https:\/\/artifacts.elastic.co\/packages\/7.x\/apt stable main\" &gt; \/etc\/apt\/sources.list.d\/elastic-7.x.list<\/pre><ol start=\"2\" class=\"wp-block-list\">\n<li>Install Elasticsearch by running these commands:<\/li>\n<\/ol><pre class=\"wp-block-preformatted\">apt update\napt install elasticsearch<\/pre><ol start=\"3\" class=\"wp-block-list\">\n<li>Start Elasticsearch with:<\/li>\n<\/ol><pre class=\"wp-block-preformatted\">systemctl daemon-reload\nsystemctl enable --now elasticsearch<\/pre><ol start=\"4\" class=\"wp-block-list\">\n<li>Edit the <strong>.env.production<\/strong> file in the Mastodon directory:<\/li>\n<\/ol><pre class=\"wp-block-preformatted\">nano \/home\/mastodon\/live\/.env.production<\/pre><p>Include the following variables:<\/p><pre class=\"wp-block-preformatted\">ES_ENABLED=true\nES_HOST=localhost\nES_PORT=9200\nES_PRESET=single_node_cluster  # Use the appropriate preset for your setup: single_node_cluster, small_cluster, or large_cluster\n# ES_USER=\n# ES_PASS=<\/pre><ol start=\"5\" class=\"wp-block-list\">\n<li>Save your edits and restart the Mastodon services:<\/li>\n<\/ol><pre class=\"wp-block-preformatted\">systemctl restart mastodon-sidekiq\nsystemctl reload mastodon-web<\/pre><ol start=\"6\" class=\"wp-block-list\">\n<li>Index the search data:<\/li>\n<\/ol><pre class=\"wp-block-preformatted\">su - mastodon\ncd live\nRAILS_ENV=production bin\/tootctl search deploy<\/pre><p><strong>Set up hCaptcha<\/strong><\/p><p>Mastodon can use CAPTCHA technology to help mitigate bot signups. Currently, this <a href=\"\/my\/tutorials\/what-is-decentralized-social-media\">decentralized social media platform<\/a> supports only hCaptcha.<\/p><ol class=\"wp-block-list\">\n<li>Sign up for a free <a href=\"https:\/\/www.hcaptcha.com\" target=\"_blank\" rel=\"noopener\">hCaptcha<\/a> account. Once registered, go to the dashboard to add a new site with your Mastodon server domain.<\/li>\n\n\n\n<li>Under the <strong>Account Settings<\/strong>, obtain your site and secret keys.<\/li>\n\n\n\n<li>Go back to your terminal and edit the <strong>.env.production<\/strong> file:<\/li>\n<\/ol><pre class=\"wp-block-preformatted\">nano \/home\/mastodon\/live\/.env.production<\/pre><p>Add the following values, replacing <strong>your_site_key<\/strong> and <strong>your_secret_key<\/strong> with your hCaptcha keys:<\/p><pre class=\"wp-block-preformatted\">HCAPTCHA_SITE_KEY=your_site_key\nHCAPTCHA_SECRET_KEY=your_secret_key<\/pre><ol start=\"4\" class=\"wp-block-list\">\n<li>After that, restart the Mastodon services:<\/li>\n<\/ol><pre class=\"wp-block-preformatted\">systemctl restart mastodon-sidekiq\nsystemctl reload mastodon-web<\/pre><ol start=\"5\" class=\"wp-block-list\">\n<li>Open your Mastodon admin dashboard and go to <strong>Administration &rarr; Server settings &rarr; Registrations<\/strong>. Then, check the <strong>Require new users to solve a CAPTCHA to confirm their account<\/strong> option and save your changes.<\/li>\n<\/ol><div class=\"wp-block-image\"><figure data-wp-context='{\"imageId\":\"69e0ab80454be\"}' data-wp-interactive=\"core\/image\" class=\"aligncenter size-large wp-lightbox-container\"><img decoding=\"async\" width=\"1024\" height=\"758\" data-wp-class--hide=\"state.isContentHidden\" data-wp-class--show=\"state.isContentVisible\" data-wp-init=\"callbacks.setButtonStyles\" data-wp-on-async--click=\"actions.showLightbox\" data-wp-on-async--load=\"callbacks.setButtonStyles\" data-wp-on-async-window--resize=\"callbacks.setButtonStyles\" src=\"\/tutorials\/wp-content\/uploads\/sites\/2\/2024\/08\/mastodon-administration-server-settings-registrations-selected-1024x758.png\" alt=\"Mastodon's Registrations options\" class=\"wp-image-114159\" srcset=\"https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2024\/08\/mastodon-administration-server-settings-registrations-selected-1024x758.png 1024w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2024\/08\/mastodon-administration-server-settings-registrations-selected-300x222.png 300w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2024\/08\/mastodon-administration-server-settings-registrations-selected-150x111.png 150w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2024\/08\/mastodon-administration-server-settings-registrations-selected-768x568.png 768w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2024\/08\/mastodon-administration-server-settings-registrations-selected-1536x1136.png 1536w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2024\/08\/mastodon-administration-server-settings-registrations-selected.png 1668w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><button class=\"lightbox-trigger\" type=\"button\" aria-haspopup=\"dialog\" aria-label=\"Enlarge\" data-wp-init=\"callbacks.initTriggerButton\" data-wp-on-async--click=\"actions.showLightbox\" data-wp-style--right=\"state.imageButtonRight\" data-wp-style--top=\"state.imageButtonTop\">\n\t\t\t<svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"12\" height=\"12\" fill=\"none\" viewbox=\"0 0 12 12\">\n\t\t\t\t<path fill=\"#fff\" d=\"M2 0a2 2 0 0 0-2 2v2h1.5V2a.5.5 0 0 1 .5-.5h2V0H2Zm2 10.5H2a.5.5 0 0 1-.5-.5V8H0v2a2 2 0 0 0 2 2h2v-1.5ZM8 12v-1.5h2a.5.5 0 0 0 .5-.5V8H12v2a2 2 0 0 1-2 2H8Zm2-12a2 2 0 0 1 2 2v2h-1.5V2a.5.5 0 0 0-.5-.5H8V0h2Z\"><\/path>\n\t\t\t<\/svg>\n\t\t<\/button><\/figure><\/div><h2 class=\"wp-block-heading\" id=\"h-best-practices-for-optimal-mastodon-server-performance\">Best practices for optimal Mastodon server performance<\/h2><p>After finishing the Mastodon server tutorial, we suggest implementing these best practices to ensure optimal instance performance over time.<\/p><h3 class=\"wp-block-heading\" id=\"h-use-the-mastodon-admin-cli\">Use the Mastodon admin CLI<\/h3><p>As the name suggests, the Mastodon admin CLI lets you manage your instance via the command line. Before you start using it, make sure to switch to the <strong>mastodon<\/strong> user and navigate to the correct directory:<\/p><pre class=\"wp-block-preformatted\">su - mastodon\ncd live<\/pre><p><strong>Base CLI commands<\/strong><\/p><p>The base CLI provides general commands to interact with your Mastodon instance:<\/p><ul class=\"wp-block-list\">\n<li><strong>tootctl self-destruct<\/strong> &ndash; permanently shuts down your Mastodon instance and deletes all associated data. Use this command with caution, as it is irreversible.<\/li>\n\n\n\n<li><strong>tootctl &ndash;version<\/strong> &ndash; displays your Mastodon software&rsquo;s installed version.<\/li>\n<\/ul><p><strong>Accounts CLI commands<\/strong><\/p><p>The following commands let you manage user accounts and their roles:<\/p><ul class=\"wp-block-list\">\n<li><strong>tootctl accounts create username &ndash;email user@example.com<\/strong> &ndash; creates a new user account with the specified username and email address.<\/li>\n\n\n\n<li><strong>tootctl accounts modify username &ndash;role Admin<\/strong> &ndash; changes a user&rsquo;s role to <strong>Admin<\/strong>, <strong>Moderator<\/strong>, or <strong>User<\/strong>.<\/li>\n\n\n\n<li><strong>tootctl accounts modify username &ndash;reset-password<\/strong> &ndash; resets a specific user account password.<\/li>\n\n\n\n<li><strong>tootctl accounts delete username<\/strong> &ndash; permanently deletes a user account by username.<\/li>\n<\/ul><p><strong>Cache CLI commands<\/strong><\/p><p>Use the cache CLI to manage and clear various caches on your Mastodon server:<\/p><ul class=\"wp-block-list\">\n<li><strong>tootctl cache clear<\/strong> &ndash; clears all cached data from your instance, including timelines and media files.<\/li>\n\n\n\n<li><strong>tootctl cache recount<\/strong> &ndash; recounts the cached item numbers and updates the cache status.<\/li>\n<\/ul><p><strong>Settings CLI commands<\/strong><\/p><p>The settings CLI allows you to configure server-wide settings and preferences:<\/p><ul class=\"wp-block-list\">\n<li><strong>tootctl settings registrations open<\/strong> &ndash; opens user registrations, allowing new users to sign up.<\/li>\n\n\n\n<li><strong>tootctl settings registrations close<\/strong> &ndash; closes user registrations, preventing new signups.<\/li>\n\n\n\n<li><strong>tootctl settings registrations approved<\/strong> &ndash; approves user registrations that are pending.<\/li>\n<\/ul><p>You can find complete commands and their explanations in the <a href=\"https:\/\/docs.joinmastodon.org\/admin\/tootctl\" target=\"_blank\" rel=\"noopener\">Mastodon admin CLI documentation<\/a>.<\/p><h3 class=\"wp-block-heading\" id=\"h-clean-up-and-back-up-the-server\">Clean up and back up the server<\/h3><p>Maintaining your Mastodon server involves regularly running cleanup tasks to free up space and resources and backing up data to protect them from accidental loss or corruption.<\/p><p><strong>Run periodic cleanup tasks<\/strong><\/p><p>Mastodon generates temporary files, such as remote media and preview cards, that can accumulate over time. Cleaning these up periodically via a <a href=\"\/my\/tutorials\/cron-job\">cron job<\/a> will help improve server performance.<\/p><ol class=\"wp-block-list\">\n<li>Switch to the Mastodon user:<\/li>\n<\/ol><pre class=\"wp-block-preformatted\">su - mastodon<\/pre><ol start=\"2\" class=\"wp-block-list\">\n<li>Use the <strong>crontab -e<\/strong> command to edit the cron file for this user:<\/li>\n<\/ol><pre class=\"wp-block-preformatted\">crontab -e<\/pre><p>If this is your first time doing so, you&rsquo;ll be prompted to select an editor. Choose your preferred one.<\/p><p>At the bottom of the file, add the following lines to schedule the cleanup tasks:<\/p><pre class=\"wp-block-preformatted\">@weekly RAILS_ENV=production \/home\/mastodon\/live\/bin\/tootctl media remove\n@weekly RAILS_ENV=production \/home\/mastodon\/live\/bin\/tootctl preview_cards remove<\/pre><ol start=\"3\" class=\"wp-block-list\">\n<li>Save the file, then verify the cron job is correctly set by listing the crontab entries:<\/li>\n<\/ol><pre class=\"wp-block-preformatted\">crontab -l<\/pre><p>This will display all scheduled tasks for the Mastodon user.<\/p><p><strong>Automatically back up Mastodon data on Hostinger<\/strong><\/p><p>Hosting Mastodon on Hostinger&rsquo;s VPS allows you to easily create backups using our built-in features.<\/p><ol class=\"wp-block-list\">\n<li>Log in to your Hostinger account and go to <strong>VPS &rarr; Manage<\/strong>.<\/li>\n\n\n\n<li>In the VPS dashboard&rsquo;s left sidebar, select <strong>Settings &rarr; Backup &amp; Monitoring &rarr; Snapshots &amp; Backups<\/strong>.<\/li>\n\n\n\n<li>Click <strong>Create Snapshot<\/strong> to capture your VPS&rsquo;s current state and data.<\/li>\n<\/ol><p>To set up automatic backups, activate the <strong>Daily Backups <\/strong>option first, and then configure your preferred backup frequency under <strong>Auto-backups settings<\/strong>.<\/p><div class=\"wp-block-image\"><figure class=\"aligncenter size-large\"><a href=\"\/my\/tutorials\/wp-content\/uploads\/sites\/2\/2024\/08\/hpanel-vps-snapshots-backups.png\"><img decoding=\"async\" width=\"1024\" height=\"936\" src=\"\/tutorials\/wp-content\/uploads\/sites\/2\/2024\/08\/hpanel-vps-snapshots-backups-1024x936.png\" alt=\"Hostinger VPS' snapshot and backup features\" class=\"wp-image-114160\" srcset=\"https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2024\/08\/hpanel-vps-snapshots-backups-1024x936.png 1024w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2024\/08\/hpanel-vps-snapshots-backups-300x274.png 300w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2024\/08\/hpanel-vps-snapshots-backups-150x137.png 150w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2024\/08\/hpanel-vps-snapshots-backups-768x702.png 768w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2024\/08\/hpanel-vps-snapshots-backups-1536x1405.png 1536w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2024\/08\/hpanel-vps-snapshots-backups.png 1542w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure><\/div><?xml encoding=\"utf-8\" ?><figure class=\"wp-block-image size-large\"><a href=\"\/my\/vps-hosting\" target=\"_blank\" rel=\"noreferrer noopener\"><img decoding=\"async\" width=\"1024\" height=\"300\" src=\"https:\/\/www.hostinger.com\/tutorials\/wp-content\/uploads\/sites\/2\/2023\/02\/VPS-hosting-banner-1024x300.png\" alt=\"\" class=\"wp-image-77934\" srcset=\"https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2023\/02\/VPS-hosting-banner.png 1024w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2023\/02\/VPS-hosting-banner-300x88.png 300w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2023\/02\/VPS-hosting-banner-150x44.png 150w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2023\/02\/VPS-hosting-banner-768x225.png 768w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure><p><strong>Manually back up Mastodon data<\/strong><\/p><p>Alternatively, you can manually back up important data, such as application secrets, databases, user-uploaded files, and Redis dumps.<\/p><ol class=\"wp-block-list\">\n<li>Store the <strong>.env.production<\/strong> file somewhere safe, as it contains secret configuration details:<\/li>\n<\/ol><pre class=\"wp-block-preformatted\">cp \/home\/mastodon\/live\/.env.production \/path\/to\/backup\/directory<\/pre><ol start=\"2\" class=\"wp-block-list\">\n<li>Use <strong>pg_dump<\/strong> to create a backup of your PostgreSQL database. Replace the second <strong>mastodon<\/strong> variable with your database name:<\/li>\n<\/ol><pre class=\"wp-block-preformatted\">pg_dump -U mastodon mastodon &gt; \/path\/to\/backup\/directory\/mastodon_backup.sql<\/pre><ol start=\"3\" class=\"wp-block-list\">\n<li>If you use local file storage, back up the <strong>public\/system<\/strong> directory, where uploaded files are stored by default:<\/li>\n<\/ol><pre class=\"wp-block-preformatted\">cp -r \/home\/mastodon\/live\/public\/system \/path\/to\/backup\/directory<\/pre><ol start=\"4\" class=\"wp-block-list\">\n<li>Copy the Redis dump file located at <strong>\/var\/lib\/redis\/dump.rdb<\/strong>:<\/li>\n<\/ol><pre class=\"wp-block-preformatted\">cp \/var\/lib\/redis\/dump.rdb \/path\/to\/backup\/directory<\/pre><h3 class=\"wp-block-heading\" id=\"h-upgrade-the-server-version\">Upgrade the server version<\/h3><p>Upgrading your Mastodon server to the latest version enables you to benefit from new features, performance enhancements, and security updates.<\/p><p>To view the latest version available, visit the <a href=\"https:\/\/github.com\/mastodon\/mastodon\/releases\" target=\"_blank\" rel=\"noopener\">Mastodon GitHub releases page<\/a>. Review the changelog and specific upgrade instructions for the release you plan to install.<\/p><p>After that, check the currently installed version with these commands:<\/p><pre class=\"wp-block-preformatted\">su - mastodon\ncd \/home\/mastodon\/live\ngit describe --tags<\/pre><p>You should see your current Mastodon installation&rsquo;s version tag:<\/p><pre class=\"wp-block-preformatted\">v4.2.9<\/pre><p>Now, you can start upgrading your Magento server&rsquo;s version with these steps:<\/p><ol class=\"wp-block-list\">\n<li>Fetch the latest tags:<\/li>\n<\/ol><pre class=\"wp-block-preformatted\">git fetch --tags<\/pre><ol start=\"2\" class=\"wp-block-list\">\n<li>Search for Mastodon&rsquo;s latest edition. Replace <strong>v4.2.10<\/strong> with the actual newest release version number:<\/li>\n<\/ol><pre class=\"wp-block-preformatted\">git checkout v4.2.10<\/pre><p>Follow the specific instructions provided in the release notes when upgrading your instance.<\/p><ol start=\"3\" class=\"wp-block-list\">\n<li>Return to the root user:<\/li>\n<\/ol><pre class=\"wp-block-preformatted\">exit<\/pre><ol start=\"4\" class=\"wp-block-list\">\n<li>Restart all three Mastodon services:<\/li>\n<\/ol><pre class=\"wp-block-preformatted\">systemctl restart mastodon-sidekiq\nsystemctl reload mastodon-web\nsystemctl restart mastodon-streaming<\/pre><h2 class=\"wp-block-heading\" id=\"h-conclusion\">Conclusion<\/h2><p>In this article, you&rsquo;ve learned how to make a Mastodon server, from preparing the environment to installing the server and additional features. You&rsquo;ve also explored several tips to optimize your instance&rsquo;s performance, such as cleaning up junk files and backing up necessary data.<\/p><p>Establishing a dedicated server for Mastodon provides an enjoyable social media experience with complete control over your instance. Be sure to update your server whenever new versions are released to maintain a reliable and engaging platform for your community.<\/p><h2 class=\"wp-block-heading\" id=\"h-how-to-create-a-mastodon-server-faq\">How to create a Mastodon server FAQ<\/h2><div id=\"rank-math-faq\" class=\"rank-math-block\">\n<div class=\"rank-math-list \">\n<div id=\"faq-question-694484aee7839\" class=\"rank-math-list-item\">\n<h3 class=\"rank-math-question \">Why should you run your own Mastodon server?<\/h3>\n<div class=\"rank-math-answer \">\n\n<p>Running your own Mastodon server allows you to control content and moderation, ensure privacy, and create a customizable social media experience for your community without the limitations of centralized platforms.<\/p>\n\n<\/div>\n<\/div>\n<div id=\"faq-question-694484aee783c\" class=\"rank-math-list-item\">\n<h3 class=\"rank-math-question \">How much does it cost to run a Mastodon server?<\/h3>\n<div class=\"rank-math-answer \">\n\n<p>The cost to host a Mastodon server varies. For example, a VPS can cost u003cstrongu003e$5u003c\/strongu003e to u003cstrongu003e$20\/monthu003c\/strongu003e, while a domain name can range from u003cstrongu003e$1u003c\/strongu003e to u003cstrongu003e$10\/yearu003c\/strongu003e. There may be additional expenses for using third-party services to enhance functionalities.<\/p>\n\n<\/div>\n<\/div>\n<div id=\"faq-question-694484aee783d\" class=\"rank-math-list-item\">\n<h3 class=\"rank-math-question \">What are the system requirements for setting up a Mastodon server?<\/h3>\n<div class=\"rank-math-answer \">\n\n<p>A Mastodon server requires a Linux VPS or dedicated server with at least u003cstrongu003e2u003c\/strongu003e CPU cores, u003cstrongu003e3 GBu003c\/strongu003e RAM, and u003cstrongu003e25 GBu003c\/strongu003e of disk storage. The server should use u003cstrongu003eUbuntu 22.04u003c\/strongu003e or u003cstrongu003eDebian 11u003c\/strongu003e and have software like PostgreSQL, Redis, Ruby, and NGINX installed.<\/p>\n\n<\/div>\n<\/div>\n<div id=\"faq-question-694484aee783e\" class=\"rank-math-list-item\">\n<h3 class=\"rank-math-question \">Can I make money by running a Mastodon server?<\/h3>\n<div class=\"rank-math-answer \">\n\n<p>You can generate income from a Mastodon server through membership fees, donations, or sponsorships. Carefully plan and engage with the community to ensure sustainability without compromising user experience.<\/p>\n\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>Mastodon has become a popular alternative to traditional social media platforms. As a decentralized, open-source social network, Mastadon empowers users to operate their own servers, giving them complete control to customize their social media experience. In this article, you&rsquo;ll learn how to set up a Mastodon server on a virtual private server (VPS), from establishing [&#8230;]<\/p>\n<p><a class=\"btn btn-secondary understrap-read-more-link\" href=\"\/my\/tutorials\/how-to-create-a-qr-code-for-wedding-rsvp-19\">Read More&#8230;<\/a><\/p>\n","protected":false},"author":411,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"rank_math_title":"How to create your own Mastodon server","rank_math_description":"Learn how to host a Mastodon server: 1. Set up a relay SMTP server 2. Secure the server 3. Prepare the system environment + more.","rank_math_focus_keyword":"how to create a mastodon server","footnotes":""},"categories":[22640,22639],"tags":[],"class_list":["post-114143","post","type-post","status-publish","format-standard","hentry","category-vps-use-cases","category-vps"],"hreflangs":[{"locale":"en-US","link":"https:\/\/www.hostinger.com\/tutorials\/how-to-create-a-mastodon-server","default":0},{"locale":"en-UK","link":"https:\/\/www.hostinger.com\/uk\/tutorials\/how-to-create-a-mastodon-server","default":0},{"locale":"en-MY","link":"https:\/\/www.hostinger.com\/my\/tutorials\/how-to-create-a-mastodon-server","default":0},{"locale":"en-PH","link":"https:\/\/www.hostinger.com\/ph\/tutorials\/how-to-create-a-mastodon-server","default":0},{"locale":"en-IN","link":"https:\/\/www.hostinger.com\/in\/tutorials\/how-to-create-a-mastodon-server","default":0},{"locale":"en-CA","link":"https:\/\/www.hostinger.com\/ca\/tutorials\/how-to-create-a-mastodon-server","default":0},{"locale":"en-AU","link":"https:\/\/www.hostinger.com\/au\/tutorials\/how-to-create-a-mastodon-server","default":0},{"locale":"en-NG","link":"https:\/\/www.hostinger.com\/ng\/tutorials\/how-to-create-a-mastodon-server","default":0}],"_links":{"self":[{"href":"https:\/\/www.hostinger.com\/my\/tutorials\/wp-json\/wp\/v2\/posts\/114143","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.hostinger.com\/my\/tutorials\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.hostinger.com\/my\/tutorials\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.hostinger.com\/my\/tutorials\/wp-json\/wp\/v2\/users\/411"}],"replies":[{"embeddable":true,"href":"https:\/\/www.hostinger.com\/my\/tutorials\/wp-json\/wp\/v2\/comments?post=114143"}],"version-history":[{"count":7,"href":"https:\/\/www.hostinger.com\/my\/tutorials\/wp-json\/wp\/v2\/posts\/114143\/revisions"}],"predecessor-version":[{"id":126103,"href":"https:\/\/www.hostinger.com\/my\/tutorials\/wp-json\/wp\/v2\/posts\/114143\/revisions\/126103"}],"wp:attachment":[{"href":"https:\/\/www.hostinger.com\/my\/tutorials\/wp-json\/wp\/v2\/media?parent=114143"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.hostinger.com\/my\/tutorials\/wp-json\/wp\/v2\/categories?post=114143"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.hostinger.com\/my\/tutorials\/wp-json\/wp\/v2\/tags?post=114143"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}