<p>You can share your <a href="https://calibre-ebook.com/" target="_blank">Calibre</a> ebook library by running the <a href="https://manual.calibre-ebook.com/generated/en/calibre-server.html"><code>calibre-server</code></a> daemon, either from your desktop machine or on a server that is available on your local network. (Or, if you have it set up that way, it can be outward-facing to the wide world.)</p>

<p>To share your library from the desktop Calibre application, choose <code>Connect/share</code> from the menu at the top of the window, then choose <code>Start Content Server</code>. Make a note of the IP address and port, and then you can use other devices on your network to access the library at that address. Normally I use the "Get Books" function of the <a href="https://www.appstafarian.com/marvin.html" target="_blank">Marvin</a> ebook app on my iPad, or else the "Experimental Browser" on my Kindle and download the books directly to the devices. On my Android phone, I use the Chrome browser and then long press on the link to an Epub file, choose to save to device, and then open it using <a href="https://fbreader.org/" target="_blank">FBreader</a>.</p>

<p>To share the library from your GNU/Linux server, you'll have to install Calibre on the server and then put a copy of your ebook Library on the server as well. To start and stop the server daemon, you need to put a service startup script in the <code>/etc/init.d</code> directory with all of the other system startup scripts. An example is given below&mdash;fill in with the appropriate paths and user data for your setup. (See the <a href="https://manual.calibre-ebook.com/generated/en/calibre-server.html" target="_blank">calibre-server user manual</a> for a full list of options and their descriptions.) When the script is in place and has executable permissions, you start and stop the service as follows (as root):</p>

<pre>
service calibre-server start|stop|restart
</pre>

<h2>Service Startup Script</h2>

<pre>
#!/bin/bash

CALIBRE_LIBRARY_PATH=&quot;/path/to/CalibreLibrary&quot;
PIDFILE=/tmp/calibre-server.pid
USER=&lt;run_as_user&gt;        # run daemon as this user
LOGIN=&lt;end_user_username&gt; # to log into library (optional)
PW=&lt;password&gt;             # to log into library (optional)
PORT=3456

start() {
        echo &quot;Starting Calibre server...&quot;
        su -c &quot;calibre-server --with-library=\&quot;$CALIBRE_LIBRARY_PATH\&quot; --username=$LOGIN --password=$PW -p $PORT --pidfile=$PIDFILE --daemonize&quot; &amp; 
        if [ $? -ne 0 ]; then
                echo &quot;Could not start calibre-server.&quot;
        fi
}

stop() {
        echo &quot;Stopping Calibre server...&quot;
        if [ -e $PIDFILE ]; then
                read PID &lt; $PIDFILE
                ps aux | grep &quot;$PID&quot; | grep 'calibre-server' &gt; /dev/null
                RUNNING=$?
                if [ $RUNNING -eq 0 ]; then
                        kill $PID
                        if [ $? -eq 0 ]; then
                                rm $PIDFILE
                        fi
                else
                        echo &quot;Could not find a calibre-server process with PID $PID.&quot;
                fi
        else
                echo &quot;Could not find pidfile: $PIDFILE&quot;
        fi
}

restart() {
        stop
        start
}

status() {
        if [ -e $PIDFILE ]; then
                read PID &lt; $PIDFILE
                echo &quot;calibre-server is running with PID $PID.&quot;
        else
                echo &quot;calibre-server is not running.&quot;
        fi
}

unknown() {
        echo &quot;Unrecognized command: $1&quot;
        echo &quot;Try one of the following: (start|stop|restart|status)&quot;
}

case $1 in
        start ) 
                start
                ;;
        stop )
                stop
                ;;
        restart )
                restart
                ;;
        status )
                status
                ;;
        * )
                unknown
                ;;
esac
</pre>


<h2>Links</h2>

<ul>
	<li><a href="https://calibre-ebook.com/" target="_blank">Calibre</a> ebook Management Software</li>
	<li><a href="https://www.appstafarian.com/marvin.html" target="_blank">Marvin</a> ebook app for iOS</li>
	<li><a href="https://fbreader.org/" target="_blank">FBreader</a> open-source multi-platform ebook reader.</li>
</ul>