4 C
Texas

How To Install Calibre Ebook Server On Ubuntu 20.04

Today we are going to learn that how to install Calibre Ebook Server On Ubntu 20.04. Calibre is an open source ebook manager that helps you to manage your ebook library. With the help of Calibre you can access your ebook library from anywhere in the world & you can also share them with your favourite person family or friend. You’ve also the option to download them to the smartphone for later reading. So, here we’ll see the steps to install calibre ebook server on Ubuntu 20.04.

Step 1: Update Your System

First of all update your system to have the latest updates installed.

sudo apt update && sudo apt upgrade -y

Step 2: Allow Firewall Access

If you have not already installed firewall, type the below command to install it.

- Advertisement -
sudo apt install ufw

Once, installed enable SSH port.

sudo ufw allow "OpenSSH"

Then enable the firewall to start on boot.

Now, allow the port 8080 that is being used by the calibre server.

sudo ufw allow 8080

Verify the firewall status by typing

sudo ufw status
Status: active
To Action From
-- ------ ----
OpenSSH ALLOW Anywhere
8080 ALLOW Anywhere
OpenSSH (v6) ALLOW Anywhere (v6)
8080 (v6) ALLOW Anywhere (v6)

Step 3: Download & Install Calibre Server

Calibre is available on Ubuntu 20.04 but here we’ll use their official site to download the latest version of it instead of downloading it from Ubuntu repository.

Run the below command to install the required dependencies.

sudo apt install libfontconfig libgl1-mesa-glx

And then type the below command to get the calibre server installer.

wget https://download.calibre-ebook.com/linux-installer.sh

Now, make the script exceutable

chmod +x ./linux-installer.sh

And finally hit the below command to install the Calibre.

sudo ./linux-installer.sh

If you face any warning ignore them because it will give you warning as you are using desktop Ubuntu version instead of Ubuntu server.

Step 4: Create Your Ebook Library

Here we’ll download a book to show you how it works. You can download many books from Project Gutenberg as they provide free public domain books. Hit the below command to download one book.

wget http://www.gutenberg.org/ebooks/209.kindle.noimages -O turnofthescrew.mobi

Then create a new folder for you calibre library.

sudo mkdir calibre-library

And, then add the pre-downloaded book into this folder.

calibredb add *.mobi --with-library calibre-library/

That’s it your book was added.

Step 5: Running the Calibre Server on Ubuntu 20.04

Fire the following command in your terminal in order to run the calibre server on ubuntu 20.04.

calibre-server calibre-library

The above command consists of two parts. calibre-server refers to start the server & the calibre-library indicates the folder used by the server.

Output:

You’ll see the similar output.

calibre server listening on 0.0.0.0:8080
OPDS feeds advertised via BonJour at: your_server_ip port: 8080

Step 6: Access Calibre Server Via Web

Now, open your favourite browser and type your IP along with calibre port like http://IP:8080 to access the calibre on web page.

Click on the shown folder & you’ll see the downloaded book here. Similarly you can add many books here.

To stop the server simply press Ctrl+C in the terminal.

In order to change the default port of calibre type

calibre-server calibre-library --port 7530

Make sure to allow this port through firewall.

Step 7: Creating A Service For Calibre Server

To start calibre server on every boot, simply add the service for calibre. Create a new file /etc/systemd/system/calibre-server.service.

sudo nano /etc/systemd/system/calibre-server.service

Then paste the below content into the file.

### startup service
[Unit]
Description=calibre content server
After=network.target
[Service]
Type=simple
User=<username>
Group=<username>
ExecStart=/opt/calibre/calibre-server /home/<username>/calibre-library --enable-local-write
[Install]
WantedBy=multi-user.target
Note: Replace username with your system user.

Finally save & close the file.

To start calibre server, type

sudo systemctl start calibre-server

To start on boot hit

sudo systemctl enable calibre-server

Step 8: Add User Authentication

In order to add user authentication, stop calibre server.

sudo systemctl stop calibre-server

And then start the script by typing

sudo calibre-server --userdb /home/<username>/.config/calibre/server-users.sqlite --manage-users
1) Add a new user
2) Edit an existing user
3) Remove a user
4) Cancel
What do you want to do? [1-4]: 1
Enter the username: osradar
Enter the new password for osradar:
Re-enter the new password for osradar, to verify:
User osradar added successfully!

Provide details as required to setup user authentication.

Then edit the service file.

sudo nano /etc/systemd/system/calibre-server.service

Now, type –-enable-auth to the end of ExectStart line.

. . .
ExecStart=/opt/calibre/calibre-server "/home/<username>/calibre-library" --userdb "/home/<username>/.config/calibre/server-users.sqlite" --enable-local-write --enable-auth
. . .

Save & exit the file.

Then reload the daemon by

sudo systemctl daemon-reload
sudo systemctl start calibre-server

User authentication enabled now you’ve to provide username and password while accessing on web page.

So, this is how you can install Calibre Ebook Server on Ubutnu 20.04

- Advertisement -
Everything Linux, A.I, IT News, DataOps, Open Source and more delivered right to you.
Subscribe
"The best Linux newsletter on the web"

LEAVE A REPLY

Please enter your comment!
Please enter your name here



Latest article