Showing posts with label Linux. Show all posts
Showing posts with label Linux. Show all posts

Sunday, October 6, 2024

Lock Linux package version using yum

        Managing package versions in Linux is an important task of Linux Server Administration. We often apply an update and the application is broken and unusable. In that case, we need to lock the package version so that the update skips the newer version of the package. Generally, this happens when we want to lock the package version to retain the application's usability. The yum-plugin-versionlock plugin allows Linux Administrators to lock the version of a specific package to prevent unwanted updates during the regular system update process. 


Following is the step-by-step guide to lock the package version. 

  1. Install yum-plugin-versionlock plugin in the system.

    yum install yum-plugin-versionlock




  2. Lock the version of the package. In the example below I have locked the grub Package version, all the packages that start with the name grub will be locked to the current version and will be skipped during updates.

    yum versionlock grub2-*



  3. Use the list command to list all the package's versions locked. 

    yum versionlock list



  4. Delete a single package from the locked version list.

    yum versionlock delete grub2-common-1:2.06-80.el9_4.alma.1.*
    yum versionlock list




  5. Delete all packages from the locked version list.

    yum versionlock clear
    yum versionlock list







Tuesday, December 28, 2021

Send running process to background using disown


Sometimes we are in hurry and we execute the long-running command in the shell which makes us wait. I still remember that I did it some time and woke up the entire night to keep monitoring the command. Using the command disown we can make the running command run in the background and detach it from the shell so that it won't get killed when we terminate the shell.


  • Execute the process. In the example below I have executed the command sleep for 15 mins(900 seconds).

  • Ctrl + Z to pause the program and get shell prompt back. If Ctrl + Z is not working then execute kill -SIGSTOP PID 

  • Check the process with ps command.

  • Execute command bg to run the process in the background.

  • Execute jobs command to find the jobid of the program

  • Execute command disown -h [jobid]    %1 for first and %2 for a second.

  • Checked if the process is still running.

  • Exit from the terminal

  • Run bash command in the docker container and check the process is running.

Monday, August 30, 2021

Boot OL8 in single user mode to reset root password.

Booting OL8 in single user mode to reset root password.

Press e to edit the boot menu.



Once boot options is displayed, add rd.break at the end of the linux.. . Below is the screenshot of the rd.break at the end. Once rd.break is added Press CTRL + x to boot system in single user mode.



Once booted into single user mode, it looks something like below.



Remount /sysroot with rw and chroot to /sysroot.



Now change password with passwd command.



Once password is changed. Type exit get out of chroot. Type reboot to restart normal.



Sunday, April 19, 2020

Install Oracle Database 19c in CentOS 8


Oracle Database 19c, is the long term support release of the Oracle Database 12c and 18c. It offers Premier and Extended Support through to 31st March, 2023 and 31st March, 2026 respectively. It is available for all of the Operating system platforms: Linux, Windows, Solaris, HP/UX and AIX platforms. It is available for Oracle Cloud too.

Though Linux version 8 is not in the support matrix we can tweak parameter to install Oracle 19c in Linux version 8. Following is the support matrix for Oracle 19c installation on Linux.


Supported Linux OS matrix for Oracle 19c
Operating SystemKernelKernel Version
Oracle Linux 7.4Unbreakable Enterprise Kernel 44.1.12-124.19.2.el7uek.x86_64 or later
Oracle Linux 7.4Unbreakable Enterprise Kernel 54.14.35-1818.1.6.el7uek.x86_64 or later
Oracle Linux 7.5Red Hat Compatible kernel3.10.0-862.11.6.el7.x86_64 or later
Red Hat Enterprise Linux 7.53.10.0-862.11.6.el7.x86_64 or later
SUSE Linux Enterprise Server 12 SP34.4.162-94.72-default or later
SUSE Linux Enterprise Server 154.12.14-23-default or later



Modify Kernel parameters for Oracle 19c. Add following parameters and values to file /etc/sysctl.conf. Once sysctl.conf file is modified execute sysctl -l /etc/sysctl.conf to reflect change.
fs.file-max = 6815744
kernel.sem = 250 32000 100 128
kernel.shmmni = 4096
kernel.shmall = 1073741824
kernel.shmmax = 4398046511104
kernel.panic_on_oops = 1
net.core.rmem_default = 262144
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 1048576
net.ipv4.conf.all.rp_filter = 2
net.ipv4.conf.default.rp_filter = 2
fs.aio-max-nr = 1048576
net.ipv4.ip_local_port_range = 9000 65500



sysctl -p /etc/sysctl.conf


Kernel parameters added to /etc/sysctl.conf

Execute sysctl -p /etc/sysctl.conf to reflect kernel parameter change.


Modify user limits. Add following lines to /etc/security/limits.d/oracle-limit.conf file.
oracle soft nofile 1024
oracle hard nofile 65536
oracle soft nproc 16384
oracle hard nproc 16384
oracle soft stack 10240
oracle hard stack 32768
oracle hard memlock 134217728
oracle soft memlock 134217728


User limits modified in file oracle-limit.conf


Install all required Linux packages. Execute following yum command as user root to install all required packages and their dependencies.
yum -y install bc binutils dnf elfutils-libelf libnsl libXau \
elfutils-libelf-devel fontconfig-devel gcc glibc glibc-devel \
ksh libaio libaio-devel libgcc librdmacm-devel librdmacm-devel libstdc++ \
libstdc++ libstdc++-devel libX11 libxcb libXi libXrender libXrender-devel \
libXtst make net-tools nfs-utils python36 smartmontools sysstat targetcli

yum installation on going.


Once all required package is installed it looks something like above.


Add all required groups and users.



Change password for user oracle



Verify user with id oracle command



Modify selinux parameter. Set SELINUX to permissive and execute setenforce permissive 



Stop Firewall and disable firewall at startup



Create Oracle Home directory and change ownership to user oracle and group oinstall.



Upload downloaded Oracle 19c software to Oracle Home directory. Once upload is completed extract oracle software.



Switch user to oracle and configure required environment variables for Oracle.


Create additional directory for SQLPATH. This directory can be used for centralized sql files path.



It is always better to validate the display setting before you execute the runInstaller command. Install xterm linux package and execute xterm command to verify display has been configured properly. If display has been set properly then you will be poped up with new xterm windows as below.


xterm windows that will be displayed if you have properly configured display settings.

Export environment variable CV_ASSUME_DISTID to 7.6. Otherwise there will be compatibility error installation will not begin at all.
export CV_ASSUME_DISTID=OEL7.6


Change directory to Oracle Home where Installer file has been extracted. Execute runInstaller to being installation.



Landing window after executing runInstaller command. Select Create and configure option. Click on Next to continue.



Select Desktop class and click on Next to continue.



Provide global dbname Password and Click on Next to continue.



Select Inventory location and click on Next to continue.



Select Automatically run configuration script. Provide root password and click on Next to continue.



All pre-requisite Check passed successfully so Installation window directly redirected to Summary window. I have clicked on Back button to view list of the pre-requisite and its status.



List of Pre-requisites that have been checked and its status as success. Click on Next to continue.



Once again summary page. Click on Install to begin installation.



Installation in progress..



Prompted to confirm execution or root.sh script with user root and password provided duration configuration windows earlier. Click on Yes to continue.



Noticed database Configuration has failed. I have checked installation log and noticed following error message.
INFO:  [Apr 18, 2020 11:36:32 AM] ... GenericInternalPlugIn.handleProcess() entered.
INFO:  [Apr 18, 2020 11:36:32 AM] ... GenericInternalPlugIn: getting configAssistantParmas.
INFO:  [Apr 18, 2020 11:36:32 AM] ... GenericInternalPlugIn: checking secretArguments.
INFO:  [Apr 18, 2020 11:36:32 AM] ... GenericInternalPlugIn: starting read loop.
INFO:  [Apr 18, 2020 11:36:48 AM] [FATAL] [DBT-06103] The port (5,500) is already in use.
INFO:  [Apr 18, 2020 11:36:48 AM] Skipping line: [FATAL] [DBT-06103] The port (5,500) is already in use.
INFO:  [Apr 18, 2020 11:36:48 AM]    ACTION: Specify a free port.
INFO:  [Apr 18, 2020 11:36:48 AM] Skipping line:    ACTION: Specify a free port.
INFO:  [Apr 18, 2020 11:36:49 AM] Completed Plugin named: Oracle Database Configuration Assistant
INFO:  [Apr 18, 2020 11:36:49 AM] Setup completed with overall status as Failed



Database configuration failed.

Checked /etc/hosts file and noticed I do not have fully qualified domain name in the hosts file. So added fully qualified domain name and clicked on Retry button in Installer window.




Noticed database configuration has started without issue.  Click on Details button to view detail log of the installation.



Click on Close to close Details window.




Once installation completes Database configuration was successful message will be displayed. Click on Close to close installation window.