Installing Chef server in your CentOS 6.7 easily.

I have tried to install chef in my CentOS 6.7 but it was like complicated thing till today.

So many problems I have faced and I am giving them as precautions to you.

1. You should have minimum 1 Mbps unlimited connection. Atleast 5 GB data you are going to download.

2. Always you have to choose your current OS version builds, If you choose other version builds you will be stopped with library issues.

3. Atleast 6 - 7 GB of freespace

and Lot of patience.

I will give you in a simple way. Just open your terminal and turn into root user if you were not.

Then Download files from below links. Open them via browser and get the final link and download in your way.

1. https://packagecloud.io/chef/stable/packages/el/6/chef-server-core-12.3.1-1.el6.x86_64.rpm/download

2.https://packagecloud.io/chef/stable/packages/el/6/opscode-reporting-1.5.5-1.el6.x86_64.rpm/download

3.https://packagecloud.io/chef/stable/packages/el/6/opscode-push-jobs-server-1.1.6-1.x86_64.rpm/download

4.https://web-dl.packagecloud.io/chef/stable/packages/el/6/chef-sync-1.0.0~rc.7-1.el6.x86_64.rpm

5. https://packagecloud.io/chef/stable/packages/el/6/chef-manage-2.1.1-1.el6.x86_64.rpm/download

6. https://opscode-omnibus-packages.s3.amazonaws.com/el/6/x86_64/chefdk-0.10.0-1.el6.x86_64.rpm


After download all these files place them in any directory.

Now let us assume these files are in /home/mypc/chef directory.


Step 1:

rpm -ivh chef-server-core-12.3.1-1.el6.x86_64.rpm

chef-server-ctl reconfigure

chef-server-ctl user-create rajachef Raja G raja@myserver.com  abc123 --filename /home/virt01/userkey.pem

Original Syntax : $ chef-server-ctl user-create user_name first_name last_name email password --filename FILE_NAME

chef-server-ctl org-create virt02 "virt02.myserver.com." --association_user virt02 --filename /home/virt02/virt02-validator.pem

Original Syntax: $ chef-server-ctl org-create short_name "full_organization_name" --association_user user_name --filename ORGANIZATION-validator.pem

Step 2: 


chef-server-ctl install opscode-manage --path /home/mypc/chef/chef-manage-2.1.1-1.el6.x86_64.rpm

chef-server-ctl reconfigure

opscode-manage-ctl reconfigure

Step 3: 

chef-server-ctl install opscode-push-jobs-server --path /home/mypc/chef/opscode-push-jobs-server-1.1.6-1.x86_64.rpm

chef-server-ctl reconfigure

opscode-push-jobs-server-ctl reconfigure

Step 4:

chef-server-ctl install chef-sync --path /home/mypc/chef/chef-sync-1.0.0~rc.7-1.el6.x86_64.rpm

chef-server-ctl reconfigure

chef-sync-ctl reconfigure

Step 5: 


chef-server-ctl install opscode-reporting --path /home/mypc/chef/ opscode-reporting-1.5.5-1.el6.x86_64.rpm

chef-server-ctl reconfigure

opscode-reporting-ctl reconfigure

Step 6:


And now install Chef Development Kit.

rpm -ivh chefdk-0.10.0-1.el6.x86_64.rpm

That's it chef server successfully installed in your system. To access chef , just open your browser and type localhost or IP of your PC. And you will get Login page and login with those credentials given initially at Step 1. 

If you are facing any issues please dont hesitate to ask. 

Thank you.

Regards
Raja





Extract log efficiently by using sed

Modification of Log pulling command by using sed

Old command That I use to do log extraction

sed -nre '/12:23:12/,/12:24:12/ p' logfile > /tmp/somelog.txt

But this will take match of given two time stamps at any where in log file.And sometimes from middle of the line which gives obviously wrong log that I need.

So , Now we are modifying sed to look after only at lines starting with timestamp.
It will pull the logs if timestamp exists at beginning of the lines else It wont pull any log.

sed -nre '/^12:23:12/,/^12:24:12/ p' logfile > /tmp/somelog.txt

Note: If you want to make sure that given timestamp existed or not at line starting
you can use

grep -m 5 12:23:12 server.log

The above command ran for 5 first matching of grep and so you can conclude the availability of
given time-stamp in logfile.

For more information please refer sed man page

Hope it will help you.


Reset Gnome 2 panel to default applets

If you ever accidentally remove your Gnome Panel in any Gnome 2.X default DE Linux then,  you can reset it to default with

mv ~/.gconf/apps/panel ~/.gconf/apps/panel.bak

Now restart your Linux and re login. Your gnome panel will be back 🔙.

Hope it helps you.

Changing hostname in CentOS ,Redhat Linux OS

Hello ,

Today lets see an article about changing hostname in CentOS and Redhat.

We have to change hostname in 3 locations to apply changes globally in all locations. 
Configuration filenames :

    

1. /etc/sysconfig/network
2. /etc/hosts
3. hostname command 

1. Open /etc/sysconfig/network with any editor.
           
                                     
# vim /etc/sysconfig/network


And write/modify line as

                                   
HOSTNAME=


Ex: HOSTNAME=centos.virt02.com

close and save file.

2. Open /etc/hosts file  and add as
   

                               
                                # vim /etc/hosts

and add as
                           
192.168.56.101 centos.virt02.com centos


close and save file.

3. Now type command hostname to see current hostname . To assign new hostname

                                 
# hostname=centos.virt02.com



after doing all those steps , restart network with
service network restart


Hope it will help you.

Summary :

[root@localhost Tools]# cat /etc/sysconfig/network
NETWORKING=yes
NETWORKING_IPV6=no
HOSTNAME=centos.virt02.com
[root@localhost Tools]# cat /etc/hosts
127.0.0.1               localhost.localdomain localhost
::1             localhost6.localdomain6 localhost6
192.168.56.101 centos.virt02.com centos
[root@localhost Tools]# hostname
centos.virt02.com
[root@localhost Tools]#


How to avoid ambiguous redirect error in Bash ?

Hello ,

Today I was trying to take Threaddump for my Java process in single command with date and hostname like this

jstack -l `pgrep java` > /tmp/TD_`hostname`_`date`_`pgrep java`

But I am getting error like 

-bash: /tmp/TD_`hostname`_`date`_`pgrep java`: ambiguous redirect

Then I posted at  unix.stackexchange.com and a friend named Muru helped me in fixing that issue with very simple way


$ echo foo > /tmp/TD_`hostname`_`date`_`pgrep java`
bash: /tmp/TD_`hostname`_`date`_`pgrep java`: ambiguous redirect
$ echo foo > /tmp/"TD_`hostname`_`date`_`pgrep java`"
$ ls /tmp/TD*

/tmp/TD_muru-arch_Sat 26 Dec 16:14:29 IST 2015

Summary : Command jstack -`pgrep java` > /tmp/TD_`hostname`_`date`_`pgrep java` is wrong 

and right way of using this is jstack -`pgrep java` > /tmp/"TD_`hostname`_`date`_`pgrep java` "


Hope it will help you. 

Installing latest Git in CentOS 6.7

Hello ,

I am Raja. Today I am writing this article on installing latest Git in CentOS 6.7 via source.

Actually in CentOS 6.7 , we are getting only 1.7.1 version but the latest Git version is git-2.6.3. And while installing I've been through lot of R&D.
Here I am providing you everything in a single article.

Here the avalibale version of git in CentOS 6.7.

[localserver@dhcppc2 ~]$ yum list  git
Loaded plugins: fastestmirror, refresh-packagekit, security
Loading mirror speeds from cached hostfile
 * base: mirrors.vonline.vn
 * extras: mirrors.vonline.vn
 * updates: mirrors.vonline.vn
Available Packages
git.i686                          1.7.1-3.el6_4.1                           base
[localserver@dhcppc2 ~]$

Lets begin with install

1. Create a directory and change into that directory.
mkdir git
cd git

2. Get git downloaded using wget and unrar it
wget https://www.kernel.org/pub/software/scm/git/git-2.6.3.tar.gz
tar -xvf git-2.6.3.tar.gz


and then change into directory
cd git-2.6.3

3.Actually in Linux , source based installation are can done with 3 easy steps and they are

./configure
make
make install ( as root user in the same directory )

When I have started  "./configure" I came to know that gcc has not installed in my CentOS 6.7. so installing it with

 
yum install gcc


Then continued to configure and again I got stucked with


cache.h:21:18: warning: zlib.h: No such file or directory
Can't locate ExtUtils/MakeMaker.pm
/bin/sh: msgfmt: command not found


errors. so to stop all these errors I am giving all libraries in single line

yum install zlib zlib-devel perl-ExtUtils-MakeMaker gettext  gcc -y 

Then run these commands again

./confgure
make
make install (as root)
that's it. Git installation got completed.

Now execute below steps to configure your Git and make sure you have a Git account with same E-mail.

git config --global user.name "Raja Sekhar Reddy G"
git config --global user.email ""

----------------------------------------------------------------------

Till now all we have done installation and configuring of Git . Now lets make a SSH based communication between your localrepo's to your Git account.

1. Generate SSH key with your E-mail of Github account

ssh-keygen -t rsa -b 4096 -C ""


2. Make sure SSH-Agent running , it will help us here with key based authentication.

eval "$(ssh-agent -s)"


from the above command if PID got returned then that means SSH-Agent running

and then execute below command

ssh-add ~/.ssh/id_rsa


3. Now open your Public key with below command and copy it.

cat ~/.ssh/id_rsa.pub

4. Login to your Github account.
Github home page -> Settings -> SSH Keys -> Add SSH Keys

It will open a Input field,  paste your copied key and submit.

5. Come to your terminal and type this

ssh -T git@github.com


You will get similar message like below

Hi rajagennu! You've successfully authenticated, but GitHub does not provide shell access.


Now lets create a localrepo and sync it with Github repo remotely

In your terminal , type as

mkdir Python_Admin
cd Python_Admin/
echo "# Python_Admin" >> README.md
cat README.md
git init
git add README.md
git commit -m "First Commit"
git remote add origin git@github.com:rajagennu/Python_Admin.git
git push -u origin master


Now look at your Github repo. You will see your files there.
For example , you have created file named as : sysload.py

then , lets add to git and push to remote repo

touch sysload.py             # created sysload.py
git add sysload.py           # added into Git repo
git commit -m  "just added local file"                # committing changes to localrepo"
git push -u origin master


Now look at your remoterepo in GitHub. You can find sysload.py file there.

Hope it will helps you.

If you need any help , dont hesitate to ask.

Thank you.










Install Google Chrome in CentOS 6.X

Hello ,

In CentOS 6.X , installing Google Chrome webbrowser is not easy task. We have dependencies issues with  "libstdc++.so.6(GLIBCXX_3.4.15)".

On searching I came to know about Chrome Richardlloyd . By using his script we can install Chrome very easily with in CentOS.

To install it , open your terminal and turn into root user and paste these lines one after one
wget http://chrome.richardlloyd.org.uk/install_chrome.sh
chmod u+x install_chrome.sh
./install_chrome.sh
It will install Google Chrome in your CentOS. 

Note : Google announced , dropping support for 32-Bit google chrome from March 2016. 

How to solve "An unknown FastCGI error occured" error in IIS7 and IIS 7.5 ?

PHP does not work with "An unknown FastCGI error occured" error in IIS 7 / 7.5/ 8 
 Symptoms 
With PHP domains shows the following error: 
HTTP Error 500.0 - Internal Server Error An unknown FastCGI error occurred Error Code 0x800736b1 

FromCommandLinethe following error occur: 
C:\Windows\system32>"C:\Program Files\HSphere\3rdparty\PHP\PHP53\php-cgi.exe" -v The application has failed to start because its side-by-side configuration isin correct. Please see the application event log for more detail.  
In theEventViewerwe could see: 
Activation context generation failed for "c:\program files\hsphere\3rdparty\php\php53\php-cgi.exe". Dependent Assembly Microsoft.VC90.CRT,processorArchitecture="x86",publicKeyToken="1fc8b3b9a1e18e3b",type="win32",version="9.0.21022.8" could not be found. Please use sxstrace.exe for detailed diagnosis.  
Cause 
Windows System Misconfiguration.  
Resolution 
Installing the following updates should resolved the issue.