Sunday, 23 October 2016

Unable to send mails from Linux servers

Here are the steps to configure sendmail ..  In case if you notice the setup is missing on any of the servers..
keep these commands handy..

1.       Backup sendmail.mc
cp -p /etc/mail/sendmail.mc /etc/mail/sendmail.mc_orig
2.    Modify the external smtp server (uncommenting the line and updating the value )
dnl define(`SMART_HOST', `smtp.your.provider')dnl
to
define(`SMART_HOST', `mail.global.frontbridge.com')dnl

3.    Compile
make all

4.    Restart sendmail service
(OEL - 7)
systemctl start sendmail
systemctl enable sendmail

Lower versions
/etc/init.d/sendmail restart
(or)
/etc/init.d/sendmail start

Sunday, 9 October 2016

VirtualBOX error /tmp/vbox.0/Makefile.include.header:97: *** Error: unable to find the sources of your current Linux kernel. Specify KERN_DIR=

During the installation of “Insert Guest Additions CD Image” everytime it was failing.  The purpose of installing is will help us in free movement of cursor(mouse pointer) from host to guest and vice versa without using right CTRL key. Everytime if we want to move our cursor from guest to host or host to guest we need to press right CTRL key.
I am running my host on Windows7
and Guest running on OEL6.4
When i was installing i see below error:
vbox
When i checked the log file mention in the above screen, i see below error.
Creating udev rule for the Guest Additions kernel module.
/tmp/vbox.0/Makefile.include.header:97: *** Error: unable to find the sources of your current Linux kernel. Specify KERN_DIR=<directory> and run Make again. Stop.
Creating user for the Guest Additions.
To overcome this error update gcc using
1.yum update gcc
2. yum update
3. yum install kernel-uek-devel
*Please note that to execute “yum” your guest vmbox should have internet connection
now after doing all the above I again executed ./VMBoxLinuxAdditions.run
successYes I am able to successfully finish the Insert VMBox Guest Addition CD Image on Virtual Guest

Step By Step OEL 6.4 Install

In this post i will list out all the steps to Install OEL 6.4.
Download the software from edelivery.oracle.com
1a
1
Select Install or Upgrade the existing System23
Select Skip4567
8
9
10
11
12
1314
1516
1718
19
202122 24
252627282930313233
Login with root. Once login disable the firewall.
34

Monday, 30 May 2016

How Shell Locates the file

To run script, you need to have in the same directory where you created your script, if you are in different directory your script will not run (because of path settings), For e.g.. Your home directory is ( use $ pwd to see current working directory) /home/vivek. Then you created one script called 'first', after creation of this script you moved to some other directory lets say /home/vivek/Letters/Personal, Now if you try to execute your script it will not run, since script 'first' is in /home/vivek directory, to overcome this problem there are two ways first, specify complete path of your script when ever you want to run it from other directories like giving following command
$ /bin/sh   /home/vivek/first 

Now every time you have to give all this detailed as you work in other directory, this take time and you have to remember complete path. 
There is another way, if you notice that all of our programs (in form of executable files) are marked as executable and can be directly executed from prompt from any directory. (To see executables of our normal program give command $ ls -l /bin ) By typing commands like
$ bc
$ cc myprg.c
$ cal 

etc, How its possible? All our executables files are installed in directory called /bin and /bin directory is set in your PATH setting, Now when you type name of any command at $ prompt, what shell do is it first look that command in its internal part (called as internal command, which is part of Shell itself, and always available to execute), if found as internal command shell will execute it, If not found It will look for current directory, if found shell will execute command from current directory, if not found, then Shell will Look PATH setting, and try to find our requested commands executable file in all of the directories mentioned in PATH settings, if found it will execute it, otherwise it will give message "bash: xxxx :command not found", Still there is one question remain can I run my shell script same as these executables?, Yes you can, for this purpose create bin directory in your home directory and then copy your tested version of shell script to this bin directory. After this you can run you script as executable file without using command like
$ /bin/sh   /home/vivek/first 

Command to create you own bin directory.
$ cd
$ mkdir bin
$ cp first ~/bin
$ first
Each of above commands can be explained as follows:

Each of above commandExplanation
$ cdGo to your home directory
$ mkdir binNow created bin directory, to install your own shell script, so that script can be run as independent program or can be accessed from any directory
$ cp   first ~/bincopy your script 'first' to your bin directory
$ firstTest whether script is running or not (It will run)

vi editor command list

For this PurposeUse this vi Command Syntax
To insert new textesc + i ( You have to press 'escape' key then 'i')
To save fileesc + : + w (Press 'escape' key  then 'colon' and finally 'w')
To save file with file name (save as)esc + : + w  "filename"
To quit the vi editoresc + : + q
To quit without savingesc + : + q!
To save and quit vi editoresc + : + wq
To search for specified word in forward directionesc + /word (Press 'escape' key, type /word-to-find, for e.g. to find word 'shri', type as
/shri)
To continue with search n
To search for specified word in backward directionesc + ?word (Press 'escape' key, type word-to-find)
To copy the line where cursor is locatedesc + yy
To paste the text just deleted or copied at the cursoresc + p
To delete entire line where cursor is locatedesc + dd
To delete word from cursor positionesc + dw
To Find all occurrence of given word and Replace then globally without confirmation esc + :%s/word-to-find/word-to-replace/gFor. e.g. :%s/mumbai/pune/g
Here word "mumbai" is replace with "pune"
To Find all occurrence of given word and Replace then globally with confirmationesc + :%s/word-to-find/word-to-replace/cg
To run shell command like ls, cp or date etc within viesc + :!shell-command

For e.g. :!pwd