How to Self-Host Audiobookshelf on a VPS (Complete Guide)
Audiobookshelf is a powerful self-hosted application that organizes and streams your audiobook collection with ease. This guide will walk you through the installation process on a Virtual Private Server (VPS). Whether youโre a developer or a homelabber, setting up Audiobookshelf on your VPS can be a rewarding experience.
What You Need
Before starting, ensure you have the following:
- A VPS (Virtual Private Server)
- Basic knowledge of Docker and command line
- A domain name (optional, but recommended for easier access)
For the VPS, consider providers that are budget-friendly and offer good performance. Hereโs a quick comparison of some top VPS providers:
| Provider | Monthly Price | CPU Cores | RAM | Storage |
|---|---|---|---|---|
| Contabo VPS | 5.99 EUR | 2 | 4 GB | 200 GB SSD |
| Hetzner Cloud | 4.15 EUR | 1 | 2 GB | 20 GB SSD |
| DigitalOcean | 6 USD | 1 | 1 GB | 25 GB SSD |
| Vultr | 6 USD | 1 | 1 GB | 25 GB SSD |
| Linode (Akamai Cloud) | 5 USD | 1 | 2 GB | 25 GB SSD |
For further details on pricing and features, refer to our full VPS comparison.
Step 1: Select and Set Up Your VPS
For this guide, we will use Hetzner Cloud as our VPS provider due to its affordability. Once you sign up and create your VPS instance, make sure you select a Linux distribution that supports Docker, such as Ubuntu 20.04 LTS.
Step 2: Connect to Your VPS
Use SSH to connect to your VPS. Open your terminal and run the following command:
ssh root@your_vps_ip
Replace your_vps_ip with the actual IP address of your VPS.
Step 3: Install Docker
Once connected, the next step is to install Docker. Run the following commands:
apt update
apt install apt-transport-https ca-certificates curl software-properties-common -y
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add -
add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
apt update
apt install docker-ce -y
To ensure Docker is correctly installed, check the version:
docker --version
Step 4: Install Docker Compose
Next, you need Docker Compose to manage multi-container Docker applications. Execute the following command:
curl -L "https://github.com/docker/compose/releases/latest/download/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose
You can verify the installation using:
docker-compose --version
Step 5: Set Up Audiobookshelf
Now that Docker and Docker Compose are installed, itโs time to set up Audiobookshelf. Create a new directory for your Audiobookshelf installation:
mkdir audiobookshelf
cd audiobookshelf
Create a docker-compose.yml file using your preferred text editor:
version: "3.3"
services:
audiobookshelf:
image: "sleeplessninja/audiobookshelf:latest"
ports:
- "8080:80"
volumes:
- audiobooks:/audiobooks
restart: unless-stopped
volumes:
audiobooks:
Save and close the file.
Step 6: Start Audiobookshelf
Now, you can start Audiobookshelf with Docker Compose:
docker-compose up -d
Visit http://your_vps_ip:8080 in your browser to access Audiobookshelf. Follow the on-screen instructions to set up your library.
Step 7: Configure Domain (Optional)
If you have a domain name and want to use it, you may want to set up a reverse proxy using Nginx. Install Nginx:
apt install nginx -y
Modify the Nginx configuration to redirect traffic from your domain to the Audiobookshelf application.
Example Nginx Configuration
server {
listen 80;
server_name your_domain.com;
location / {
proxy_pass http://localhost:8080;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
}
FAQs
1. What are the benefits of self-hosting Audiobookshelf?
Self-hosting Audiobookshelf allows you complete control over your audiobook library, providing privacy and security. You can host your collection without relying on third-party services and customize functionalities to meet your needs. This is ideal for users who prefer to manage their own data without restrictions imposed by commercial platforms.
2. Can I run Audiobookshelf on low-spec VPS?
Yes, Audiobookshelf can run on lower-spec VPS as long as you meet the minimum requirements. For instance, a VPS with 1 CPU core and 1 GB RAM can suffice for basic use. However, for optimal performance, especially with larger libraries, choose a VPS with 2+ GB RAM, like Hetzner Cloud or Contabo VPS, which start at affordable prices.
3. How do I back up my Audiobookshelf data?
Backing up your Audiobookshelf data is essential for data safety. Since Audiobookshelf uses Docker volumes, you can back up the data stored in the audiobooks volume. Use the following command to create a backup:
docker run --rm --volumes-from audiobookshelf_audiobooks_1 -v $(pwd):/backup ubuntu tar czvf /backup/audiobookshelf_backup.tar.gz /audiobooks
This creates a compressed backup of your audio files, which you can store safely offsite.
By following these steps, you will be able to successfully self-host Audiobookshelf on your chosen VPS. Happy listening!