docker run hello-world

Virtualization is the latest Trend and it’s happening everywhere. We started with virtualising hardware and soon realised its over-kill. Realisation is the starting of change. It resulted in a light weight version of virtualization: Linux-Containers or LXC . They are getting adopted Industry wide.

LXC is the solution but what is the tool!!!

One of the most accepted tool is Docker

LXC makes use of the kernel functionalities of cgroup and kernel-namespace. It virtualises at the operating system level and makes it less costlier than its predecessor.

So let’s try setting-up docker and run hello-world, our very old custom..

fyi: Docker makes use of virtualbox. For OSX you may download the package (.pkg) from boot2docker/osx-installer and double-clicking it installs both virtualbox and docker. For other OS/platforms, you may follow instructions from docker-installation-guide.

Once the installation is complete, use splotligt (⌘-Space bar) to open boot2docker.

It opens terminal and runs the initialisation steps and generates encryption keys.

Screen Shot 2015-07-15 at 10.21.51 pm

The terminal is left to you after that.

Lets spin up the VM now.

boot2docker start

Display the docker environment variables to see if the certificate path are set right.

boot2docker shellinit

`To set the environment variables displayed with the above command, run the above command with ‘eval’

eval "$(boot2docker shellinit)" 
or 
$(boot2docker shellinit)

We are ready for the final run..

boot2docker run hello-world

You should now be seeing the output of hello-world.

Screen Shot 2015-07-15 at 10.45.51 pm

 

If things didn’t go well and you want to start again deleting the current vm, run the below set of commands in order.

boot2docker delete
boot2docker init
boot2docker start
$(boot2docker shellinit)
boot2docker run hello-world

LDAP_CONTROL_RELAX undeclared while installing python-ldap

ERROR:

Modules/constants.c: In function ‘LDAPinit_constants’:
Modules/constants.c:158: error: ‘LDAP_OPT_DIAGNOSTIC_MESSAGE’ undeclared (first use in this function)
Modules/constants.c:158: error: (Each undeclared identifier is reported only once
Modules/constants.c:158: error: for each function it appears in.)
Modules/constants.c:380: error: ‘LDAP_CONTROL_RELAX’ undeclared (first use in this function)
error: command ‘gcc’ failed with exit status 1

 

Solution:
Install openldap24-libs & openldap24-libs-devel :
sudo yum install openldap24-libs-devel
sudo yum install openldap24-libs

Run the below commands and get the unique list of directories from the output:
Add those folders to setup.cfg file in the below section:
[_ldap]
library_dirs = /opt/openldap-RE24/lib /usr/lib
include_dirs = /opt/openldap-RE24/include /usr/include/sasl /usr/include

Now run the installation command:
python setup.py install

Apache httpd: APR not found; error while installation

During Apache httpd installation if you get below error, that means Apache Portable Run-time environment was not found or not installed.

checking for APR... no
configure: error: APR not found.  Please read the documentation.

and/or

checking for APR-util... no
configure: error: APR-util not found. Please read the documentation.

So install APR and APR-util and give httpd those paths. Httpd will be happy to run for you after that… 🙂

Go further if you want to know how to install APR.

You can download APR and APR-util from here.

Then extract those to separate folders.

First change to the extract APR directory and install it. (Tip: cd command to change directory)

sudo ./configure --prefix=<apr-path>

sudo make

sudo make install

So you have a working APR. Next is APR-util.

Change to the extract APR-Util directory and install it. (Tip: cd command to change directory)

sudo ./configure --prefix=<apr-util-path> --with-prefix=<apr-path>

sudo make

sudo make instal

Install zlib packages with the command (optional; you can turn this off at your will):

yum install zlib zlib-devel

Apart from APR and APR-Util, you may need to install pcre too. So download it from here first.

Change to the directory and use the below commands to install.

sudo ./configure --prefix=<pcre-path>

sudo make

sudo make install

Now lets make httpd understand that we have a working pcre, APR and APR-util.

./configure --enable-file-cache --enable-cache --enable-disk-cache --enable-mem-cache --enable-deflate --enable-expires --enable-headers --enable-usertrack --enable-cgi --enable-vhost-alias --enable-rewrite --enable-so --prefix=<httpd-path> --with-apr=<apr-path> --with-apr-util=<apr-util-path> --with-pcre=<pcre-path>

# Rest is history make make install