Monday, April 14, 2014

Installing HHVM 3.0.1 on Centos 6.5 (64-bit)

3.0.0 is the latest series in the HHVM world. In order to upgrade/install the 3.0.1 package. Follow these instructions

Compared to 2.4 HHVM release, the following packages were upgraded from the stock centos repository. Please be aware of these.

  1. ocaml (from 3.11 to 3.12)
  2. ImageMagick (from 6.5 to 6.8)

If you are here for the first time, configure hop5.in repo like this

 
cd /etc/yum.repos.d
sudo wget http://www.hop5.in/yum/el6/hop5.repo 
After that do a simple

[root@node1 ~]# yum clean all
Loaded plugins: fastestmirror
Cleaning repos: base elrepo epel extras hop5 mod-pagespeed nginx nikoforge pgdg92 rpmforge rpmforge-extras
              : rpmfusion-free-updates rpmfusion-nonfree-updates updates
Cleaning up Everything
Cleaning up list of fastest mirrors
 
[root@node1 ~]# yum install hhvm
Loaded plugins: fastestmirror
Determining fastest mirrors
epel/metalink                                                                                           |  14 kB     00:00
 * base: mirrors.advancedhosters.com
 * elrepo: ftp.nluug.nl
 * epel: epel.mirror.constant.com
 * extras: mirrors.lga7.us.voxel.net
 * rpmforge: mirror.nl.leaseweb.net
 * rpmforge-extras: mirror.nl.leaseweb.net
 * rpmfusion-free-updates: mirror.us.leaseweb.net
 * rpmfusion-nonfree-updates: mirror.us.leaseweb.net
 * updates: mirror.lug.udel.edu
base                                                                           | 3.7 kB     00:00
base/primary_db                                                                | 4.4 MB     00:01
elrepo                                                                         | 2.9 kB     00:00
elrepo/primary_db                                                              | 625 kB     00:00
epel                                                                           | 4.4 kB     00:00
epel/primary_db                                                                | 6.0 MB     00:01
extras                                                                         | 3.4 kB     00:00
extras/primary_db                                                              |  19 kB     00:00
hop5                                                                           | 2.9 kB     00:00
hop5/primary_db                                                                | 153 kB     00:00
mod-pagespeed                                                                  |  951 B     00:00
mod-pagespeed/primary                                                          | 5.1 kB     00:00
mod-pagespeed                                                                  32/32
nginx                                                                          | 2.9 kB     00:00
nginx/primary_db                                                               |  28 kB     00:00
nikoforge                                                                      | 1.3 kB     00:00
nikoforge/primary                                                              | 3.8 kB     00:00
nikoforge                                                                      8/8
pgdg92                                                                         | 3.7 kB     00:00
pgdg92/primary_db                                                              | 102 kB     00:00
rpmforge                                                                       | 1.9 kB     00:00
rpmforge/primary_db                                                            | 2.7 MB     00:00
rpmforge-extras                                                                | 1.9 kB     00:00
rpmforge-extras/primary_db                                                     | 471 kB     00:00
rpmfusion-free-updates                                                         | 2.7 kB     00:00
rpmfusion-free-updates/primary_db                                              | 267 kB     00:00
rpmfusion-nonfree-updates                                                      | 2.2 kB     00:00
rpmfusion-nonfree-updates/primary_db                                           |  65 kB     00:00
updates                                                                        | 3.4 kB     00:00
updates/primary_db                                                             | 2.6 MB     00:01
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package hhvm.x86_64 0:2.4.0-1.el6 will be updated
---> Package hhvm.x86_64 0:3.0.1-1.el6 will be an update
--> Finished Dependency Resolution

Dependencies Resolved

===============================================================================================================================
 Package                    Arch                         Version                              Repository                  Size
===============================================================================================================================
Updating:
 hhvm                       x86_64                       3.0.1-1.el6                          hop5                       9.4 M

Transaction Summary
===============================================================================================================================
Upgrade       1 Package(s)

Total download size: 9.4 M
Is this ok [y/N]: y
Downloading Packages:
hhvm-3.0.1-1.el6.x86_64.rpm                                                                             | 9.4 MB     00:00
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Updating   : hhvm-3.0.1-1.el6.x86_64                                                                                     1/2
  Cleanup    : hhvm-2.4.0-1.el6.x86_64                                                                                     2/2
  Verifying  : hhvm-3.0.1-1.el6.x86_64                                                                                     1/2
  Verifying  : hhvm-2.4.0-1.el6.x86_64                                                                                     2/2

Updated:
  hhvm.x86_64 0:3.0.1-1.el6

Complete!
[root@node1 ~]#  
If you are upgrading from previous hiphop-php Package, Just do a
[root@node1 ~]# yum update hiphop-php

After this, check that hhvm is installed correctly

[root@node1 ~]# hhvm --version
HipHop VM 3.0.1 (rel)
Compiler: 
Repo schema: e69de29bb2d1d6434b8b29ae775ad8c2e48c5391

Have fun with this new and improved release.


Tuesday, March 18, 2014

AtomSQL - Simple Database Query Language for RDBMS & NoSQL Systems

AtomSQL came from the frustration of working too much with RDBMS systems and typing too much to get the necessary data from the Databases.

This post is an introduction to AtomSQL

Lets go through the following examples to see how we use SQL queries normally and in AtomSQL Format.

1. Create a new table

BEFORE:
CREATE TABLE myTable (id INTEGER PRIMARYKEY, name VARCHAR(255) ENGINE=INNODB


AFTER:

myTable { id INTEGER PRIMARY KEY, name VARCHAR(255) } ENGINE=INNODB


So, what has changed ???

We just got rid of the keywords and are letting the {} do the necessary JOB.

TIP: Remember C/C++ Structures ?

2. Inserting new records to the table

Before:

INSERT INTO myTable VALUES (1, 'Tom'), (2, 'Jerry')


After:

myTable = [ (1, 'Tom'), (2, 'Jerry') ]


Again, We use () for Tuples and [] for Array representation to get the job done. Keywords have gone away !
TIP: Remember JSON, Perl Arrays ?

3. Updating records

Before

UPDATE myTable SET name = 'Jerry Mouse' Where name = 'Jerry'


After

myTable /name = 'Jerry Mouse'/ (name = 'Jerry')


Again, we are using // for replacing data and () are used for condition to be used in WHERE Clause
TIP: Remember perl, sed, vim for data replacement ?

4. Deleting records

Before

DELETE FROM myTable Where name = 'Jerry'


After

! myTable (name = 'Jerry')


! Bang is the operator for destroying stuff. () is used for WHERE Clause

5. Seleting Records

Before

SELECT * from myTable where name != 'Jerry'


After

myTable <*> (name != 'Jerry')


<> is used for Column selection and () is used for WHERE clause

More Features/Limitations/Installation can be read from http://nareshv.github.io/atomsql/

Tuesday, February 11, 2014

Configure HHVM with Apache + FastCGI on Centos 6.5

On centos you can run regular fastcgi processes with mod_fcgid package. In order to communicate with HHVM over TCP/IP you need to install mod_fastcgi which is available elsewhere on the internet.

 Follow these instructions to use apache + fastcgi with hhvm.

0. Pre-requisites

Make sure you add the following to /etc/hosts on your server where you are going to use curl/browser

127.0.0.1 test.example.com

1. Install httpd-devel packages

[root@localhost yum.repos.d]# yum install httpd-devel -y

2. Download mod_fastcgi

 [root@localhost ~]# wget http://www.fastcgi.com/dist/mod_fastcgi-SNAP-0910052141.tar.gz

3. Compile and install mod_fastcgi

Make sure to change the top_dir variable in the Makefile to centos specific like below or else package wont compile

top_dir      = /usr/lib64/httpd

[root@localhost ~]# tar zxf mod_fastcgi-SNAP-0910052141.tar.gz 
[root@localhost ~]# cd mod_fastcgi-SNAP-0910052141
[root@localhost mod_fastcgi-SNAP-0910052141]# cp Makefile.AP2 Makefile
[root@localhost mod_fastcgi-SNAP-0910052141]# make
[root@localhost mod_fastcgi-SNAP-0910052141]# make install

4. Start the hhvm server in fastcgi mode

[root@localhost ~]# /usr/bin/hhvm --mode server -vServer.Port=9000 -vServer.Type=fastcgi 
mapping self...
mapping self took 0'00" (34658 us) wall time
loading static content...
loading static content took 0'00" (3 us) wall time
page server started
all servers started

5. Create a dummy apache configuration file

[root@localhost ~]# cat /etc/httpd/conf.d/1.conf 

    ServerName test.example.com
    DocumentRoot /var/www/localhost
    LoadModule fastcgi_module modules/mod_fastcgi.so
    FastCgiExternalServer /var/www/localhost -host 127.0.0.1:9000

[root@localhost ~]# 

6. Create document root and simple php file

mkdir -p /var/www/localhost && echo '<?php echo "hello world"; ?>' > /var/www/localhost/index.php

7. Start httpd from another terminal

[root@localhost ~]# service httpd restart
Stopping httpd:                                            [  OK  ]
Starting httpd: httpd: Could not reliably determine the server's fully qualified domain name, using localhost.localdomain for ServerName
                                                           [  OK  ]
8. Fire a request and see that you get response from HHVM
 nareshv @ localhost $ curl http://test.example.com/index.php ; echo
hello world!
 nareshv @ localhost $
 nareshv @ localhost $ curl http://test.example.com/404.php ; echo
Not Found
 nareshv @ localhost $

9. Final configurations

Once you have proper working setup like above, create a configuration file for hhvm and run it in daemon mode.

Have Fun!

Monday, February 10, 2014

Installing docker 0.8 version on Centos 6.5

1. Configure EPEL Repository
[root@localhost ~]# sudo yum install http://ftp.riken.jp/Linux/fedora/epel/6/i386/epel-release-6-8.noarch.rpm
Loaded plugins: fastestmirror
Determining fastest mirrors
 * base: centos.aol.in
 * extras: centos.aol.in
 * updates: centos.aol.in
Setting up Install Process
epel-release-6-8.noarch.rpm                                                                    |  14 kB     00:00     
Examining /var/tmp/yum-root-7UK58w/epel-release-6-8.noarch.rpm: epel-release-6-8.noarch
Marking /var/tmp/yum-root-7UK58w/epel-release-6-8.noarch.rpm to be installed
Resolving Dependencies
--> Running transaction check
---> Package epel-release.noarch 0:6-8 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

======================================================================================================================
 Package                     Arch                  Version              Repository                               Size
======================================================================================================================
Installing:
 epel-release                noarch                6-8                  /epel-release-6-8.noarch                 22 k

Transaction Summary
======================================================================================================================
Install       1 Package(s)

Total size: 22 k
Installed size: 22 k
Is this ok [y/N]: y
Downloading Packages:
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing : epel-release-6-8.noarch                                                                            1/1 
  Verifying  : epel-release-6-8.noarch                                                                            1/1 

Installed:
  epel-release.noarch 0:6-8                                                                                           

Complete!

2. Install the docker-io package from EPEL Repository
[root@localhost ~]# yum install docker-io
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
epel/metalink                                                                                  | 4.6 kB     00:00     
 * base: centos.aol.in
 * epel: epel.mirror.net.in
 * extras: centos.aol.in
 * updates: centos.aol.in
epel                                                                                           | 4.2 kB     00:00     
epel/primary_db                                                                                | 5.9 MB     00:06     
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package docker-io.x86_64 0:0.7.6-2.el6 will be installed
--> Processing Dependency: xz for package: docker-io-0.7.6-2.el6.x86_64
--> Processing Dependency: lxc for package: docker-io-0.7.6-2.el6.x86_64
--> Processing Dependency: libcgroup for package: docker-io-0.7.6-2.el6.x86_64
--> Running transaction check
---> Package libcgroup.x86_64 0:0.40.rc1-5.el6_5.1 will be installed
---> Package lxc.x86_64 0:0.9.0-2.el6 will be installed
--> Processing Dependency: liblxc.so.0()(64bit) for package: lxc-0.9.0-2.el6.x86_64
---> Package xz.x86_64 0:4.999.9-0.3.beta.20091007git.el6 will be installed
--> Running transaction check
---> Package lxc-libs.x86_64 0:0.9.0-2.el6 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

======================================================================================================================
 Package                Arch                Version                                        Repository            Size
======================================================================================================================
Installing:
 docker-io              x86_64              0.7.6-2.el6                                    epel                 3.4 M
Installing for dependencies:
 libcgroup              x86_64              0.40.rc1-5.el6_5.1                             updates              125 k
 lxc                    x86_64              0.9.0-2.el6                                    epel                  78 k
 lxc-libs               x86_64              0.9.0-2.el6                                    epel                 116 k
 xz                     x86_64              4.999.9-0.3.beta.20091007git.el6               base                 137 k

Transaction Summary
======================================================================================================================
Install       5 Package(s)

Total download size: 3.9 M
Installed size: 19 M
Is this ok [y/N]: y
Downloading Packages:
(1/5): docker-io-0.7.6-2.el6.x86_64.rpm                                                        | 3.4 MB     00:03     
(2/5): libcgroup-0.40.rc1-5.el6_5.1.x86_64.rpm                                                 | 125 kB     00:00     
(3/5): lxc-0.9.0-2.el6.x86_64.rpm                                                              |  78 kB     00:00     
(4/5): lxc-libs-0.9.0-2.el6.x86_64.rpm                                                         | 116 kB     00:00     
(5/5): xz-4.999.9-0.3.beta.20091007git.el6.x86_64.rpm                                          | 137 kB     00:00     
----------------------------------------------------------------------------------------------------------------------
Total                                                                                 858 kB/s | 3.9 MB     00:04     
warning: rpmts_HdrFromFdno: Header V3 RSA/SHA256 Signature, key ID 0608b895: NOKEY
Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6
Importing GPG key 0x0608B895:
 Userid : EPEL (6) 
 Package: epel-release-6-8.noarch (@/epel-release-6-8.noarch)
 From   : /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6
Is this ok [y/N]: y
warning: rpmts_HdrFromFdno: Header V3 RSA/SHA256 Signature, key ID c105b9de: NOKEY
Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
Importing GPG key 0xC105B9DE:
 Userid : CentOS-6 Key (CentOS 6 Official Signing Key) 
 Package: centos-release-6-5.el6.centos.11.1.x86_64 (@anaconda-CentOS-201311272149.x86_64/6.5)
 From   : /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
Is this ok [y/N]: y
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing : libcgroup-0.40.rc1-5.el6_5.1.x86_64                                                                1/5 
  Installing : xz-4.999.9-0.3.beta.20091007git.el6.x86_64                                                         2/5 
  Installing : lxc-libs-0.9.0-2.el6.x86_64                                                                        3/5 
  Installing : lxc-0.9.0-2.el6.x86_64                                                                             4/5 
  Installing : docker-io-0.7.6-2.el6.x86_64                                                                       5/5 
  Verifying  : lxc-libs-0.9.0-2.el6.x86_64                                                                        1/5 
  Verifying  : xz-4.999.9-0.3.beta.20091007git.el6.x86_64                                                         2/5 
  Verifying  : docker-io-0.7.6-2.el6.x86_64                                                                       3/5 
  Verifying  : libcgroup-0.40.rc1-5.el6_5.1.x86_64                                                                4/5 
  Verifying  : lxc-0.9.0-2.el6.x86_64                                                                             5/5 

Installed:
  docker-io.x86_64 0:0.7.6-2.el6                                                                                      

Dependency Installed:
  libcgroup.x86_64 0:0.40.rc1-5.el6_5.1             lxc.x86_64 0:0.9.0-2.el6      lxc-libs.x86_64 0:0.9.0-2.el6     
  xz.x86_64 0:4.999.9-0.3.beta.20091007git.el6     

Complete!
[root@localhost ~]# 

3. For the brave, start the docker and see these warnings
[root@localhost ~]# docker -d &
[1] 1145
[root@localhost ~]# 2014/02/10 03:23:29 WARNING: You are running linux kernel version 2.6.32-431.el6.x86_64, which might be unstable running docker. Please upgrade your kernel to 3.8.0.
[/var/lib/docker|c3648251] +job initapi()
[/var/lib/docker|c3648251.initapi()] Creating server

Docker will continue to run. But, better upgrade to kernel 3.8 or higher. 4. Configure the elrepo repository so that we can upgrade kernel to 3.8 or higher
[root@localhost ~]# yum install http://www.elrepo.org/elrepo-release-6-5.el6.elrepo.noarch.rpm
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: centos.aol.in
 * epel: epel.mirror.net.in
 * extras: centos.aol.in
 * updates: centos.aol.in
Setting up Install Process
elrepo-release-6-5.el6.elrepo.noarch.rpm                                                       | 7.2 kB     00:00     
Examining /var/tmp/yum-root-7UK58w/elrepo-release-6-5.el6.elrepo.noarch.rpm: elrepo-release-6-5.el6.elrepo.noarch
Marking /var/tmp/yum-root-7UK58w/elrepo-release-6-5.el6.elrepo.noarch.rpm to be installed
Resolving Dependencies
--> Running transaction check
---> Package elrepo-release.noarch 0:6-5.el6.elrepo will be installed
--> Finished Dependency Resolution

Dependencies Resolved

======================================================================================================================
 Package                 Arch            Version                 Repository                                      Size
======================================================================================================================
Installing:
 elrepo-release          noarch          6-5.el6.elrepo          /elrepo-release-6-5.el6.elrepo.noarch          2.8 k

Transaction Summary
======================================================================================================================
Install       1 Package(s)

Total size: 2.8 k
Installed size: 2.8 k
Is this ok [y/N]: y
Downloading Packages:
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing : elrepo-release-6-5.el6.elrepo.noarch                                                               1/1 
  Verifying  : elrepo-release-6-5.el6.elrepo.noarch                                                               1/1 

Installed:
  elrepo-release.noarch 0:6-5.el6.elrepo                                                                              

Complete!
5. Install the kernel-ml from elrepo
[root@localhost ~]# yum --enablerepo=elrepo-kernel install kernel-ml
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: centos.aol.in
 * elrepo: mirror.smartmedia.net.id
 * elrepo-kernel: mirror.smartmedia.net.id
 * epel: epel.mirror.net.in
 * extras: centos.aol.in
 * updates: centos.aol.in
elrepo                                                                                         | 2.9 kB     00:00     
elrepo/primary_db                                                                              | 593 kB     00:02     
elrepo-kernel                                                                                  | 2.9 kB     00:00     
elrepo-kernel/primary_db                                                                       |  19 kB     00:00     
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package kernel-ml.x86_64 0:3.13.2-1.el6.elrepo will be installed
--> Finished Dependency Resolution

Dependencies Resolved

======================================================================================================================
 Package                  Arch                  Version                            Repository                    Size
======================================================================================================================
Installing:
 kernel-ml                x86_64                3.13.2-1.el6.elrepo                elrepo-kernel                 35 M

Transaction Summary
======================================================================================================================
Install       1 Package(s)

Total download size: 35 M
Installed size: 159 M
Is this ok [y/N]: y
Downloading Packages:
kernel-ml-3.13.2-1.el6.elrepo.x86_64.rpm                                                       |  35 MB     02:21     
warning: rpmts_HdrFromFdno: Header V4 DSA/SHA1 Signature, key ID baadae52: NOKEY
Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-elrepo.org
Importing GPG key 0xBAADAE52:
 Userid : elrepo.org (RPM Signing Key for elrepo.org) 
 Package: elrepo-release-6-5.el6.elrepo.noarch (@/elrepo-release-6-5.el6.elrepo.noarch)
 From   : /etc/pki/rpm-gpg/RPM-GPG-KEY-elrepo.org
Is this ok [y/N]: y
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing : kernel-ml-3.13.2-1.el6.elrepo.x86_64                                                               1/1 
  Verifying  : kernel-ml-3.13.2-1.el6.elrepo.x86_64                                                               1/1 

Installed:
  kernel-ml.x86_64 0:3.13.2-1.el6.elrepo                                                                              

Complete!
[root@localhost ~]# 
6. Reboot the server into the 3.13 kernel (MAKE SURE TO SELECT KERNEL IN GRUB MENU)
[root@localhost ~]# reboot

Broadcast message from root@localhost.localdomain
        (/dev/pts/0) at 3:33 ...

The system is going down for reboot NOW!

7. Login and verify the server kernel version
[root@localhost ~]# uname -r
3.13.2-1.el6.elrepo.x86_64
[root@localhost ~]# 

8. See that a new docker0 interface is created
[root@localhost ~]# ifconfig
docker0   Link encap:Ethernet  HWaddr A2:FA:1E:55:53:77  
          inet addr:172.17.42.1  Bcast:0.0.0.0  Mask:255.255.0.0
          inet6 addr: fe80::a0fa:1eff:fe55:5377/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:9 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:0 (0.0 b)  TX bytes:1422 (1.3 KiB)

eth0      Link encap:Ethernet  HWaddr 08:00:27:D5:BC:A0  
          inet addr:192.168.1.111  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: fe80::a00:27ff:fed5:bca0/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:118 errors:0 dropped:0 overruns:0 frame:0
          TX packets:47 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:13818 (13.4 KiB)  TX bytes:7215 (7.0 KiB)

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b)

[root@localhost ~]# 

9. Start the docker in daemon mode
[root@localhost ~]# docker -d
10. Verify the docker version
[root@localhost ~]# docker version
Client version: 0.7.6
Go version (client): go1.2
Git commit (client): bc3b2ec/0.7.6
Server version: 0.7.6
Git commit (server): bc3b2ec/0.7.6
Go version (server): go1.2
Last stable version: 0.8.0, please update docker
[root@localhost ~]# 

11. Update to 0.8 version (Optional Step)
[root@localhost ~]# ps auxww | grep docker
root      1008  0.0  1.3 338992  6788 ?        Sl   03:35   0:00 /usr/bin/docker -d
root      1357  0.0  0.1 103296   820 pts/0    S+   03:55   0:00 grep docker
[root@localhost ~]# kill -9 1008

[root@localhost ~]# yum install http://kojipkgs.fedoraproject.org//packages/docker-io/0.8.0/2.el6/x86_64/docker-io-0.8.0-2.el6.x86_64.rpm
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: centos.aol.in
 * elrepo: mirror.smartmedia.net.id
 * epel: epel.mirror.net.in
 * extras: centos.aol.in
 * updates: centos.aol.in
Setting up Install Process
docker-io-0.8.0-2.el6.x86_64.rpm                                                               | 3.6 MB     00:05     
Examining /var/tmp/yum-root-7UK58w/docker-io-0.8.0-2.el6.x86_64.rpm: docker-io-0.8.0-2.el6.x86_64
Marking /var/tmp/yum-root-7UK58w/docker-io-0.8.0-2.el6.x86_64.rpm as an update to docker-io-0.7.6-2.el6.x86_64
Resolving Dependencies
--> Running transaction check
---> Package docker-io.x86_64 0:0.7.6-2.el6 will be updated
---> Package docker-io.x86_64 0:0.8.0-2.el6 will be an update
--> Finished Dependency Resolution

Dependencies Resolved

======================================================================================================================
 Package                Arch                Version                  Repository                                  Size
======================================================================================================================
Updating:
 docker-io              x86_64              0.8.0-2.el6              /docker-io-0.8.0-2.el6.x86_64               19 M

Transaction Summary
======================================================================================================================
Upgrade       1 Package(s)

Total size: 19 M
Is this ok [y/N]: y
Downloading Packages:
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Updating   : docker-io-0.8.0-2.el6.x86_64                                                                       1/2 
  Cleanup    : docker-io-0.7.6-2.el6.x86_64                                                                       2/2 
  Verifying  : docker-io-0.8.0-2.el6.x86_64                                                                       1/2 
  Verifying  : docker-io-0.7.6-2.el6.x86_64                                                                       2/2 

Updated:
  docker-io.x86_64 0:0.8.0-2.el6                                                                                      

Complete!

[root@localhost ~]# docker info
Containers: 0
Images: 0
Driver: devicemapper
 Pool Name: docker-253:0-110-pool
 Data file: /var/lib/docker/devicemapper/devicemapper/data
 Metadata file: /var/lib/docker/devicemapper/devicemapper/metadata
 Data Space Used: 291.5 Mb
 Data Space Total: 102400.0 Mb
 Metadata Space Used: 0.7 Mb
 Metadata Space Total: 2048.0 Mb
WARNING: No swap limit support
[root@localhost ~]# 

Go to http://docs.docker.io/en/latest/ and get started with docker.

Have Fun !

NOTE: If you were use http://www.hop5.in repository. Dont worry as the package upgrades are seamless due to the package name being same.

Saturday, October 19, 2013

Install HHVM 2.2.0 Final Release on Centos 6.4 (64-bit)

Facebook released HHVM 2.2.0 couple of days ago and made the package available on multiple distributions.

Setup hop5.in repo as mentioned in this blog post

1. Install the package using yum

[root@node1 x86_64]# yum install hiphop-php-2.2.0-1.el6.x86_64 -y

2. Check the version of newly installed package

[root@node1 x86_64]# hhvm --version
HipHop VM v2.2.0 (rel)
Compiler: 1382176880_483521803
Repo schema: 484929643_1382176880

3. Have fun with this new release :-)

Long list of changelog is available here

Thursday, September 19, 2013

Tuesday, September 10, 2013

Postgresql 9.3 and NoSQL Awesomeness on Fedora 19

Postgresql 9.3 was released yesterday. This document explains how to install postgresql 9.3 on Fedora 19 system and play with the built-in JSON support for the columns. (i.e the NOSQL Feature within a RDBMS database!)

1. Install Fedora 19 as you usually do

2. Setup PGDG Repository

[root@fallenangel ~]# yum install http://yum.postgresql.org/9.3/fedora/fedora-19-x86_64/pgdg-fedora93-9.3-1.noarch.rpm -y
oaded plugins: fastestmirror, langpacks, refresh-packagekit
pgdg-fedora93-9.3-1.noarch.rpm  | 5.1 kB  00:00:00     
Examining /var/tmp/yum-root-cjnqf8/pgdg-fedora93-9.3-1.noarch.rpm: pgdg-fedora93-9.3-1.noarch
Marking /var/tmp/yum-root-cjnqf8/pgdg-fedora93-9.3-1.noarch.rpm to be installed
Resolving Dependencies
--> Running transaction check
---> Package pgdg-fedora93.noarch 0:9.3-1 will be installed
--> Finished Dependency Resolution

Dependencies Resolved
Total size: 2.1 k
Installed size: 2.1 k
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : pgdg-fedora93-9.3-1.noarch         1/1 
  Verifying  : pgdg-fedora93-9.3-1.noarch                         1/1 

Installed:
  pgdg-fedora93.noarch 0:9.3-1
Complete!

3. Install postgresql-9.3
[root@fallenangel ~]# yum install postgresql93-server -y

4. Initialize the Postgresql database

[root@fallenangel ~]#  su - postgres
-bash-4.2$ env PGDATA=/var/lib/pgsql/9.3/data /usr/pgsql-9.3/bin/initdb
The files belonging to this database system will be owned by user "postgres".
This user must also own the server process.

The database cluster will be initialized with locale "en_US.UTF-8".
The default database encoding has accordingly been set to "UTF8".
The default text search configuration will be set to "english".

Data page checksums are disabled.

fixing permissions on existing directory /var/lib/pgsql/9.3/data ... ok
creating subdirectories ... ok
selecting default max_connections ... 100
selecting default shared_buffers ... 128MB
creating configuration files ... ok
creating template1 database in /var/lib/pgsql/9.3/data/base/1 ... ok
initializing pg_authid ... ok
initializing dependencies ... ok
creating system views ... ok
loading system objects' descriptions ... ok
creating collations ... ok
creating conversions ... ok
creating dictionaries ... ok
setting privileges on built-in objects ... ok
creating information schema ... ok
loading PL/pgSQL server-side language ... ok
vacuuming database template1 ... ok
copying template1 to template0 ... ok
copying template1 to postgres ... ok
syncing data to disk ... ok

WARNING: enabling "trust" authentication for local connections
You can change this by editing pg_hba.conf or using the option -A, or
--auth-local and --auth-host, the next time you run initdb.

Success. You can now start the database server using:

    /usr/pgsql-9.3/bin/postgres -D /var/lib/pgsql/9.3/data
or
    /usr/pgsql-9.3/bin/pg_ctl -D /var/lib/pgsql/9.3/data -l logfile start

-bash-4.2$ 

5. Start the postgresql server

[root@fallenangel ~]# service postgresql-9.3 start
Redirecting to /bin/systemctl start  postgresql-9.3.service
[root@fallenangel ~]# 


6. Connect to the Server and create a test database

[root@fallenangel ~]# su - postgres
-bash-4.2$ createdb json

-bash-4.2$ psql json
psql (9.3.0)
Type "help" for help.

json=# create user json_user with password 'json_password';
CREATE ROLE
json=# grant all privileges on database json to json_user;
GRANT
json=# \q

7. Connect to the Server with newly created Username

[root@fallenangel ~]# psql -U json_user -d json
psql (9.3.0)
Type "help" for help.

8. Create a new table with JSON datatype in one of the columns

json=> create table "User" (
json(> id integer,
json(> details json
json(> );

CREATE TABLE
json=> insert into "User" (id, details) values (1, '{"uuid":1234, "name":"John Doe", "email": "John.Doe@acme.com", "status":"active"}');
INSERT 0 1

json=> insert into "User" (id, details) values (1, '{"uuid":1235, "name":"Tomcat", "email": "tomcat@acme.com", "status":"active", "phones":["+1 800 700 500", "+1 400 300 200"]}');
INSERT 0 1
json=> 
9. Now the SQL Queries using NoSQL dataset

1. Get the list of all UUIDs (embedded inside `details` column)

json=> select details->'uuid' as "uuid" from "User";
 uuid 
------
 1234
 1235
(2 rows)

2. Get the list of all Emails from "User" table

json=> select details->'email' as "email" from "User";
        email         
---------------------
 "John.Doe@acme.com"
 "tomcat@acme.com"
(2 rows)

3. Get the First Phone number (from the array of phones) from "User" table

json=> select details->'name' as "name", details->'phones'->0 as "uuid" from "User";
  name  |       uuid       
------------+------------------
 "John Doe" | 
 "Tomcat"   | "+1 800 700 500"
(2 rows)


Please be aware that JSON Implies UTF-8 Charset. There is no need to explicitly mention this.

More JSON functions in postgres-9.3 are available in this document.

LIMITATIONS: Currently, to update the column, we need to pass the entire json data instead of updating a single KEY inside JSON content.

For example, you might expect the following works, But it doesn't.

Update the 'name' key inside the json dataset.

json=> update "User" set details->'name' = 'John Doe II' where details->'name' = 'John Doe';

ERROR:  syntax error at or near "->"
LINE 1: update "User" set details->'name' = 'John Doe II' where deta..

It would be awesome if postgresql developers add such feature.

Friday, September 06, 2013

Installing Facebook's Hiphop "Kimchi" Release on Centos 6.x , RHEL 6.x

Facebook's hiphop changelog is updated for "Kimchi" release in github with the following list.

"Kimchi" 2-Sep-2013
  - Fix order of custom attributes and visibility in ctor arg promotion
  - Implement CachingIterator
  - Implement RecursiveCachingIterator
  - Generalized heuristic for choosing when to inline in the jit
  - Imported calendar extension
  - Use gcc-4.8.1 by default
  - Improve hhvm commandline parsing logic
  - Fix register_shutdown in session_set_save_handler to match PHP 5.4
  - Add "native" functions for use in Systemlib
  - PHP extension source-compatitblility layer
  - Fix ArrayIterator constructor PHP compatibility
  - Enable building against libmemcached 1.0.8
  - Debugger: $_ not cleared but still printed after exception
  - Fix clone of SplPriorityQueue
  - Debugger: Fix bugs when multiple threads hit the same breakpoint
  - Fix several namespace bugs
  - Several PHP compatibility fixes for ArrayObject and ArrayIterator
  - Fix list assignment with collection literals
  - support "tuple(...)" in initializer expressions
  - HHVM should compile with libmemcached 1.0.9+
  - Support "(new Vector {..})->method()" style syntax
  - use trigger_error in PHP for Redis user errors
  - multiple simplexml fixes
  - fixed serialize/unserialize for SplObjectStorage
  - Implement ReflectionParameter::IsCallable()

I have pushed a new package to the hop5.in repository, Grab the package and test it out.

Major change from packaging point of view is the libmemcached version, which is upgraded to 1.0.16

Follow these steps to upgrade

1. Enable hop5.in repository as mentioned before

2. Do a yum upgrade (or yum install)

yum install hiphop-php-2.1.210.2-1.el6 -y
Resolving Dependencies
--> Running transaction check
---> Package hiphop-php.x86_64 0:2.1.210-4.el6 will be updated
---> Package hiphop-php.x86_64 0:2.1.210.2-1.el6 will be an update
--> Processing Dependency: libmemcached >= 1.0.9 for package: hiphop-php-2.1.210.2-1.el6.x86_64
--> Processing Dependency: libmemcached.so.11()(64bit) for package: hiphop-php-2.1.210.2-1.el6.x86_64
--> Running transaction check
---> Package libmemcached.x86_64 0:0.49-1.el6 will be updated
---> Package libmemcached.x86_64 0:1.0.16-1.el6 will be an update
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================
 Package              Arch           Version                 Repository    Size
================================================================================
Updating:
 hiphop-php           x86_64         2.1.210.2-1.el6         hop5          19 M
Updating for dependencies:
 libmemcached         x86_64         1.0.16-1.el6            hop5         208 k

Transaction Summary
================================================================================
Upgrade       2 Package(s)

Total download size: 19 M
Downloading Packages:
--------------------------------------------------------------------------------
Total                                           777 kB/s |  19 MB     00:24     
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Updating   : libmemcached-1.0.16-1.el6.x86_64                             1/4 
  Updating   : hiphop-php-2.1.210.2-1.el6.x86_64                            2/4 
  Cleanup    : hiphop-php-2.1.210-4.el6.x86_64                              3/4 
  Cleanup    : libmemcached-0.49-1.el6.x86_64                               4/4 
  Verifying  : hiphop-php-2.1.210.2-1.el6.x86_64                            1/4 
  Verifying  : libmemcached-1.0.16-1.el6.x86_64                             2/4 
  Verifying  : hiphop-php-2.1.210-4.el6.x86_64                              3/4 
  Verifying  : libmemcached-0.49-1.el6.x86_64                               4/4 

Updated:
  hiphop-php.x86_64 0:2.1.210.2-1.el6                                           

Dependency Updated:
  libmemcached.x86_64 0:1.0.16-1.el6                                            

Complete!
 
3. See that new package is installed

bash-4.1# rpm -qa | grep hiphop-php
hiphop-php-2.1.210.2-1.el6.x86_64
4. Check the hhvm version details

bash-4.1# /usr/bin/hhvm --version
HipHop VM v2.1.0-dev (rel)
Compiler: heads/master-0-g13ddbb4ec17cffeeaaa83940016e6811cd71b387
Repo schema: a40e2fdb7f3c4700ef306f956630f09cd1ba53e0
bash-4.1# cd /var/www && /usr/bin/hhvm index.php 
Hello world.
5. Have fun!

NOTE: Please be aware that, from facebook's point of view this is just a internal release in the 2.1.0-dev series.

Monday, September 02, 2013

Getting ready for the faster HHVM (hiphop php) version

UPDATE: Now you can install "Kimchi" release as of 6-Sep-2013 

HHVM (hiphop php) is getting ready for a faster version with the following changes

I have built a preview version as of Sep-1-2013, which can be easily installed on your system.

Steps to Upgrade from 2.1.0 on CentOS-6.x / RHEL-6.x


1. Make sure you have enabled hop5.in repository as mentioned in this blog post.

2. Update hiphop-php

[nareshv@fallenangel ~]$ sudo yum install hiphop-php-2.1.210.1-1.el6
Total download size: 19 M
Is this ok [y/N]: y
Downloading Packages:
hiphop-php-2.1.210.1-1.el6.x86_64.rpm                                                                                                                                          |  19 MB     00:00     
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Updating   : hiphop-php-2.1.210.1-1.el6.x86_64   1/2 
  Cleanup    : hiphop-php-2.1.210-4.el6.x86_64     2/2 
  Verifying  : hiphop-php-2.1.210.1-1.el6.x86_64   1/2 
  Verifying  : hiphop-php-2.1.210-4.el6.x86_64     2/2 

Updated:
  hiphop-php.x86_64 0:2.1.210.1-1.el6                                                                                                                                                                 

Complete!


3. Check the version of new Hiphop

[nareshv@fallenangel ~]$ /usr/bin/hhvm --version
HipHop VM v2.1.0-dev (rel)
Compiler: heads/master-0-ged8774975e0c017b8baf09d1547d769b26c5f278
Repo schema: d74c9a7e6b05d0018945a73ae5567bafa294f29d

NOTES:Be sure to test this preview release on your testing environment before using it on production.

Sunday, September 01, 2013

Installing Docker.io version 0.6.1 on Centos / Fedora

Docker.io has released 0.6.1 version with the following changelog

If you have already installed docker.io on your centos/rhel system. Just do the upgrade with the following steps

Upgrading from 0.5.3 to 0.6.1

1. Make sure you have enabled hop5.in repository as mentioned in previous post

2. Do a yum upgrade

yum update docker-io

Wednesday, August 21, 2013

Installing docker.io on centos 6.4 (64-bit)

NOTES: epel has another package called docker (which is a KDE docking application and is not related to this). So, you will get an error performing these steps, if you have that package already installed.

UPDATE-1: Docker version-0.6.1 is released. Upgrade instructions are available here

UPDATE-2: Docker version-0.6.2 is released. 

Docker.io is the lightweight "container engine + image repository" built on top of LXC (linux lightweight containers) to ship any application.

At the core of docker.io there are
  1.  an application "/usr/bin/docker" 
  2.  set of pre-created operating-system/application images hosted with "docker.io"
  3.  AUFS (Another Union filesystem) to take care of snapshots, diffs, ro/rw requirements
  4. LXC (Linux lightweight containers)
  5. cgroups (for resource management and namespacing)
As of writing this blog, the latest version is 0.5.3 . The project is actively being developed and things can change in near future.

Follow these instructions to get docker.io installed on your system.

0. Install centos 6.x

1. Disable selinux as it interferes with functionality of LXC

[root@localhost ~]# cat /etc/selinux/config 
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
#       enforcing - SELinux security policy is enforced.
#       permissive - SELinux prints warnings instead of enforcing.
#       disabled - SELinux is fully disabled.
SELINUX=disabled
# SELINUXTYPE= type of policy in use. Possible values are:
#       targeted - Only targeted network daemons are protected.
#       strict - Full SELinux protection.
SELINUXTYPE=targeted
2. Download and setup Fedora EPEL Repository

sudo yum install http://ftp.riken.jp/Linux/fedora/epel/6/i386/epel-release-6-8.noarch.rpm

3. Setup hop5.in repository

cd /etc/yum.repos.d
sudo wget http://www.hop5.in/yum/el6/hop5.repo

4. Install docker-io package

[root@localhost ~]# yum install docker-io
Loaded plugins: fastestmirror, security
Loading mirror speeds from cached hostfile
 * base: centos.excellmedia.net
 * epel: kartolo.sby.datautama.net.id
 * extras: centos.excellmedia.net
 * updates: centos.excellmedia.net
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package docker-io.x86_64 0:0.5.3-4.el6 will be installed
--> Processing Dependency: lxc >= 0.8.0 for package: docker-io-0.5.3-4.el6.x86_64
--> Processing Dependency: kernel-ml-aufs >= 3.10.5 for package: docker-io-0.5.3-4.el6.x86_64
--> Running transaction check
---> Package kernel-ml-aufs.x86_64 0:3.10.5-3.el6 will be installed
---> Package lxc.x86_64 0:0.8.0-3.el6 will be installed
--> Processing Dependency: liblxc.so.0()(64bit) for package: lxc-0.8.0-3.el6.x86_64
--> Running transaction check
---> Package lxc-libs.x86_64 0:0.8.0-3.el6 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

============================================================================================
 Package                   Arch              Version                  Repository       Size
============================================================================================
Installing:
 docker-io                 x86_64            0.5.3-4.el6              hop5            1.2 M
Installing for dependencies:
 kernel-ml-aufs            x86_64            3.10.5-3.el6             hop5             33 M
 lxc                       x86_64            0.8.0-3.el6              hop5             81 k
 lxc-libs                  x86_64            0.8.0-3.el6              hop5             75 k

Transaction Summary
============================================================================================
Install       4 Package(s)

Total download size: 34 M
Installed size: 159 M
Is this ok [y/N]: y
Downloading Packages:
(1/4): docker-io-0.5.3-4.el6.x86_64.rpm                              | 1.2 MB     00:03     
(2/4): kernel-ml-aufs-3.10.5-3.el6.x86_64.rpm                        |  33 MB     00:33     
(3/4): lxc-0.8.0-3.el6.x86_64.rpm                                    |  81 kB     00:00     
(4/4): lxc-libs-0.8.0-3.el6.x86_64.rpm                               |  75 kB     00:00     
--------------------------------------------------------------------------------------------
Total                                                       896 kB/s |  34 MB     00:39     
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing : lxc-libs-0.8.0-3.el6.x86_64                                              1/4 
  Installing : lxc-0.8.0-3.el6.x86_64                                                   2/4 
  Installing : kernel-ml-aufs-3.10.5-3.el6.x86_64                                       3/4 
  Installing : docker-io-0.5.3-4.el6.x86_64                                             4/4 
  Verifying  : kernel-ml-aufs-3.10.5-3.el6.x86_64                                       1/4 
  Verifying  : lxc-0.8.0-3.el6.x86_64                                                   2/4 
  Verifying  : lxc-libs-0.8.0-3.el6.x86_64                                              3/4 
  Verifying  : docker-io-0.5.3-4.el6.x86_64                                             4/4 

Installed:
  docker-io.x86_64 0:0.5.3-4.el6                                                            

Dependency Installed:
  kernel-ml-aufs.x86_64 0:3.10.5-3.el6               lxc.x86_64 0:0.8.0-3.el6              
  lxc-libs.x86_64 0:0.8.0-3.el6                     

Complete!
[root@localhost ~]#

5. See the package is installed correctly

[root@localhost ~]# docker -h
Usage of docker:
  -D=false: Debug mode
  -H=[unix:///var/run/docker.sock]: tcp://host:port to bind/connect to or unix://path/to/socket to use
  -api-enable-cors=false: Enable CORS requests in the remote api.
  -b="": Attach containers to a pre-existing network bridge. Use 'none' to disable container networking
  -d=false: Daemon mode
  -dns="": Set custom dns servers
  -g="/var/lib/docker": Path to graph storage base dir.
  -p="/var/run/docker.pid": File containing process PID
  -r=false: Restart previously running containers

6. Add cgroup filesystem to /etc/fstab , so that docker will work correctly

[root@localhost ~]# echo "none                    /sys/fs/cgroup          cgroup  defaults        0 0" >> /etc/fstab 
[root@localhost ~]# mount /sys/fs/cgroup

Per "Peter Zimmerman" a reboot is needed to actually mount /sys/fs/cgroup (due to the kernel doesn't have cgroup support). So, the above mount step is not really needed. As its used only upon reboot.

7. Reboot the system ; make sure to select "3.10.5-3.el6.x86_64" kernel version while booting.

8. Once system is up and running, make sure you are on right kernel

[root@localhost ~]# uname -r
3.10.5-3.el6.x86_64

[root@localhost ~]# grep aufs /proc/filesystems 
nodev   aufs
 
9. Start the docker.io in daemon mode (in a different terminal)

[root@localhost ~]# docker -d 
2013/08/21 07:47:07 WARNING: Your kernel does not support cgroup swap limit.
2013/08/21 07:47:07 Listening for HTTP on /var/run/docker.sock (unix)

10. Print hello world from a centos 6.4 container.

[root@localhost ~]# docker run centos:6.4 echo "hello world"
2013/08/21 07:48:41 POST /v1.4/containers/create
2013/08/21 07:48:41 POST /v1.4/containers/c6bc9e80097e/start
2013/08/21 07:48:41 POST /v1.4/containers/c6bc9e80097e/attach?logs=1&stderr=1&stdout=1&stream=1
hello world

11. Ping from inside the container
[root@localhost ~]# docker -dns '8.8.8.8' run centos:6.4 ping -c 3 yahoo.com
2013/08/21 08:02:15 POST /v1.4/containers/create
2013/08/21 08:02:15 POST /v1.4/containers/c40a1244f9bc/start
2013/08/21 08:02:15 POST /v1.4/containers/c40a1244f9bc/attach?logs=1&stderr=1&stdout=1&stream=1
PING yahoo.com (98.138.253.109) 56(84) bytes of data.
64 bytes from ir1.fp.vip.ne1.yahoo.com (98.138.253.109): icmp_seq=1 ttl=48 time=323 ms
64 bytes from ir1.fp.vip.ne1.yahoo.com (98.138.253.109): icmp_seq=2 ttl=48 time=329 ms
64 bytes from ir1.fp.vip.ne1.yahoo.com (98.138.253.109): icmp_seq=3 ttl=49 time=302 ms

--- yahoo.com ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2304ms
rtt min/avg/max/mdev = 302.032/318.318/329.656/11.807 ms

TROUBLESHOOTING

"DNS/Networking Errors inside the docker"

[root@localhost ~]# docker -dns="8.8.8.8" run centos:6.4 yum install hiphop-php
2013/08/21 07:53:05 POST /v1.4/containers/create
2013/08/21 07:53:05 POST /v1.4/containers/6d9fef14bd1a/start
2013/08/21 07:53:05 POST /v1.4/containers/6d9fef14bd1a/attach?logs=1&stderr=1&stdout=1&stream=1
Loaded plugins: fastestmirror
Error: Cannot retrieve repository metadata (repomd.xml) for repository: base. Please verify its path and try again
Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=6&arch=x86_64&repo=os error was
14: PYCURL ERROR 6 - "Couldn't resolve host 'mirrorlist.centos.org'"


Please issue the following commands, so that docker and its environment will be reset and above issue will be taken care of.

pkill docker
iptables -t nat -F
ifconfig docker0 down
brctl delbr docker0
docker -d

CREDITS: Thanks to sciurus for doing the hardwork in creating the spec file for kernel-ml-aufs.

Monday, August 19, 2013

Installing Go Lang 1.1 on centos 6.4 *64-bit

UPDATE: 28/Apr/2014 - Golang package is now available on Fedora EPEL Repository. You can just configure EPEL repo and do a "yum install golang".

I have added go-lang package to the current repository. So you can try installing it using the following steps.

1. Install centos 6.x

2. Download and setup Fedora EPEL Repository

sudo yum install http://ftp.riken.jp/Linux/fedora/epel/6/i386/epel-release-6-8.noarch.rpm

(Step-3 not needed, if you are seeing this on Apr/2014)

3. Setup hop5.in repository


cd /etc/yum.repos.d
sudo wget http://www.hop5.in/yum/el6/hop5.repo

4. Install go package

sudo yum install golang

5. Write a simple "hello world" program to get started with go

[nareshv@fallenangel tmp]$ cat hello.go
package main

import "fmt"

func main() {
    fmt.Println("Hello, World.")
}
[nareshv@fallenangel tmp]$ go run hello.go
Hello, World. 

6. Continue exploring go-lang, from here

(Note is not applicable if you are using golang from EPEL Repository)

Note: Please note that, go-lang is compiled without emacs support (to avoid pulling tons of packages) and with gcc-4.6.3.

Monday, July 15, 2013

Installing HHVM (Hiphop PHP) 2.1.0 On Centos 6.x

HHVM 2.1.0 was released a day ago (as of writing this blog).  In order to install this stable version on your server / development environment. Follow these steps

1. Configure the Repository as mentioned in my previous post

2. Upgrade to the latest version

sudo yum update hiphop-php

3. Confirm that the package is installed correctly

/usr/bin/hhvm --help

NOTE: You need to re-build your we-application (if you are using repo-authoritative mode) with the current version and then only upgrade your production server, or else you might not have this application working correctly.

Have fun with this stable version.

Saturday, July 13, 2013

Wednesday, July 10, 2013

Install TokuDB Mysql Server along with Existing mysql-server on Centos/Ubuntu Server

Tokudb has fractal tree engine which is mentioned to perform bettern than innodb in certain instances. In some scenarios you might want to run mysql-server which is patched with tokudb engine along with your current mysql server (for performance testing, evaluation etc).

A straightforward installation will mess up /var/lib/mysql, so follow these instructions to make sure that the server installation doesn't mess up existing installation.

1. Download and unzip the tokudb to /usr/local/

nareshv@fallenangel:~/Downloads$ sudo mv mysql-5.5.30-tokudb-7.0.1-linux-x86_64 /usr/local/
nareshv@fallenangel:/usr/local$ sudo ln -s mysql-5.5.30-tokudb-7.0.1-linux-x86_64 mysql
nareshv@fallenangel:/usr/local$ cd mysql
nareshv@fallenangel:/usr/local/mysql$ ls -l
total 80
drwxrwxr-x  2 nareshv nareshv  4096 Apr 19 04:57 bin
-rw-r--r--  1 nareshv nareshv 17987 Apr 19 03:11 COPYING
drwxrwxr-x  4 nareshv nareshv  4096 Apr 19 04:57 data
drwxrwxr-x  2 nareshv nareshv  4096 Apr 19 04:57 docs
drwxrwxr-x  3 nareshv nareshv  4096 Apr 19 04:57 include
-rw-r--r--  1 nareshv nareshv  7469 Apr 19 03:11 INSTALL-BINARY
drwxrwxr-x  3 nareshv nareshv  4096 Apr 19 04:57 lib
drwxrwxr-x  4 nareshv nareshv  4096 Apr 19 04:57 man
drwxrwxr-x 10 nareshv nareshv  4096 Apr 19 04:57 mysql-test
-rw-r--r--  1 nareshv nareshv  2552 Apr 19 03:11 README
-rw-r--r--  1 nareshv nareshv  3659 Apr 19 04:52 README-TOKUDB
drwxrwxr-x  2 nareshv nareshv  4096 Apr 19 04:57 scripts
drwxrwxr-x 27 nareshv nareshv  4096 Apr 19 04:57 share
drwxrwxr-x  4 nareshv nareshv  4096 Apr 19 04:57 sql-bench
drwxrwxr-x  2 nareshv nareshv  4096 Apr 19 04:57 support-files

2. Install the mysqlserver to /usr/local/mysql (not /var/lib/mysql)

nareshv@fallenangel:/usr/local/mysql$ sudo -u mysql ./scripts/mysql_install_db --user=mysql --datadir=/usr/local/mysql/data --basedir=/usr/local/mysql
Installing MySQL system tables...
OK
Filling help tables...
OK

To start mysqld at boot time you have to copy
support-files/mysql.server to the right place for your system

PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:

/usr/local/mysql/bin/mysqladmin -u root password 'new-password'
/usr/local/mysql/bin/mysqladmin -u root -h fallenangel password 'new-password'

Alternatively you can run:
/usr/local/mysql/bin/mysql_secure_installation

which will also give you the option of removing the test
databases and anonymous user created by default.  This is
strongly recommended for production servers.

See the manual for more instructions.

You can start the MySQL daemon with:
cd /usr/local/mysql ; /usr/local/mysql/bin/mysqld_safe &

You can test the MySQL daemon with mysql-test-run.pl
cd /usr/local/mysql/mysql-test ; perl mysql-test-run.pl

Please report any problems with the /usr/local/mysql/scripts/mysqlbug script!

3. Create a new startup script to launch mysqld on port 3307

nareshv@fallenangel:/usr/local/mysql-5.5.30-tokudb-7.0.1-linux-x86_64$ sudo vi run.sh
#!/bin/bash

/usr/bin/env MYSQL_HOME=/usr/local/mysql ./bin/mysqld --user=mysql \
    --pid-file=/usr/local/mysql/mysqld.pid \
    --socket=/usr/local/mysql/mysqld.sock \
    --port=3307 \
    --basedir=/usr/local/mysql \
    --datadir=/usr/local/mysql/data \
    --lc-messages-dir=/usr/local/mysql/share \
    --tmpdir=/tmp \
    --skip-external-locking \
    --bind-address=127.0.0.1 \

nareshv@fallenangel:/usr/local/mysql-5.5.30-tokudb-7.0.1-linux-x86_64$

4. Run the mysql server in another terminal as root user

nareshv@fallenangel:/usr/local/mysql-5.5.30-tokudb-7.0.1-linux-x86_64$ sudo ./run.sh

5. Connect and check if mysql is available on 3307 / 127.0.0.1

nareshv@fallenangel:/usr/local/mysql-5.5.30-tokudb-7.0.1-linux-x86_64$ mysql -u root -h 127.0.0.1 -P 3307
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.5.30-tokudb-7.0.1 MySQL Community Server (GPL)

Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| test               |
+--------------------+
4 rows in set (0.00 sec)

mysql> quit
Bye

Confirm that variables point to /usr/share/mysql only
mysql> show variables like '%dir%';
+-----------------------------------------+-------------------------------------------------------------------+
| Variable_name                           | Value                                                             |
+-----------------------------------------+-------------------------------------------------------------------+
| basedir                                 | /usr/local/mysql                                                  |
| binlog_direct_non_transactional_updates | OFF                                                               |
| character_sets_dir                      | /usr/local/mysql-5.5.30-tokudb-7.0.1-linux-x86_64/share/charsets/ |
| datadir                                 | /usr/local/mysql/data/                                            |
| innodb_data_home_dir                    | /usr/local/mysql/data                                             |
| innodb_log_group_home_dir               | /usr/local/mysql/data                                             |
| innodb_max_dirty_pages_pct              | 75                                                                |
| lc_messages_dir                         | /usr/local/mysql/share/                                           |
| plugin_dir                              | /usr/local/mysql-5.5.30-tokudb-7.0.1-linux-x86_64/lib/plugin/     |
| slave_load_tmpdir                       | /tmp                                                              |
| tmpdir                                  | /tmp                                                              |
| tokudb_data_dir                         |                                                                   |
| tokudb_directio                         | OFF                                                               |
| tokudb_log_dir                          |                                                                   |
| tokudb_tmp_dir                          |                                                                   |
+-----------------------------------------+-------------------------------------------------------------------+
15 rows in set (0.00 sec)

Friday, May 17, 2013

Install HHVM (Hiphop PHP) on Centos 6.4 (64-bit)

UPDATED: 10/July/2013 - Fixed the errors which are causing repo not available. Sorry for the trouble.

UPDATEd: 19/Oct/2013 - HHVM 2.2.0 Release is available now

UPDATED: 18/Dec/2013 - HHVM 2.3.0 Release is available now  

UPDATED: 14/Apr/2014 - HHVM 3.0.1 Release is available now

I have created a repository and compiled HHVM (v2 of HPHP) rpm packages. Follow these steps to get started.

1. Install Centos 6.x (minimal is preferred)

2. Install epel repository

sudo yum install http://ftp.riken.jp/Linux/fedora/epel/6/i386/epel-release-6-8.noarch.rpm

(or get the latest version from http://ftp.riken.jp/Linux/fedora/epel/6/i386/repoview/epel-release.html)

3. download the hop5 repository configuration file

cd /etc/yum.repos.d

sudo wget http://www.hop5.in/yum/el6/hop5.repo
 
If you are here after Mar-2014, use hhvm as package name instead of hiphop-php

4. Install hiphop-php
sudo yum install hiphop-php

5. Follow the instructions at https://github.com/facebook/hiphop-php to get started


Please note that, i have compiled the required rpms from fedora distribution. DO NOT FILE ANY BUGS WITH CENTOS/FEDORA regarding the rpms that you are about to install from this repoisitory.

Sunday, November 20, 2011

Fixing Redmine user page-load-error on Debian 6

For those who are using redmine on debian-6.0, and using redmine might see problem using it, when we try to visit the user page.

Error look something like this.


ActionView::TemplateError (undefined method `html_safe' for "user@mycompany.com":String) on line #10 of app/views/users/show.rhtml:
Solution to this problem is to apply this patch.



redmine-server:/usr/share/redmine# diff /usr/lib/ruby/1.8/action_view/helpers/url_helper.rb /usr/lib/ruby/1.8/action_view/helpers/url_helper.rb.orig 476,477c476<           #html = content_tag("a", name || email_address_obfuscated.html_safe, html_options.merge({ "href" => "mailto:"+html_escape(email_address)+extras }))<                 html = content_tag("a", name || html_escape(email_address_obfuscated), html_options.merge({ "href" => "mailto:"+html_escape(email_address)+extras }))--->           html = content_tag("a", name || email_address_obfuscated.html_safe, html_options.merge({ "href" => "mailto:"+html_escape(email_address)+extras }))mdserver1:/usr/share/redmine# 

Monday, October 31, 2011

Building Facebook's HipHop on Fedora 15

Facebook has opensourced their Hiphop code transformer. Simply put Hiphop transforms your code written in PHP Language into Machine Language. So this post is mainly for PHP Developers and Others who want to get their hands dirty with Hiphop on Fedora 15.

Before you get started. Please visit the main home page of the hiphop Project itself.

On github you see the list of all the pre-requisites. First lets get our development environment ready.


Prerequisites.

You need a Fedora 15 64-bit installation. You need not install anything. Just install the Live CD and follow these steps to get the things done.

1. Install the Fedora Packager packages


[root@nareshv-build64 ~]# yum groupinstall "Fedora Packager"


2. Make sure you have git and c++ compiler


[root@nareshv-build64 ~]# yum install gcc-c++ git wget 


3. Install all the pre-requisites as mentioned in the hiphop wiki

[root@nareshv-build64 ~]# yum install zlib-devel   \
xorg-x11-devel   \
libXau-devel   \
libxcb-devel   \
libX11-devel   \
libXpm-devel   \
freetype-devel   \
fontconfig-devel   \
libcom_err-devel   \
libjpeg-turbo   \
2:libpng-devel   \
libsepol-devel   \
libselinux-devel   \
keyutils-libs   \
krb5-devel   \
openssl-devel   \
mysql-devel   \
gd-devel   \
boost-devel   \
libcap-devel   \
oniguruma-devel   \
pcre-devel   \
libicu-devel   \
binutils-devel   \
libxml2-devel   \
libmcrypt-devel   \
expat-devel   \
libstdc++-devel   \
glibc-devel   \
tbb-devel   \
cyrus-sasl   \
libmemcached-devel   \
bzip2-devel   \
openldap-devel   \
ncurses-devel   \
readline-devel   \
pam-devel   \
uw-imap-devel   \
systemtap-sdt   \
libaio-devel   \
mysql-devel   \
jemalloc-devel


4. Now we have to build libevent-1.4 and curl packages on our own as facebook has made some patches to those packages.

5. Lets create the environment for building the packages

6. Create workspace for checking out the hiphop source code.


[root@nareshv-build64 ~]# cd $HOME/
[root@nareshv-build64 ~]# mkdir -p $HOME/dev/hiphop/ $HOME/dev/hiphop/usr
[root@nareshv-build64 ~]# cd $HOME/dev/hiphop


7. Checkout the hiphop source code


[root@nareshv-build64 ~]# cd $HOME/dev/hiphop/ && git clone git://github.com/facebook/hiphop-php.git



8. Download curl and libevent for building locally


[root@nareshv-build64 ~]# cd $HOME/dev/hiphop/
[root@nareshv-build64 hiphop]# wget http://curl.haxx.se/download/curl-7.20.0.tar.bz2
[root@nareshv-build64 hiphop]# wget http://www.monkey.org/~provos/libevent-1.4.13-stable.tar.gz

[root@nareshv-build64 hiphop]# tar jxf curl-7.20.0.tar.bz2
[root@nareshv-build64 hiphop]# tar zxf libevent-1.4.13-stable.tar.gz

[root@nareshv-build64 hiphop]# cd libevent-1.4.13-stable
[root@nareshv-build64 libevent-1.4.13-stable]# cp ../hiphop-php/src/third_party/libevent-1.4.13.fb-changes.diff .
[root@nareshv-build64 libevent-1.4.13-stable]# patch < libevent-1.4.13.fb-changes.diff
[root@nareshv-build64 libevent-1.4.13-stable]# export CMAKE_PREFIX_PATH=$HOME/dev/hiphop/usr
[root@nareshv-build64 libevent-1.4.13-stable]# make
[root@nareshv-build64 libevent-1.4.13-stable]# make install
[root@nareshv-build64 libevent-1.4.13-stable]# cd $HOME/dev/hiphop/

[root@nareshv-build64 hiphop]# cd curl-7.20.0
[root@nareshv-build64 curl-7.20.0]# cp ../hiphop-php/src/third_party/libcurl.fb-changes.diff .
[root@nareshv-build64 curl-7.20.0]# patch -p0 < libcurl.fb-changes.diff

# While applying patch, it will ask for which file to patch. Type in the names without the .new and .old paths. 
# Example: include/curl/multi.h and 
# Example: lib/multi.c
# After this, patch will be applied correctly.

[root@nareshv-build64 curl-7.20.0]# ./configure --prefix=$HOME/dev/hiphop/usr/
[root@nareshv-build64 curl-7.20.0]# make
[root@nareshv-build64 curl-7.20.0]# make install
[root@nareshv-build64 curl-7.20.0]# cd $HOME/dev/hiphop/


9. Now get ready to build hiphop itself


[root@nareshv-build64 curl-7.20.0]# cd $HOME/dev/hiphop/hiphop-php
[root@nareshv-build64 hiphop-php]# export CMAKE_PREFIX_PATH=$HOME/dev/hiphop/usr/
[root@nareshv-build64 hiphop-php]# git submodule init
[root@nareshv-build64 hiphop-php]# git submodule update
[root@nareshv-build64 hiphop-php]# export HPHP_HOME=`pwd`
[root@nareshv-build64 hiphop-php]# export HPHP_LIB=`pwd`/bin
[root@nareshv-build64 hiphop-php]# cmake .
[root@nareshv-build64 hiphop-php]# make


10. You will encounter some errors related to 'c-client version should be higher than 2007'.

On fedora the package is called libc-client and libc-client-devel and the includes are present in /usr/include/imap/ folders.

Lets adjust the CMakeCache.txt like this.

[root@nareshv-build64 hiphop-php]# cd $HOME/dev/hiphop/hiphop-php/
[root@nareshv-build64 hiphop-php]# vim CMakeCache.txt

 71 //Path to a file.CCLIENT_INCLUDE_PATH:PATH=CCLIENT_INCLUDE_PATH-NOTFOUND
 72 CCLIENT_INCLUDE_PATH:PATH=/usr/include/imap/
 73 
 74 //Path to a library.CCLIENT_LIBRARY:FILEPATH=CCLIENT_LIBRARY-NOTFOUND
 75 CCLIENT_LIBRARY:FILEPATH=/usr/lib64/libc-client.so.2007


11. Build again.

[root@nareshv-build64 hiphop-php]# cd $HOME/dev/hiphop/hiphop-php/
[root@nareshv-build64 hiphop-php]# cmake .
[root@nareshv-build64 hiphop-php]# make


12. Now it will fail at mysql related references like this


[ 88%] Building CXX object src/hphp/CMakeFiles/hphp.dir/externals.cpp.o
Linking CXX executable hphp
../../bin/libhphp_runtime.a(ext_mysql.cpp.o): In function `HPHP::php_mysql_do_query_general(HPHP::String const&, HPHP::Variant const&, bool)':
ext_mysql.cpp:(.text+0x8109): undefined reference to `cli_safe_read'
ext_mysql.cpp:(.text+0x822c): undefined reference to `net_field_length'
ext_mysql.cpp:(.text+0x83a0): undefined reference to `cli_safe_read'
ext_mysql.cpp:(.text+0x8675): undefined reference to `free_root'
collect2: ld returned 1 exit status
gmake[2]: *** [src/hphp/hphp] Error 1
gmake[1]: *** [src/hphp/CMakeFiles/hphp.dir/all] Error 2
gmake: *** [all] Error 2


After investigating for a couple of hours. found that this issue is related to the way mysql rpm is built in fedora distribution. Somehow i managed to overcome this problem by doing the following things.

12.1 Download the mysql .src.rpm from koji

I went to http://koji.fedoraproject.org/koji/buildinfo?buildID=268920

and downloaded the following .src.rpm

http://kojipkgs.fedoraproject.org/packages/mysql/5.5.16/3.fc17/src/mysql-5.5.16-3.fc17.src.rpm

12.2 Install the .src.rpm as 'fedora' user (It can be root also. I did it as fedora user. But you got the point)


[root@nareshv-build64 hiphop-php]# rpm -Uvh mysql-5.5.16-3.fc17.src.rpm


12.3 Update the libmysql.version file


[root@nareshv-build64 hiphop-php]# cd /home/fedora/rpmbuild/SOURCES/
[root@nareshv-build64 SOURCES]# ls
filter-requires-mysql.sh    mysql-disable-test.patch     mysql-errno.patch          mysql-strmov.patch
generate-tarball.sh         mysqld-nowatch.patch         mysql-expired-certs.patch  mysql.tmpfiles.d
libmysql.version            mysqld-prepare-db-dir        mysql-install-test.patch   mysql-va-list.patch
my.cnf                      mysqld.service               mysql-openssl-test.patch   mysql-versioning.patch
my_config.h                 mysql-dubious-exports.patch  mysql-plugin-bool.patch    README.mysql-docs
mysql-5.5.16-nodocs.tar.gz  mysqld-wait-ready            mysql-s390-tsc.patch       README.mysql-license
mysql-chain-certs.patch     mysql-embedded-check.c       mysql-stack-guard.patch    scriptstub.c
[root@nareshv-build64 SOURCES]# tail libmysql.version 
 mysql_get_charset_by_csname;
 mysql_net_realloc;
# PHP's mysqli.so requires this (via the ER() macro)
 mysql_client_errors;
# Hiphop needs it
 cli_safe_read;
 net_field_length;
 cli_safe_read;
 free_root;
};


12.4 Rebuild the RPM

[fedora@nareshv-build64 SOURCES]$ rpmbuild -bb ../SPECS/mysql.spec 
...
...
Wrote: /home/fedora/rpmbuild/RPMS/x86_64/mysql-5.5.16-3.fc15.x86_64.rpm
Wrote: /home/fedora/rpmbuild/RPMS/x86_64/mysql-libs-5.5.16-3.fc15.x86_64.rpm
Wrote: /home/fedora/rpmbuild/RPMS/x86_64/mysql-server-5.5.16-3.fc15.x86_64.rpm
Wrote: /home/fedora/rpmbuild/RPMS/x86_64/mysql-devel-5.5.16-3.fc15.x86_64.rpm
Wrote: /home/fedora/rpmbuild/RPMS/x86_64/mysql-embedded-5.5.16-3.fc15.x86_64.rpm
Wrote: /home/fedora/rpmbuild/RPMS/x86_64/mysql-embedded-devel-5.5.16-3.fc15.x86_64.rpm
Wrote: /home/fedora/rpmbuild/RPMS/x86_64/mysql-bench-5.5.16-3.fc15.x86_64.rpm
Wrote: /home/fedora/rpmbuild/RPMS/x86_64/mysql-test-5.5.16-3.fc15.x86_64.rpm

Wrote: /home/fedora/rpmbuild/RPMS/x86_64/mysql-debuginfo-5.5.16-3.fc15.x86_64.rpm
Executing(%clean): /bin/sh -e /var/tmp/rpm-tmp.I5L4qW
+ umask 022
+ cd /home/fedora/rpmbuild/BUILD
+ cd mysql-5.5.16
+ rm -rf /home/fedora/rpmbuild/BUILDROOT/mysql-5.5.16-3.fc15.x86_64
+ exit 0


12.5 Install the RPM Files happily


[root@nareshv-build64 SOURCES]# yum install /home/fedora/rpmbuild/RPMS/x86_64/mysql-libs-5.5.16-3.fc15.x86_64.rpm \
/home/fedora/rpmbuild/RPMS/x86_64/mysql-5.5.16-3.fc15.x86_64.rpm \
/home/fedora/rpmbuild/RPMS/x86_64/mysql-devel-5.5.16-3.fc15.x86_64.rpm -y --nogpg


13. Now build hiphop again

[root@nareshv-build64 hiphop-php]# cd $HOME/dev/hiphop/hiphop-php/
[root@nareshv-build64 hiphop-php]# gmake clean
[root@nareshv-build64 hiphop-php]# cmake .
[root@nareshv-build64 hiphop-php]# make


14. You should have the binary created

[root@nareshv-build64 hiphop-php]# src/hphp/hphp -h | head
Error in command line: unknown option -h\n\n
HipHop Compiler for PHP Usage:

 hphp  

Options:
  --help                         display this message
  --version                      display version number
  -t [ --target ] arg (=run)     lint | analyze | php | cpp | sep-ext-cpp | 
                                 filecache | run (default)
  -f [ --format ] arg            lint: (none); 


15. Now continue with the rest of the tutorial on how to get your code compiled in the main hiphop project page itself.

Wednesday, June 29, 2011

Node.js on Fedora 15

Since currently there is no easy way to install node.js via yum repository. Here is how you can quickly get the node.js installed on your fedora-15 box

1. Install fedora packager rpms (as root)



[nareshv@localhost SRPMS]$ sudo yum groupinstall "Fedora Packager"



2. Create the setup environment for building RPM (for non-root users)



[nareshv@localhost ~]$ rpmdev-setuptree



3. Download the SRPM (as nonroot)



[nareshv@localhost ~]$ cd rpmbuild/SRPMS/
[nareshv@localhost SRPMS]$ ls
[nareshv@localhost SRPMS]$ wget http://v3.sk/~lkundrak/SRPMS/nodejs-0.4.1-1.el6.src.rpm
--2011-06-29 22:18:50-- http://v3.sk/~lkundrak/SRPMS/nodejs-0.4.1-1.el6.src.rpm
Resolving v3.sk... 91.210.183.14
Connecting to v3.sk|91.210.183.14|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 4859437 (4.6M) [application/x-rpm]
Saving to: ânodejs-0.4.1-1.el6.src.rpmâ

100%[====================================================>] 4,859,437 600K/s in 11s

2011-06-29 22:19:03 (444 KB/s) - nodejs-0.4.1-1.el6.src.rpm



4. Install the dependencies for the RPM (as root)



[nareshv@localhost SRPMS]$ sudo yum install openssl-devel v8-devel c-ares-devel \
libev-devel libeio-devel http-parser-devel \
waf libgpg-error-devel \
libstdc++-devel gcc-c++ -y




5. Build the RPM (as non-root)



[nareshv@localhost SRPMS]$ rpmbuild --rebuild nodejs-0.4.1-1.el6.src.rpm
...
...
...
Executing(%doc): /bin/sh -e /var/tmp/rpm-tmp.OWCyPT
+ umask 022
+ cd /home/nareshv/rpmbuild/BUILD
+ cd node-v0.4.1
+ DOCDIR=/home/nareshv/rpmbuild/BUILDROOT/nodejs-0.4.1-1.el6.x86_64/usr/share/doc/nodejs-0.4.1
+ export DOCDIR
+ rm -rf /home/nareshv/rpmbuild/BUILDROOT/nodejs-0.4.1-1.el6.x86_64/usr/share/doc/nodejs-0.4.1
+ /bin/mkdir -p /home/nareshv/rpmbuild/BUILDROOT/nodejs-0.4.1-1.el6.x86_64/usr/share/doc/nodejs-0.4.1
+ cp -pr ChangeLog LICENSE README.md doc /home/nareshv/rpmbuild/BUILDROOT/nodejs-0.4.1-1.el6.x86_64/usr/share/doc/nodejs-0.4.1
+ exit 0
Requires(rpmlib): rpmlib(CompressedFileNames) <= 3.0.4-1 rpmlib(FileDigests) <= 4.6.0-1 rpmlib(PayloadFilesHavePrefix) <= 4.0-1
Requires: http_parser.so.0()(64bit) libc.so.6()(64bit) libc.so.6(GLIBC_2.14)(64bit) libc.so.6(GLIBC_2.2.5)(64bit) libc.so.6(GLIBC_2.3.4)(64bit) libc.so.6(GLIBC_2.4)(64bit) libcares.so.2()(64bit) libcrypto.so.10()(64bit) libdl.so.2()(64bit) libdl.so.2(GLIBC_2.2.5)(64bit) libeio.so.1()(64bit) libev.so.4()(64bit) libgcc_s.so.1()(64bit) libgcc_s.so.1(GCC_3.0)(64bit) libm.so.6()(64bit) libpthread.so.0()(64bit) libpthread.so.0(GLIBC_2.2.5)(64bit) librt.so.1()(64bit) libssl.so.10()(64bit) libstdc++.so.6()(64bit) libstdc++.so.6(CXXABI_1.3)(64bit) libstdc++.so.6(GLIBCXX_3.4)(64bit) libutil.so.1()(64bit) libutil.so.1(GLIBC_2.2.5)(64bit) libv8-3.0.0.1.so()(64bit) libz.so.1()(64bit) rtld(GNU_HASH)
Processing files: nodejs-devel-0.4.1-1.fc15.x86_64
Provides: pkgconfig(nodejs) = 0.3.2
Requires(rpmlib): rpmlib(CompressedFileNames) <= 3.0.4-1 rpmlib(FileDigests) <= 4.6.0-1 rpmlib(PayloadFilesHavePrefix) <= 4.0-1
Requires: /usr/bin/pkg-config
Processing files: nodejs-debuginfo-0.4.1-1.fc15.x86_64
Checking for unpackaged file(s): /usr/lib/rpm/check-files /home/nareshv/rpmbuild/BUILDROOT/nodejs-0.4.1-1.el6.x86_64
Wrote: /home/nareshv/rpmbuild/RPMS/x86_64/nodejs-0.4.1-1.fc15.x86_64.rpm
Wrote: /home/nareshv/rpmbuild/RPMS/x86_64/nodejs-devel-0.4.1-1.fc15.x86_64.rpm
Wrote: /home/nareshv/rpmbuild/RPMS/x86_64/nodejs-debuginfo-0.4.1-1.fc15.x86_64.rpm
Executing(%clean): /bin/sh -e /var/tmp/rpm-tmp.ume4Ra
+ umask 022
+ cd /home/nareshv/rpmbuild/BUILD
+ cd node-v0.4.1
+ rm -rf /home/nareshv/rpmbuild/BUILDROOT/nodejs-0.4.1-1.el6.x86_64
+ exit 0
Executing(--clean): /bin/sh -e /var/tmp/rpm-tmp.goIXqg
+ umask 022
+ cd /home/nareshv/rpmbuild/BUILD
+ rm -rf node-v0.4.1
+ exit 0



6. Install the RPM (as root)



[nareshv@localhost SRPMS]$ sudo yum install /home/nareshv/rpmbuild/RPMS/x86_64/nodejs-0.4.1-1.fc15.x86_64.rpm --nogpg -y




7. Start node.js



[nareshv@localhost ~]$ node
> console.log("hello world!")
hello world!
>



Thats it!. Now you have node.js installed on your box.

Have a look at list of plugins and start playing with them.

Monday, June 06, 2011

Smashing Book 2



I really love the new Smashing Book 2.

I have placed the order, the moment they released it to everyone. Somehow for the first two times i never got the book. Third time i got the book and here is it.

I really really thank the Smashing Team for their efforts. Kudos to you guys n gals !