{"id":2913,"date":"2025-01-19T13:28:30","date_gmt":"2022-05-13T14:52:42","guid":{"rendered":""},"modified":"2025-02-02T00:46:19","modified_gmt":"2025-02-01T23:46:19","slug":"how-to-install-mastodon-social-network-with-docker-on-rocky-linux-9","status":"publish","type":"post","link":"https:\/\/netcloud24.com\/knowledgebase\/how-to-install-mastodon-social-network-with-docker-on-rocky-linux-9\/","title":{"rendered":"Linux VPS &#038; VPS Windows Setup Guide | NetCloud24 Mastodon Social Network with Docker on Rocky Linux 9"},"content":{"rendered":"<p>\u00a0<\/p>\n<\/p>\n<header>\n<h1>\u00a0<\/h1>\n<\/header>\n<article>\n<p>Mastodon is an open-source, decentralized social network that has gained popularity as a federated platform, allowing users to manage their own communities. In this guide, we will walk you through the process of installing Mastodon using Docker on Rocky Linux 9. Whether you are setting up a local instance or deploying Mastodon on a , this tutorial will guide you through the necessary steps to get started.<\/p>\n<section>\n<h2>Step 1: Install Docker and Docker Compose<\/h2>\n<p>Before installing Mastodon, you need to ensure Docker and Docker Compose are installed on your Rocky Linux 9 server. Run the following commands to install Docker:<\/p>\n<pre><code>\r\nsudo dnf update -y\r\nsudo dnf install -y dnf-plugins-core\r\nsudo dnf config-manager --add-repo https:\/\/download.docker.com\/linux\/centos\/docker-ce.repo\r\nsudo dnf install -y docker-ce docker-ce-cli containerd.io\r\n            <\/code><\/pre>\n<p>Once Docker is installed, enable and start the Docker service:<\/p>\n<pre><code>\r\nsudo systemctl enable docker\r\nsudo systemctl start docker\r\n            <\/code><\/pre>\n<p>Now install Docker Compose using the following command:<\/p>\n<pre><code>\r\nsudo curl -L \"https:\/\/github.com\/docker\/compose\/releases\/download\/1.29.2\/docker-compose-$(uname -s)-$(uname -m)\" -o \/usr\/local\/bin\/docker-compose\r\nsudo chmod +x \/usr\/local\/bin\/docker-compose\r\n            <\/code><\/pre>\n<p>Verify the installation by checking the Docker and Docker Compose versions:<\/p>\n<pre><code>\r\ndocker --version\r\ndocker-compose --version\r\n            <\/code><\/pre>\n<p>This setup prepares your server to run Docker containers, whether locally or on a <a href=\"https:\/\/ie.netcloud24.com\">VPS Windows VPS Servers<\/a> platform.<\/p>\n<\/section>\n<section>\n<h2>Step 2: Set Up Mastodon Docker Environment<\/h2>\n<p>Create a directory for Mastodon and navigate into it:<\/p>\n<pre><code>mkdir ~\/mastodon &amp;&amp; cd ~\/mastodon<\/code><\/pre>\n<p>Clone the Mastodon repository from GitHub:<\/p>\n<pre><code>git clone https:\/\/github.com\/mastodon\/mastodon.git .<\/code><\/pre>\n<p>Switch to the latest stable release branch:<\/p>\n<pre><code>git checkout $(git tag | grep -v rc | tail -1)<\/code><\/pre>\n<\/section>\n<section>\n<h2>Step 3: Configure Environment Variables<\/h2>\n<p>Copy the sample environment configuration file to use for your instance:<\/p>\n<pre><code>cp .env.production.sample .env.production<\/code><\/pre>\n<p>Edit the <code>.env.production<\/code> file to configure your domain, email, and database information. Make sure to set up your domain name, for example:<\/p>\n<pre><code>\r\nLOCAL_DOMAIN=yourdomain.com\r\nSMTP_SERVER=smtp.yourmailprovider.com\r\nSMTP_PORT=587\r\nSMTP_LOGIN=yourlogin\r\nSMTP_PASSWORD=yourpassword\r\n            <\/code><\/pre>\n<p>Configure other necessary settings, including database passwords. This configuration ensures Mastodon will work correctly when deployed, whether locally or on a <a href=\"https:\/\/ie.netcloud24.com\">UK VPS Windows<\/a> hosting solution.<\/p>\n<\/section>\n<section>\n<h2>Step 4: Build and Start Mastodon with Docker Compose<\/h2>\n<p>Now that the environment is set up, you can build and start the Mastodon containers. Run the following commands to build the containers:<\/p>\n<pre><code>\r\ndocker-compose build\r\ndocker-compose run --rm web rake db:setup\r\ndocker-compose run --rm web rake db:migrate\r\ndocker-compose run --rm web rake assets:precompile\r\n            <\/code><\/pre>\n<p>Once the containers are built, start Mastodon:<\/p>\n<pre><code>docker-compose up -d<\/code><\/pre>\n<p>Mastodon will now be running in the background using Docker. Whether you&#8217;re deploying locally or using a <a href=\"https:\/\/ie.netcloud24.com\">Windows VPSVirtual Private Server hosting<\/a> platform, your Mastodon instance will be accessible.<\/p>\n<\/section>\n<section>\n<h2>Step 5: Configure Nginx as a Reverse Proxy<\/h2>\n<p>To make your Mastodon instance publicly accessible, you can configure Nginx as a reverse proxy. Install Nginx with the following command:<\/p>\n<pre><code>sudo dnf install nginx<\/code><\/pre>\n<p>After installation, create a configuration file for Mastodon in Nginx:<\/p>\n<pre><code>sudo nano \/etc\/nginx\/conf.d\/mastodon.conf<\/code><\/pre>\n<p>Add the following configuration, replacing <code>yourdomain.com<\/code> with your domain:<\/p>\n<pre><code>\r\nserver {\r\n    listen 80;\r\n    server_name yourdomain.com;\r\n    \r\n    location \/ {\r\n        proxy_pass http:\/\/127.0.0.1:3000;\r\n        proxy_set_header Host $host;\r\n        proxy_set_header X-Real-IP $remote_addr;\r\n        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;\r\n        proxy_set_header X-Forwarded-Proto $scheme;\r\n    }\r\n}\r\n            <\/code><\/pre>\n<p>Enable and restart Nginx:<\/p>\n<pre><code>\r\nsudo systemctl enable nginx\r\nsudo systemctl restart nginx\r\n            <\/code><\/pre>\n<p>This will allow users to access your Mastodon instance through your domain, whether it&#8217;s hosted locally or on a <a href=\"https:\/\/ie.netcloud24.com\">VPS Windows VPShosting UK<\/a> platform.<\/p>\n<\/section>\n<section>\n<h2>Step 6: Secure Your Mastodon Instance with SSL<\/h2>\n<p>For security, you should enable SSL on your Mastodon instance using Let\u2019s Encrypt. Install Certbot and its Nginx plugin:<\/p>\n<pre><code>sudo dnf install certbot python3-certbot-nginx<\/code><\/pre>\n<p>Obtain the SSL certificate and configure Nginx with the following command:<\/p>\n<pre><code>sudo certbot --nginx -d yourdomain.com<\/code><\/pre>\n<p>Certbot will automatically configure SSL for your domain, securing your Mastodon instance with HTTPS, whether hosted on a local server or a <a href=\"https:\/\/ie.netcloud24.com\">Windows VPS hosting UK<\/a>.<\/p>\n<\/section>\n<footer>\n<p>Mastodon is now installed and running on Rocky Linux 9, providing a fully functional social network platform. For reliable and scalable hosting, consider using . They offer various hosting plans, including <strong>windows virtual private servers<\/strong>, <strong>windows vps hosting<\/strong>, and <strong>windows virtual dedicated server hosting<\/strong>. Whether you&#8217;re looking for <strong>windows vps italy<\/strong> or <strong>uk vps windows<\/strong> solutions, their hosting services provide the performance and flexibility needed to support your Mastodon instance.<\/p>\n<\/footer>\n<\/article>\n<div class=\"post-author-box\" style=\"border-top:1px solid #ddd;margin-top:20px;padding-top:15px;\">\n<p><strong>Author:<\/strong> \u0141ukasz Bodziony<\/p>\n<p><strong>Website:<\/strong> <a href=\"https:\/\/ca.netcloud24.com\" target=\"_blank\" rel=\"dofollow\">Windows VPS<\/a><\/p>\n<p><em>\u0141ukasz Bodziony is the CEO and founder of <a href=\"https:\/\/netcloud24.com\" target=\"_blank\" rel=\"dofollow\">NETCLOUD24<\/a>, a global VPS hosting brand proudly originating from Poland. With extensive experience in cloud computing, virtualization, and server management, he delivers high-performance <strong>Windows VPS<\/strong> and <strong>Remote Desktop Services (RDS)<\/strong> solutions to clients across Europe, North America, and beyond.<\/em><\/p>\n<p><em>His expertise covers a wide range of technologies, including <strong>Microsoft Azure<\/strong>, <strong>Proxmox VE<\/strong>, <strong>Amazon Web Services (AWS)<\/strong>, and numerous other virtualization and cloud platforms.<\/em><\/p>\n<p><em>Beyond running his hosting business, \u0141ukasz also provides <strong>professional paid server configuration and optimization services<\/strong> for companies and individuals. Outside of work, he is dedicated to caring for his children and building a secure future for them.<\/em><\/p>\n<p><em>If you are interested in working with him or need expert assistance with your hosting, cloud environment, or server setup, feel free to reach out via <a href=\"https:\/\/ca.netcloud24.com\" target=\"_blank\" rel=\"dofollow\">Windows VPS<\/a>.<\/em><\/p>\n<\/p><\/div>\n","protected":false},"excerpt":{"rendered":"<p>\u00a0 \u00a0 Mastodon is an open-source, decentralized social network that has gained popularity as a federated platform, allowing users to manage their own communities. In this guide, we\u2026<\/p>\n","protected":false},"author":1,"featured_media":3421,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_seopress_robots_primary_cat":"","_seopress_titles_title":"","_seopress_titles_desc":"","_seopress_robots_index":"","footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[],"tags":[14,12,11,23,20,21,22,17,7,8,6,10,18,19,15,24,16,5,13,9],"class_list":["post-2913","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","tag-cheapvps","tag-cloudvps","tag-hostingvps","tag-rds","tag-rdscal","tag-remotedesktop","tag-remotedesktopvps","tag-servervps","tag-ukvps","tag-virtualserver","tag-vpshosting","tag-vpsserver","tag-vpssolutions","tag-vpswindows","tag-vpswithwindows","tag-windowsrds","tag-windowsserver","tag-windowsvps","tag-windowsvpshosting","tag-windowsvpsuk"],"jetpack_publicize_connections":[],"_links":{"self":[{"href":"https:\/\/netcloud24.com\/knowledgebase\/wp-json\/wp\/v2\/posts\/2913","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/netcloud24.com\/knowledgebase\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/netcloud24.com\/knowledgebase\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/netcloud24.com\/knowledgebase\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/netcloud24.com\/knowledgebase\/wp-json\/wp\/v2\/comments?post=2913"}],"version-history":[{"count":0,"href":"https:\/\/netcloud24.com\/knowledgebase\/wp-json\/wp\/v2\/posts\/2913\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/netcloud24.com\/knowledgebase\/wp-json\/wp\/v2\/media\/3421"}],"wp:attachment":[{"href":"https:\/\/netcloud24.com\/knowledgebase\/wp-json\/wp\/v2\/media?parent=2913"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/netcloud24.com\/knowledgebase\/wp-json\/wp\/v2\/categories?post=2913"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/netcloud24.com\/knowledgebase\/wp-json\/wp\/v2\/tags?post=2913"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}