Wednesday, 21 February 2018

How to change Password by using sh script

Please find below script For change password automatic . set below script in crontab

Create new file .sh

vim  /home/Alert/pass.sh

Enter below line in .sh file

#!/bin/bash
# Change password echo -e "Password\nPassword" | passwd username

Set permission for .sh file

chmod 777 /home/Alert/pass.sh


set script in crontab :-


45 10 * * * /bin/sh /home/Alert/pass.sh


Done

How to install perl modules on linux

Please find below command :-

yum -y install perl-CPAN
perl -MCPAN -e shell
yum install perl-DBD-mysql -y

Then start installation of modules :-

[root@localhost ~]# perl -MCPAN -e shell


Then Enter Below command :-




   




   install "Asterisk::AMI"
   install "asterisk::perl"
   install DBI
   install LWP
   install "Bit::Vector"
   install CGI
   install "Carp::Clan"
   install "Compress::Raw::Bzip2"
   install "Compress::Raw::Zlib"
   install "Config::Abstract"
   install DCOP
   install "Date::Calc"
   install "Device::Gsm"
   install "Device::Modem"
   install "Device::SerialPort"
   install "Email::Date::Format"
   install "Encode::Locale"
   install "ExtUtils::MakeMaker"
   install FCGI
   install "File::Listing"
   install "HTTP::Cookies"
   install "HTTP::Daemon"
   install "HTTP::Date"
   install "HTTP::Message"
   install "HTTP::Negotiate"
   install "IO::Compress::Base"
   install "LWP::MediaTypes"
   install "List::Util"
   install "MIME::Lite"
   install "MIME::Types"
   install "Mail::Lite"
   install "Net::HTTP"
   install Perl
   install "Pod::Simple"
   install Storable
   install "Sub::Uplevel"
   install "Test::Exception"
   install "Test::Pod"
   install "Test::Simple"
   install "Time::Local"
   install "Time::Piece"
   install "Template::Plugin::TimeDate"
   install "WWW::RobotRules"



Done!

Tuesday, 20 February 2018

mount: unknown filesystem type LVM2_member

Please find below :- 

root@zoo:~# mount /dev/sdd2 /home/mukesh
mount: unknown filesystem type 'LVM2_member'

root@zoo:~# fdisk -l /dev/sdd
Disk /dev/sdd: 233.8 GiB, 251000193024 bytes, 490234752 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x0009345d
Device     Boot  Start       End   Sectors   Size Id Type
/dev/sdd1  *        63    208844    208782   102M 83 Linux
/dev/sdd2       208845 488247479 488038635 232.7G 8e Linux LVM
(/dev/sdi1 is /boot partition, /dev/sdi2 is where the /home data resides)

Seems lvm2 tools also provide a way to check if its lvm or not, using lvmdiskscan (/dev/sdd2 here)

root@zoo:~# lvmdiskscan
  /dev/sdb1  [       1.82 TiB]
  /dev/sdc2  [     149.04 GiB]
  /dev/sdd1  [     101.94 MiB]
  /dev/sdd2  [     232.71 GiB] LVM physical volume
  0 disks
  4 partitions
  0 LVM physical volume whole disks
  1 LVM physical volume

Scan LVM

root@zoo:~# lvscan
 inactive '/dev/VolGroup00/LogVol00' [457.75 GiB] inherit
 inactive '/dev/VolGroup00/LogVol01' [1.94 GiB] inherit

Run below command for Activate LVM

root@zoo:~# vgchange -ay

Check Now

root@zoo:~# lvscan
  ACTIVE            '/dev/VolGroup00/LogVol00' [457.75 GiB] inherit
  ACTIVE            '/dev/VolGroup00/LogVol01' [1.94 GiB] inherit

Now mount :

mount /dev/VolGroup00/LogVol00 /home/mukesh

Done !

Monday, 19 February 2018

HOW TO CONFIGURE JENKINS ON CENTOS 7

Please find below steps :-

JAVA installation : 

Jenkins requires Java 7 Minimum version.

#yum search java |grep openjdk
#yum install java-1.8.0-openjdk* wget -y 

Then check JAVA version 

1) #java -version

Output :-
openjdk version "1.8.0_131"
OpenJDK Runtime Environment (build 1.8.0_131-b12)
OpenJDK 64-Bit Server VM (build 25.131-b12, mixed mode)

Install RPM For Jenkins

#rpm –import https://pkg.jenkins.io/redhat-stable/jenkins.io.key
#cd /etc/yum.repos.d/
#wget https://pkg.jenkins.io/redhat-stable/jenkins.repo

Install Jenkins:

#yum install jenkins -y

Now We have to enable, start and check the status of Jenkins:

systemctl enable jenkins
systemctl start jenkins
systemctl status jenkins

Thursday, 15 February 2018

How to Install Python 2.7 on centos 6 & 7

Installation steps :-

Check Python version:
1) python -V

update Puthon version:

1) sudo yum update
2) sudo yum install scl-utils
3) sudo yum install centos-release-scl-rh
4) sudo yum install python27
5) sudo scl enable python27 bash

Verify the update:

1) python -V
  Python 2.7.8

After logging out or restarting, you must enable python 2.7:
$ sudo scl enable python27 bash
Enabling Python 2.7 in .bash_profile or .bashrc causes the machine to hang because CentOS 6 relies on Python 2.6 for Yum.

Tuesday, 13 February 2018

How to install NTP in Linux

Tested configuration:-

At server side:-
1) Yum install ntp* -y
2) vim /etc/ntp.conf 
Here on line 8:- restrict default netrap nopeer noquery (From here remove nopeer and noquery)
3) Then restart ntp service

At client side:-

1) Install package chrony* 
2) Yum install system-config-date
3) system-config-date 
a) (Here check mark on syncronize date and time over network)
 b) remove all ntp server
c) add server IP of NTP server

4) Advanced Option 
a) Speed up initial syncronized (OK)
 
5) Then restart services

Trouble shooting:-

1) If after restart of service only time is changing then please check hard ware clock of both machines:- By following 
hwclock --show

If hardware clock is not same then sync there clock after restart NTP service

2) If hardware clock are same but still it is not working then change the BIOS cell of machine. It may be Down thats why it is not able to work with hardware.

Please do configuration and if face any problem then please let me know.

How To Open A Port In CentOS 7 With Firewalld

Open Specific Port Opening a port in firewalld is fairly straightforward, in the below example we allow traffic in from any source IP ad...