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.

  1. Open PowerShell.

  2. In your preferred directory, make a new kavita folder and navigate to it using the following command:

    mkdir kavita; cd kavita

  3. Create a docker-compose.yml file and open it using Notepad by running:

    notepad docker-compose.yml

  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. 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

  6. Press Ctrl + S to save changes.

  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

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.

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. Open your internet browser.

  2. Navigate to the following URL: localhost:5000/

  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.

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. On the Kavita web interface, in the upper-right corner, click Server settings.

  2. Select the Libraries tab and click Add library.

  3. In the Name field, enter a custom name for the new library.

  4. From the Type dropdown list, select Book, and click Next.

  5. Click Browse for media folders.

  6. Select /, then books, and click Share.

  7. Click Next twice and then Save to finish.

The newly added folder should now be visible under Libraries.

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. Open the Server settings page.

  2. In the General tab, scroll down to the Folder watching.

  3. Turn on the Enable folder watching toggle.

  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. Open Kavita Server settings.

  2. Select the Users tab and click Invite.

  3. In the Email field, enter a username for the new user account.

  4. Select the roles and libraries you want the new account to have access to and click Invite.

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. Copy the provided URL.

  2. Open a new tab in your browser.

  3. Paste the copied link in the URL field.

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. Copy the provided URL.

  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. 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. Launch Moon+ Reader.

  2. In the upper-right corner, tap the three-dot icon and select Add new catalog.

  3. 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/

  4. Tap OK.

Your Kavita library should now be visible on the Net library screen.

Method 2: Using an internet browser

To access your e-book library on the Kavita server from an internet browser:

  1. Copy the Nord name of the device hosting the Kavita server.

  2. Open your internet browser.

  3. In the URL field, paste the copied Nord name, add :5000/, and press Enter. Example secret.meerkat-himalayas.nord:5000/

  4. Type in the username and password of the Kavita user account.

  5. Click Submit to log in.

Now you can access your digital e-book library from the comfort of your internet browser.

Last updated

© 2024 Nord Security. All Rights Reserved.