Sunday, May 27, 2012

Installing Octopress on CentOS 6/RedHat/Scientific Linux

Official Octopress website have user-specific installation procedure prone to many errors due to 'rvm' and 'rbenv'. This is the mostly foolproof method to set-up Octopress correctly on Redhat based distros.

Run these as root:
# yum groupinstall 'Development Tools'
# yum install readline-devel zlib zlib-devel openssl openssl-devel libyaml git python-setuptools
# easy_install Pygments
Pygments is not necessary as it uses pygments.rb. (Thanks to @octopress)

Now, run these as normal user:
$ wget http://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.2-p320.zip
$ unzip ruby-1.9.2-p320.zip 
$ cd ruby-1.9.2-p320
$ ./configure --prefix=/usr --with-openssl-include=/usr/include/openssl --with-openssl-lib=/usr/lib64/openssl/engines --disable-option-checking --disable-pthread
$ make
If you are using 32-bit, then replace '--with-openssl-lib=/usr/lib64/openssl/engines' to '--with-openssl-lib=/usr/lib/openssl/engines'.

Again, run these as root:
# make install
Again, run these as normal user:
$ git clone git://github.com/imathis/octopress.git octopress
$ cd octopress
Now, as root:
# gem install bundler
# bundle install
# rake install
Lastly, as normal user:
$ rake install
Now, follow Configuring Octopress. That's it. You have installed Octopress on your system. Leak: I will soon be moving this blog to Octopress and will be hosting it on GAE.

Saturday, May 26, 2012

Better fonts in Chrome For Linux

Make a file .fonts.conf in your home directory and add this to it:
<match target="font">
  <edit name="autohint" mode="assign">
      <bool>true</bool>
    </edit>
    <edit name="hinting" mode="assign">
      <bool>true</bool>
    </edit>
    <edit mode="assign" name="hintstyle">
      <const>hintslight</const>
   </edit>
</match>
Now, restart Chrome to see the changes.

Install Java Browser plugin for Firefox 64-Bit in CentOS/Redhat

Download the latest 64-bit RPM package from main Java homepage. Install it as:
rpm -ivh <package-name>.rpm
And, add the plugin to Firefox with:
# cd /usr/lib64/mozilla/plugins
# ln -s $(find / -mount -name libnpjp2.so)
If 'ln -s $(find / -mount -name libnpjp2.so)' fails, then, first find the file 'libnpjp2.so' and supply the path as:
# ln -s <path-to-libnpjp2.so>

Restart your browser and you will have the working Java plugin for Firefox.

Install Log.io on CentOS

Searching for a simple online log viewer, I found log.io. Documentation has a recipe to install log.io on Ubuntu 11.10 but it doesn't match uniformly for CentOS. Seems like many things are hard-coded. So, I began to hack into it to make it working and I succeeded.

Installation Procedure:
# yum install gcc make openssl-devel git
# mkdir ~/downloads 
# cd downloads 
# wget "http://nodejs.org/dist/v0.6.11/node-v0.6.11.tar.gz" 
# tar -xzvf node-v0.6.11.tar.gz
# cd node-v0.6.11/ 
# ./configure
If it complains about missing libraries or anything else and doesn't succeeds, install the required libraries using Yum.
# make
# make install
# ln -s /usr/local/bin/node /usr/local/bin/nodejs
# wget http://npmjs.org/install.sh
# chmod +x install.sh
# ./install.sh
# PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin
# rm -f /usr/bin/npm
# ln -s /usr/local/bin/npm /usr/bin/npm
# useradd -d /home/logio logio
# usermod -G adm logio
# npm config set unsafe-perm true
# npm install -g --prefix=/usr/local git://github.com/NarrativeScience/Log.io.git
# chmod -R 777 /var/log/log.io/

It's done. Now, start the server using:
# log.io server start

The server is now started. Allow access to port 8993 as:
# iptables -A INPUT -p tcp --dport 8993 -j ACCEPT

Hurray!. Head over to http://:8993 and see the power of nodejs.
Similarly, install Log.io on another machine and start the harvester with:
# log.io harvester start
Tested on CentOS 6.