Register Guidelines E-Books Search Today's Posts Mark Forums Read

Go Back   MobileRead Forums > E-Book Software > Calibre > Related Tools

Notices

Reply
 
Thread Tools Search this Thread
Old 09-18-2011, 05:42 AM   #1
aruangra
Connoisseur
aruangra has learned how to read e-booksaruangra has learned how to read e-booksaruangra has learned how to read e-booksaruangra has learned how to read e-booksaruangra has learned how to read e-booksaruangra has learned how to read e-booksaruangra has learned how to read e-books
 
Posts: 83
Karma: 888
Join Date: May 2010
Device: Nook Touch, iPad1, iPad2, iPod Touch 4G, Pixel Qi
[HOW TO] Install Calibre in Intel-Based NAS

I think I should write up the instruction for installing Calibre on Intel-based NAS. Please refer to the following instruction. If you have any question, please let me know.

Best regards,
Anat Ruangrassamee

--------------------------------------------------------------------------------
How to install Calibre in Intel-Based NAS
18 September 2011

I successfully install Calibre on a Synology DS411+II NAS to run news fetching and the content server. I tried to compile libc but had several problems. The key to the success is “Debian 6 chroot environment”. This instruction may work for other Intel-based NASes for example QNAP.

NOTE: The instruction for the ARM-based NAS was added by smintman in the following posts.

Prerequisite
Bootstrapped NAS
For Synology, refer to
http://forum.synology.com/wiki/index...trap,_ipkg_etc
http://forum.synology.com/wiki/index...tall_Bootstrap

Steps
1. Preparing chroot environment on a PC
I followed the instruction in the following websites with slight modifications to create Debian 6.0.0 packages for i386 targets which is required by Calibre
http://kristof.vanhertum.be/?p=132
http://www.nslu2-linux.org/wiki/DS101/Debian

Code:
debootstrap --foreign --arch i386 squeeze chroottarget "http://ftp.de.debian.org/debian"
You may skip this step by simply downloading my chroot target file for the i386 architecture:
http://www.mediafire.com/?dbjgsc8v7u1dxps

2. Setup the chroot environment in your NAS
2.1 Copy the chroot target to a HDD in your NAS (/volume1/debian/ in this instruction) by any approach (FTP, NFS,etc). From now, you should use a terminal program to execute commands.
2.2 At the directory /volume1/debian/, uncompress the chroot target file using this command (Note: Don’t type # and anything in front of #)
Code:
ds # tar -xvf chroottarget.tar.gz
2.3 At the directory /volume1/debian/, finish debootstrap second stage on the target platform by using this command:
Code:
ds # chroot chroottarget /debootstrap/debootstrap --second-stage
2.4 Copy the file /etc/resolv.conf and /etc/hostname of your NAS to your chroot environment
Code:
ds # cp /etc/resolv.conf  /volume1/debian/chroottarget/etc/
ds # cp /etc/hostname /volume1/debian/chroottarget/etc/
3. Start up the chroot environment. Note that when you reboot your NAS, you need to run the following commands to start up the chroot environment.
At the directory /volume1/debian/, input this command:
Code:
ds # chroot chroottarget /bin/bash
The command prompt will be changed to chroot (for example “ds-chroot #”). Then input this command to mount “proc”
Code:
ds-chroot # mount -t proc proc /proc
4. Update apt-get and install some dependencies and programs.
Code:
ds-chroot# echo "deb ftp://ftp.debian.org/debian stable main contrib non-free" > /etc/apt/sources.list
ds-chroot# apt-get update
Then install dependencies for Calibre. This will install Calibre 0.7.7. Note that Calibre does not work in this step. This command is used only for getting necessary dependencies.
Code:
ds-chroot# apt-get install calibre 
ds-chroot# apt-get install python
ds-chroot# apt-get install bzip2
ds-chroot# apt-get install unzip
5. Install Calibre
5.1 Make the directory “calibre” in the directory “/opt”
5.2 Download Calibre from http://sourceforge.net/projects/calibre/files/ . You may use the newest version for i686 (I use Calibre 0.8.15 on my NAS.). You can download the file to your PC and then copy to /volume1/debian/chroottarget/opt/calibre. Then uncompress the file in the directory /opt/calibre
Code:
ds-chroot# bzip2 -dv calibre-0.8.15-i686.tar.bz2
Now, you have all program files in the directory /opt/calibre. Congratulations! Calibre should work now

6. Use Calibre
6.1 The recipes are in /opt/calibre/resources/ builtin_recipes.zip. Unzip the file and move the recipe you want to /opt/calibre
6.2 Make a directory “serve” in /opt/calibre for storing ebooks.
6.3 Run the content server by this command
Code:
/opt/calibre/calibre-server --with-library /opt/calibre/serve/ --port 8081 –-daemonize
6.4 Get news and update the database by this command
Code:
/opt/calibre/ebook-convert /opt/calibre/***.recipe /opt/calibre/***.epub
/opt/calibre/calibredb add --duplicates --with-library /opt/calibre/serve/ /opt/calibre/***.epub
7. Schedule news fetching
I use APScheduler 2.0.2 for python. Follow the instruction in this website:
http://pypi.python.org/pypi/APScheduler/
This is my script (script.py):

Code:
import os
import time
from apscheduler.scheduler import Scheduler

# Start the scheduler
sched = Scheduler()
sched.start()

def job_function1():
	os.system("/opt/calibre/ebook-convert /opt/calibre/cnn.recipe /opt/calibre/cnn.epub")
	os.system("/opt/calibre/calibredb add --duplicates --with-library /opt/calibre/serve/ /opt/calibre/cnn.epub")

	os.system('/opt/calibre/ebook-convert /opt/calibre/cnn.recipe /opt/calibre/cnn.mobi')
	os.system('/opt/calibre/calibre-smtp -r smtp.gmail.com -v --port 587 --username XXXXX@gmail.com --password YYYYY --a /opt/calibre/cnn.mobi --s "News Delivery" XXXXX@gmail.com ZZZZZ@free.kindle.com ""')

# Schedule
sched.add_cron_job(job_function1, day_of_week='mon-sun', hour=4, minute=0)

while True:
    time.sleep(10)
The last two lines will keep the script alive. To run the script in background, use this command:
Code:
nohup python script.py &
8. When rebooting the NAS, input the following commands to start up the scheduling script and the content server:
Code:
cd /volume1/debian/
chroot chroottarget /bin/bash
mount -t proc proc /proc
cd opt/calibre/
/opt/calibre/calibre-server --with-library /opt/calibre/serve/ --port 8081 --daemonize
nohup python script.py &

Last edited by aruangra; 09-22-2011 at 10:45 PM.
aruangra is offline   Reply With Quote
Old 09-18-2011, 06:21 AM   #2
bthoven
Evangelist
bthoven will become famous soon enoughbthoven will become famous soon enoughbthoven will become famous soon enoughbthoven will become famous soon enoughbthoven will become famous soon enoughbthoven will become famous soon enough
 
bthoven's Avatar
 
Posts: 475
Karma: 590
Join Date: Aug 2009
Location: Bangkok, Thailand
Device: Kindle Paperwhite
Great and very clear instruction.

Last edited by bthoven; 09-18-2011 at 06:28 AM.
bthoven is offline   Reply With Quote
Advert
Old 09-20-2011, 04:09 PM   #3
smintman
Junior Member
smintman began at the beginning.
 
Posts: 5
Karma: 10
Join Date: Sep 2011
Device: Kindle3
Modification for ARM based NAS (Synology DS211j)

After one day of experimenting.

Step 1. I installed debian on VirtualPC. I followed instructions in to create Debian 6.0.0 packages for armel target
http://kristof.vanhertum.be/?p=132 with small change
debootstrap --foreign --arch armel lenny chroottarget "http://ftp.de.debian.org/debian"

Step 4. I installed calibre with apt-get, but later I removed it.

Step 5. I used Source install from
http://calibre-ebook.com/download_linux, becouse there is no binaries for ARM architecture. After instalation of all packages and succesfull compiling - calibre is working .

Thanks aruangra.

Last edited by smintman; 09-20-2011 at 04:12 PM.
smintman is offline   Reply With Quote
Old 09-20-2011, 09:02 PM   #4
aruangra
Connoisseur
aruangra has learned how to read e-booksaruangra has learned how to read e-booksaruangra has learned how to read e-booksaruangra has learned how to read e-booksaruangra has learned how to read e-booksaruangra has learned how to read e-booksaruangra has learned how to read e-books
 
Posts: 83
Karma: 888
Join Date: May 2010
Device: Nook Touch, iPad1, iPad2, iPod Touch 4G, Pixel Qi
smintman,

Good to hear that it works.

1. To make the debian 6.0.0 package, we must specify "squeeze" instead of "lenny"
debootstrap --foreign --arch armel squeeze chroottarget "http://ftp.de.debian.org/debian"
Am I correct?

2. I am interested to know how you compile the source. Could you please elaborate more?
For example...What is the command for compiling ? What dependencies do you need to install before compiling? and How?

3. Does Calibre in your 211j work for both fetching news and serving contents as a webserver ?

I have several ARM-based PCs lying around. So, it would be useful if I can run calibre on it.

Last edited by aruangra; 09-20-2011 at 10:28 PM.
aruangra is offline   Reply With Quote
Old 09-21-2011, 07:14 AM   #5
smintman
Junior Member
smintman began at the beginning.
 
Posts: 5
Karma: 10
Join Date: Sep 2011
Device: Kindle3
Quote:
Originally Posted by aruangra View Post
smintman,

Good to hear that it works.

1. To make the debian 6.0.0 package, we must specify "squeeze" instead of "lenny"
debootstrap --foreign --arch armel squeeze chroottarget "http://ftp.de.debian.org/debian"
Am I correct?

2. I am interested to know how you compile the source. Could you please elaborate more?
For example...What is the command for compiling ? What dependencies do you need to install before compiling? and How?

3. Does Calibre in your 211j work for both fetching news and serving contents as a webserver ?

I have several ARM-based PCs lying around. So, it would be useful if I can run calibre on it.

Ad1.
It was my first attempt with linux . Sorry, I don't know difference between lenny and squeeze. I used lenny, I changed only parameter --arch to armel, I thought it was mistake on that page. I have no problem with it.

Ad2.
With compiling it was bigger problem . Maybe becouse I did it for a first time. I tried to use your procedure, but in step 5 I was lost. I tried binary images, but they didn't work. Somewhere I found answer from kovid that there is no binary of calibre for ARM, so you must compile it.
So I tried procedure Source install from http://calibre-ebook.com/download_linux.
1. One problem was with python, i didn't have version 2.7.1.
I followed instructions on page http://www.gossamer-threads.com/list.../python/918238. I added "deb http://ftp.uk.debian.org/debian/ unstable main contrib non-free" to #/etc/apt/sources.list and installed python2.7.
2. I thought, that I have all dependencies, so I continued.
3.
Code:
wget -O- http://status.calibre-ebook.com/dist/src | tar xvz
Sources was downloaded.
4. I entered
Code:
python2.7 setup.py install
maybe 20 times. There was always some kind of error message that i googled and tried to solve. Most of them was missing dependencies. so I installed missing packages. I used frequently page www.debian.org, where I found missing package. I installed package with
Code:
apt-get install xxxxxxx
until it ends with no error. It ended with creating of calibre commands in /usr/bin/ directory.
5. Everything was compiled, I had calibre commands and I thought that I finished, but it didn't work when I tried to start calibre server. Error was "no such file python2:" And answer from google:
Code:
ln -s /usr/bin/python2.7 /usr/bin/python2
.

Ad 3.
I tried to fetch news as test.
Code:
ebook-convert /opt/calibre/recipes/dilbert.recipe /opt/calibre/serve/dilbert.mobi --output-profile kindle
It works and create also nice same new kindle periodical as windows version of calibre.
After it I tried to add it to server and start.
Code:
calibredb add --duplicates --with-library /opt/calibre/serve/ /opt/calibre/serve/dilbert.mobi
calibre-server --with-library /opt/calibre/serve/ --port 8081 daemonize
And it worked. I downloaded ebook from browser http://diskstation:8081 and opened it in KindleForPC.
Scheduling and mailing is also working, there is only one little problem, that in scheduling system there is UTC time, that is probably from debian setup.

So it was hard for me, because I had no experience with linux,debian,arm till this week, I didn't understand most of things that I did and some steps may be obsolete or funny for linux geeks. But big my thanks goes to google and kovid for calibre. So if it can be done easier, let me know.
Today I will try to setup scheduler, based on your step 7.

Last edited by smintman; 09-23-2011 at 04:09 AM.
smintman is offline   Reply With Quote
Advert
Old 09-21-2011, 07:53 AM   #6
aruangra
Connoisseur
aruangra has learned how to read e-booksaruangra has learned how to read e-booksaruangra has learned how to read e-booksaruangra has learned how to read e-booksaruangra has learned how to read e-booksaruangra has learned how to read e-booksaruangra has learned how to read e-books
 
Posts: 83
Karma: 888
Join Date: May 2010
Device: Nook Touch, iPad1, iPad2, iPod Touch 4G, Pixel Qi
smintman,

Thanks for your clear answer. I will try it on my ARM PC tonight. I am also very new to Linux and google helps a lot

Regards,
aruangra
aruangra is offline   Reply With Quote
Old 09-22-2011, 07:40 PM   #7
aruangra
Connoisseur
aruangra has learned how to read e-booksaruangra has learned how to read e-booksaruangra has learned how to read e-booksaruangra has learned how to read e-booksaruangra has learned how to read e-booksaruangra has learned how to read e-booksaruangra has learned how to read e-books
 
Posts: 83
Karma: 888
Join Date: May 2010
Device: Nook Touch, iPad1, iPad2, iPod Touch 4G, Pixel Qi
I am compiling Calibre on my ARM-based pc and got this error. I have both "python-qt4" and python-qt4-dev" packages installed before compiling.

Code:
root@localhost:/opt/calibre# python2.7 setup.py install
Traceback (most recent call last):
  File "setup.py", line 13, in <module>
    import setup.commands as commands
  File "/opt/calibre/setup/commands.py", line 34, in <module>
    from setup.extensions import Build, BuildPDF2XML
  File "/opt/calibre/setup/extensions.py", line 12, in <module>
    from PyQt4.pyqtconfig import QtGuiModuleMakefile
ImportError: No module named PyQt4.pyqtconfig
root@localhost:/opt/calibre#
Please advice. Thank you.
aruangra is offline   Reply With Quote
Old 09-23-2011, 04:25 AM   #8
smintman
Junior Member
smintman began at the beginning.
 
Posts: 5
Karma: 10
Join Date: Sep 2011
Device: Kindle3
Quote:
Originally Posted by aruangra View Post
I am compiling Calibre on my ARM-based pc and got this error. I have both "python-qt4" and python-qt4-dev" packages installed before compiling.

Code:
root@localhost:/opt/calibre# python2.7 setup.py install
Traceback (most recent call last):
  File "setup.py", line 13, in <module>
    import setup.commands as commands
  File "/opt/calibre/setup/commands.py", line 34, in <module>
    from setup.extensions import Build, BuildPDF2XML
  File "/opt/calibre/setup/extensions.py", line 12, in <module>
    from PyQt4.pyqtconfig import QtGuiModuleMakefile
ImportError: No module named PyQt4.pyqtconfig
root@localhost:/opt/calibre#
Please advice. Thank you.
I looked to my browser history and I found this page . Try to install "qt4-qmake". Maybe there is some command, that print all installed packages, I will try to list them later evening. When I tried to complile, i didnt write anything, it was pure experiment with happy end.
Attached Files
File Type: txt modules.txt (58.4 KB, 710 views)

Last edited by smintman; 09-24-2011 at 02:27 AM.
smintman is offline   Reply With Quote
Old 09-25-2011, 06:46 AM   #9
aruangra
Connoisseur
aruangra has learned how to read e-booksaruangra has learned how to read e-booksaruangra has learned how to read e-booksaruangra has learned how to read e-booksaruangra has learned how to read e-booksaruangra has learned how to read e-booksaruangra has learned how to read e-books
 
Posts: 83
Karma: 888
Join Date: May 2010
Device: Nook Touch, iPad1, iPad2, iPod Touch 4G, Pixel Qi
smintman,

Thank you for the list. Calibre 0.7.7 that came with Debian 6.0.0 works well. So, I didn't try to compile the new version.

Best regards,
Anat
aruangra is offline   Reply With Quote
Old 01-19-2013, 10:49 PM   #10
carlyman
Junior Member
carlyman began at the beginning.
 
Posts: 5
Karma: 10
Join Date: Oct 2010
Device: Kindle 3
Was able to get through it all, but get the following error when I finally try to run calibre. Seems it might be a GLIBC version issue; any ideas? ...would an earlier version of calibre work better (I pulled the latest 0.9.15)?

Code:
WARNING: Failed to set default libc locale, using en_US.UTF-8
Traceback (most recent call last):
  File "site.py", line 53, in main
  File "site.py", line 13, in set_default_encoding
  File "locale.py", line 539, in setlocale
Error: unsupported locale setting
carlyman is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Calibre on Qnap NAS TS419P 2012 Related Tools 6 10-04-2016 01:28 PM
Error when running on Atom D525-based DS411+II NAS server aruangra Related Tools 15 09-19-2011 03:15 AM
Calibre Content server and Iomega NAS subivan Devices 9 08-12-2011 05:26 PM
Using Calibre on a NAS Shawn_KY Calibre 9 01-07-2011 01:24 AM
Calibre hangs on startup after moving to NAS smartin Calibre 4 09-26-2010 04:21 PM


All times are GMT -4. The time now is 06:45 AM.


MobileRead.com is a privately owned, operated and funded community.