Wiki > Audiobookshelf
Setup
Intro
Audiobookshelf is an open-source self-hosted media server for your audiobooks and podcasts.
The software will be configured in the /home/user/audiobookshelf
directory.
You will need a port number to access Audiobookshelf. Port 17754 has been automatically generated for you, but you may use another 5 digit port between 10000 and 32767.
Pre-requisites
The directions below assume:
- You have a directory of audiobook files in
/home/user/files/audiobooks
- You have a directory of podcast files in
/home/user/files/podcasts
Note: If you do not have directories with existing audiobooks or podcasts create them before starting the installation. Alternatively, you can use your existing folders and change directory paths for your files as needed.
Installation
-
Connect to your slot through SSH
-
Create a directory for audiobookshelf
mkdir -p ~/audiobookshelf
-
Create a compose file.
touch ~/audiobookshelf/docker-compose.yml
-
Edit the compose file
nano ~/audiobookshelf/docker-compose.yml
-
Copy the following adjusting your time zone if desired and changing your directory paths for your files as needed. Paste into the text editor. Once pasted, press
Ctrl+S
thenCtrl+X
version: "3.7"
services:
audiobookshelf:
image: ghcr.io/advplyr/audiobookshelf:latest
ports:
- 17754:80
volumes:
- /home/user/files/audiobooks:/audiobooks
- /home/user/files/podcasts:/podcasts
- /home/user/audiobookshelf:/config
- /home/user/audiobookshelf:/metadata
environment:
- TZ=UTC
restart: unless-stopped
-
Start the compose file:
podman-compose -f ~/audiobookshelf/docker-compose.yml up -d
Accessing Audiobookshelf
You will now be able to access your files folder using the username and password you defined from http://server.whatbox.ca:17754/
After installation, you should immediately access Audiobookshelf and set up your Root user.
Using SSL with a Managed App Link
If you want to access your Audiobookshelf instance with HTTPS access, add a custom app managed link with port 17754 and select Enable websockets (optional)
Managing Audiobookshelf
Stopping
podman-compose -f ~/audiobookshelf/docker-compose.yml down
Starting
podman-compose -f ~/audiobookshelf/docker-compose.yml up -d
Restarting
podman-compose -f ~/audiobookshelf/docker-compose.yml restart
Upgrading
podman-compose -f ~/audiobookshelf/docker-compose.yml down; podman-compose -f ~/audiobookshelf/docker-compose.yml pull; podman-compose -f ~/audiobookshelf/docker-compose.yml up -d
Auto-restarting Audiobookshelf
Here's how you can set up Audiobookshelf to start automatically when the VM is restarted:
- Create a file to be used for the script:
touch ~/audiobookshelf_restart.cron
- Edit the file and enter the following text:
nano -w ~/audiobookshelf_restart.cron
#!/bin/bash
if pgrep -f "audiobookshelf_1" > /dev/null
then
echo "Audiobookshelf is running."
else
echo "Audiobookshelf is not running, starting Audiobookshelf"
podman-compose -f /home/user/audiobookshelf/docker-compose.yml up -d
fi
exit
- Save the file with Ctrl+x, then press "y" and Enter to accept overwriting.
- Make the script executable:
chmod +x ~/audiobookshelf_restart.cron
- Open your crontab:
EDITOR=nano crontab -e
- Enter the following text:
@reboot /home/user/audiobookshelf_restart.cron >/dev/null 2>&1
*/5 * * * * /home/user/audiobookshelf_restart.cron >/dev/null 2>&1
- Save the file with Ctrl+x, then press "y" and Enter to accept overwriting.
Auto-upgrading Audiobookshelf
Here's how you can set up Audiobookshelf to automatically attempt to update the project everyday at 22:00 UTC:
- Open your crontab:
EDITOR=nano crontab -e
- Enter the following text:
0 22 * * * podman-compose -f ~/audiobookshelf/docker-compose.yml down; podman-compose -f ~/audiobookshelf/docker-compose.yml pull; podman-compose -f ~/audiobookshelf/docker-compose.yml up -d
- Save the file with Ctrl+x, then press "y" and Enter to accept overwriting.
Removing
-
Navigate to the directory containing the
docker-compose.yml
filecd audiobookshelf
-
Remove the services including networks and volumes created
podman-compose down --volumes
-
Remove the directory
rm -r /home/user/audiobookshelf
-
To remove any crontab -e entries open your crontab:
EDITOR=nano crontab -e
and delete or comment out any of the restart/upgrade commands you might have added. Then, save the file with Ctrl+x, then press "y" and Enter to accept overwriting.