• Skip to main content

Uly.me

cloud engineer

  • Home
  • About
  • Archives

redhat

Lock a Package in Linux

January 7, 2022

Here’s how to lockdown a package to a specific version.

Search for the current package.

$ sudo rpm -qa |  grep sdk
google-cloud-sdk-365.0.1-1.x86_64

$ sudo rpm -qa | grep sdk google-cloud-sdk-365.0.1-1.x86_64

Install versionlock.

yum install yum-plugin-versionlock

yum install yum-plugin-versionlock

Lock a package.

yum versionlock google-cloud-sdk-365.0.1-1.x86_64

yum versionlock google-cloud-sdk-365.0.1-1.x86_64

Display all locked versions.

yum versionlock list

yum versionlock list

Unlock and clear.

yum versionlock clear

yum versionlock clear

Filed Under: Linux Tagged With: lock, redhat, versionlock, yum

Check Reboot After Updates

July 16, 2021

Here’s the command to check if the system needs a reboot after running yum update.

Must be root or run it sudo.

$ needs-restarting -r ; echo $?
Core libraries or services have been updated:
  openssl-libs -> 1:1.0.2k-21.el7_9
  kernel -> 3.10.0-1160.31.1.el7
  dbus -> 1:1.10.24-15.el7
  linux-firmware -> 20200421-80.git78c0348.el7_9
  glibc -> 2.17-324.el7_9
  systemd -> 219-78.el7_9.3
 
Reboot is required to ensure that your system benefits from these updates.
 
More information:
https://access.redhat.com/solutions/27943
1

$ needs-restarting -r ; echo $? Core libraries or services have been updated: openssl-libs -> 1:1.0.2k-21.el7_9 kernel -> 3.10.0-1160.31.1.el7 dbus -> 1:1.10.24-15.el7 linux-firmware -> 20200421-80.git78c0348.el7_9 glibc -> 2.17-324.el7_9 systemd -> 219-78.el7_9.3 Reboot is required to ensure that your system benefits from these updates. More information: https://access.redhat.com/solutions/27943 1

In this instance, it requires a reboot due to a new kernel.

Filed Under: Linux Tagged With: centos, check, reboot, redhat, update

Set Timezone Permanently

March 18, 2021

It’s recommended to set the clock to UTC. In rare occasions, local time may be needed.

Here’s how to set your server’s timezone permanently.

Check the date first.

date

date

Backup localtime. Set it to US Eastern Time.

mv /etc/localtime /etc/localtime.backup
ln -s /usr/share/zoneinfo/America/New_York /etc/localtime

mv /etc/localtime /etc/localtime.backup ln -s /usr/share/zoneinfo/America/New_York /etc/localtime

Backup clock. Set it to US Eastern Time.

cp -p /etc/sysconfig/clock /etc/sysconfig/clock.backup 
> /etc/sysconfig/clock
echo ZONE=\"America/New_York\" > /etc/sysconfig/clock

cp -p /etc/sysconfig/clock /etc/sysconfig/clock.backup > /etc/sysconfig/clock echo ZONE=\"America/New_York\" > /etc/sysconfig/clock

Run the date again to validate.

date

date

Filed Under: Linux Tagged With: permanent, redhat, set, timezone

Install OpenJDK 8

January 31, 2021

Here’s the installation instructions for OpenJDK 8.

For Fedora, Redhat and Oracle Linux.

yum install java-1.8.0-openjdk

yum install java-1.8.0-openjdk

For Debian and Ubuntu.

apt-get install openjdk-8-jre

apt-get install openjdk-8-jre

To see if the packages (symbolic links) are there, they can be found in /etc/alternatives/, at least in Redhat 7.

ls -l /etc/alternatives/

ls -l /etc/alternatives/

Filed Under: Misc Tagged With: 1.8.0, centos, java, jdk, jre, redhat, ubuntu

HTTPD on Redhat & Centos

December 4, 2020

Here are the commands to start, stop, enable and get the status of Apache on RHEL and CentOS.

systemctl enable httpd  # enable on bootup
systemctl status httpd  # get status
systemctl start httpd   # start
systemctl stop httpd    # stop
systemctl restart httpd # restart

systemctl enable httpd # enable on bootup systemctl status httpd # get status systemctl start httpd # start systemctl stop httpd # stop systemctl restart httpd # restart

Filed Under: Linux Tagged With: centos, enable, redhat, start, status, stop

OpenSSL Upgrade

October 19, 2020

Here’s how to upgrade to OpenSSL 1.1 on Redhat/Centos.

# check
openssl version
yum info openssl
# download and install
cd /usr/local/src
wget https://www.openssl.org/source/openssl-1.0.2-latest.tar.gz
tar -zxf openssl-1.0.2-latest.tar.gz
# compile
cd openssl-1.0.2a
./config
make
make test
make install
# update softlink
mv /usr/bin/openssl /root/
ln -s /usr/local/ssl/bin/openssl /usr/bin/openssl
# verify new version
openssl version

# check openssl version yum info openssl # download and install cd /usr/local/src wget https://www.openssl.org/source/openssl-1.0.2-latest.tar.gz tar -zxf openssl-1.0.2-latest.tar.gz # compile cd openssl-1.0.2a ./config make make test make install # update softlink mv /usr/bin/openssl /root/ ln -s /usr/local/ssl/bin/openssl /usr/bin/openssl # verify new version openssl version

Filed Under: Linux Tagged With: centos, openssl, redhat, upgrade

Yum Repo Plugins

April 2, 2020

Here’s how to disable plugin in Yum repos.

# check which plugins are enabled
yum repolist
# disable plugins
yum update --disableplugin=product-id,subscription-manager
# check agin
yum repolist

# check which plugins are enabled yum repolist # disable plugins yum update --disableplugin=product-id,subscription-manager # check agin yum repolist

If that doesn’t work, check the individual config files of each plugin.

cd /etc/yum/pluginconf.d/
vim product-id.conf
vim subscription-manager.conf

cd /etc/yum/pluginconf.d/ vim product-id.conf vim subscription-manager.conf

Disable it.

[main]
enable=0

[main] enable=0

Filed Under: Linux Tagged With: plugins, redhat, repo, repolist, yum

Create Swap Disk

March 28, 2020

To see which disk is available for swap disk use.

lsblk
blkid
df -Th

lsblk blkid df -Th

Format the disk.

fdisk /dev/xvda

fdisk /dev/xvda

Create a swap disk.

sudo mkswap -f /dev/xvda
sudo swapon -s /dev/xvda
# or
sudo swapon /dev/xvda

sudo mkswap -f /dev/xvda sudo swapon -s /dev/xvda # or sudo swapon /dev/xvda

Check if swap disk is available.

lsblk
free -h 
cat /proc/swaps
cat /proc/meminfo
swapon -s
top
vmstat
vmstat 1 5

lsblk free -h cat /proc/swaps cat /proc/meminfo swapon -s top vmstat vmstat 1 5

Filed Under: Linux Tagged With: create, redhat, swap, xfs

  • Go to page 1
  • Go to page 2
  • Go to Next Page »
  • Home
  • About
  • Archives

Copyright © 2023