Topics Based on Linux related articles

How to set up Linux Chroot Jails

  • Add User with No Login 

[root@testsvr01 ~]# useradd  -s /sbin/nologin -p password user

  • Modify sshd_config File 

[root@testsvr01 ~]# vi  /etc/ssh/sshd_config

    #Subsystem      sftp    /usr/libexec/openssh/sftp-server   

   Subsystem sftp internal-sftp

   Match Group user
   ForceCommand internal-sftp
   ChrootDirectory /home/user
   X11Forwarding no
   AllowTcpForwarding no

How to Replace LVM Disk with New One

  • Check Available Disk

[root@testsvr01~]# lsblk
NAME                  MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sda                     8:0    0  100G  0 disk
sdb                     8:16   0  500G  0 disk
sdc                     8:32   0  500G  0 disk
└─vg_pgdata-lv_pgdata 253:2    0  500G  0 lvm  /pgdata
sr0                    11:0    1 1024M  0 rom
vda                   252:0    0  100G  0 disk
├─vda1                252:1    0  500M  0 part /boot
└─vda2                252:2    0 99.5G  0 part

How to Extend XFS Partition in Linux

  • Check Available Disk

[root@testsvr01~]# lsblk
NAME          MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sda             8:0    0   60G  0 disk
├─sda1          8:1    0    1G  0 part /boot
└─sda2          8:2    0   59G  0 part
  ├─rhel-root 253:0    0 35.6G  0 lvm  /
  ├─rhel-swap 253:1    0    6G  0 lvm  [SWAP]
  └─rhel-home 253:2    0 17.4G  0 lvm  /home
sdb             8:16   0  250G  0 disk
sdc             8:32   0  250G  0 disk

How to Remove Old Kernel from RHEL Server

[root@testsvr01~]# rpm -q kernel
kernel-3.10.0-1160.15.2.el7.x86_64
kernel-3.10.0-1160.21.1.el7.x86_64
kernel-3.10.0-1160.24.1.el7.x86_64
kernel-3.10.0-1160.36.2.el7.x86_64
kernel-3.10.0-1160.71.1.el7.x86_64
[root@ehapp01 ~]# package-cleanup --oldkernels --count=1
Loaded plugins: fastestmirror, langpacks
--> Running transaction check
---> Package kernel.x86_64 0:3.10.0-1160.15.2.el7 will be erased
---> Package kernel.x86_64 0:3.10.0-1160.21.1.el7 will be erased

PostgreSQL 12 Installation in RHEL8 Server

[root@testdbsvr01~]# dnf install -y https://download.postgresql.org/pub/repos/yum/reporpms/EL-8-x86_64/pgdg-redhat-repo-latest.noarch.rpm
[root@testdbsvr01~]# dnf -qy module disable postgresql

 

[root@testdbsvr01~]# dnf install -y postgresql12-server

[root@testdbsvr01~]# dnf install -y postgresql12-contrib

[root@testdbsvr01~]# /usr/pgsql-12/bin/postgresql-12-setup initdb
Initializing database ... OK

Subscribe to Linux