RHEL, CentOS and Oracle Linux 7 tips

Linux logo Here are some miscellaneous tips for RHEL, CentOS and Oracle Linux 7 systems I have found useful. This post is a work in-progress, I will update it every now and then as I come up with more tips.

Systemd basic usage

Systemd has replaced legacy initd and init scripts, systemd services are managed with systemctl. Start service

# systemctl start crond

Stop service

# systemctl stop crond

Enable service start on boot

# systemctl enable crond

Disable service start on boot

# systemctl disable crond

Show service status

# systemctl status crond

Install Open VM Tools for vSphere virtual machines

VMware vSphere 5.x does not ship with RHEL, CentOS or Oracle Linux 7 compatible VMware Tools. You can either use VMware Tools shipping with VMware Workstation 10 or simply use Open VM Tools which are included in RHEL, CentOS and OL 7.

# yum install open-vm-tools

Enable tmpfs file system for /tmp

# systemctl enable tmp.mount

Empty existing files and directories from /tmp and reboot, /tmp will be mounted as tmpfs volume on boot

Disable IBM Power RAID adapter services

On systems without IBM Power RAID adapter, like VMware vSphere VMs, you can safely disable iprdump, iprinit and iprupdate services

# systemctl disable iprdump iprinit iprupdate
iprdump.service is not a native service, redirecting to /sbin/chkconfig.
Executing /sbin/chkconfig iprdump off
iprinit.service is not a native service, redirecting to /sbin/chkconfig.
Executing /sbin/chkconfig iprinit off
iprupdate.service is not a native service, redirecting to /sbin/chkconfig.
Executing /sbin/chkconfig iprupdate off

Set crashkernel memory allocation to 0

On systems with 2 GB or more RAM, RHEL, CentOS and Oracle Linux 7 will allocate some RAM for crashkernel area for diagnostics purposes. If you do not have active support subscription from Red Hat or Oracle, and you have no need for kernel debug information in case of system crash, you can safely set crashkernel reservation to zero and free up some RAM for application use.

# vi /etc/sysconfig/grub

Edit GRUB_CMDLINE_LINUX and change crashkernel=auto to crashkernel=0

GRUB_DISTRIBUTOR="$(sed 's, release .*$,,g' /etc/system-release)"
GRUB_CMDLINE_LINUX="vconsole.font=latarcyrheb-sun16 vconsole.keymap=fi-latin1 crashkernel=0"

Rebuild GRUB configuration file with

# grub2-mkconfig -o /etc/grub2.cfg

Change default boot kernel entry

You can list available kernels on your system with

# egrep ^menuentry /etc/grub2.cfg | cut -f 2 -d \'
Oracle Linux Server, with Linux 3.10.0-123.el7.x86_64
Oracle Linux Server, with Linux 3.10.0-123.4.4.el7.x86_64
Oracle Linux Server, with Unbreakable Enterprise Kernel 3.8.13-35.3.2.el7uek.x86_64
Oracle Linux Server, with Unbreakable Enterprise Kernel 3.8.13-35.3.1.el7uek.x86_64
Oracle Linux Server, with Linux 0-rescue-d3e0313c0f6d48a0bb72495d261ec20a

Use grub2-set-default command to set default boot kernel, to set first kernel in grub2.cfg as default run

# grub2-set-default 0
# grub2-mkconfig -o /etc/grub2.cfg

Use blkid to show disk device UUID

RHEL, CentOS and Oracle Linux 7 map disk devices by their UUID in /etc/fstab, if you create a new disk and wish to know its UUID you can use blkid to get it

# blkid /dev/sdb
/dev/sdb: UUID="54892ed3-9e26-4977-8e88-88ead89d218d" UUID_SUB="afa5f2f0-ef87-459b-a626-6e5a834a7ae2" TYPE="btrfs"

 Install Iotop for per process disk IO monitoring

Iotop is top-like utility for monitoring per process or per thread disk IO bandwidth usage, iotop is available in standard RHEL, CentOS and OL 7 repository.

# yum install iotop

Extra Packages for Enterprise Linux repository

Fedora Project hosts Extra Packages for Enterprise Linux repository which contains additional software for RHEL, CentOS and OL 7. EPEL 7 repository is still marked as beta but I have had no isssues with packages from it. You can read more about EPEL repository at https://fedoraproject.org/wiki/EPEL

# rpm -ivh http://www.nic.funet.fi/pub/mirrors/fedora.redhat.com/pub/epel/beta/7/x86_64/epel-release-7-0.2.noarch.rpm

Install haveged to enhance random number generation on VMs

Virtual machines generally have shallower random entropy pool than physical hosts have available, because of this any process involving random numbers, like encryption key generation, can take a lot longer on virtual machines than it takes on a physical host. You can feed Linux random number entropy pool with haveged and speed up SSL key generation and maybe even enhance SSL encryption effectiveness. Haveged is available in EPEL repository.

# yum install haveged
# systemctl start haveged
# systemctl enable haveged


4 Replies to “RHEL, CentOS and Oracle Linux 7 tips”

  1. Thanks for all these tips!
    On VMs I also disable smartmon tools as the (real) disks are handled by ESX or the network storage equipment.
    systemctl disable smartd

  2. There is an easier way to change crashkernel with grubby, for example I don’t like boot splashes and remove them during kickstart with the following command.

    grubby –update-kernel=ALL –remove-args=”quiet rhgb” –args=”crashkernel=0 elevator=noop vconsole.keymap=de-latin1″

  3. I’ve found something very strange. About every 15-20 days, we will notice our Internet is maxed out. Eliminating all hosts in the office, it came down to a vanilla install of Oracle Linux 7 that’s just sitting there as a play/test machine. No one has touched it in days yet, our Internet bandwidth was maxed out almost 24 hours. Rebooting the machine, bandwidth dropped. Anyone see this with v7 of the other distros?

  4. To remove the crashkernel, just remove the crashkernel parameter from /etc/default/grub. Then use grub2-mkconfig to generate a new grub.cfg. Also you don’t need to run grub2-mkconfig after you run grub2-set-default. You might get an unexpected outcome doing it in the order.

Leave a Reply