Search
K
Links

How to host a remote Kavita e-book server

Discover how to set up a Kavita e-book server to manage your digital library and access it remotely over Meshnet.

Introduction

Kavita is a multi-platform, open-source digital library server. It allows you to import your e-book collection and then conveniently access it from any device. Such a setup eliminates the need for downloading files on different devices and keeping track of your progress on each one.
Since the Kavita server is web-based, it can be easily shared between peers. However, leaving your home network open for remote access can be considered a vulnerability and be exploited for malicious intents.
By using Meshnet, you don’t have to set up port forwarding or manually configure a VPN connection. Meshnet uses encrypted network tunnels to connect devices into a single virtual network allowing secure, unrestricted remote connections.
This article demonstrates how you can self-host a Kavita server for your digital book collection using Docker and remotely connect to the server via Meshnet.

Prerequisites

Before you begin, ensure you have Docker and Docker Compose installed on your device. You can find instructions on how to download and install these tools on the Docker website:
Note
Docker Compose comes pre-installed with Docker Desktop.

Create your Kavita instance using Docker

You can begin preparing your Kavita server once you have Docker running on your device.

Prepare a Docker Compose file

To start, you have to define the instructions for deploying the Kavita instance. This is done in the form of a Docker Compose file.
Windows
macOS and Linux
  1. 1.
    Open PowerShell.
  2. 2.
    In your preferred directory, make a new kavita folder and navigate to it using the following command:
    mkdir kavita; cd kavita
  3. 3.
    Create a docker-compose.yml file and open it using Notepad by running:
    notepad docker-compose.yml
    When prompted to create the file, click Yes.
    Notepad dialog asking to create a file, with the "Yes" button highlighted.
  4. 4.
    In Notepad, paste the following instructions for the Kavita Docker container:
    services:
    kavita:
    image: jvmilazz0/kavita:latest
    container_name: kavita
    volumes:
    - .\data:/kavita/config
    - <\path\to\e-books>:/books
    environment:
    - TZ=<TimeZone>
    ports:
    - "5000:5000"
    restart: unless-stopped
  5. 5.
    Update the placeholders with the values relevant to your configuration:
    • Replace <\path\to\e-books> with the path to your e-book folder.
    • Replace <TimeZone> with your time zone.
      Example
      Notepad window with two lines highlighted.
  6. 6.
    Press Ctrl + S to save changes.
  7. 7.
    Exit Notepad.
Tip
If you want to include additional folders, such as comic books and manga, you can append new lines under the volumes section. For example:
- <\path\to\comics>:/comics
- <\path\to\manga>:/manga
  1. 1.
    Open Terminal.
  2. 2.
    In your preferred directory, make a new kavita folder and navigate to it using the following command:
    mkdir kavita && cd kavita
  3. 3.
    Create a docker-compose.yml file and open it using the Nano text editor by running:
    nano docker-compose.yml
  4. 4.
    In the compose file, paste the following instructions for the Kavita Docker container:
    services:
    kavita:
    image: jvmilazz0/kavita:latest
    container_name: kavita
    volumes:
    - ./data:/kavita/config
    - </path/to/e-books>:/books
    environment:
    - TZ=<TimeZone>
    ports:
    - "5000:5000"
    restart: unless-stopped
  5. 5.
    Update the placeholders with the values relevant to your configuration:
    • Replace </path/to/e-books> with the path to your e-book folder.
    • Replace <TimeZone> with your time zone.
      Example
      Terminal window with two lines highlighted.
  6. 6.
    Press Ctrl + X, Y, and Enter to save changes and exit the text editor.
Tip
If you want to include additional folders, such as comic books and manga, you can append new lines under the volumes section. For example:
- </path/to/comics>:/comics
- </path/to/manga>:/manga

Deploy the Kavita container

Now, you can use the instructions declared in the compose file to create your Kavita server instance. To deploy the container, while in the kavita directory, run the following command:
docker compose up -d
Docker will pull the Kavita image from Docker Hub and deploy the container.

Verify the container status

Run the docker ps command to check the state of the container. In the output, under STATUS, you should see Up and the duration indicating how long the container has been active.
Terminal output showing the container status as "Up"

Personalize your Kavita server

The Kavita server is controlled and used directly from a web interface which is created when the service is deployed.

Set up an administrator user

To start using the server, you need to create an administrator account. This account will have all of the permissions to manage the server.
  1. 1.
    Open your internet browser.
  2. 2.
    Navigate to the following URL: localhost:5000/
  3. 3.
    Fill in the following details:
    • In the Username field, enter a custom username for the administrator account.
    • In the Email field, type in an email address that should be associated with the administrator user.
    • In the Password field, enter a strong password that will be used for administrator authentication.
  4. 4.
    Click Register.
    "Register" button highlighted with the username, email, and password fields filled in.
  5. 5.
    On the login page, enter your newly created authentication details and click Submit.
    "Submit" button highlighted on the login screen.
You should now see the home page of the Kavita web interface.

Add your e-book library

Currently, your Kavita server does not display any e-books present in the folder you provided when deploying the Docker container. To fix this, you need to create a new library and point it to the location of your e-book collection.
  1. 1.
    On the Kavita web interface, in the upper-right corner, click Server settings.
    "Server settings" icon button highlighted.
  2. 2.
    Select the Libraries tab and click Add library.
  3. 3.
    In the Name field, enter a custom name for the new library.
  4. 4.
    From the Type dropdown list, select Book, and click Next.
    "Book" type selected and "Next" button highlighted.
  5. 5.
    Click Browse for media folders.
  6. 6.
    Select /, then books, and click Share.
    Path to the e-book folder and "Share" button highlighted.
  7. 7.
    Click Next twice and then Save to finish.
The newly added folder should now be visible under Libraries.
"Libraries" tab of the Kavita dashboard showing the new library.
Note
Ensure that your e-book folder structure follows the requirements provided in the Kavita documentation. Otherwise, the server may not detect your e-books.

Turn on automatic library scans

To make sure that your libraries are updated as soon as possible, you can enable the "Folder watching" feature of Kavita. It will monitor your library folders for any changes and update them when necessary.
  1. 1.
    Open the Server settings page.
  2. 2.
    In the General tab, scroll down to the Folder watching.
  3. 3.
    Turn on the Enable folder watching toggle.
    "Enable folder watching" toggle turned on.
  4. 4.
    Click Save.

Invite additional users

If you wish to share access to the Kavita server with your friends or family, it is advisable to have distinct accounts for each user. Kavita has a user management system that allows you to send invitation links or manually create accounts yourself.
To create a new user account:
  1. 1.
    Open Kavita Server settings.
  2. 2.
    Select the Users tab and click Invite.
    "Invite" button highlighted.
  3. 3.
    In the Email field, enter a username for the new user account.
  4. 4.
    Select the roles and libraries you want the new account to have access to and click Invite.
    "Invite" button highlighted with the roles and libraries for the new user account selected.
You should now see a registration link in the Invite url field. From here, you can choose if you want to finish the new user creation yourself or send the invitation link to your Meshnet peer.
Complete account setup
To finish the user creation process yourself:
  1. 1.
    Copy the provided URL.
    Copy button next to the invite URL highlighted.
  2. 2.
    Open a new tab in your browser.
  3. 3.
    Paste the copied link in the URL field.
  4. 4.
    Fill in the Username and Password fields, and click Register.
    Registration form with the account details filled in.
A notification claiming Account registration complete should prompt in the lower-left corner of your browser.
Send invitation
To send an invitation to your Meshnet peer:
  1. 1.
    Copy the provided URL.
    Copy button next to the invite URL highlighted.
  2. 2.
    Change the localhost part of the link to the Nord name of your Kavita server. Example
    http:/secret.meerkat-himalayas.nord:5000/registration/confirm-email?token=CfDJ8GCw%2fIYkjOBCikS3942rGk%2f1oYUHCPIC6fHx%2bYM%2fZW%2bP04ir6UiYOaeyk2UVAZc2FE5ug9Zc2MGmg%2fMTgSyPcdrS3QrK3ZaIx6j5Pl1Pkya2bqrO7pLNkcCm2ne8ndLA8UgTElFkx7NH9SZMUbIPxDsfN83iqLVOkAXhDkk1dusAcieahaz6s1lmr3r68tU9Qg%3d%3d&email=fernando.thewhale
  3. 3.
    Share the updated link with your peer.
After opening the link, the invitee will need to fill in the registration details and create the account.

Remotely access your e-books with Meshnet

Your Kavita e-book server is now fully set up and ready for use. You can remotely connect to the server over Meshnet by either using a third-party e-book reader app or directly from your internet browser.

Method 1: Using mobile reader apps

Note
You can find a list of tested external reader apps on the Kavita FAQ page.
This section contains instructions for connecting to the Kavita server using the Moon+ Reader app on Android as an example.
You can download and install Moon+ Reader for free from Google Play. After installing the app:
  1. 1.
    Copy the Nord name of the device hosting the Kavita server by tapping the three-dot menu and selecting Copy device’s Nord name.
    "Copy device's Nord name" option highlighted.
  2. 2.
    Launch Moon+ Reader.
  3. 3.
    If prompted, grant the All files access permission to the reader app.
    "Allow access to manage all files" toggle enabled.
  4. 4.
    Tap the arrow icon in the upper-right corner of the Net library section.
    Arrow button highlighted.
  5. 5.
    In the upper-right corner, tap the three-dot icon and select Add new catalog.
  6. 6.
    Fill in the following details:
    • In the Catalog name field, enter a custom name for the Kavita library that will be displayed in the reader.
    • In the Catalog URL field, type in http://, paste the copied Nord name, and add :5000/.
      Example http://secret.meerkat-himalayas.nord:5000/
  7. 7.
    Tap OK.
    "OK" button highlighted on the filled in Add new catalog dialog.
Your Kavita library should now be visible on the Net library screen.
Newly added Kavita library highlighted.

Method 2: Using an internet browser

To access your e-book library on the Kavita server from an internet browser:
  1. 1.
    Copy the Nord name of the device hosting the Kavita server.
    Nord name copied from the Windows NordVPN app.
  2. 2.
    Open your internet browser.
  3. 3.
    In the URL field, paste the copied Nord name, add :5000/, and press Enter. Example secret.meerkat-himalayas.nord:5000/
  4. 4.
    Type in the username and password of the Kavita user account.
  5. 5.
    Click Submit to log in.
    "Submit" button highlighted on the Kavita login page.
Now you can access your digital e-book library from the comfort of your internet browser.
© 2023 Nord Security. All Rights Reserved.