Friday, 9 May 2014

Insatall Docker

To install Docker on CentOS, first enable EPEL repository, and then use yum command:
$ sudo yum install docker-io
$ sudo service docker start
$ sudo chkconfig docker on
To install Docker on Fedora, use the following commands:
$ sudo yum install docker-io
$ sudo systemctl start docker.service
$ sudo systemctl enable docker.service
After installing Docker on CentOS or Fedora, you need to add yourself to docker group to be able to run Docker as a non-root user. Use this command for that:
$ sudo usermod -a -G docker $USER
Log out, and log back in to activate the group change.
At this point, you should be able to run docker command as a unprivileged user.

Basic Usage of Docker

To start a new Docker container, you need to decide which Docker image to use for the container. You can search the official Docker image index which lists publicly available Docker images. The Docker index includes Linux base images managed by Docker team (e.g., UbuntuDebianFedoraCentOS), as well as user-contributed custom images (e.g.,MySQLRedisWordPress).
For example, to start a Ubuntu container in the interactive mode, run the following command. The last argument '/bin/bash' is to be executed inside a container upon its launch.
$ docker run -i -t ubuntu /bin/bash
The first time you run the above command, it will download available Ubuntu docker image(s) over networks, and then boot up a Docker container using the image. A Ubuntu container will boot up instantly, and you will see a console prompt inside the container. You can access a full-fledged Ubuntu operating system inside the container sandbox.
If you type 'exit' at the prompt, you will get out of the container, and it will be stopped.
To get a list of all containers (including stopped ones), run:
$ docker ps -a
CONTAINER ID        IMAGE               COMMAND             CREATED              STATUS              PORTS               NAMES
6a08a0b2bb4c        ubuntu:14.04        /bin/bash           About a minute ago   Exit 0                                  cocky_ritchie
To re-start a stopped container in daemon mode:
$ docker start [container-id]
To remove a stopped container:
$ docker rm [container-id]
To attach to a background-running container in order to view or interact with the container:
$ docker attach [container-id]
You can freely customize a running container (e.g., installing new software). If you want to save the changes in the current container, first get out of the container's interactive mode by typing "exit" at the prompt. Then save the changed image as a different image by using this command:
$ docker commit [container-id] [new-image-name]
To get the container ID of your container, you can use "docker ps -a" command as described earlier.
Once you have created a new image like this, you can launch a new container off of this image.
You can also download any public container images (e.g., ubuntu, bowery/mysql) and store them in a local repository as follows.
$ docker pull [image name]
To view all locally downloaded/saved container images:
$ docker images
You can choose a specific image to boot a container from:
$ docker run -i -t [image-id] /bin/bash
To remove a container image from the local repository:
$ docker rmi [image-id]

Fancy Bash Prompt in Linux

Configuring a different prompt for SSH sessions is one of my favorites, because it has saved me from many an error due to running a command in the wrong terminal. A dull life without broken servers is not too much to ask. Just add these lines to the ~/.bashrc of your user on the remote machine:
if [ -n "$SSH_CLIENT" ]; then text=" ssh-session"
export PS1='\[\e[1;32m\]\u@\h:\w${text}$\[\e[m\] '
Then load your changes without logging out:
$ source ~/.bashrc
Now open an SSH session from another machine and you will see something like figure 1.
fig-1 green ssh prompt
Figure 1: New SSH session prompt in bold green.

You can even do all of this over SSH so you don't have to get up.


Of course you may choose from a multitude of splendid ANSI colors. You can find ANSI color code charts all over the place. These are the basic colors:
0;30m   Black
0;31m   Red
0;32m   Green
0;33m   Yellow
0;34m   Blue
0;35m   Purple
0;36m   Cyan
0;37m   White
0 is normal font. Change the 0 to 1 for bold, 4 for underline, and 5 for slow blink. In the SSH exampletext=" ssh-session" is whatever text string you want, and the text label is also arbitrary, as long as it matches ${text}.
The Bash shell supports a lot of special characters for customizing the prompt. For example, \u is the username, and \h is the hostname. Other useful special characters are:
\d : the date in "Weekday Month Date" format 
\t : the current time in 24-hour HH:MM:SS format
\w : the current working directory
\s : the name of the shell
\n : newline
\[ : begin a sequence of non-printing characters, for embedding a terminal control sequence into the prompt
\] : end a sequence of non-printing characters
Your custom prompt sequences are hard to read because of all the escapes, but you'll get the hang of it with a little practice. Note how the whole sequence is enclosed in single quotes, and it starts after PS1=.\u@\h: is an example of how to insert punctuation marks after the special characters. Literal punctuation marks are not escaped. You can insert spaces in the same manner; for example, see the closing color code, \[\e[m\] ', which has a space after last square bracket. This creates a space after the dollar sign. This example also shows how to reset the font color back to the terminal default. In the next example you'll see how to set a custom font color on right side of the prompt.
This example creates a pleasant cyan prompt with date and time (figure 2). Note also how you can add square brackets around the prompt, or any part of it, by enclosing the special characters with un-escaped brackets:
$ PS1='\[\e[1;34m\][\d \t \u@\h \w]\$\[\e[m\] '
fig-2 cyan prompt
Figure 2: A pleasant cyan prompt with date and time.

You can go nuts with colors (figure 3):
$ PS1='\[\e[1;36m\]\d \[\e[1;32m\]\t \[\e[1;33m\]\u@\[\e[1;35m\]\h:\w\$\[\e[0;31m\] '
Figure 3: Yikes, it's color riot.

Putting a color code at the end, like \[\e[0;31m\], sets a custom color on anything you type, and everything else that appears after the prompt.

Multi-line Prompt

Most terminals are 80 characters wide, so you run out of room when you have a long prompt. So why not break up the lines? You can with our old friend the newline special character, \n:
PS1='\[\e[1;33m\]\u@\h \w ->\n\[\e[1;36m\] \@ \d\$\[\e[m\] '
This creates a nice prompt with the username, current directory, and time and date (figure 4). It has an arrow to indicate there is another line, and it terminates in a proper dollar sign for an unprivileged user.
fig-4 multiline
Figure 4: A nice multi-line prompt.

Root Prompt

The root prompt is indicated by the hash mark, #. As long as we're making fancy prompts, why not make one for the root user too? Add these lines to both your ~/.bashrc, and to root's/root/.bashrc:
if [ $(id -u) -eq 0 ];
    PS1='\[\e[1;36m\][\d \t \u@\h \w]\$\[\e[m\] '
    PS1='\[\e[1;33m\][\d \t \u@\h \w]\$\[\e[m\] '
You can either sudo or su to root, then source ~/.bashrc, and enjoy root's new fancy prompt. You can fancy up root's prompt just like for any user. A quick way to check any user's ID number is with the ID command:
$ id -u

Put a Fortune in your Prompt

Remember way back when we did Put a Talking Cow in Your Linux Message of the Day? You can also put one in your Bash prompt by adding this line to ~/.bashrc::
[[ "$PS1" ]] && /usr/games/fortune | /usr/games/cowsay -n
Figure 5: Talking cow in your prompt.

~/.bashrc Gotchas

If there is not a ~/.bashrc then create one. On most distros it is sourced from ~/.profile, which you can verify by looking for something like these lines in ~/.profile:
# if running bash
if [ -n "$BASH_VERSION" ]; then
    # include .bashrc if it exists
    if [ -f "$HOME/.bashrc" ]; then
 . "$HOME/.bashrc"
If your particular flavor of Linux does not use ~/.profile, then look for ~/.bash_profile or ~/.bash_login. If it doesn't have those then you have a weird Linux, and must consult your distro documentation to find out what to do.
Feeling lost? You can output your current prompt settings:
$ echo $PS1 

Linux Compatibility with Various File Systems

Linux Compatibility with Various File Systems
Run Linux Natively
Read from Linux
Copy/Move Files
Default SUSE Linux file system. Journaled.
Extended file system. Default for many older Linux systems.
ext2 with journal.
IBM Journaled file system.
Journaled file system originally for SGI IRIX, ported to Linux.
The file system Linus Torvalds ported to the x86 platform.
Network file system.
DOS floppy disk format.
MS-DOS File Allocation Table.
Windows 9x file system.
Windows NT/2000/XP.
NTFS > Linux only.
Macintosh Hierarchical file system.
CD-ROM file system.
Universal Disk Format for DVD-ROM

Saturday, 22 March 2014

IT care

PABX Installation for Avaya, Panasonic, NEC, Cisco & Nortel.

PABX Phone System Installation

We offer a wide range of PBX phone system maintenance support, service, and monitoring plans for systems anywhere in the UAE. We have the ability to customize a support plan that meets your needs and budget that can include any manufacturer's software or technical support offering.
Our support plan includes :
  • Onsite support staff on call basis
  • Post warranty support for Avaya, Nortel, Panasonic, Cisco,NEC
  • Expansion of system by modification of dial plan and adding additional features and modules.
As an expert installer for Avaya, Cisco, Panasonic, Nortel, Shoretel and Digium. We offer a comprehensive array of telecommunication products and maintenance services.
Contact us on  04 2694487 / 055 7763955 or Email for best  telephone system implementation.

Avaya IP Office Telephone system

Avaya IP Office a powerful communications solution for various type of businesses.
Avaya IP Office unifies your communications, providing your employees with a solution that lets them handle all their business communications on the device of their choice.

Panasonic Telephone System

Panasonic range of telephone systems provide best cost effective communications solution for small and medium businesses. The systems provide the features that satisfy the demand of the most sophisticated and cost conscious users.

Copyright ©IT care, All rights reserved.

Saturday, 15 June 2013

About the Blog

 This material may be distributed only subject to the terms and conditions set forth in the Open Publication License, v0.4 or later
I've written this documentation and am providing it free to the Linux community as a public-service. I have made every attempt to ensure that the information contained herein is timely, accurate, and helpful, but in no way will I be held liable for any damage(s) caused directly or indirectly by any misinformation contained herein.
I will not appreciate being flamed for any errors or omissions. However, if you notice a glaring inaccuracy, or have suggestions for further improvement, please, let me know.
This document, currently, should be considered moderate-beta. I began writing it in 1997, and continue to update it as time permits. Development in the Open Source community continues at a rapid pace, and at times it is a challenge to keep this document up to date. As such, this document may have one or more sections which contain obsolete information.
In short, I make no guarantees for any of this information to be correct. If it helps you out, that's great!

Thursday, 13 June 2013


 FAQ on Linux Interview questions 

1 What best describes the purpose of the .htaccess file?

Ans:              To password protect a web directoryTo limit access to the web directory from specified IPsTo override default web
server configuration optionsTo store variables for use by the web server

2 Which of the following commands can you use to see the amount of swap space that is being used on your system?

Ans:              /proc/freefreems/proc/memuse

3 Which of the following entries would you add to the hosts.allow file to give access to the web server from a network of
http: 10.10.10.
smtp: 10.10.10.
http - 10.10.104

4 A process called 'elix' is running with process id 402. 
 Which directory contains information about the process?

6 When you point your web browser to a CGI script you receive an Internal ServerError. Which of the following is least likely to be the cause of the problem?

Incorrect permissions on the CGI script

A failure of the web server
A syntax error in the CGI script

The CGI script printing text before printing the CGI header

ANS: Incorrect permissions on the CGI scriptA failure of the web serverA syntax error in the CGI scriptThe CGI script printing text before printing the CGI header

7 In the /etc/passwd file, what is the significance of an X in the password field?

Ans:              It indicates that the password is  set to X It indicates that the password is shadowed It indicates that the account is  disabled It indicates that the password has yet to be set on this account

8 What is the purpose of the SUID permission?

Ans:              It allows a file to be executed with the supervisor permissionIt allows a file to be executed with the permissions of the ownerIt allows a file to be executed with the permissions of a groupIt allows a file to be executed with the permissions provided on the command line

9 What is the significance of square brackets around a process when looking at alisting produced by the ps command?

Ans:              The process has diedThe task is a kernel task and cannot be killed The task is sleeping