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<br></br>sudo ln -s /usr/share/zoneinfo/Australia/Adelaide /etc/localtime<br></br>sudo ntpdate -u au.pool.ntp.org
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<br></br>#add the following line:<br></br>deb http://downloads-distro.mongodb.org/repo/ubuntu-upstart dist 10gen<br></br>
Install mongodb & python utils
sudo apt-get update<br></br>sudo apt-get install mongodb-10gen python-pip python-dev build-essential<br></br>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<br></br># USB device: DS9490<br></br>server: usb = all<br></br>######################### OWFS ##########################<br></br>mountpoint = /mnt/1wire<br></br>allow_other<br></br>####################### OWHTTPD #########################<br></br>http: port = 2121<br></br>####################### OWFTPD ##########################<br></br>ftp: port = 2120<br></br>####################### OWSERVER ########################<br></br>server: port = localhost:4304
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<br></br>sudo modprobe snd-bcm2835
sudo apt-get install mplayer alsa-base alsa-utils pulseaudio mpg123<br></br># make mplayer use mpg123 codec instead of default ffmp3float<br></br>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<br></br>cd /usr/share/GeoIP/<br></br>wget http://geolite.maxmind.com/download/geoip/database/GeoLiteCountry/GeoIP.dat.gz<br></br>wget http://geolite.maxmind.com/download/geoip/database/GeoLiteCity.dat.gz<br></br>gunzip GeoIP.dat.gz<br></br>gunzip GeoLiteCity.dat.gz<br></br>rm -f *.gz<br></br>
Edit the VirtualHost settings in httpd.conf
<ifmodule mod_geoip.c><br></br>GeoIPEnable On<br></br>GeoIPDBFile /usr/share/GeoIP/GeoIP.dat Standard<br></br>GeoIPDBFile /usr/share/GeoIP/GeoLiteCity.dat Standard<br></br></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
Wireshark install on Ubuntu 12.04
Just a short note on Wireshark install (needed to beat an Asterisk SIP install into submission)
sudo apt-get install wireshark<br></br>sudo useradd -U -M -s /bin/false wireshark<br></br>sudo chgrp wireshark /usr/bin/dumpcap<br></br>sudo chmod 754 /usr/bin/dumpcap<br></br>sudo setcap 'CAP_NET_RAW+eip CAP_NET_ADMIN+eip' /usr/bin/dumpcap<br></br>sudo gpasswd -a YOURUSERNAME wireshark
Source: http://wiki.wireshark.org/CaptureSetup/CapturePrivileges
Organisational micro-blogging for all
Having seen more and more articles on the use of micro-blogging tools in educational and corporates settings, I am constantly surprised that one of the most useful options from my point-of-view seems to be constantly overlooked. Micro-blogging is like Twitter, but private to your organisation. It is a great way to capture those more informal internal discussions. It can help distribute useful information (such as links) throughout your organisation or help kick-start conversations.