How To Prevent Yum Upgrade Kernel On CentOS / Red Hat How do I exclude kernel or other packages from getting updated via yum?

You can prevent yum command from updating the Kernel permanently by following the simple steps.

Option #1: Edit /etc/yum.conf file

Use a text editor such as vi to edit /etc/yum.conf:

# vi /etc/yum.conf

Append/modify exclude directive line under [main] section, enter:

exclude=kernel*

Save and close the file. Try, updating the system without updating the Linux kernel:

# yum -y update

This is a permanent option, so you don’t need pass the -x option to yum command.

Option #2: Pass the -x option to prevent yum from updating kernel
The syntax is as follows to skip update on command line itself:

# yum -x 'kernel*' update

On Red Hat Enterprise Linux

The up2date command in Red Hat Enterprise Linux 4 excludes kernel updates by default. The yum in Red Hat Enterprise Linux 5 includes kernel updates by default.
To skip installing or updating kernel or other packages while using the yum update utility in Red Hat Enterprise Linux 5 and 6, use following options
Temporary solution via Command line:

# yum update --exclude=PACKAGENAME

For example, to exclude all kernel related packages:

# yum update --exclude=kernel*

To make permanent changes, edit the /etc/yum.conf file and following entries to it:

[main]
cachedir=/var/cache/yum/$basearch/$releasever
keepcache=0
debuglevel=2
logfile=/var/log/yum.log
exclude=kernel* redhat-release*

Related Article: Prevent Yum From Upgrading The Kernel | Exclude kernel or other packages from getting updated in Red Hat Enterprise

How to disable IPv6 on Linux CentOS or RHEL 7 This Article describes procedure to disable IPv6 on CentOS or Red Hat 7.x

There are 2 ways to do this:

  1. Disable IPv6 in kernel module (requires reboot)
  2. Disable IPv6 using sysctl settings (no reboot required)

To verify if IPv6 is enabled or not, execute :

# ifconfig -a | grep inet6

inet6 fe80::211:aff:fe6a:9de4 prefixlen 64 scopeid 0x20
inet6 ::1 prefixlen 128 scopeid 0x10[host]

Disable IPv6 in kernel module (requires reboot)

1) Edit /etc/default/grub and add ipv6.disable=1 in line

GRUB_CMDLINE_LINUX, e.g.:

# vi /etc/default/grub

GRUB_TIMEOUT=5
GRUB_DEFAULT=saved
GRUB_DISABLE_SUBMENU=true
GRUB_TERMINAL_OUTPUT=”console”
GRUB_CMDLINE_LINUX=”ipv6.disable=1 crashkernel=auto rhgb quiet”
GRUB_DISABLE_RECOVERY=”true”

2) Regenerate a GRUB configuration file and overwrite existing one:

# grub2-mkconfig -o /boot/grub2/grub.cfg

3) Restart system and verify no line “inet6” in “ip addr show” command output.

# shutdown -r now
 

# ip addr show | grep net6

Disable IPv6 using sysctl settings (no reboot required)

1) Append below lines in /etc/sysctl.conf:

net.ipv6.conf.all.disable_ipv6 = 1
net.ipv6.conf.default.disable_ipv6 = 1

NOTE : To disable IPv6 on a single interface add below lines to /etc/sysctl.conf :
net.ipv6.conf.[interface].disable_ipv6 = 1 ### put interface name here [interface]
net.ipv6.conf.default.disable_ipv6 = 1

2) To make the settings affective, execute :

# sysctl -p

NOTE : make sure the file /etc/ssh/sshd_config contains the line AddressFamily inet to avoid breaking SSH Xforwarding if you are using the sysctl method

3) Add the AddressFamily line to sshd_config :

# vi /etc/ssh/sshd_config
 ....
 AddressFamily inet
 ....
 Restart sshd for changes to get get effect :

# systemctl restart sshd

Related Articles: CentOS / RHEL 7 : How to disable IPv6

Give Linux read-only permission for specific user and folder A small HOW-TO create a user then give to that user a read-only permissions with ACL

In this article we will show you how to create a user, then give to that new user a read-only permissions (for example if you need a log viewer user)

  1. create user
    #useradd username
  2. give to that user a password
    #passwd username
  3. use ‘setfacl’ to give the permission
    #setfacl -R -m u:username:r-x /dir/sub_dir1/.../

setfacl syntax

setfacl [-bkndRLPvh] [{-m|-x} acl_spec] [{-M|-X} acl_file] file ...

Description of SETFACL

The setfacl utility sets Access Control Lists (ACLs) of files and directories. On the command line, a sequence of commands is followed by a sequence of files (which in turn can be followed by another sequence of commands, and so on).

The options -m and -x expect an ACL on the command line. Multiple ACL entries are separated by commas (“,”). The options -M and -X read an ACL from a file or from standard input. The ACL entry format is described in the ACL Entries section, below.

The –set and –set-file options set the ACL of a file or a directory. The previous ACL is replaced. ACL entries for this operation must include permissions.

The -m (–modify) and -M (–modify-file) options modify the ACL of a file or directory. ACL entries for this operation must include permissions.

The -x (–remove) and -X (–remove-file) options remove ACL entries. It is not an error to remove an entry which does not exist. Only ACL entries without the perms field are accepted as parameters, unless the POSIXLY_CORRECT environment variable is defined.

When reading from files using the -M and -X options, setfacl accepts the output produced by getfacl. There is at most one ACL entry per line. After a pound sign (“#”), everything up to the end of the line is treated as a comment.

If setfacl is used on a file system which does not support ACLs, setfacl operates on the file mode permission bits. If the ACL does not fit completely in the permission bits, setfacl modifies the file mode permission bits to reflect the ACL as closely as possible, writes an error message to standard error, and returns with an exit status greater than 0.

Options
-b, –remove-all Remove all extended ACL entries. The base ACL entries of the owner, group and others are retained.
-k, –remove-default Remove the Default ACL. If no Default ACL exists, no warnings are issued.
-n, –no-mask Do not recalculate the effective rights mask. The default behavior of setfacl is to recalculate the ACL mask entry, unless a mask entry was explicitly given. The mask entry is set to the union of all permissions of the owning group, and all named user and group entries. (These are exactly the entries affected by the mask entry).
–mask Do recalculate the effective rights mask, even if an ACL mask entry was explicitly given. (See the -n option.)
-d, –default All operations apply to the Default ACL. Regular ACL entries in the input set are promoted to Default ACL entries. Default ACL entries in the input set are discarded. (A warning is issued if that happens).
–restore=file Restore a permission backup created by “getfacl -R” or similar. All permissions of a complete directory subtree are restored using this mechanism. If the input contains owner comments or group comments, setfacl attempts to restore the owner and owning group. If the input contains flags comments (which define the setuid, setgid, and sticky bits), setfacl sets those three bits accordingly; otherwise, it clears them. This option cannot be mixed with other options except “–test”.
–test Test mode. Instead of changing the ACLs of any files, the resulting ACLs are listed.
-R, –recursive Apply operations to all files and directories recursively. This option cannot be mixed with “–restore”.
-L, –logical “Logical walk”: follow symbolic links to directories. The default behavior is to follow symbolic link arguments, and skip symbolic links encountered in subdirectories. Only effective in combination with -R. This option cannot be mixed with “–restore”.
-P, –physical “Physical walk”: do not follow symbolic links to directories. This also skips symbolic link arguments. Only effective in combination with -R. This option cannot be mixed with “–restore”.
-v, –version Print the version of setfacl, and exit.
-h, –help Print a help message explaining the command line options.
— A double-dash marks the end of command line options; all remaining parameters are interpreted as file names. This option is especially useful for file names that start with a dash.
– If the file name parameter is a single dash, setfacl reads a list of files from standard input.

ACL Entries
setfacl recognizes the following ACL entry formats (spaces in the following formats are optional, but have been included for legibility):

[d[efault]:] [u[ser]:]uid [:perms] Permissions of the user with user ID uid, or permissions of the file’s owner if uid is empty.
[d[efault]:] g[roup]:gid [:perms] Permissions of the group with group ID gid, or permissions of the owning group if gid is empty.
[d[efault]:] m[ask][:] [:perms] Effective rights mask.
[d[efault]:] o[ther][:] [:perms] Permissions of others.
Whitespace between delimiter characters and non-delimiter characters is ignored.

Proper ACL entries including permissions are used in modify and set operations (options -m, -M, –set and –set-file). Entries without the perms field are used for deletion of entries (options -x and -X).

For uid and gid you can specify either a name or a number.

The perms field is a combination of characters that indicate the permissions: read (“r”), write (“w”), execute (“x”), or “execute only if the file is a directory or already has execute permission for some user” (capital “X”). Alternatively, the perms field can be an octal digit (“0”-“7”).

Related Articles: Linux setfacl command | Setting filesystem ACL

How to Check if Your Linux System is 32-bit or 64-bit Tricks and tips to find the architecture of a running linux machine

It’s always a good idea to know some basics about the operating system you’re running on your computer. For example, you may need to know whether you’re running a 64-bit or 32-bit system so you know which file to download for a program you want to install.

We will show you several different ways of checking whether your Linux system is 32-bit or 64-bit. Some provide additional information beyond whether the system is 32-bit or 64-bit.

The first two methods involves the “uname” command, which prints system information to the screen. If you want more information than just whether your system is 32-bit or 64-bit, type the following command and press Enter.

uname –a

The following information is printed to the screen in the following order: kernel name, network node hostname, kernel release, kernel version, machine hardware name, processor type, hardware platform, operating system. You can find out what the Linux kernel is and what it does at How-To Geek.

The machine hardware name lists whether your system is 32-bit (“i686” or “i386”) or 64-bit (“x86_64”). Notice that the processor type and hardware platform also indicates 32-bit or 64-bit.

To use the “uname” command to only find out whether your system is 32-bit or 64-bit, type the following command and press Enter.

uname –m

This displays only the machine hardware name and indicates, as above, whether your system is 32-bit (“i686” or “i386”) or 64-bit (“x86_64”).

The “arch” command is similar to the “uname -m” command and prints to the screen whether your system is 32-bit (“i686”) or 64-bit (“x86_64”). Type the following command and press Enter.

arch

You can also use the “file” command with a special argument (“/sbin/init”) to find out whether your system is 32-bit or 64-bit. Type the following command and press Enter.

file /sbin/init

The following output is printed to the screen. The text outlined in red indicates whether your system is 32-bit or 64-bit.

Linux Centos, History A short bio about Linux Centos

CentOS is a Linux distribution that attempts to provide a free, enterprise-class, community-supported computing platform functionally compatible with its upstream source, Red Hat Enterprise Linux (RHEL).In January 2014, CentOS announced the official joining with Red Hat while staying independent from RHEL, under a new CentOS governing board.

The first CentOS release in May 2004, numbered as CentOS version 2, was forked from RHEL version 2.1AS.Since the release of version 7.0, CentOS officially supports only the x86-64 architecture, while versions older than 7.0-1406 also support IA-32 with Physical Address Extension (PAE). As of December 2015, AltArch releases of CentOS 7 are available for the IA-32 architecture, Power architecture, and for the ARMv7hl and AArch64 variants of the ARM architecture.

CentOS versionRelease date
CentOS version Release date – From Wikipedia – CentOS version Release date