I'm assuming you're running the latest version of Ubuntu (24.04) or Debian (12), so the installation of prerequisites will use apt.
- Login as root:
sudo -i
- Install the prerequisites:
apt install docker.io docker-compose nginx python3-venv
- Create directory for Mastodon:
mkdir /opt/mastodon
- Enter to Mastodon directory:
cd /opt/mastodon
- Create directory for Postgres:
mkdir postgres14
- Create directory for Redis:
mkdir redis
- Create directory for Mastodon files:
mkdir -p public/system
- Set owner to Mastodon user (991) for public directory:
chown -R 991:991 public
- Get docker-compose.yml for Mastodon:
wget https://raw.githubusercontent.com/mastodon/mastodon/main/docker-compose.yml