Webserver and database combination on Raspberry Pi
My normal combination on the big-server side would be Apache + MySQL (or PostgreSQL), but on the RPi this seems to be absolute overkill. For data-logging operations I would not use the local system anyway (looking at MQTT as well as Remote MongoDB datastore via REST Webservices).
After some poking around and reading up on the options I decided to go for the following combo: LightHTTPD + SQLite. Both are lightweight replacement of their fully-featured big-server counterparts (Apache HTTP & MySQL) and have very familiar configurations. There would be other options that have even less resource usage, but I really don’t have the time to start from scratch somewhere.
Chromebook tips to get started
Just got myself (actually it’s for our Office Manager back in OZ) one of these Chromebooks while in Europe (since Google Australia with their absolutely hopeless hardware strategy do not seem to be able to ship any devices – Nexus 4 anyone ?) .
Since the first days turned out to be a bit of a frustrating experience, I thought I share some of the findings as I had a hard time finding much useful info on troubleshooting ChromeOS.
Raspberry Pi - Raspbian post install tasks
The Raspbian Install process is fairly well documented using the Raspbian Installer. This is just to document common tasks after the stock install.
Install base utils
apt-get install sudo vim ntpdate git-core binutils make gcc ca-certificates rpi-update
Allow non-root user account access to ‘sudo’
adduser USERNAME sudo
For those Ubuntu users there is no ‘admin’ group in Raspbian (Debian Wheezy).
NTP time update
sudo rm /etc/localtime
sudo ln -s /usr/share/zoneinfo/Australia/Adelaide /etc/localtime
sudo ntpdate -u au.pool.ntp.org
Probably best to choose an NTP Server closest to your location or provided by your ISP
Mongodb / Python development install on Ubuntu
Add apt repository key
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv 7F0CEB10
Add apt repository
sudo vim /etc/apt/sources.list.d/10gen.list
#add the following line:
deb http://downloads-distro.mongodb.org/repo/ubuntu-upstart dist 10gen
Install mongodb & python utils
sudo apt-get update
sudo apt-get install mongodb-10gen python-pip python-dev build-essential
pip install pymongo
Accessing 1-wire devices on Raspberry Pi using OWFS
To connect 1-wire serial devices to the RPi I am using a DS9490R USB 1-wire adapter (rather than wiring I2C 1-Wire master components to GPIO I2C – which I might look at sometime down the track)
Install packages
sudo apt-get install owfs ow-shell
Edit config file
vim /etc/owfs.conf
! server: server = localhost:4304
# USB device: DS9490
server: usb = all
######################### OWFS ##########################
mountpoint = /mnt/1wire
allow_other
####################### OWHTTPD #########################
http: port = 2121
####################### OWFTPD ##########################
ftp: port = 2120
####################### OWSERVER ########################
server: port = localhost:4304
Create Startup Script
I created a startup script for owfs modelled on the owserver script (not sure why this one is actually missing)
Installing OMXPlayer on Raspberry Pi
Since I didn’t have any luck playing videos on the RPi using mplayer I found omxplayer after some search. It has the ability to use the RPi’s GPU thus taking some load of the CPU.
UPDATE 2013-04-01: omxplayer is now included in the Raspbian (Debian Wheezy) repositories and can be simply installed by one line.
sudo apt-get install omxplayer
Check another article on how to install Raspbian.
Raspberry Pi - Text to Speech
Just a quick note on Speech Synthesis a Raspberry Pi project. I had to research some of the options on the Raspberry Pi while looking into a project where I need some audio announcements.
Configuring Sound
echo 'snd-bcm2835' >> /etc/modules
sudo modprobe snd-bcm2835
sudo apt-get install mplayer alsa-base alsa-utils pulseaudio mpg123
# make mplayer use mpg123 codec instead of default ffmp3float
echo "afm=mp3lib" >> ~/.mplayer/config
Since I am using Raspbian which is a Debian based (Wheezy) Distribution I used some Ubuntu documentation (https://help.ubuntu.com/community/TextToSpeech) as the starting point.
Creating Twitter Archives
One of the more common uses of Twitter for me is to monitor “back-channels” at events (often events I can attend, but more often these days events I am unable to attend).
Unfortunately Twitter’s search capabilities cease to be useful after a little while and so it is very handy to be able to create an archive for the events ‘hashtag’. There used to be a number of tools in the early days, but mainly because of Twitter’s changes to policies and very unfortunate morphing into a closed ‘media-publishing’ platform, the developers of such tools were forced to discontinue their services.
Enable GeoIP lookups on CentOS
GeoIP enables you to identify the location, organization, connection speed, and user type of your website visitors.
yum install GeoIP mod_geoip
cd /usr/share/GeoIP/
wget http://geolite.maxmind.com/download/geoip/database/GeoLiteCountry/GeoIP.dat.gz
wget http://geolite.maxmind.com/download/geoip/database/GeoLiteCity.dat.gz
gunzip GeoIP.dat.gz
gunzip GeoLiteCity.dat.gz
rm -f *.gz
Edit the VirtualHost settings in httpd.conf
<ifmodule mod_geoip.c>
GeoIPEnable On
GeoIPDBFile /usr/share/GeoIP/GeoIP.dat Standard
GeoIPDBFile /usr/share/GeoLiteCity.dat Standard
</ifmodule>
Restart Apache
/etc/init.d/httpd restart
Accessing Amazon RDS from Desktop
Every once in a while it is handy to be able to access an Amazon RDS Database Instance remotely from a desktop.
ssh -i <strong>YOUR-AMAZON-PRIVATE-KEY</strong>.pem -l <strong>YOUR-AMAZON-RDS-USERNAME</strong> -L 33060:<strong>YOUR-AMAZON-RDS-PRIVATE-IPADDRESS</strong>:3306 -N ec2-usr@<strong>YOUR-AMAZON-EC2-INSTANCE-PUBLIC-ADDRESS</strong>
Note: YOURAMAZONRDSPRIVATEIPADDRESS needs to be the AWS internal RDS IP Address – not the external hostname
You can then connect to RDS using mysql commands or any GUI tool such as MySQL Workbench via localhost:33060
Thanks to: Dirk Taggesell via AWS Forums
Offline RSS Reading on Ubuntu
I sometimes have time to read RSS feeds when I have no Internet connection. Granted this is happening less often these days with wireless connectivity pretty much ubiquitous, but I frequently have that need. Most often it’s in an air-plane when you want to catch up on non-essential news and don’t have any connectivity.
This is where Lightread comes in handy. It synchronizes your Google Reader Account with excellent integration into the Ubuntu UI (desktop notification of new items …).
CoffeeScript on Ubuntu 12.04
Installing CoffeeScript on Ubuntu 12.04 is a complete no-brainer by the looks of it (since both node.js Core as well as Node Package Manager are in the Ubuntu repos).
sudo apt-get install nodejs npm
sudo npm install -g coffee-script
To check the installation
coffee -v
Just as a reminder for myself & in case it helps somebody …