DEV Community

Cover image for Fast Guide: Install CapRover + Poste.io Mail Server in 5 Minutes on Ubuntu VPS or Localhost
Ion Iacob for Big Bang Social

Posted on

Fast Guide: Install CapRover + Poste.io Mail Server in 5 Minutes on Ubuntu VPS or Localhost

🚀 Why Use CapRover + Poste.io?

  1. Easy Deployment: CapRover offers one-click app deployment, including Docker apps like Poste.io.
  2. Full Mail Server: Poste.io provides a complete mail server solution (SMTP, IMAP, POP3) with ClamAV integration.
  3. Docker-Powered: Both CapRover and Poste.io run on Docker, making it easy to manage, scale, and transport between VPS or devices.
  4. Built-in HTTPS: CapRover allows automatic HTTPS using Let's Encrypt, providing security by default.
  5. Resource Efficiency: Lightweight and optimized for VPS or local environments with minimal overhead.

Image description

Step 1: Install Docker and Docker Compose

First, install Docker and Docker Compose on your system.

  1. Update your system:

    sudo apt update && sudo apt upgrade -y
    
  2. Install Docker:

    sudo apt install docker.io -y
    
  3. Install Docker Compose:

    sudo apt install docker-compose -y
    
  4. Enable Docker service:

    sudo systemctl enable docker
    sudo systemctl start docker
    
  5. Optional: Add your user to the Docker group (so you can run Docker without sudo):

    sudo usermod -aG docker $USER
    

    Log out and back in for the changes to take effect.


Step 2: Install CapRover

  1. Run the CapRover installation script:

    docker run -e MAIN_NODE_IP_ADDRESS=YOUR_IP_ADDRESS -e MAIN_NODE_DOMAIN_NAME=YOUR_DOMAIN -v /var/run/docker.sock:/var/run/docker.sock -v /captain:/captain caprover/caprover
    
- Replace `YOUR_IP_ADDRESS` with your VPS IP (or `127.0.0.1` for localhost).
- Replace `YOUR_DOMAIN` with your domain name or use `captain.localhost` for testing on localhost.
Enter fullscreen mode Exit fullscreen mode
  1. Access the CapRover dashboard:

    Open your browser and go to http://YOUR_IP_ADDRESS:3000 (or http://localhost:3000 if on localhost).


Step 3: Install Poste.io Mail Server using CapRover

  1. Log into CapRover dashboard and create a new app:
- Go to **Apps** > **Create New App**, name it `Poste` (or any name you prefer).
Enter fullscreen mode Exit fullscreen mode
  1. Deploy Poste.io with one-click:
- Go to the app you created > **App Configs** > **HTTP Settings**:
  - Set the root domain or subdomain for your mail server (e.g., `mail.yourdomain.com`).

- Go to **App Configs** > **Dockerfile** > **Edit Dockerfile** and add:
Enter fullscreen mode Exit fullscreen mode
  ```yaml
  captainVersion: 4
  services:
    app:
      image: analogic/poste.io
      ports:
        - 25:25
        - 80:80
        - 443:443
        - 110:110
        - 143:143
        - 993:993
        - 995:995
        - 587:587
        - 4190:4190
      environment:
        - "HTTPS=ON"
        - "VIRTUAL_HOST=mail.yourdomain.com"
        - "ENABLE_CLAMAV=ON"
      volumes:
        - /captain/data/poste/maildata:/data
  ```
Enter fullscreen mode Exit fullscreen mode
  1. Deploy and finalize:
- Click **Save and Update** in CapRover.
- Poste.io should now be running at `mail.yourdomain.com`.
Enter fullscreen mode Exit fullscreen mode

Step 4: Access Poste.io

  1. Access the Poste.io admin dashboard:

    Open your browser and go to https://mail.yourdomain.com/admin (replace yourdomain.com with your actual domain).

  2. Configure your mail server:

Image description
Follow the on-screen instructions to set up your mail server.


Done!

Image description

You've now successfully installed CapRover and Poste.io in just a few minutes on your Ubuntu VPS or localhost. Make sure to configure firewall rules to allow relevant ports (25, 80, 443, 110, 143, 587, etc.).


Additional Notes:

  • For production servers, it's recommended to set up proper DNS records (MX, SPF, DKIM, etc.) for your domain to ensure your mail server works optimally.
  • You can manage your CapRover server and deploy more apps using the CapRover dashboard. """

Top comments (0)