Showing posts with label Some Important commands for Linux administration. Show all posts
Showing posts with label Some Important commands for Linux administration. Show all posts

Tuesday, February 18, 2020

Some Important commands for Linux administration....

1. To register linux server with your account: -

[root@AMITESHJSK /]#subscription-manager register --username amiteshjsk --password *******  --auto-attach

2.To check Kernel version in Linux

[root@AMITESHJSK /]# uname -a
Linux AMITESHJSK 3.10.0-514.el7.x86_64 #1 SMP Wed Oct 19 11:24:13 EDT 2016 x86_64 x86_64 x86_64 GNU/Linux

3.To check the inode number of a file or directory

Inode number or Index number is the entry in inode table containing the informations      (metadata) of a file or directories .

[root@AMITESHJSK /]# ls -li kisna.txt
14441 -rw-r--r--. 1 root root 0 Jun 30 10:30 kisna.txt

4. To create Soft links and Hard links

Soft link or symbolic link or symlink is same as shortcuts in windows OS, an easiest way to link files or directories .
To create Soft links 
[root@AMITESHJSK /]# ln -s /etc/ssh/sshd_config sshd
[root@AMITESHJSK /]# ls -ltr |grep -i sshd
lrwxrwxrwx.   1 root root   20 Jun 30 10:40 sshd -> /etc/ssh/sshd_config

Note: - /etc/ssh/sshd_config (source file)
            sshd  (link file)  

To create Hard links

[root@AMITESHJSK /]# ln /etc/ssh/sshd_config sshdhard
[root@AMITESHJSK /]# ls -ltr | grep -i sshdhard
-rw-------.   2 root root 4360 Jun 24 10:20 sshdhard

Note: - /etc/ssh/sshd_config (source file)
            sshdhard  (link file)

5. To mount your .iso file in linux server: -

[root@AMITESHJSK /]#mount -o loop rhel-server-7.3-x86_64-dvd.iso /mnt/iso

Mount Options :
ro  –  read only,  rw  –  read write,  user  –  user can mount,  exec  –  script can be execute,  noexec  –  script can’t be execute,  noauto  –  partition will not mount automatically,  auto  –  mounts automatically,  sync  –  input and output will synchronize.

6.To set Proxy address in Linux server: -

[root@AMITESHJSK /]#export http_proxy=http://192.168.11.40:8080/
----------------------------------------------------------------------------------------------------------------------

7.To configure NFS in Linux server: -

A.) First of all you have to make entry in /etc/exports of nfs server like:-

/mnt/iso (rw,sync,no_root_squash)



Note: - /mnt/iso (desired mount which you want to share)
 If you want to share mount point with only selected host(eg.- 192.168.11.42) then make entry in /etc/exports like: -

/mnt/iso 192.168.11.42 (rw,sync,no_root_squash)

B.) After that restart nfs service: -


[root@AMITESHJSK /]#service nfs restart


C.) Now you can check shared mount point details by below command: -

[root@AMITESHJSK /]#showmount -e
Export list for MONITORING:
/mnt/iso *

D.) Now mount in client server after creating a directory 

[root@AMITESHJSK /]#mkdir iso
[root@AMITESHJSK /]#mount -t nfs 192.168.11.41:/mnt/iso /iso


Note: - 192.168.11.41 (NFS Server IP )

root_squash – If we are putting root_squash, then it will map root UUID/ GID to anonymous UUID/GID. So in client side the client root user will be denied for accessing, creating file in mounted NFS partition.

no_root_squash  – In no_root_squash , It won’t map root UUID/GID to anonymous user and thus the client root user have all the privileges on the mounted NFS partition.

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

8.To check list of Listening ports in Redhat Linux:-

[root@AMITESHJSK /]#netstat -tulpn














9. To find a file by name on system from any directory path: -


[root@AMITESHJSK /]#locate filename

-----------------------------------------------------------------
Creating yum  repository file for installing Redhat cluster Software Pacemaker :-

A.) First of all, Mount ISO image file in Server by using below command: -

[root@AMITESHJSK /]#mkdir iso 
[root@AMITESHJSK /]#mount -o loop rhel-server-7.3-x86_64-dvd.iso /iso

B.) Then create a repository file in /etc/yum.repos.d/ path:-

[root@AMITESHJSK /]#vi ha.repo
[repo-update]
gpgcheck=0
enabled=1
baseurl=file:///iso
name=repo-update

[repo-ha]

gpgcheck=0
enabled=1
baseurl=file:///iso/addons/HighAvailability
name=repo-ha

[repo-storage]

gpgcheck=0
enabled=1
baseurl=file:///iso/addons/ResilientStorage
name=repo-storage


C.) Exit by using :wq! from vi editor.

D.) Now we can check our repolist by:-

#yum repolist
epo id                                      repo name                                                                  status
repo-ha                                      repo-ha                                                                        37
repo-storage                                 repo-storage                                                                   42
repo-update                                  repo-update                                                                 4,751
rhel-7-server-rpms/7Server/x86_64            Red Hat Enterprise Linux 7 Server (RPMs)                                   28,773
repolist: 33,603

E.) After that we can install pacemaker by using below command: -

[root@AMITESHJSK /]#yum install -y pacemaker pcs psmisc policycoreutils-python


Stay tuned for installation and configuration of pacemaker.
--------------------------------------------------------------------------------------------------------------------------



Click below link to know more important commands----
https://lalganjrbl.blogspot.com/2020/03/small-but-thick-knowledge.html





Introduction to Linux Part 1

Introduction to Linux Part 1

Introduction to Linux Linux is an operating system that works just like Windows and Mac OS X. As an operating system, Linux is a very h...