0% found this document useful (0 votes)
26 views7 pages

Intervie Que Linux

Uploaded by

RISHKUMAR
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
26 views7 pages

Intervie Que Linux

Uploaded by

RISHKUMAR
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 7

yum update -- Patching

check lvm version


Remove package and dependency command

# rpm -qa |grep lvm2 -- to

To remove old lvm version


yum remove (version name)
yum remove (lvm2-2.02.186-7.el7*)
yum remove (lvm2-libs-2.02.186-7.el7*)

===================================================================================
====

Inode is full then we canot create files

===================================================================================
====
Components of LVM
There are three main components to LVM:

Physical Volumes
Volume Groups
Logical Volumes

pvdisplay -- TO DISPLAY PV

dnf install lvm2

fdisk -l -- to check avlbl disk

# pvcreate /dev/sdb1
Physical volume "/dev/sdb1" successfully created.

# pvdisplay
OR
# pvdisplay /dev/sdb1

vgcreate mynew_vg /dev/sdb1

# vgextend mynew_vg /dev/sdb2


Volume group "mynew_vg" successfully extended

# lvcreate -L 400 -n vol01 mynew_vg

Create a filesystem on logical volumes


The logical volume is almost ready to use. All we need to do is to create a
filesystem on it with the mkfs command.

# mkfs.ext4 -m 0 /dev/mynew_vg/vol01

Edit fstab to automatically mount partitions


For the filesystem to be automatically mounted, we should add an entry for it into
the /etc/fstab file. This will mount the partitions for us when the computer boots
up in the future.

# nano /etc/fstab
Mount logical volumes
In order to use our new volumes, we’ll need to mount them. Don’t forget to also
create the mount point first.

# mkdir /foobar
# mount -a

Extend a logical volume


The biggest advantage of a logical volume is that it can be extended any time we
are running out of space. For example, to increase the size of a logical volume and
add other 800 MB of space, we can run this command:

# lvextend -L +800 /dev/mynew_vg/vol01

To make the filesystem grow and use the added space we need to resize the
filesystem with the following command.

# resize2fs /dev/mynew_vg/vol01

Remove a logical volume


The command lvremove can be used to remove logical volumes. We should make sure a
logical volume does not have any valuable data stored on it before we attempt to
remove it. Moreover, we should make sure the volume is not mounted.

# lvremove /dev/mynew_vg/vol02

===================================================================================
====

df -hT /var/
ls -lrth /var/log/messages

===================================================================================
====

To rename host and add ip adddress


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

systemctl restart NetworkManager

# hostnamectl set-hostname osekilx0606v

vi /etc/hosts

remove old hostname and IP address & add NEWHOSTNAME AND IP

153.88.95.224 osekilx0606v.int.se.nmc.ericsson.se osekilx0606v


:wq!

#systemctl restart NetworkManager

# cd /etc/sysconfig/network-scripts

#ls

#vi ifcfg-ens192

IPADDR= add NEW IP

NETMASK= remove old netmaks and add new netmask

GATEWAY= remove old gateway and add NEw gateway

:wq!

#ifup ifcfg-ens192

#pwd

#systemctl restart Networkmanager

#ifup ifcfg-ens192

#ifdown ifcfg-ens192

ifconfig-a
=============================================================

Downgrading NFS-V4 to NFS-V3

Linux Team : Take the backup of cat /etc/fstab


cp -pr /etc/fstab > /etc/fstab_date
df -hT | grep -i nfs
date;hostname -i

vi /etc/fstab

Comment the below lines in fstab for NFS FS

#130.100.156.70:/chnpmesi003/qtree /global nfs defaults 0 0


#130.100.156.70:/chnpmesi004/qtree /use_cases_data nfs defaults 0 0
#130.100.156.70:/chnpmesi005/qtree /use_cases_data_ARCHIVE nfs defaults
0 0

and Add new entry of NFS FS to mount with NFS version 3

130.100.156.70:/chnpmesi003/qtree /global nfs vers=3 0 0


130.100.156.70:/chnpmesi004/qtree /use_cases_data nfs vers=3 0 0
130.100.156.70:/chnpmesi005/qtree /use_cases_data_ARCHIVE nfs vers=3
0 0

Save file :wq!


#mount -a
#df -hT | grep -i nfs
===================================================================================
===========================

Access issue :

id thjoescggs
/opt/quest/bin/vastool user checkaccess thjoescggs
/opt/quest/bin/vastool user checkaccess thjoescggs
pam_tally2 -u thjoescggs
pam_tally2 -u thjoescggs -r

===================================================================================
============================

1) check telnet connection

# telnet <ip> <port no>

2) check selinux status , it should be enabled and in permissive mode

# sestatus

3) check firewall service , it should be dead , if not , please check further with
SMEs

# systemctl status firewalld

4) check ip

# ifconfig

5) check network connectivity

# netstat -nautlp |grep 1521

===================================================================================
============================

Regarding the CHN-DC Bharti IPv6 VM unreachability

ip a
cat /etc/sysconfig/network-scripts/ifcfg-ens224
vi /etc/sysconfig/network-scripts/ifcfg-ens224
systemctl restart NetworkManager
nmcli connection show
ip a

try to ping

===================================================================================
==============================
check nectwork manager

ip a
ifconfig
cat ls /etc/sysconfig/network-scripts
/etc/sysconfig/network-scripts/ifcfg-ens224

=======================================================
Run below command before reboot

grub2-mkconfig -o /boot/grub2/grub.cfg

=========================================================
IP forwarding should usually be turned off if you’re not using one of the
aforementioned configurations. You typically don’t want your system wasting
bandwidth or resources to forward packets elsewhere, unless it’s been designed to
do that job. Using the net.ipv4.ip_forward kernel setting to control IP forwarding
will ensure that you have full control over your packets. This setting will
override all other firewall and software settings.

set the parameter of net.ipv4.ip_forward value to 1


To change below value 0 to 1
net.ipv4.ip_forward=0

command below :

# cat /etc/sysctl.conf
#vi /cat/etc/sysctl.conf
And change the value

==================================================================

How to Setup Passwordless SSH Login in Linux

1) Generate an SSH Key Pair

Login to jump host, in my case I am using ‘sysadm’. Run ssh-keyen command to


generate Public and Private keys for sysadm using rsa algorithm.This command will
prompt you to enter path of public and private keys

$ ssh-keygen -t rsa

Note: By default, ssh-keygen command generate keys of size 2048 bits. If you wish
to change the size of keys, then use ‘-b’ option followed by size in bits. Example
is shown below,

$ ssh-keygen -t rsa -b 4096

2) Copy Public Key to the Remote Server

Now that you have generated the SSH keys, you need to copy the public key to the
remote server where you want to set up passwordless SSH login. Use ‘ssh-copy-id‘
command to copy user’s public key to remote system.

Syntax:

$ ssh-copy-id <user-name>@<Remote-Linux-System-IP>

$ ssh-copy-id [email protected]

3) Test Passwordless SSH Login


Now try to ssh remote system from jump host.

$ ssh [email protected]

===================================================================================
========

cronjob

systemctl status crond


cat /etc/crontab
SHELL=/bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin
MAILTO=root

# For details see man 4 crontabs

# Example of job definition:


# .---------------- minute (0 - 59)
# | .------------- hour (0 - 23)
# | | .---------- day of month (1 - 31)
# | | | .------- month (1 - 12) OR jan,feb,mar,apr ...
# | | | | .---- day of week (0 - 6) (Sunday=0 or 7) OR
sun,mon,tue,wed,thu,fri,sat
# | | | | |
# * * * * * user-name command to be executed

Start by checking whether the current user has any scheduled jobs:

$ crontab -l
00 23 * * * localuser rsync -av /home/localuser/source
/home/localuser/destination
00 12 * * 6 localuser cp -R /home/localuser/destination/* /home/localuser/full/

To edit the crontab file for the current user, use the command:

crontab -e

Example Crontab Entries:

Run a script every day at 2 AM:


0 2 * * * /path/to/your/script.sh

Run a command every 15 minutes:


*/15 * * * * /path/to/your/command

Run a backup script every Sunday at 3 AM:


0 3 * * 0 /path/to/backup.sh

Save and Exit:


After adding your scheduled jobs, save and exit the editor. The changes will take
effect immediately.
View Scheduled Jobs:

To view the current user’s scheduled jobs, use:


crontab -l
To remove all scheduled jobs for the current user, use:
crontab -r

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

Change Permissions Using Symbolic Mode:

chmod u=rwx,g=rx,o=rx /path/to/file_or_directory

Change Permissions Using Numeric Mode:

Read ® = 4
Write (w) = 2
Execute (x) = 1

chmod 755 /path/to/file_or_directory

===================================================================================
==========================

Changing Ownership
Use the chown command to change the owner and group of a file or directory.

Change the owner of a file or directory:

chown new_owner /path/to/file_or_directory

===================================================================================
==========================
Change hostname

# hostnamectl set-hostname osekilx0606v

vi /etc/hosts
remove old hostname and IP address & add NEWHOSTNAME AND IP
153.88.95.224 osekilx0606v.int.se.nmc.ericsson.se osekilx0606v

:wq!
#systemctl restart NetworkManager

# cd /etc/sysconfig/network-scripts
#ls
#vi ifcfg-ens192
IPADDR= add NEW IP
NETMASK= remove old netmaks and add new netmask
GATEWAY= remove old gateway and add NEw gateway
:wq!
#ifup ifcfg-ens192
#pwd
#systemctl restart Networkmanager
#ifup ifcfg-ens192
#ifdown ifcfg-ens192
ifconfig-a

You might also like