Install Diaspora one Centos 6.4 with Apache

So Im going to test diaspora on one of my virtual server with run centos 6.4.

Setup Centos

Setup Repos

rpm -Uvh remi-release-6*.rpm epel-release-6*.rpm"

Install packages

yum install tar make automake gcc gcc-c++ git net-tools libcurl-devel libxml2-devel libffi-devel libxslt-devel tcl redis ImageMagick npm mysql-server mysql-devel httpd mod_ssl libyaml libyaml-devel patch readline-devel libtool bison

Start services

chkconfig --level 3 httpd on
chkconfig --level 3 mysqld on
chkconfig --level 3 redis on


service mysqld start
service httpd start
service redis start


Install Diaspora

adduser diaspora
su diaspora

Install ruby

\curl -L | bash -s stable
source /home/diaspora/.rvm/scripts/rvm
 rvm autolibs read-only
rvm install 1.9.3-p448
git clone -b master git://
cd diaspora <-- press y

Configure Mysql

Run this in mysql

Create database diaspora;
CREATE USER 'diaspora'@'localhost' IDENTIFIED BY 'some_pass@diaspora';
GRANT ALL PRIVILEGES ON diaspora.* TO 'diaspora'@'localhost';


Configure Diaspora


cp config/diaspora.yml.example config/diaspora.yml
cp config/database.yml.example config/database.yml

Set up your mysql settings in configure/diaspora.yml

Set up the diaspora.yml with you settings. This is the settings I enabled

url: ""
certificate_authorities: '/etc/pki/tls/certs/ca-bundle.crt'
rails_environment: 'production'
database: 'mysql'
unicorn_worker: 2
pod_name: "Ztekarna"
enable_registrations: true
autofollow_on_join_user: ''
open: true
count: 25
suggest_email: ''
enable: true
sender_address: ''
method: 'smtp'
host: 'localhost'
 port: 25


Run diaspora setup

RAILS_ENV=production bundle install --without test development
RAILS_ENV=production bundle exec rake db:create db:schema:load

Start Diaspora


Setup Apache config

Use this config for setting up apache

I now for testing use the ssl keys in /etc/pki/tls but for production you should use sign keys.


No when diaspora is started you can visit your url and start using Diaspora


Starting diaspora then

install screen

yum install screen

Then to start diaspora run

su diaspora
source /home/diaspora/.rvm/scripts/rvm

More reading

Custom nagios plugins in python

For monitoring different service and function you may need to build some custom monitoring plugins. I have some build for nrpe and will work with both nagios and icinga.
This script will do and mysql check and then send the data back and also start graphing the data back if you use pnp4nagios 🙂

Every plugin must have two things.

1. an exit code thet will say the state of the plugin (OK.Critical,warning) <- this will generate the alerts

  • 1 = ok
  • 2= Critical
  • 3=Warnings
  • 4= unknown


2. Some text to abaout the plugin saying for exampel disk space.


Here below is my small script that will de some db qestions ans return the result to nagios. If the values return is under 0 then it will exit in state 2 and then nagios will alert.


#!/usr/bin/env python
#Mysql stats
#Get stats from mysql server
#then prints the stats to icinga to process
import MySQLdb
from datetime import date, timedelta
import datetime
import sys
def mysql_query(sql):
 run an mysql mysql_query
 con = None
 con = MySQLdb.Connection(mysqlhost, mysqluser,
 mysqlpass, mysqldb)
 curs = con.cursor()
 for value in curs:
 return back
 except MySQLdb.Error, e:
 print "Error in MYSQL {0} : {1}".format(e.args[0], e.args[1])
 if con:

#mysql to run on the mysql server
qery="""SELEC your own super mysql qery and the group by"""

#Send mysql to server
back =mysql_query(qery)

#Testing result and building string back to nagios
if back[0] <= 30:
 print "CRITICAL | 'value'="+str(back[0])+" 'value'="+str(back[1])
 print "OK: | 'value'="+str(back[0])+" 'value'="+str(back[1])

Rolling back Andrioid on your Nexus 4 after Ubuntu

So i had to roll back to andriod. ubunut is not realy ready for my phone.
So this is how you do.

1. download you andriod images from here

Download and untar in nice folder.

2. Connect with USB to phone and power it on (Booting to ubuntu is ok)


adb reboot-bootloader

This will make the phone go into boot image.


3. Install andriod

in the folder that the downloadin andriod image is in run

sudo ./


4. All Done

So now you have you phone back to running andriod. You can look down the boot images but i did not 🙂


2013-11-04 10.33.26
2013-11-04 10.37.16
2013-11-04 10.36.11