Run Mastodon - A Federated Twitter Alternative - in Docker

Channel:
Subscribers:
14,500
Published on ● Video Link: https://www.youtube.com/watch?v=_K5la-WchuY



Category:
Tutorial
Duration: 6:59
451 views
17


#Mastodon #Docker #Twitter

Full steps can be found at https://i12bretro.github.io/tutorials/0853.html

What is Mastodon?
Mastodon is a free, open-source social network server based on ActivityPub where users can follow friends and discover new ones. On Mastodon, users can publish anything they want: links, pictures, text, video. All Mastodon servers are interoperable as a federated network (users on one server can seamlessly communicate with users from another one, including non-Mastodon software that implements ActivityPub)! - https://github.com/mastodon/mastodon
 
Installing Docker
   01. Log into the Linux based device
   02. Run the following commands in the terminal
         # install prerequisites
         sudo apt install apt-transport-https ca-certificates curl software-properties-common gnupg-agent -y
         # add docker gpg key
         curl -fsSL https://download.docker.com/linux/$(awk -F'=' '/^ID=/{ print $NF }' /etc/os-release)/gpg | sudo apt-key add -
         # add docker software repository
         sudo add-apt-repository "deb [arch=$(dpkg --print-architecture)] https://download.docker.com/linux/$(awk -F'=' '/^ID=/{ print $NF }' /etc/os-release) $(lsb_release -cs) stable"
         # install docker
         sudo apt install docker-ce docker-compose containerd.io -y
         # enable and start docker service
         sudo systemctl enable docker && sudo systemctl start docker
         # add the current user to the docker group
         sudo usermod -aG docker $USER
         # reauthenticate for the new group membership to take effect
         su - $USER
 
Generating SSL Certificate with Let's Encrypt
NOTE: In order for Let's Encrypt to verify ownership of the DNS name, the host certbot is running from must be accessible via port 80 (http) or port 443 (https). For homelab users, this will normally involve port forwarding from the router to the certbot host, which is beyond the scope of this tutorial. Just note, I have forwarded port 80 on my router to the host running certbot for this handshake to complete successfully.
 
   01. Continue with the following commands in a terminal window
         # remove apt version of certbot if installed
         sudo apt remove certbot -y
         # install snapd
         sudo apt install snapd -y
         # install snap core and update
         sudo snap install core; sudo snap refresh core
         # install certbot snap
         sudo snap install --classic certbot
         # create certbot symbolic link
         sudo ln -s /snap/bin/certbot /usr/bin/certbot
         # if a web server process is currently using port 80, stop it before proceeding
         # generate a certificate
         sudo certbot certonly --standalone --preferred-challenges http -d ≪%DNS NAME%≫
   02. When prompted, enter an email address and agree to the terms of service
   03. Choose whether to share your email and receive emails from certbot
   04. Certbot will output information regarding the location of the certificate files
   05. Continue with the following commands in a terminal window
         # create ssl-certs group
         sudo groupadd ssl-certs
         # add $USER and root users to group
         sudo usermod -aG ssl-certs $USER
         sudo usermod -aG ssl-certs root
         # verify the members of ssl-cert
         getent group ssl-certs
         # set owner group of /etc/letsencrypt
         sudo chgrp -R ssl-certs /etc/letsencrypt
         # set permissions on /etc/letsencrypt
         sudo chmod -R g=rX /etc/letsencrypt
 
Running the Mastodon Container Stack
   01. Now that Docker is installed, run the following commands to setup the Mastodon Docker containers
         # create working directories
         mkdir ~/docker/postgres -p && mkdir ~/docker/redis -p && mkdir ~/docker/mastodon/public/system -p && mkdir ~/docker/nginx/conf -p
         # pull the mastodon web container
         docker pull tootsuite/mastodon
         # generate secrets, run this 2 times
         docker run --rm -it tootsuite/mastodon bundle exec rake secret
         # generate VAPID keys
         docker run --rm -it tootsuite/mastodon bundle exec rake mastodon:webpush:generate_vapid_key
         # create a mastodon .env file
         # copy the generated secrets and keys into the .env file
         # make sure to set the LOCAL_DOMAIN as this cannot be changed later
         nano ~/docker/mastodon/.env
   02. Paste the following into the .env file, then edit the LOCAL_DOMAIN, WEB_DOMAIN, PostgreSQL, Secrets, Web Push and SMTP settings
NOTE: A full example .env file can be find at  https://github.com/mastodon/mastodon/blob/main/.env.production.sample
         # This is a sample configuration file. You can generate your configuration


....Full steps can be found on GitHub [link at the top]


### Connect with me and others ###
★ Discord: https://discord.com/invite/EzenvmSHW8
★ Reddit: https://reddit.com/r/i12bretro
★ Twitter: https://twitter.com/i12bretro







Tags:
Alternative
Browser Based
Container
Containerization
Docker
Docker How To
Docker Installation Tutorial
Docker Made Easy
Docker Simplified
Docker Tutorial
Federated
Home Lab
Home Lab Ideas
Homelab
How To
Install Guide
Linux
Mastodon
Micro Blogging
Microblogging
Self-Hosted
Social Media
Social Network
Tutorial
Twitter
Twitter Alternative
Ubuntu
Web Based
Web Based Tools
i12bretro