Guide to Deploy Decentralized Social Platform Lemmy on Cloud VPS with Minimum 2-Core Configuration
Detailed guide to deploy Lemmy, a decentralized social media platform, on a Cloud VPS with a minimum 2-core configuration, including installation, setup, and performance optimization.
Image credit: geralt · Pixabay Content License
Introduction to Lemmy and Benefits of Self-Hosting
Lemmy is a decentralized social network platform built on the fediverse model, similar to Mastodon but focused on forums (subreddits). With its decentralized architecture, Lemmy allows users to create and manage independent communities without relying on a central authority. Self-hosting Lemmy on a Cloud VPS offers significant advantages, including full data control, customizable interfaces, and reduced dependency on third-party platforms.
System Requirements and Environment Setup
To deploy Lemmy on a Cloud VPS, you need a server with the following minimum configuration:
- 2 CPU cores
- 4GB RAM
- 20GB SSD storage
- Operating System: Ubuntu 22.04 LTS or Debian 11
Before starting, ensure your VPS is updated:
sudo apt update && sudo apt upgrade -y
Deploying Lemmy on Cloud VPS
We will use Docker to deploy Lemmy quickly and manage it efficiently.
Step 1: Install Docker and Docker Compose
sudo apt install docker.io docker-compose -y
Step 2: Create Project Directory and Docker Compose File
mkdir lemmy && cd lemmy
nano docker-compose.yml
Paste the following content into the docker-compose.yml file:
version: '3.8'
services:
lemmy:
image: lemmydev/lemmy:latest
container_name: lemmy
ports:
- "8536:8536"
environment:
- DATABASE_URL=postgres://lemmy:password@db:5432/lemmy
- SMTP_HOST=smtp.gmail.com
- SMTP_PORT=587
- [email protected]
- SMTP_PASSWORD=your-password
- SITE_NAME=Lemmy Instance
- SITE_URL=https://your-domain.com
volumes:
- ./data:/lemmy/data
depends_on:
- db
restart: unless-stopped
db:
image: postgres:13
container_name: lemmy-db
environment:
- POSTGRES_DB=lemmy
- POSTGRES_USER=lemmy
- POSTGRES_PASSWORD=password
volumes:
- ./db_data:/var/lib/postgresql/data
restart: unless-stopped
Step 3: Start the Services
docker-compose up -d
Performance Optimization and Additional Configuration
After Lemmy starts, you can optimize performance by:
- Configuring a reverse proxy (Cloudflare or Nginx) for security and faster access.
- Setting up upsert database with PostgreSQL to improve query performance.
- Creating a cron job for regular data backups.
Test Access
Visit https://your-domain.com to verify Lemmy is running.
Troubleshooting and Verification
If Lemmy fails to start, check the logs:
docker logs lemmy
Ensure dependent services (PostgreSQL, SMTP) are running. If needed, recheck the environment configuration in the docker-compose.yml file.
References
For more information about Lemmy, refer to:
High-RAM Cloud VPS Plans Optimized for AI, Databases & Cache
Enterprise RAID 10 NVMe SSDs, CMC & FPT District 9 uplinks with Anycast Anti-DDoS and 99.99% SLA.
VPS-4E
10% VAT included
- CPU: 4 vCPU
- RAM: 8 GB
- SSD: 50 GB NVMe
