I wanted to get some automation working on my NAS at home, and I needed to install Python. Being an ARM-powered model, it was traditionally hard to get compatible binaries from sources like APT, so I’d previously used the add-on found at ReadyNASExtras. This time, I ran into issues with some dependencies. I couldn’t install and compile all of the Python modules that I needed, so I was required to compile Python from source.
My original goal: write a Python script to transform a gnarly HTML listing of available downloads into a nice clean RSS feed for FlexGet to consume.
FlexGet is an awesome tool that can be used to automate the downloading of files. It’s great, as it tracks which URLs it has seen before, and won’t download the same file twice. There are also lots of other plugins. It is often used for nefarious purposes, to download torrents from an XML feed and pass the torrent file on to a BitTorrent client.
My first-ever Python script turned out great. I used a combination of the following Python modules:
- Requests – to scrape the HTML
- BeautifulSoup – to parse the HTML, and make it easy to pull out the data I was after
- Feedgen – to build a compliant XML RSS Podcast feed file
I won’t post the code, as the site I’m scraping is a private subscription site that I’ve paid for access to, so most of the code isn’t really relevant for re-use. I may write another blog post in the near future that re-uses this concept against a publicly-accessible site.
Here’s my braindump of how I compiled and installed Python on my ReadyNAS, along with some extra bits and pieces.
- Enable SSH by installing this ReadyNAS add-on(http://www.downloads.netgear.com/files/ReadyNAS/ADDON/4.2(X86)/EnableRootSSH_1.0-arm.bin)
- Use Putty or similar to SSH into the NAS
- apt-get install build-essential libsqlite3-dev zlib1g-dev libncurses5-dev libgdbm-dev libbz2-dev libreadline5-dev libssl-dev libdb-dev
- wget https://www.python.org/ftp/python/2.7.10/Python-2.7.10.tgz
- tar zxvf Python-2.7.10.tgz
- cd Python-2.7.10
- ./configure –prefix=/usr –enable-shared –build=sparc-linux
- make
- make install
- wget https://bootstrap.pypa.io/get-pip.py –no-check-certificate
- wget http://peak.telecommunity.com/dist/ez_setup.py
- python ez_setup.py
The remainder of the below steps aren’t required unless you want to use the additional modules:
- easy_install requests
- easy_install beautifulsoup4
- apt-get install libxml2-dev
- apt-get install libxslt-dev
- easy_install lxml
- easy_install feedgen
- easy_install functools32
- easy_install flexget
(This broke easy_install. I had to re-run #11 to get it working again) - apt-get autoremove
Any ideas how to install the new .net core to a readynas 102
LikeLike
Sorry, not sure. I’ve never looked into it.
LikeLike
Thank you for sharing this.
I tried on my Readynas v2 Duo, I can’t pass the step 9 (make install) because of error messages:
[Errno 28] No space left on device
I checked but I have enough space on my disk.
Do you have an idea about this ?
LikeLike
Nevermind, I had too many files on my disk and no more inode free.
LikeLike
Debian Squeeze is end of life.
To continue to use unsupported packages you’ll need to point apt-get to a different repository.
Edit /etc/apt/sources.list, comment out all the lines with a preceding # and add the following line:
deb http://archive.debian.org/debian/ squeeze contrib main non-free
This will allow you access to the last released version of Squeeze from the Debian archive site.
LikeLike