Red Hat Enterprise Linux-8-Configuring Basic System Settings-En-US
Red Hat Enterprise Linux-8-Configuring Basic System Settings-En-US
Set up the essential functions of your system and customize your system
environment
The text of and illustrations in this document are licensed by Red Hat under a Creative Commons
Attribution–Share Alike 3.0 Unported license ("CC-BY-SA"). An explanation of CC-BY-SA is
available at
http://creativecommons.org/licenses/by-sa/3.0/
. In accordance with CC-BY-SA, if you distribute this document or an adaptation of it, you must
provide the URL for the original version.
Red Hat, as the licensor of this document, waives the right to enforce, and agrees not to assert,
Section 4d of CC-BY-SA to the fullest extent permitted by applicable law.
Red Hat, Red Hat Enterprise Linux, the Shadowman logo, the Red Hat logo, JBoss, OpenShift,
Fedora, the Infinity logo, and RHCE are trademarks of Red Hat, Inc., registered in the United States
and other countries.
Linux ® is the registered trademark of Linus Torvalds in the United States and other countries.
XFS ® is a trademark of Silicon Graphics International Corp. or its subsidiaries in the United States
and/or other countries.
MySQL ® is a registered trademark of MySQL AB in the United States, the European Union and
other countries.
Node.js ® is an official trademark of Joyent. Red Hat is not formally related to or endorsed by the
official Joyent Node.js open source or commercial project.
The OpenStack ® Word Mark and OpenStack logo are either registered trademarks/service marks
or trademarks/service marks of the OpenStack Foundation, in the United States and other
countries and are used with the OpenStack Foundation's permission. We are not affiliated with,
endorsed or sponsored by the OpenStack Foundation, or the OpenStack community.
Abstract
Perform basic system administration tasks, configure the environment settings, register your
system, and configure network access and system security. Administer users, groups, and file
permissions. Use system roles for managing system configurations interface on multiple RHEL
systems. Use systemd for efficient service management. Configure the Network Time Protocol
(NTP) with chrony. Backup and restore your system using ReaR. Install and use dynamic
programming languages such as Python 3 and PHP.
Table of Contents
Table of Contents
. . . . . . . . . . . . . FEEDBACK
PROVIDING . . . . . . . . . . . . ON
. . . .RED
. . . . .HAT
. . . . .DOCUMENTATION
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8. . . . . . . . . . . . .
.CHAPTER
. . . . . . . . . . 1.. .CONFIGURING
. . . . . . . . . . . . . . . .AND
. . . . .MANAGING
. . . . . . . . . . . . .BASIC
. . . . . . .NETWORK
. . . . . . . . . . .ACCESS
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9. . . . . . . . . . . . .
1.1. CONFIGURING THE NETWORK AND HOST NAME IN THE GRAPHICAL INSTALLATION MODE 9
1.2. CONFIGURING AN ETHERNET CONNECTION BY USING NMCLI 10
1.3. CONFIGURING AN ETHERNET CONNECTION BY USING NMTUI 12
1.4. MANAGING NETWORKING IN THE RHEL WEB CONSOLE 16
1.5. MANAGING NETWORKING USING RHEL SYSTEM ROLES 16
1.6. ADDITIONAL RESOURCES 17
.CHAPTER
. . . . . . . . . . 2.
. . REGISTERING
. . . . . . . . . . . . . . . THE
. . . . . SYSTEM
. . . . . . . . . .AND
. . . . .MANAGING
. . . . . . . . . . . . SUBSCRIPTIONS
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
..............
2.1. REGISTERING THE SYSTEM AFTER THE INSTALLATION 18
2.2. REGISTERING SUBSCRIPTIONS WITH CREDENTIALS IN THE WEB CONSOLE 19
2.3. REGISTERING A SYSTEM USING RED HAT ACCOUNT ON GNOME 20
2.4. REGISTERING A SYSTEM USING AN ACTIVATION KEY ON GNOME 21
2.5. REGISTERING RHEL 8 USING THE INSTALLER GUI 22
.CHAPTER
. . . . . . . . . . 3.
. . ACCESSING
. . . . . . . . . . . . . .THE
. . . . RED
. . . . . HAT
. . . . . SUPPORT
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .24
..............
3.1. OBTAINING RED HAT SUPPORT THROUGH RED HAT CUSTOMER PORTAL 24
3.2. TROUBLESHOOTING PROBLEMS USING SOSREPORT 24
.CHAPTER
. . . . . . . . . . 4.
. . .CHANGING
. . . . . . . . . . . .BASIC
. . . . . . .ENVIRONMENT
. . . . . . . . . . . . . . . . SETTINGS
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .26
..............
4.1. CONFIGURING THE DATE AND TIME 26
4.1.1. Displaying the current date and time 26
4.2. CONFIGURING TIME SETTINGS BY USING THE WEB CONSOLE 26
4.3. CONFIGURING THE SYSTEM LOCALE 28
4.4. CONFIGURING THE KEYBOARD LAYOUT 29
4.5. CHANGING THE FONT SIZE IN TEXT CONSOLE MODE 29
4.6. ADDITIONAL RESOURCES 30
.CHAPTER
. . . . . . . . . . 5.
. . USING
. . . . . . . .SECURE
. . . . . . . . .COMMUNICATIONS
. . . . . . . . . . . . . . . . . . . . .BETWEEN
. . . . . . . . . . .TWO
. . . . . SYSTEMS
. . . . . . . . . . . WITH
. . . . . . OPENSSH
. . . . . . . . . . . . . . . . . . . . . . . . 31
..............
5.1. GENERATING SSH KEY PAIRS 31
5.2. SETTING KEY-BASED AUTHENTICATION AS THE ONLY METHOD ON AN OPENSSH SERVER 32
5.3. CACHING YOUR SSH CREDENTIALS BY USING SSH-AGENT 33
5.4. AUTHENTICATING BY SSH KEYS STORED ON A SMART CARD 34
5.5. ADDITIONAL RESOURCES 35
.CHAPTER
. . . . . . . . . . 6.
. . .CONFIGURING
. . . . . . . . . . . . . . . BASIC
. . . . . . . SYSTEM
. . . . . . . . . .SECURITY
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .36
..............
6.1. ENABLING THE FIREWALLD SERVICE 36
6.2. MANAGING FIREWALL IN THE RHEL 8 WEB CONSOLE 37
6.3. MANAGING BASIC SELINUX SETTINGS 37
6.4. SWITCHING SELINUX MODES IN THE RHEL 8 WEB CONSOLE 38
6.5. ADDITIONAL RESOURCES 38
.CHAPTER
. . . . . . . . . . 7.
. . MANAGING
. . . . . . . . . . . . .SOFTWARE
. . . . . . . . . . . . .PACKAGES
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .40
..............
7.1. SOFTWARE MANAGEMENT TOOLS IN RHEL 8 40
7.2. APPLICATION STREAMS 40
7.3. SEARCHING FOR SOFTWARE PACKAGES 40
7.3.1. Searching packages with YUM 41
7.3.2. Listing packages with YUM 41
7.3.3. Listing repositories with YUM 42
7.3.4. Displaying package information with YUM 42
7.3.5. Listing package groups with YUM 42
1
Red Hat Enterprise Linux 8 Configuring basic system settings
. . . . . . . . . . . 8.
CHAPTER . . .INTRODUCTION
. . . . . . . . . . . . . . . . .TO
. . . RHEL
. . . . . . .SYSTEM
. . . . . . . . .ROLES
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
..............
. . . . . . . . . . . 9.
CHAPTER . . .CONFIGURING
. . . . . . . . . . . . . . . LOGGING
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .64
..............
9.1. CONFIGURING A REMOTE LOGGING SOLUTION 64
9.1.1. The Rsyslog logging service 64
9.1.2. Installing Rsyslog documentation 64
9.1.3. Configuring a server for remote logging over TCP 65
9.1.4. Configuring remote logging to a server over TCP 67
9.1.5. Configuring TLS-encrypted remote logging 68
9.1.6. Configuring a server for receiving remote logging information over UDP 72
2
Table of Contents
. . . . . . . . . . . 10.
CHAPTER . . . TROUBLESHOOTING
. . . . . . . . . . . . . . . . . . . . . . .PROBLEMS
. . . . . . . . . . . . BY
. . . .USING
. . . . . . .LOG
. . . . . FILES
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .95
..............
10.1. SERVICES HANDLING SYSLOG MESSAGES 95
10.2. SUBDIRECTORIES STORING SYSLOG MESSAGES 95
10.3. VIEWING LOGS USING THE COMMAND LINE 95
10.4. REVIEWING LOGS IN THE WEB CONSOLE 97
10.4.1. Reviewing logs in the web console 97
10.4.2. Filtering logs in the web console 98
10.4.3. Text search options for filtering logs in the web console 99
10.4.4. Using a text search box to filter logs in the web console 100
10.4.5. Options for logs filtering 101
10.5. ADDITIONAL RESOURCES 102
. . . . . . . . . . . 11.
CHAPTER . . .MANAGING
. . . . . . . . . . . . USERS
. . . . . . . .AND
. . . . .GROUPS
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .103
...............
11.1. INTRODUCTION TO MANAGING USER AND GROUP ACCOUNTS 103
11.1.1. Introduction to users and groups 103
11.1.2. Configuring reserved user and group IDs 103
11.1.3. User private groups 104
11.2. GETTING STARTED WITH MANAGING USER ACCOUNTS 104
11.2.1. Managing accounts and groups using command line tools 105
11.3. MANAGING USERS FROM THE COMMAND LINE 106
11.3.1. Adding a new user from the command line 106
11.3.2. Adding a new group from the command line 106
11.3.3. Adding a user to a supplementary group from the command line 107
11.3.4. Creating a group directory 108
11.3.5. Removing a user on the command line 109
11.4. MANAGING USER ACCOUNTS IN THE WEB CONSOLE 110
11.4.1. Adding new accounts by using the web console 110
11.4.2. Enforcing password expiration in the web console 111
11.5. EDITING USER GROUPS USING THE COMMAND LINE 111
11.5.1. Primary and supplementary user groups 112
11.5.2. Listing the primary and supplementary groups of a user 112
11.5.3. Changing the primary group of a user 113
11.5.4. Adding a user to a supplementary group from the command line 113
11.5.5. Removing a user from a supplementary group 114
3
Red Hat Enterprise Linux 8 Configuring basic system settings
. . . . . . . . . . . 12.
CHAPTER . . . MANAGING
. . . . . . . . . . . . .SUDO
. . . . . . ACCESS
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .119
..............
12.1. USER AUTHORIZATIONS IN SUDOERS 119
12.2. GRANTING SUDO ACCESS TO A USER 120
12.3. ENABLING UNPRIVILEGED USERS TO RUN CERTAIN COMMANDS 121
. . . . . . . . . . . 13.
CHAPTER . . . MANAGING
. . . . . . . . . . . . .FILE
. . . . .SYSTEM
. . . . . . . . . PERMISSIONS
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .124
...............
13.1. MANAGING FILE PERMISSIONS 124
13.1.1. Base file permissions 124
13.1.2. User file-creation mode mask 126
13.1.3. Default file permissions 127
13.1.4. Changing file permissions using symbolic values 129
13.1.5. Changing file permissions using octal values 131
13.2. MANAGING THE ACCESS CONTROL LIST 131
13.2.1. Displaying the current Access Control List 131
13.2.2. Setting the Access Control List 131
13.3. MANAGING THE UMASK 132
13.3.1. Displaying the current value of the umask 132
13.3.2. Displaying the default bash umask 133
13.3.3. Setting the umask using symbolic values 134
13.3.4. Setting the umask using octal values 135
13.3.5. Changing the default umask for the non-login shell 135
13.3.6. Changing the default umask for the login shell 135
13.3.7. Changing the default umask for a specific user 136
13.3.8. Setting default permissions for newly created home directories 136
. . . . . . . . . . . 14.
CHAPTER . . . MANAGING
. . . . . . . . . . . . .SYSTEMD
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .138
...............
14.1. SYSTEMD UNIT FILES LOCATIONS 138
14.2. MANAGING SYSTEM SERVICES WITH SYSTEMCTL 139
14.2.1. Listing system services 139
14.2.2. Displaying system service status 140
14.2.3. Starting a system service 143
14.2.4. Stopping a system service 143
14.2.5. Restarting a system service 144
14.2.6. Enabling a system service to start at boot 145
14.2.7. Disabling a system service to start at boot 145
14.3. BOOTING INTO A TARGET SYSTEM STATE 146
14.3.1. Target unit files 146
14.3.2. Changing the default target to boot into 147
14.3.3. Changing the current target 148
14.3.4. Booting to rescue mode 148
14.3.5. Troubleshooting the boot process 149
14.4. SHUTTING DOWN, SUSPENDING, AND HIBERNATING THE SYSTEM 150
14.4.1. System shutdown 150
14.4.2. Scheduling a system shutdown 150
14.4.3. Shutting down the system using the systemctl command 151
14.4.4. Restarting the system 151
14.4.5. Optimizing power consumption by suspending and hibernating the system 152
14.4.6. Overview of the power management commands with systemctl 153
4
Table of Contents
. . . . . . . . . . . 15.
CHAPTER . . . CONFIGURING
. . . . . . . . . . . . . . . . TIME
. . . . . .SYNCHRONIZATION
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .156
...............
15.1. USING THE CHRONY SUITE TO CONFIGURE NTP 156
15.1.1. Introduction to chrony suite 156
15.1.2. Using chronyc to control chronyd 156
15.1.3. Migrating to chrony 157
15.1.3.1. Migration script 158
15.2. USING CHRONY 158
15.2.1. Managing chrony 159
15.2.2. Checking if chrony is synchronized 159
15.2.3. Manually adjusting the System Clock 160
15.2.4. Disabling a chrony dispatcher script 161
15.2.5. Setting up chrony for a system in an isolated network 161
15.2.6. Configuring remote monitoring access 162
15.2.7. Managing time synchronization using RHEL system roles 164
15.2.8. Additional resources 165
15.3. CHRONY WITH HW TIMESTAMPING 165
15.3.1. Verifying support for hardware timestamping 165
15.3.2. Enabling hardware timestamping 166
15.3.3. Configuring client polling interval 166
15.3.4. Enabling interleaved mode 166
15.3.5. Configuring server for large number of clients 167
15.3.6. Verifying hardware timestamping 167
15.3.7. Configuring PTP-NTP bridge 168
15.4. ACHIEVING SOME SETTINGS PREVIOUSLY SUPPORTED BY NTP IN CHRONY 168
15.4.1. Monitoring by ntpq and ntpdc 169
15.4.2. Using authentication mechanism based on public key cryptography 169
15.4.3. Using ephemeral symmetric associations 169
15.4.4. multicast/broadcast client 170
15.5. OVERVIEW OF NETWORK TIME SECURITY (NTS) IN CHRONY 170
15.5.1. Enabling Network Time Security (NTS) in the client configuration file 171
15.5.2. Enabling Network Time Security (NTS) on the server 172
. . . . . . . . . . . 16.
CHAPTER . . . USING
. . . . . . . .LANGPACKS
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .174
...............
16.1. CHECKING LANGUAGES THAT PROVIDE LANGPACKS 174
16.2. WORKING WITH RPM WEAK DEPENDENCY-BASED LANGPACKS 174
16.2.1. Listing already installed language support 174
16.2.2. Checking the availability of language support 174
16.2.3. Listing packages installed for a language 175
16.2.4. Installing language support 175
16.2.5. Removing language support 175
16.3. SAVING DISK SPACE BY USING GLIBC-LANGPACK-<LOCALE_CODE> 175
.CHAPTER
. . . . . . . . . . 17.
. . . DUMPING
. . . . . . . . . . .A. .CRASHED
. . . . . . . . . . .KERNEL
. . . . . . . . .FOR
. . . . .LATER
. . . . . . . ANALYSIS
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 177
...............
17.1. WHAT IS KDUMP 177
17.2. CONFIGURING KDUMP MEMORY USAGE AND TARGET LOCATION IN WEB CONSOLE 177
17.3. KDUMP USING RHEL SYSTEM ROLES 179
17.4. ADDITIONAL RESOURCES 180
. . . . . . . . . . . 18.
CHAPTER . . . RECOVERING
. . . . . . . . . . . . . . .AND
. . . . . RESTORING
. . . . . . . . . . . . .A
. . SYSTEM
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .181
..............
18.1. SETTING UP REAR 181
5
Red Hat Enterprise Linux 8 Configuring basic system settings
. . . . . . . . . . . 19.
CHAPTER . . . INSTALLING
. . . . . . . . . . . . . .AND
. . . . .USING
. . . . . . . DYNAMIC
. . . . . . . . . . .PROGRAMMING
. . . . . . . . . . . . . . . . . LANGUAGES
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .185
...............
19.1. INTRODUCTION TO PYTHON 185
19.1.1. Python versions 185
19.1.2. Notable differences between Python versions 186
19.2. INSTALLING AND USING PYTHON 187
19.2.1. Installing Python 3 187
19.2.2. Installing additional Python 3 packages 188
19.2.3. Installing additional Python 3 tools for developers 189
19.2.4. Installing Python 2 191
19.2.5. Migrating from Python 2 to Python 3 192
19.2.6. Using Python 192
19.3. CONFIGURING THE UNVERSIONED PYTHON 193
19.3.1. Configuring the unversioned python command directly 193
19.3.2. Configuring the unversioned python command to the required Python version interactively 194
19.3.3. Additional resources 194
19.4. PACKAGING PYTHON 3 RPMS 194
19.4.1. The spec file description for a Python package 194
19.4.2. Common macros for Python 3 RPMs 196
19.4.3. Automatic provides for Python RPMs 197
19.5. HANDLING INTERPRETER DIRECTIVES IN PYTHON SCRIPTS 197
19.5.1. Modifying interpreter directives in Python scripts 198
19.5.2. Changing /usr/bin/python3 interpreter directives in your custom packages 198
19.6. USING THE PHP SCRIPTING LANGUAGE 199
19.6.1. Installing the PHP scripting language 199
19.6.2. Using the PHP scripting language with a web server 200
19.6.2.1. Using PHP with the Apache HTTP Server 200
19.6.2.2. Using PHP with the nginx web server 201
19.6.3. Running a PHP script using the command-line interface 203
19.6.4. Additional resources 204
19.7. GETTING STARTED WITH TCL/TK 204
19.7.1. Introduction to Tcl/Tk 204
19.7.2. Notable changes in Tcl/Tk 8.6 205
19.7.3. Migrating to Tcl/Tk 8.6 205
19.7.3.1. Migration path for developers of Tcl extensions 206
19.7.3.2. Migration path for users scripting their tasks with Tcl/Tk 206
6
Table of Contents
7
Red Hat Enterprise Linux 8 Configuring basic system settings
4. Enter your suggestion for improvement in the Description field. Include links to the relevant
parts of the documentation.
8
CHAPTER 1. CONFIGURING AND MANAGING BASIC NETWORK ACCESS
Procedure
1. From the Installation Summary window, click Network and Host Name.
2. From the list in the left-hand pane, select an interface. The details are displayed in the right-
hand pane.
4. Click + to add a virtual network interface, which can be either: Team, Bond, Bridge, or VLAN.
6. Click Configure to change settings such as IP addresses, DNS servers, or routing configuration
for an existing interface (both virtual and physical).
7. Type a host name for your system in the Host Name field.
The host name can either be a fully qualified domain name (FQDN) in the format
hostname.domainname, or a short host name without the domain. Many networks have a
Dynamic Host Configuration Protocol (DHCP) service that automatically supplies connected
systems with a domain name. To allow the DHCP service to assign the domain name to this
system, specify only the short host name.
Host names can only contain alphanumeric characters and - or .. Host name should be equal to
or less than 64 characters. Host names cannot start or end with - and .. To be compliant with
DNS, each part of a FQDN should be equal to or less than 63 characters and the FQDN total
length, including dots, should not exceed 255 characters.
The value localhost means that no specific static host name for the target system is
configured, and the actual host name of the installed system is configured during the
processing of the network configuration, for example, by NetworkManager using DHCP or DNS.
When using static IP and host name configuration, it depends on the planned system use case
whether to use a short name or FQDN. Red Hat Identity Management configures FQDN during
provisioning but some 3rd party software products may require short name. In either case, to
ensure availability of both forms in all situations, add an entry for the host in /etc/hosts in the
format IP FQDN short-alias.
9. Alternatively, in the Network and Hostname window, you can choose the Wireless option. Click
Select network in the right-hand pane to select your wifi connection, enter the password if
required, and click Done.
9
Red Hat Enterprise Linux 8 Configuring basic system settings
Additional resources
For more information about network device naming standards, see Configuring and managing
networking.
Prerequisites
A physical or virtual Ethernet Network Interface Controller (NIC) exists in the server’s
configuration.
Procedure
By default, NetworkManager creates a profile for each NIC in the host. If you plan to connect
this NIC only to a specific network, adapt the automatically-created profile. If you plan to
connect this NIC to networks with different settings, create individual profiles for each network.
On hosts with multiple profiles, a meaningful name makes it easier to identify the purpose of a
profile.
To set a static IPv4 address, network mask, default gateway, DNS servers, and search
domain, enter:
To set a static IPv6 address, network mask, default gateway, DNS servers, and search
domain, enter:
Verification
11
Red Hat Enterprise Linux 8 Configuring basic system settings
# cat /etc/resolv.conf
search example.com
nameserver 192.0.2.200
nameserver 2001:db8:1::ffbb
If multiple connection profiles are active at the same time, the order of nameserver entries
depend on the DNS priority values in these profile and the connection types.
5. Use the ping utility to verify that this host can send packets to other hosts:
# ping <host-name-or-IP-address>
Troubleshooting
Verify that the network cable is plugged-in to the host and a switch.
Check whether the link failure exists only on this host or also on other hosts connected to the
same switch.
Verify that the network cable and the network interface are working as expected. Perform
hardware diagnosis steps and replace defect cables and network interface cards.
If the configuration on the disk does not match the configuration on the device, starting or
restarting NetworkManager creates an in-memory connection that reflects the configuration of
the device. For further details and how to avoid this problem, see the NetworkManager
duplicates a connection after restart of NetworkManager service solution.
Additional resources
NOTE
12
CHAPTER 1. CONFIGURING AND MANAGING BASIC NETWORK ACCESS
NOTE
In nmtui:
Prerequisites
A physical or virtual Ethernet Network Interface Controller (NIC) exists in the server’s
configuration.
Procedure
1. If you do not know the network device name you want to use in the connection, display the
available devices:
2. Start nmtui:
# nmtui
i. Press Add.
ii. Select Ethernet from the list of network types, and press Enter.
To modify an existing profile, select the profile from the list, and press Enter.
6. If you create a new connection profile, enter the network device name into the Device field.
7. Depending on your environment, configure the IP address settings in the IPv4 configuration
and IPv6 configuration areas accordingly. For this, press the button next to these areas, and
select:
Manual, if the network requires static IP address settings. In this case, you must fill further
13
Red Hat Enterprise Linux 8 Configuring basic system settings
Manual, if the network requires static IP address settings. In this case, you must fill further
fields:
i. Press Show next to the protocol you want to configure to display additional fields.
ii. Press Add next to Addresses, and enter the IP address and the subnet mask in
Classless Inter-Domain Routing (CIDR) format.
If you do not specify a subnet mask, NetworkManager sets a /32 subnet mask for IPv4
addresses and /64 for IPv6 addresses.
iv. Press Add next to DNS servers, and enter the DNS server address.
v. Press Add next to Search domains, and enter the DNS search domain.
14
CHAPTER 1. CONFIGURING AND MANAGING BASIC NETWORK ACCESS
10. Select Quit, and press Enter to close the nmtui application.
Verification
# cat /etc/resolv.conf
search example.com
nameserver 192.0.2.200
nameserver 2001:db8:1::ffbb
If multiple connection profiles are active at the same time, the order of nameserver entries
depend on the DNS priority values in these profile and the connection types.
5. Use the ping utility to verify that this host can send packets to other hosts:
# ping <host-name-or-IP-address>
Troubleshooting
Verify that the network cable is plugged-in to the host and a switch.
Check whether the link failure exists only on this host or also on other hosts connected to the
same switch.
Verify that the network cable and the network interface are working as expected. Perform
hardware diagnosis steps and replace defect cables and network interface cards.
If the configuration on the disk does not match the configuration on the device, starting or
15
Red Hat Enterprise Linux 8 Configuring basic system settings
Additional resources
Ethernet
Bridge
Bonded
16
CHAPTER 1. CONFIGURING AND MANAGING BASIC NETWORK ACCESS
VLAN
MacVLAN
InfiniBand
The required networking connections for each host are provided as a list within the
network_connections variable.
WARNING
The network role updates or creates all connection profiles on the target system
exactly as specified in the network_connections variable. Therefore, the network
role removes options from the specified profiles if the options are only present on
the system but not in the network_connections variable.
The following example shows how to apply the network role to ensure that an Ethernet connection with
the required parameters exists:
An example playbook applying the network role to set up an Ethernet connection with the
required parameters
# SPDX-License-Identifier: BSD-3-Clause
---
- hosts: managed-node-01.example.com
vars:
network_connections:
roles:
- rhel-system-roles.network
Additional resources
Preparing a control node and managed nodes to use RHEL system roles
17
Red Hat Enterprise Linux 8 Configuring basic system settings
You can use a subscription to Red Hat Content Delivery Network to track:
Registered systems
Prerequisites
For more information about the installation process, see Interactively installing RHEL from
installation media.
Procedure
The command prompts you to enter your Red Hat Customer Portal user name and password.
If the registration process fails, you can register your system with a specific pool. For guidance
on how to do it, proceed with the following steps:
This command displays all available subscriptions for your Red Hat account. For every
subscription, various characteristics are displayed, including the pool ID.
18
CHAPTER 2. REGISTERING THE SYSTEM AND MANAGING SUBSCRIPTIONS
b. Attach the appropriate subscription to your system by replacing pool_id with the pool ID
determined in the previous step:
NOTE
To register the system with Red Hat Insights, you can use the rhc connect utility. See
Setting up remote host configuration .
Prerequisites
Procedure
2. In the Health filed in the Overview page, click the Not registered warning, or click
Subscriptions in the main menu to move to page with your subscription information.
4. In the Register system dialog box, select Account to register by using your account credentials.
19
Red Hat Enterprise Linux 8 Configuring basic system settings
If you do not want to connect your system to Red Hat Insights, clear the Insights check box.
8. Click Register.
Prerequisites
Procedure
1. Open the system menu, which is accessible from the upper-right screen corner, and click the
Settings icon.
20
CHAPTER 2. REGISTERING THE SYSTEM AND MANAGING SUBSCRIPTIONS
4. If you are not using the Red Hat server, enter the server address in the URL field.
Enter your Red Hat account user name in the Login field.
7. Click Register.
Prerequisites
21
Red Hat Enterprise Linux 8 Configuring basic system settings
See the Activation Keys page for creating new activation keys.
Procedure
1. Open the system menu, which is accessible from the upper-right screen corner, and click the
Settings icon.
4. If you are not using the Red Hat server, enter the server address in the URL field.
7. Click Register.
22
CHAPTER 2. REGISTERING THE SYSTEM AND MANAGING SUBSCRIPTIONS
Prerequisites
You have a valid user account on the Red Hat Customer Portal. See the Create a Red Hat Login
page.
Procedure
1. From the Installation Summary screen, under Software, click Connect to Red Hat.
2. Authenticate your Red Hat account using the Account or Activation Key option.
3. Optional: In the Set System Purpose field select the Role, SLA, and Usage attribute that you
want to set from the drop-down menu.
At this point, your Red Hat Enterprise Linux 8 system has been successfully registered.
23
Red Hat Enterprise Linux 8 Configuring basic system settings
To obtain support from Red Hat, use the Red Hat Customer Portal, which provides access to everything
available with your subscription.
Prerequisites
A valid user account on the Red Hat Customer Portal. See Create a Red Hat Login .
Procedure
The following section describes how to use the sosreport command to produce reports for your support
cases.
Prerequisites
A valid user account on the Red Hat Customer Portal. See Create a Red Hat Login .
A support-case number.
Procedure
NOTE
24
CHAPTER 3. ACCESSING THE RED HAT SUPPORT
NOTE
The default minimal installation of Red Hat Enterprise Linux does not include the
sos package, which provides the sosreport command.
2. Generate a report:
# sosreport
Note that when attaching the report, you are prompted to enter the number of the relevant
support case.
Additional resources
What is an sosreport and how to create one in Red Hat Enterprise Linux?
25
Red Hat Enterprise Linux 8 Configuring basic system settings
System locales
Keyboard layout
Language
Red Hat Enterprise Linux 8 uses the chronyd daemon to implement NTP. chronyd is available from the
chrony package. For more information, see Using the chrony suite to configure NTP .
Procedure
$ date
Mon Mar 30 16:02:59 CEST 2020
$ timedatectl
Local time: Mon 2020-03-30 16:04:42 CEST
Universal time: Mon 2020-03-30 14:04:42 UTC
RTC time: Mon 2020-03-30 14:04:41
Time zone: Europe/Prague (CEST, +0200)
System clock synchronized: yes
NTP service: active
RTC in local TZ: no
Additional resources
26
CHAPTER 4. CHANGING BASIC ENVIRONMENT SETTINGS
Prerequisites
Procedure
4. In the Change System Time dialog box, change the time zone if necessary.
Manually
Use this option if you need to set the time manually, without an NTP server.
Automatically using NTP server
This is a default option, which synchronizes time automatically with the preset NTP servers.
Automatically using specific NTP servers
Use this option only if you need to synchronize the system with a specific NTP server.
Specify the DNS name or the IP address of the server.
6. Click Change.
27
Red Hat Enterprise Linux 8 Configuring basic system settings
Verification
Additional resources
Procedure
$ localectl list-locales
C.utf8
aa_DJ
aa_DJ.iso88591
aa_DJ.utf8
...
$ localectl status
To set or change the default system locale settings, use a localectl set-locale sub-command as
the root user. For example:
NOTE
28
CHAPTER 4. CHANGING BASIC ENVIRONMENT SETTINGS
NOTE
The GNOME Terminal does not support non-UTF8 system locales. For more information,
see The gnome-terminal application fails to start when the system locale is set to non-
UTF8 knowledge base solution.
Additional resources
Procedure
$ localectl list-keymaps
ANSI-dvorak
al
al-plisi
amiga-de
amiga-us
...
$ localectl status
...
VC Keymap: us
...
# localectl set-keymap us
Additional resources
Enter the setfont command with the name of the font, for example:
# setfont /usr/lib/kbd/consolefonts/LatArCyrHeb-19.psfu.gz
NOTE
29
Red Hat Enterprise Linux 8 Configuring basic system settings
NOTE
The setfont command searches for multiple hard-coded paths by default. Therefore,
setfont does not require the full name and path to the font.
To double the size of the font horizontally and vertically, enter the setfont command with -d
parameter:
# setfont -d LatArCyrHeb-16
NOTE
The maximum font size that you can double is 16x16 pixel.
To preserve the selected font during the reboot of the system, use the FONT variable in the
/etc/vconsole.conf file, for example:
# cat /etc/vconsole.conf
KEYMAP="us"
FONT="eurlatgr"
You can find various fonts in the kbd-misc package, which is installed with the`kbd` package.
For example, the font LatArCyrHeb has many variants:
/usr/lib/kbd/consolefonts/LatArCyrHeb-08.psfu.gz
/usr/lib/kbd/consolefonts/LatArCyrHeb-14.psfu.gz
/usr/lib/kbd/consolefonts/LatArCyrHeb-16+.psfu.gz
/usr/lib/kbd/consolefonts/LatArCyrHeb-16.psfu.gz
/usr/lib/kbd/consolefonts/LatArCyrHeb-19.psfu.gz
NOTE
The maximum supported font size by the virtual console is 32 pixels. You can reduce the
font readability problem by using smaller resolution for the console.
30
CHAPTER 5. USING SECURE COMMUNICATIONS BETWEEN TWO SYSTEMS WITH OPENSSH
To preserve previously generated key pairs after you reinstall the system, back up the ~/.ssh/ directory
before you create new keys. After reinstalling, copy it back to your home directory. You can do this for all
users on your system, including root.
Prerequisites
You are logged in as a user who wants to connect to the OpenSSH server by using keys.
Procedure
$ ssh-keygen -t ecdsa
Generating public/private ecdsa key pair.
Enter file in which to save the key (/home/<username>/.ssh/id_ecdsa):
Enter passphrase (empty for no passphrase): <password>
Enter same passphrase again: <password>
Your identification has been saved in /home/<username>/.ssh/id_ecdsa.
Your public key has been saved in /home/<username>/.ssh/id_ecdsa.pub.
The key fingerprint is:
SHA256:Q/x+qms4j7PCQ0qFd09iZEFHA+SqwBKRNaU72oZfaCI
<username>@<localhost.example.com>
The key's randomart image is:
+---[ECDSA 256]---+
|.oo..o=++ |
|.. o .oo . |
|. .. o. o |
|....o.+... |
|o.oo.o +S . |
|.=.+. .o |
|E.*+. . . . |
|.=..+ +.. o |
| . oo*+o. |
+----[SHA256]-----+
You can also generate an RSA key pair by using the ssh-keygen command without any
parameter or an Ed25519 key pair by entering the ssh-keygen -t ed25519 command. Note that
the Ed25519 algorithm is not FIPS-140-compliant, and OpenSSH does not work with Ed25519
31
Red Hat Enterprise Linux 8 Configuring basic system settings
$ ssh-copy-id <username>@<ssh-server-example.com>
/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are
already installed
<username>@<ssh-server-example.com>'s password:
…
Number of key(s) added: 1
Now try logging into the machine, with: "ssh '<username>@<ssh-server-example.com>'" and
check to make sure that only the key(s) you wanted were added.
If you do not use the ssh-agent program in your session, the previous command copies the
most recently modified ~/.ssh/id*.pub public key if it is not yet installed. To specify another
public-key file or to prioritize keys in files over keys cached in memory by ssh-agent, use the
ssh-copy-id command with the -i option.
Verification
Additional resources
Prerequisites
Procedure
# vi /etc/ssh/sshd_config
32
CHAPTER 5. USING SECURE COMMUNICATIONS BETWEEN TWO SYSTEMS WITH OPENSSH
PasswordAuthentication no
3. On a system other than a new default installation, check that the PubkeyAuthentication
parameter is either not set or set to yes.
# setsebool -P use_nfs_home_dirs 1
6. If you are connected remotely, not using console or out-of-band access, test the key-based
login process before disabling password authentication.
Additional resources
Prerequisites
You have a remote host with the SSH daemon running and reachable through the network.
You know the IP address or hostname and credentials to log in to the remote host.
You have generated an SSH key pair with a passphrase and transferred the public key to the
remote machine.
See the Generating SSH key pairs section for details.
Procedure
1. Add the command for automatically starting ssh-agent in your session to the ~/.bashrc file:
$ vi ~/.bashrc
eval $(ssh-agent)
33
Red Hat Enterprise Linux 8 Configuring basic system settings
AddKeysToAgent yes
With this option and ssh-agent started in your session, the agent prompts for a password only
for the first time when you connect to a host.
Verification
Log in to a host which uses the corresponding public key of the cached private key in the agent,
for example:
$ ssh <example.user>@<[email protected]>
Prerequisites
On the client side, the opensc package is installed and the pcscd service is running.
Procedure
1. List all keys provided by the OpenSC PKCS #11 module including their PKCS #11 URIs and save
the output to the keys.pub file:
2. Transfer the public key to the remote server. Use the ssh-copy-id command with the keys.pub
file created in the previous step:
3. Connect to <ssh-server-example.com> by using the ECDSA key. You can use just a subset of the
URI, which uniquely references your key, for example:
Because OpenSSH uses the p11-kit-proxy wrapper and the OpenSC PKCS #11 module is
registered to the p11-kit tool, you can simplify the previous command:
34
CHAPTER 5. USING SECURE COMMUNICATIONS BETWEEN TWO SYSTEMS WITH OPENSSH
If you skip the id= part of a PKCS #11 URI, OpenSSH loads all keys that are available in the proxy
module. This can reduce the amount of typing required:
4. Optional: You can use the same URI string in the ~/.ssh/config file to make the configuration
permanent:
$ cat ~/.ssh/config
IdentityFile "pkcs11:id=%01?module-path=/usr/lib64/pkcs11/opensc-pkcs11.so"
$ ssh <ssh-server-example.com>
Enter PIN for 'SSH key':
[ssh-server-example.com] $
The ssh client utility now automatically uses this URI and the key from the smart card.
Additional resources
p11-kit(8), opensc.conf(5), pcscd(8), ssh(1), and ssh-keygen(1) man pages on your system
35
Red Hat Enterprise Linux 8 Configuring basic system settings
This section covers only the basic security features that you can configure after installation of the
operating system.
The firewalld service, which provides a firewall in Red Hat Enterprise Linux, is automatically enabled
during installation.
Procedure
If firewalld is not enabled and running, switch to the root user, and start the firewalld service
and enable to start it automatically after the system restarts:
Verification
Additional resources
man firewalld(1)
36
CHAPTER 6. CONFIGURING BASIC SYSTEM SECURITY
Prerequisites
Procedure
2. To enable or disable firewalld in the web console, switch the Firewall toggle button.
NOTE
Additionally, you can define more fine-grained access through the firewall to a service
using the Add services… button.
Disabled
Enabled
Enabled
Enforcing
Permissive
In enforcing mode, SELinux enforces the loaded policies. SELinux denies access based on SELinux
policy rules and enables only the interactions that are explicitly allowed. Enforcing mode is the safest
SELinux mode and is the default mode after installation.
37
Red Hat Enterprise Linux 8 Configuring basic system settings
In permissive mode, SELinux does not enforce the loaded policies. SELinux does not deny access, but
reports actions that break the rules to the /var/log/audit/audit.log log. Permissive mode is the default
mode during installation. Permissive mode is also useful in some specific cases, for example when
troubleshooting problems.
Additional resources
Using SELinux
By default, SELinux enforcing policy in the web console is on, and SELinux operates in enforcing mode.
By turning it off, you switch SELinux to permissive mode. Note that this selection is automatically
reverted on the next boot to the configuration defined in the /etc/sysconfig/selinux file.
Prerequisites
Procedure
2. In the web console, use the Enforce policy toggle button in the SELinux menu item to turn
SELinux enforcing policy on or off.
Security hardening
38
CHAPTER 6. CONFIGURING BASIC SYSTEM SECURITY
Using SELinux
Securing networks
39
Red Hat Enterprise Linux 8 Configuring basic system settings
NOTE
Upstream documentation identifies the technology as DNF and the tool is referred to as
DNF in the upstream. As a result, some output returned by the new YUM tool in RHEL 8
mentions DNF.
Although YUM v4 used in RHEL 8 is based on DNF, it is compatible with YUM v3 used in RHEL 7. For
software installation, the yum command and most of its options work the same way in RHEL 8 as they
did in RHEL 7.
Selected yum plug-ins and utilities have been ported to the new DNF back end, and can be installed
under the same names as in RHEL 7. Packages also provide compatibility symlinks, so the binaries,
configuration files, and directories can be found in usual locations.
Note that the legacy Python API provided by YUM v3 is no longer available. You can migrate your plug-
ins and scripts to the new API provided by YUM v4 (DNF Python API), which is stable and fully
supported. See DNF API Reference for more information.
Components made available as Application Streams can be packaged as modules or RPM packages, and
are delivered through the AppStream repository in RHEL 8. Each Application Stream has a given life
cycle, either the same as RHEL 8 or shorter, more suitable to the particular application. Application
Streams with a shorter life cycle are listed in the Red Hat Enterprise Linux 8 Application Streams Life
Cycle page.
Modules are collections of packages representing a logical unit: an application, a language stack, a
database, or a set of tools. These packages are built, tested, and released together.
Module streams represent versions of the Application Stream components. For example, two streams
(versions) of the PostgreSQL database server are available in the postgresql module: PostgreSQL 10
(the default stream) and PostgreSQL 9.6. Only one module stream can be installed on the system.
Different versions can be used in separate containers.
Detailed module commands are described in the Installing, managing, and removing user-space
components document. For a list of modules available in AppStream, see the Package manifest.
40
CHAPTER 7. MANAGING SOFTWARE PACKAGES
List packages.
List repositories.
Procedure
Note that yum search command returns term matches within the name and summary of the
packages. This makes the search faster and enables you to search for packages you do not know
the name of, but for which you know a related term.
Replace term with a term you want to search for in a package name, summary, or description.
Note that yum search --all enables a more exhaustive but slower search.
Procedure
To list all packages in all enabled repositories that are available to install, use:
41
Red Hat Enterprise Linux 8 Configuring basic system settings
Note that you can filter the results by appending global expressions as arguments. See Specifying global
expressions in yum input for more details.
Procedure
# yum repolist
# yum repoinfo
Note that you can filter the results by passing the ID or name of repositories as arguments or by
appending global expressions. See Specifying global expressions in yum input for more details.
Procedure
Note that you can filter the results by appending global expressions as arguments. See Specifying global
expressions in yum input for more details.
Procedure
42
CHAPTER 7. MANAGING SOFTWARE PACKAGES
Note that you can filter the results by appending command line options for the yum group list
command (--hidden, --available). For more available options see the man pages.
Note that you can filter the results by appending global expressions as arguments. See Specifying global
expressions in yum input for more details.
Procedure
To ensure global expressions are passed to yum as intended, use one of the following methods:
Escape the wildcard characters by preceding them with a backslash (\) character.
Install packages.
43
Red Hat Enterprise Linux 8 Configuring basic system settings
When installing packages on a multilib system (AMD64, Intel 64 machine), you can specify the
architecture of the package by appending it to the package name:
If you know the name of the binary you want to install, but not the package name, you can use
the path to the binary as an argument:
yum searches through the package lists, finds the package which provides /usr/sbin/binary-file,
and prompts you as to whether you want to install it.
Note that you can optimize the package search by explicitly defining how to parse the argument. See
Section 7.4.3, “Specifying a package name in YUM input” for more details.
Procedure
Or
Replace group-name with the full name of the group or environmental group.
44
CHAPTER 7. MANAGING SOFTWARE PACKAGES
Replace name and architecture with the exact name and architecture of the package.
To install a package using its exact name, epoch, version, release, and architecture, use:
Replace name, epoch, version, release, and architecture with the exact name, epoch, version,
release, and architecture of the package.
Procedure
45
Red Hat Enterprise Linux 8 Configuring basic system settings
To see which packages installed on your system have available updates, use:
# yum check-update
The output returns the list of packages and their dependencies that have an update available.
IMPORTANT
When applying updates to kernel, yum always installs a new kernel regardless of whether
you are using the yum update or yum install command.
IMPORTANT
If you upgraded the GRUB boot loader packages on a BIOS or IBM Power system,
reinstall GRUB. See Reinstalling GRUB.
Procedure
IMPORTANT
If you upgraded the GRUB boot loader packages on a BIOS or IBM Power system,
reinstall GRUB. See Reinstalling GRUB.
Procedure
# yum update
46
CHAPTER 7. MANAGING SOFTWARE PACKAGES
IMPORTANT
If you upgraded the GRUB boot loader packages on a BIOS or IBM Power system,
reinstall GRUB. See Reinstalling GRUB.
Procedure
To upgrade to the latest available packages that have security errata, use:
IMPORTANT
If you upgraded the GRUB boot loader packages on a BIOS or IBM Power system,
reinstall GRUB. See Reinstalling GRUB.
DNF Automatic is an alternative command-line interface to yum that is suited for automatic and regular
execution using systemd timers, cron jobs and other such tools.
DNF Automatic synchronizes package metadata as needed and then checks for updates available.
After, the tool can perform one of the following actions depending on how you configure it:
Exit
The outcome of the operation is then reported by a selected mechanism, such as the standard output or
email.
The following procedure describes how to install the DNF Automatic tool.
Procedure
47
Red Hat Enterprise Linux 8 Configuring basic system settings
Verification
To verify the successful installation, confirm the presence of the dnf-automatic package by
running the following command:
By default, DNF Automatic uses /etc/dnf/automatic.conf as its configuration file to define its behavior.
[commands] section
Sets the mode of operation of DNF Automatic.
[emitters] section
Defines how the results of DNF Automatic are reported.
[command_email] section
Provides the email emitter configuration for an external command used to send email.
[email] section
Provides the email emitter configuration.
[base] section
Overrides settings from the main configuration file of yum.
With the default settings of the /etc/dnf/automatic.conf file, DNF Automatic checks for available
updates, downloads them, and reports the results as standard output.
WARNING
Settings of the operation mode from the [commands] section are overridden by
settings used by a systemd timer unit for all timer units except dnf-automatic.timer.
Additional resources
For more details on systemd timer units, see the man dnf-automatic manual pages.
For the overview of the systemd timer units included in the dnf-automatic package, see
Section Overview of the systemd timer units included in the dnf-automatic package Overview of
the systemd timer units included in the dnf-automatic package
To run DNF Automatic, you always need to enable and start a specific systemd timer unit. You can use
48
CHAPTER 7. MANAGING SOFTWARE PACKAGES
To run DNF Automatic, you always need to enable and start a specific systemd timer unit. You can use
one of the timer units provided in the dnf-automatic package, or you can write your own timer unit
depending on your needs.
Prerequisites
For more information about DNF Automatic configuration file, see Section 2.5.6.2, “DNF Automatic
configuration file”.
Procedure
Select, enable and start a systemd timer unit that fits your needs:
dnf-automatic-download.timer
dnf-automatic-install.timer
dnf-automatic-notifyonly.timer
dnf-automatic.timer
In terms of downloading and applying updates, this timer unit behaves according to settings in the
/etc/dnf/automatic.conf configuration file. The default behavior is similar to dnf-automatic-
download.timer: it downloads the updated packages, but it does not install them.
NOTE
49
Red Hat Enterprise Linux 8 Configuring basic system settings
NOTE
Alternatively, you can also run DNF Automatic by executing the /usr/bin/dnf-automatic
file directly from the command line or from a custom script.
Verification
Additional resources
For more information about the dnf-automatic timers, see the man dnf-automatic manual
pages.
For the overview of the systemd timer units included in the dnf-automatic package, see Section
Overview of the systemd timer units included in the dnf-automatic package
7.5.6.4. Overview of the systemd timer units included in the dnf-automatic package
The systemd timer units take precedence and override the settings in the /etc/dnf/automatic.conf
configuration file concerning downloading and applying updates.
For example if you set the following option in the /etc/dnf/automatic.conf configuration file, but you
have activated the dnf-automatic-notifyonly.timer unit, the packages will not be downloaded:
download_updates = yes
50
CHAPTER 7. MANAGING SOFTWARE PACKAGES
Additional resources
For more information about the dnf-automatic timers, see the man dnf-automatic manual
pages.
For more information about the /etc/dnf/automatic.conf configuration file, see Section DNF
Automatic configuration file
Remove packages.
Procedure
51
Red Hat Enterprise Linux 8 Configuring basic system settings
NOTE
Note that you can optimize the package search by explicitly defining how to parse the argument. See
Specifying a package name in yum input for more details.
Procedure
Or
52
CHAPTER 7. MANAGING SOFTWARE PACKAGES
Replace name and architecture with the exact name and architecture of the package.
To install a package using its exact name, epoch, version, release, and architecture, use:
Replace name, epoch, version, release, and architecture with the exact name, epoch, version,
release, and architecture of the package.
Procedure
Note that you can filter the results by appending command line options for the yum group list
command (--hidden, --available). For more available options see the man pages.
Note that you can filter the results by appending global expressions as arguments. See Specifying global
expressions in yum input for more details.
The following procedure describes how to install a package group by a group name or by a groupID using
53
Red Hat Enterprise Linux 8 Configuring basic system settings
The following procedure describes how to install a package group by a group name or by a groupID using
yum.
Procedure
Or
Replace group-name with the full name of the group or environmental group.
Procedure
Or
Procedure
To ensure global expressions are passed to yum as intended, use one of the following methods:
54
CHAPTER 7. MANAGING SOFTWARE PACKAGES
Escape the wildcard characters by preceding them with a backslash (\) character.
List transactions.
Revert transactions.
Repeat transactions.
Procedure
# yum history
To display a list of all the latest operations for a selected package, use:
Replace package-name with the name of the package. You can filter the command output by
appending global expressions. See Specifying global expressions in yum input for more details.
The following procedure describes how to revert a selected transaction or the last transaction using
55
Red Hat Enterprise Linux 8 Configuring basic system settings
The following procedure describes how to revert a selected transaction or the last transaction using
yum.
Procedure
Note that the yum history undo command only reverts the steps that were performed during the
transaction. If the transaction installed a new package, the yum history undo command uninstalls it. If
the transaction uninstalled a package, the yum history undo command reinstalls it. yum history undo
also attempts to downgrade all updated packages to their previous versions, if the older packages are
still available.
Procedure
Note that the yum history redo command only repeats the steps that were performed during the
transaction.
Procedure
To ensure global expressions are passed to yum as intended, use one of the following methods:
56
CHAPTER 7. MANAGING SOFTWARE PACKAGES
Escape the wildcard characters by preceding them with a backslash (\) character.
Note that the values you define in individual [repository] sections of the /etc/yum.conf file override
values set in the [main] section.
NOTE
Do not give custom repositories names used by the Red Hat repositories to avoid
conflicts.
For a complete list of available [repository] options, see the [repository] OPTIONS section of the
yum.conf(5) manual page.
Procedure
NOTE
57
Red Hat Enterprise Linux 8 Configuring basic system settings
NOTE
WARNING
Procedure
Procedure
The configuration information for yum and related utilities are stored in the /etc/yum.conf file. This file
58
CHAPTER 7. MANAGING SOFTWARE PACKAGES
The configuration information for yum and related utilities are stored in the /etc/yum.conf file. This file
contains one mandatory [main] section, which enables you to set yum options that have global effect.
Procedure
To display the current values of global yum options specified in the [main] section of the
/etc/yum.conf file, use:
You can add additional options under the [main] section heading in /etc/yum.conf.
For a complete list of available [main] options, see the [main] OPTIONS section of the yum.conf(5)
manual page.
The following section describes how to enable, configure, and disable yum plug-ins.
Procedure
The plug-in configuration files always contain a [main] section where the enabled= option controls
whether the plug-in is enabled when you run yum commands. If this option is missing, you can add it
manually to the file.
Every installed plug-in has its own configuration file in the /etc/dnf/plugins/ directory. You can enable or
disable plug-in specific options in these files.
The following procedure describes how to disable or enable all YUM plug-ins, disable all plug-ins for a
particular command, or certain YUM plug-ins for a single command.
59
Red Hat Enterprise Linux 8 Configuring basic system settings
Procedure
1. Ensure a line beginning with plugins= is present in the [main] section of the /etc/yum.conf
file.
plugins=1
1. Ensure a line beginning with plugins= is present in the [main] section of the /etc/yum.conf
file.
plugins=0
IMPORTANT
Disabling all plug-ins is not advised. Certain plug-ins provide important yum
services. In particular, the product-id and subscription-manager plug-ins
provide support for the certificate-based Content Delivery Network (CDN).
Disabling plug-ins globally is provided as a convenience option, and is
advisable only when diagnosing a potential problem with yum.
To disable all yum plug-ins for a particular command, append --noplugins option to the
command.
60
CHAPTER 8. INTRODUCTION TO RHEL SYSTEM ROLES
Control node
A control node is the system from which you run Ansible commands and playbooks. Your control
node can be an Ansible Automation Platform, Red Hat Satellite, or a RHEL 9, 8, or 7 host. For more
information, see Preparing a control node on RHEL 8 .
Managed node
Managed nodes are the servers and network devices that you manage with Ansible. Managed nodes
are also sometimes called hosts. Ansible does not have to be installed on managed nodes. For more
information, see Preparing a managed node .
Ansible playbook
In a playbook, you define the configuration you want to achieve on your managed nodes or a set of
steps for the system on the managed node to perform. Playbooks are Ansible’s configuration,
deployment, and orchestration language.
Inventory
In an inventory file, you list the managed nodes and specify information such as IP address for each
managed node. In the inventory, you can also organize the managed nodes by creating and nesting
groups for easier scaling. An inventory file is also sometimes called a hostfile.
certificate Certificate Issuance and Requesting certificates by using RHEL system roles
Renewal
cockpit Web console Installing and configuring web console with the
cockpit RHEL system role
61
Red Hat Enterprise Linux 8 Configuring basic system settings
microsoft.sql.server Microsoft SQL Server Configuring Microsoft SQL Server by using the
microsoft.sql.server Ansible role
nbde_client Network Bound Disk Using the nbde_client and nbde_server system roles
Encryption client
nbde_server Network Bound Disk Using the nbde_client and nbde_server system roles
Encryption server
Additional resources
62
CHAPTER 8. INTRODUCTION TO RHEL SYSTEM ROLES
/usr/share/ansible/roles/rhel-system-roles.<role_name>/README.md file
/usr/share/doc/rhel-system-roles/<role_name>/ directory
63
Red Hat Enterprise Linux 8 Configuring basic system settings
The rsyslogd daemon also provides extended filtering, encryption protected relaying of messages,
input and output modules, and support for transportation using the TCP and UDP protocols.
In /etc/rsyslog.conf, which is the main configuration file for rsyslog, you can specify the rules according
to which rsyslogd handles the messages. Generally, you can classify messages by their source and topic
(facility) and urgency (priority), and then assign an action that should be performed when a message fits
these criteria.
In /etc/rsyslog.conf, you can also see a list of log files maintained by rsyslogd. Most log files are
located in the /var/log/ directory. Some applications, such as httpd and samba, store their log files in a
subdirectory within /var/log/.
Additional resources
Prerequisites
Procedure
64
CHAPTER 9. CONFIGURING LOGGING
Verification
With the Rsyslog application, you can maintain a centralized logging system where log messages are
forwarded to a server over the network. To avoid message loss when the server is not available, you can
configure an action queue for the forwarding action. This way, messages that failed to be sent are stored
locally until the server is reachable again. Note that such queues cannot be configured for connections
using the UDP protocol.
The omfwd plug-in provides forwarding over UDP or TCP. The default protocol is UDP. Because the
plug-in is built in, it does not have to be loaded.
Prerequisites
The policycoreutils-python-utils package is installed for the optional step using the
semanage command.
Procedure
1. Optional: To use a different port for rsyslog traffic, add the syslogd_port_t SELinux type to
port. For example, enable port 30514:
2. Optional: To use a different port for rsyslog traffic, configure firewalld to allow incoming
rsyslog traffic on that port. For example, allow TCP traffic on port 30514:
3. Create a new file in the /etc/rsyslog.d/ directory named, for example, remotelog.conf, and
insert the following content:
65
Red Hat Enterprise Linux 8 Configuring basic system settings
constant(value="/var/log/remote/auth/")
property(name="hostname")
constant(value="/")
property(name="programname" SecurePath="replace")
constant(value=".log")
}
template(name="TmplMsg" type="list") {
constant(value="/var/log/remote/msg/")
property(name="hostname")
constant(value="/")
property(name="programname" SecurePath="replace")
constant(value=".log")
}
# rsyslogd -N 1
rsyslogd: version 8.1911.0-2.el8, config validation run...
rsyslogd: End of config validation run. Bye.
6. Make sure the rsyslog service is running and enabled on the logging server:
8. Optional: If rsyslog is not enabled, ensure the rsyslog service starts automatically after reboot:
Your log server is now configured to receive and store log files from the other systems in your
environment.
Additional resources
Prerequisites
The rsyslog package is installed on the client systems that should report to the server.
The system contains the policycoreutils-python-utils package, which provides the semanage
command for adding a non-standard port to the SELinux configuration.
Procedure
1. Create a new file in the /etc/rsyslog.d/ directory named, for example, 10-remotelog.conf, and
insert the following content:
*.* action(type="omfwd"
queue.type="linkedlist"
queue.filename="example_fwd"
action.resumeRetryCount="-1"
queue.saveOnShutdown="on"
target="example.com" port="30514" protocol="tcp"
)
Where:
The queue.filename setting defines a disk storage. The backup files are created with the
example_fwd prefix in the working directory specified by the preceding global
workDirectory directive.
The last line forwards all received messages to the logging server. Port specification is
optional.
With this configuration, rsyslog sends messages to the server but keeps messages in
memory if the remote server is not reachable. A file on disk is created only if rsyslog runs
out of the configured memory queue space or needs to shut down, which benefits the
system performance.
NOTE
67
Red Hat Enterprise Linux 8 Configuring basic system settings
NOTE
Verification
To verify that the client system sends messages to the server, follow these steps:
# logger test
# cat /var/log/remote/msg/hostname/root.log
Feb 25 03:53:17 hostname root[6064]: test
Where hostname is the host name of the client system. Note that the log contains the user
name of the user that entered the logger command, in this case root.
Additional resources
To use encrypted transport through TLS, configure both the server and the client. The server collects
and analyzes the logs sent by one or more client systems.
You can use either the ossl network stream driver (OpenSSL) or the gtls stream driver (GnuTLS).
NOTE
If you have a separate system with higher security, for example, a system that is not
connected to any network or has stricter authorizations, use the separate system as the
certifying authority (CA).
You can customize your connection settings with stream drivers on the server side on the global,
module, and input levels, and on the client side on the global and action levels. The more specific
configuration overrides the more general configuration. This means, for example, that you can use ossl
in global settings for most connections and gtls on the input and action settings only for specific
connections.
Prerequisites
68
CHAPTER 9. CONFIGURING LOGGING
You have root access to both the client and server systems.
The following packages are installed on the server and the client systems:
For generating certificates by using the certtool command, the gnutls-utils package.
ca-cert.pem - a CA certificate that can verify keys and certificates on logging servers and
clients.
ca-cert.pem - a CA certificate that can verify keys and certificates on logging servers and
clients.
Procedure
1. Configure the server for receiving encrypted logs from your client systems:
a. Create a new file in the /etc/rsyslog.d/ directory named, for example, securelogser.conf.
b. To encrypt the communication, the configuration file must contain paths to certificate files
on your server, a selected authentication method, and a stream driver that supports TLS
encryption. Add the following lines to the /etc/rsyslog.d/securelogser.conf file:
# TCP listener
module(
load="imtcp"
PermittedPeer=["client1.example.com", "client2.example.com"]
StreamDriver.AuthMode="x509/name"
StreamDriver.Mode="1"
StreamDriver.Name="ossl"
)
69
Red Hat Enterprise Linux 8 Configuring basic system settings
NOTE
d. Verify the syntax of the /etc/rsyslog.conf file and any files in the /etc/rsyslog.d/ directory:
# rsyslogd -N 1
rsyslogd: version 8.1911.0-2.el8, config validation run (level 1)...
rsyslogd: End of config validation run. Bye.
e. Make sure the rsyslog service is running and enabled on the logging server:
g. Optional: If Rsyslog is not enabled, ensure the rsyslog service starts automatically after
reboot:
a. On a client system, create a new file in the /etc/rsyslog.d/ directory named, for example,
securelogcli.conf.
70
CHAPTER 9. CONFIGURING LOGGING
StreamDriverMode="1"
StreamDriverPermittedPeers="server.example.com"
StreamDriverAuthMode="x509/name"
target="server.example.com" port="514" protocol="tcp"
)
NOTE
d. Verify the syntax of the /etc/rsyslog.conf file and other files in the /etc/rsyslog.d/
directory:
# rsyslogd -N 1
rsyslogd: version 8.1911.0-2.el8, config validation run (level 1)...
rsyslogd: End of config validation run. Bye.
e. Make sure the rsyslog service is running and enabled on the logging server:
g. Optional: If Rsyslog is not enabled, ensure the rsyslog service starts automatically after
reboot:
Verification
To verify that the client system sends messages to the server, follow these steps:
# logger test
# cat /var/log/remote/msg/<hostname>/root.log
Feb 25 03:53:17 <hostname> root[6064]: test
Where <hostname> is the hostname of the client system. Note that the log contains the user
name of the user that entered the logger command, in this case root.
Additional resources
9.1.6. Configuring a server for receiving remote logging information over UDP
The Rsyslog application enables you to configure a system to receive logging information from remote
systems. To use remote logging through UDP, configure both the server and the client. The receiving
server collects and analyzes the logs sent by one or more client systems. By default, rsyslog uses UDP
on port 514 to receive log information from remote systems.
Follow this procedure to configure a server for collecting and analyzing logs sent by one or more client
systems over the UDP protocol.
Prerequisites
The policycoreutils-python-utils package is installed for the optional step using the
semanage command.
Procedure
1. Optional: To use a different port for rsyslog traffic than the default port 514:
a. Add the syslogd_port_t SELinux type to the SELinux policy configuration, replacing
portno with the port number you want rsyslog to use:
b. Configure firewalld to allow incoming rsyslog traffic, replacing portno with the port
number and zone with the zone you want rsyslog to use:
# firewall-cmd --reload
2. Create a new .conf file in the /etc/rsyslog.d/ directory, for example, remotelogserv.conf, and
insert the following content:
72
CHAPTER 9. CONFIGURING LOGGING
property(name="programname" SecurePath="replace")
constant(value=".log")
}
template(name="TmplMsg" type="list") {
constant(value="/var/log/remote/msg/")
property(name="hostname")
constant(value="/")
property(name="programname" SecurePath="replace")
constant(value=".log")
}
Where 514 is the port number rsyslog uses by default. You can specify a different port instead.
3. Verify the syntax of the /etc/rsyslog.conf file and all .conf files in the /etc/rsyslog.d/ directory:
# rsyslogd -N 1
rsyslogd: version 8.1911.0-2.el8, config validation run...
5. Optional: If rsyslog is not enabled, ensure the rsyslog service starts automatically after reboot:
Additional resources
Prerequisites
73
Red Hat Enterprise Linux 8 Configuring basic system settings
The rsyslog package is installed on the client systems that should report to the server.
You have configured the server for remote logging as described in Configuring a server for
receiving remote logging information over UDP.
Procedure
1. Create a new .conf file in the /etc/rsyslog.d/ directory, for example, 10-remotelogcli.conf, and
insert the following content:
*.* action(type="omfwd"
queue.type="linkedlist"
queue.filename="example_fwd"
action.resumeRetryCount="-1"
queue.saveOnShutdown="on"
target="example.com" port="portno" protocol="udp"
)
Where:
The queue.filename setting defines a disk storage. The backup files are created with the
example_fwd prefix in the working directory specified by the preceding global
workDirectory directive.
The portno value is the port number you want rsyslog to use. The default value is 514.
The last line forwards all received messages to the logging server, port specification is
optional.
With this configuration, rsyslog sends messages to the server but keeps messages in
memory if the remote server is not reachable. A file on disk is created only if rsyslog runs
out of the configured memory queue space or needs to shut down, which benefits the
system performance.
NOTE
3. Optional: If rsyslog is not enabled, ensure the rsyslog service starts automatically after reboot:
Verification
74
CHAPTER 9. CONFIGURING LOGGING
To verify that the client system sends messages to the server, follow these steps:
# logger test
# cat /var/log/remote/msg/hostname/root.log
Feb 25 03:53:17 hostname root[6064]: test
Where hostname is the host name of the client system. Note that the log contains the user
name of the user that entered the logger command, in this case root.
Additional resources
The RebindInterval setting proves to be helpful in scenarios when a target system has changed its IP
address. The Rsyslog application caches the IP address when the connection establishes, therefore, the
messages are sent to the same server. If the IP address changes, the UDP packets will be lost until the
Rsyslog service restarts. Re-establishing the connection will ensure the IP to be resolved by DNS again.
Prerequisites
You have installed the rsyslog, librelp, and rsyslog-relp packages on the server and the client
systems.
75
Red Hat Enterprise Linux 8 Configuring basic system settings
Procedure
a. On the client system, create a new .conf file in the /etc/rsyslog.d/ directory named, for
example, relpclient.conf, and insert the following content:
module(load="omrelp")
*.* action(type="omrelp" target="_target_IP_" port="_target_port_")
Where:
d. Optional: If rsyslog is not enabled, ensure the rsyslog service starts automatically after
reboot:
a. On the server system, create a new .conf file in the /etc/rsyslog.d/ directory named, for
example, relpserv.conf, and insert the following content:
ruleset(name="relp"){
*.* action(type="omfile" file="_log_path_")
}
module(load="imrelp")
input(type="imrelp" port="_target_port_" ruleset="relp")
Where:
target_port is the port of the logging server. Use the same value as in the client
configuration file.
d. Optional: If rsyslog is not enabled, ensure the rsyslog service starts automatically after
reboot:
76
CHAPTER 9. CONFIGURING LOGGING
Verification
To verify that the client system sends messages to the server, follow these steps:
# logger test
2. On the server system, view the log at the specified log_path, for example:
# cat /var/log/remote/msg/hostname/root.log
Feb 25 03:53:17 hostname root[6064]: test
Where hostname is the host name of the client system. Note that the log contains the user
name of the user that entered the logger command, in this case root.
Additional resources
You can list the input and output modules installed on your system by entering the following command:
# ls /usr/lib64/rsyslog/{i,o}m*
You can view the list of all available rsyslog modules in the
/usr/share/doc/rsyslog/html/configuration/modules/idx_output.html file after you install the
rsyslog-doc package.
9.1.11. Configuring the netconsole service to log kernel messages to a remote host
When logging to disk or using a serial console is not possible, you can use the netconsole kernel module
and the same-named service to log kernel messages over a network to a remote rsyslog service.
Prerequisites
The remote system log service is configured to receive incoming log entries from this host.
Procedure
77
Red Hat Enterprise Linux 8 Configuring basic system settings
2. Edit the /etc/sysconfig/netconsole file and set the SYSLOGADDR parameter to the IP
address of the remote host:
# SYSLOGADDR=192.0.2.1
Verification
Additional resources
Configuring system logging without journald or with minimized journald usage Knowledgebase
article
Negative effects of the RHEL default logging setup on performance and their mitigations
Knowledgebase article
With the logging RHEL system role, you can deploy logging configurations on local and remote hosts.
Logging solutions provide multiple ways of reading logs and multiple logging outputs.
Local files
systemd/journal
78
CHAPTER 9. CONFIGURING LOGGING
With the logging RHEL system role, you can combine the inputs and outputs to fit your scenario. For
example, you can configure a logging solution that stores inputs from journal in a local file, whereas
inputs read from files are both forwarded to another logging system and stored in the local log files.
Additional resources
/usr/share/ansible/roles/rhel-system-roles.logging/README.md file
/usr/share/doc/rhel-system-roles/logging/ directory
Prepare and apply an Ansible playbook to configure a logging solution on a set of separate machines.
Each machine records logs locally.
Prerequisites
You have prepared the control node and the managed nodes
You are logged in to the control node as a user who can run playbooks on the managed nodes.
The account you use to connect to the managed nodes has sudo permissions on them.
NOTE
You do not have to have the rsyslog package installed, because the RHEL system role
installs rsyslog when deployed.
Procedure
1. Create a playbook file, for example ~/playbook.yml, with the following content:
---
- name: Deploying basics input and implicit files output
hosts: managed-node-01.example.com
roles:
- rhel-system-roles.logging
vars:
logging_inputs:
- name: system_input
type: basics
logging_outputs:
- name: files_output
type: files
logging_flows:
79
Red Hat Enterprise Linux 8 Configuring basic system settings
- name: flow1
inputs: [system_input]
outputs: [files_output]
Note that this command only validates the syntax and does not protect against a wrong but valid
configuration.
$ ansible-playbook ~/playbook.yml
Verification
# rsyslogd -N 1
rsyslogd: version 8.1911.0-6.el8, config validation run...
rsyslogd: End of config validation run. Bye.
# logger test
# cat /var/log/messages
Aug 5 13:48:31 <hostname> root[6778]: test
Where <hostname> is the host name of the client system. Note that the log contains the
user name of the user that entered the logger command, in this case root.
Additional resources
/usr/share/ansible/roles/rhel-system-roles.logging/README.md file
/usr/share/doc/rhel-system-roles/logging/ directory
You can deploy a logging solution which filters the logs based on the rsyslog property-based filter.
Prerequisites
You have prepared the control node and the managed nodes
You are logged in to the control node as a user who can run playbooks on the managed nodes.
80
CHAPTER 9. CONFIGURING LOGGING
The account you use to connect to the managed nodes has sudo permissions on them.
NOTE
You do not have to have the rsyslog package installed, because the RHEL system role
installs rsyslog when deployed.
Procedure
1. Create a playbook file, for example ~/playbook.yml, with the following content:
---
- name: Deploying files input and configured files output
hosts: managed-node-01.example.com
roles:
- rhel-system-roles.logging
vars:
logging_inputs:
- name: files_input
type: basics
logging_outputs:
- name: files_output0
type: files
property: msg
property_op: contains
property_value: error
path: /var/log/errors.log
- name: files_output1
type: files
property: msg
property_op: "!contains"
property_value: error
path: /var/log/others.log
logging_flows:
- name: flow0
inputs: [files_input]
outputs: [files_output0, files_output1]
Using this configuration, all messages that contain the error string are logged in
/var/log/errors.log, and all other messages are logged in /var/log/others.log.
You can replace the error property value with the string by which you want to filter.
Note that this command only validates the syntax and does not protect against a wrong but valid
configuration.
$ ansible-playbook ~/playbook.yml
81
Red Hat Enterprise Linux 8 Configuring basic system settings
Verification
# rsyslogd -N 1
rsyslogd: version 8.1911.0-6.el8, config validation run...
rsyslogd: End of config validation run. Bye.
2. Verify that the system sends messages that contain the error string to the log:
# logger error
# cat /var/log/errors.log
Aug 5 13:48:31 hostname root[6778]: error
Where hostname is the host name of the client system. Note that the log contains the user
name of the user that entered the logger command, in this case root.
Additional resources
/usr/share/ansible/roles/rhel-system-roles.logging/README.md file
/usr/share/doc/rhel-system-roles/logging/ directory
9.2.4. Applying a remote logging solution by using the logging RHEL system role
Follow these steps to prepare and apply a Red Hat Ansible Core playbook to configure a remote logging
solution. In this playbook, one or more clients take logs from systemd-journal and forward them to a
remote server. The server receives remote input from remote_rsyslog and remote_files and outputs
the logs to local files in directories named by remote host names.
Prerequisites
You have prepared the control node and the managed nodes
You are logged in to the control node as a user who can run playbooks on the managed nodes.
The account you use to connect to the managed nodes has sudo permissions on them.
NOTE
You do not have to have the rsyslog package installed, because the RHEL system role
installs rsyslog when deployed.
Procedure
1. Create a playbook file, for example ~/playbook.yml, with the following content:
---
- name: Deploying remote input and remote_files output
82
CHAPTER 9. CONFIGURING LOGGING
hosts: managed-node-01.example.com
roles:
- rhel-system-roles.logging
vars:
logging_inputs:
- name: remote_udp_input
type: remote
udp_ports: [ 601 ]
- name: remote_tcp_input
type: remote
tcp_ports: [ 601 ]
logging_outputs:
- name: remote_files_output
type: remote_files
logging_flows:
- name: flow_0
inputs: [remote_udp_input, remote_tcp_input]
outputs: [remote_files_output]
[basic_input]
[forward_output0, forward_output1]
NOTE
You can modify the parameters in the playbook to fit your needs.
83
Red Hat Enterprise Linux 8 Configuring basic system settings
WARNING
The logging solution works only with the ports defined in the SELinux policy
of the server or client system and open in the firewall. The default SELinux
policy includes ports 601, 514, 6514, 10514, and 20514. To use a different
port, modify the SELinux policy on the client and server systems .
Note that this command only validates the syntax and does not protect against a wrong but valid
configuration.
$ ansible-playbook ~/playbook.yml
Verification
1. On both the client and the server system, test the syntax of the /etc/rsyslog.conf file:
# rsyslogd -N 1
rsyslogd: version 8.1911.0-6.el8, config validation run (level 1), master config
/etc/rsyslog.conf
rsyslogd: End of config validation run. Bye.
# logger test
# cat /var/log/<host2.example.com>/messages
Aug 5 13:48:31 <host2.example.com> root[6778]: test
Where <host2.example.com> is the host name of the client system. Note that the log
contains the user name of the user that entered the logger command, in this case root.
Additional resources
/usr/share/ansible/roles/rhel-system-roles.logging/README.md file
/usr/share/doc/rhel-system-roles/logging/ directory
84
CHAPTER 9. CONFIGURING LOGGING
Transport Layer Security (TLS) is a cryptographic protocol designed to allow secure communication
over the computer network.
As an administrator, you can use the logging RHEL system role to configure a secure transfer of logs
using Red Hat Ansible Automation Platform.
You can use an Ansible playbook with the logging RHEL system role to configure logging on RHEL
clients and transfer logs to a remote logging system using TLS encryption.
This procedure creates a private key and certificate, and configures TLS on all hosts in the clients group
in the Ansible inventory. The TLS protocol encrypts the message transmission for secure transfer of logs
over the network.
NOTE
You do not have to call the certificate RHEL system role in the playbook to create the
certificate. The logging RHEL system role calls it automatically.
In order for the CA to be able to sign the created certificate, the managed nodes must be
enrolled in an IdM domain.
Prerequisites
You have prepared the control node and the managed nodes
You are logged in to the control node as a user who can run playbooks on the managed nodes.
The account you use to connect to the managed nodes has sudo permissions on them.
Procedure
1. Create a playbook file, for example ~/playbook.yml, with the following content:
---
- name: Deploying files input and forwards output with certs
hosts: managed-node-01.example.com
roles:
- rhel-system-roles.logging
vars:
logging_certificates:
- name: logging_cert
dns: ['localhost', 'www.example.com']
ca: ipa
logging_pki_files:
- ca_cert: /local/path/to/ca_cert.pem
cert: /local/path/to/logging_cert.pem
private_key: /local/path/to/logging_cert.pem
logging_inputs:
- name: input_name
type: files
input_log_path: /var/log/containers/*.log
85
Red Hat Enterprise Linux 8 Configuring basic system settings
logging_outputs:
- name: output_name
type: forwards
target: your_target_host
tcp_port: 514
tls: true
pki_authmode: x509/name
permitted_server: 'server.example.com'
logging_flows:
- name: flow_name
inputs: [input_name]
outputs: [output_name]
logging_certificates
The value of this parameter is passed on to certificate_requests in the certificate
RHEL system role and used to create a private key and certificate.
logging_pki_files
Using this parameter, you can configure the paths and other settings that logging uses to
find the CA, certificate, and key files used for TLS, specified with one or more of the
following sub-parameters: ca_cert, ca_cert_src, cert, cert_src, private_key,
private_key_src, and tls.
NOTE
If you are using logging_certificates to create the files on the target node, do
not use ca_cert_src, cert_src, and private_key_src, which are used to copy
files not created by logging_certificates.
ca_cert
Represents the path to the CA certificate file on the target node. Default path is
/etc/pki/tls/certs/ca.pem and the file name is set by the user.
cert
Represents the path to the certificate file on the target node. Default path is
/etc/pki/tls/certs/server-cert.pem and the file name is set by the user.
private_key
Represents the path to the private key file on the target node. Default path is
/etc/pki/tls/private/server-key.pem and the file name is set by the user.
ca_cert_src
Represents the path to the CA certificate file on the control node which is copied to the
target host to the location specified by ca_cert. Do not use this if using
logging_certificates.
cert_src
Represents the path to a certificate file on the control node which is copied to the target
host to the location specified by cert. Do not use this if using logging_certificates.
private_key_src
Represents the path to a private key file on the control node which is copied to the target
host to the location specified by private_key. Do not use this if using logging_certificates.
tls
86
CHAPTER 9. CONFIGURING LOGGING
Setting this parameter to true ensures secure transfer of logs over the network. If you do not
want a secure wrapper, you can set tls: false.
Note that this command only validates the syntax and does not protect against a wrong but valid
configuration.
$ ansible-playbook ~/playbook.yml
Additional resources
/usr/share/ansible/roles/rhel-system-roles.logging/README.md file
/usr/share/doc/rhel-system-roles/logging/ directory
You can use an Ansible playbook with the logging RHEL system role to configure logging on RHEL
servers and set them to receive logs from a remote logging system using TLS encryption.
This procedure creates a private key and certificate, and configures TLS on all hosts in the server group
in the Ansible inventory.
NOTE
You do not have to call the certificate RHEL system role in the playbook to create the
certificate. The logging RHEL system role calls it automatically.
In order for the CA to be able to sign the created certificate, the managed nodes must be
enrolled in an IdM domain.
Prerequisites
You have prepared the control node and the managed nodes
You are logged in to the control node as a user who can run playbooks on the managed nodes.
The account you use to connect to the managed nodes has sudo permissions on them.
Procedure
1. Create a playbook file, for example ~/playbook.yml, with the following content:
---
- name: Deploying remote input and remote_files output with certs
hosts: managed-node-01.example.com
87
Red Hat Enterprise Linux 8 Configuring basic system settings
roles:
- rhel-system-roles.logging
vars:
logging_certificates:
- name: logging_cert
dns: ['localhost', 'www.example.com']
ca: ipa
logging_pki_files:
- ca_cert: /local/path/to/ca_cert.pem
cert: /local/path/to/logging_cert.pem
private_key: /local/path/to/logging_cert.pem
logging_inputs:
- name: input_name
type: remote
tcp_ports: 514
tls: true
permitted_clients: ['clients.example.com']
logging_outputs:
- name: output_name
type: remote_files
remote_log_path: /var/log/remote/%FROMHOST%/%PROGRAMNAME:::secpath-
replace%.log
async_writing: true
client_count: 20
io_buffer_size: 8192
logging_flows:
- name: flow_name
inputs: [input_name]
outputs: [output_name]
logging_certificates
The value of this parameter is passed on to certificate_requests in the certificate
RHEL system role and used to create a private key and certificate.
logging_pki_files
Using this parameter, you can configure the paths and other settings that logging uses to
find the CA, certificate, and key files used for TLS, specified with one or more of the
following sub-parameters: ca_cert, ca_cert_src, cert, cert_src, private_key,
private_key_src, and tls.
NOTE
If you are using logging_certificates to create the files on the target node, do
not use ca_cert_src, cert_src, and private_key_src, which are used to copy
files not created by logging_certificates.
ca_cert
Represents the path to the CA certificate file on the target node. Default path is
/etc/pki/tls/certs/ca.pem and the file name is set by the user.
cert
Represents the path to the certificate file on the target node. Default path is
/etc/pki/tls/certs/server-cert.pem and the file name is set by the user.
88
CHAPTER 9. CONFIGURING LOGGING
private_key
Represents the path to the private key file on the target node. Default path is
/etc/pki/tls/private/server-key.pem and the file name is set by the user.
ca_cert_src
Represents the path to the CA certificate file on the control node which is copied to the
target host to the location specified by ca_cert. Do not use this if using
logging_certificates.
cert_src
Represents the path to a certificate file on the control node which is copied to the target
host to the location specified by cert. Do not use this if using logging_certificates.
private_key_src
Represents the path to a private key file on the control node which is copied to the target
host to the location specified by private_key. Do not use this if using logging_certificates.
tls
Setting this parameter to true ensures secure transfer of logs over the network. If you do not
want a secure wrapper, you can set tls: false.
Note that this command only validates the syntax and does not protect against a wrong but valid
configuration.
$ ansible-playbook ~/playbook.yml
Additional resources
/usr/share/ansible/roles/rhel-system-roles.logging/README.md file
/usr/share/doc/rhel-system-roles/logging/ directory
Reliable Event Logging Protocol (RELP) is a networking protocol for data and message logging over the
TCP network. It ensures reliable delivery of event messages and you can use it in environments that do
not tolerate any message loss.
The RELP sender transfers log entries in form of commands and the receiver acknowledges them once
they are processed. To ensure consistency, RELP stores the transaction number to each transferred
command for any kind of message recovery.
You can consider a remote logging system in between the RELP Client and RELP Server. The RELP
Client transfers the logs to the remote logging system and the RELP Server receives all the logs sent by
the remote logging system.
Administrators can use the logging RHEL system role to configure the logging system to reliably send
and receive log entries.
89
Red Hat Enterprise Linux 8 Configuring basic system settings
You can use the logging RHEL system role to configure logging in RHEL systems that are logged on a
local machine and can transfer logs to the remote logging system with RELP by running an Ansible
playbook.
This procedure configures RELP on all hosts in the clients group in the Ansible inventory. The RELP
configuration uses Transport Layer Security (TLS) to encrypt the message transmission for secure
transfer of logs over the network.
Prerequisites
You have prepared the control node and the managed nodes
You are logged in to the control node as a user who can run playbooks on the managed nodes.
The account you use to connect to the managed nodes has sudo permissions on them.
Procedure
1. Create a playbook file, for example ~/playbook.yml, with the following content:
---
- name: Deploying basic input and relp output
hosts: managed-node-01.example.com
roles:
- rhel-system-roles.logging
vars:
logging_inputs:
- name: basic_input
type: basics
logging_outputs:
- name: relp_client
type: relp
target: logging.server.com
port: 20514
tls: true
ca_cert: /etc/pki/tls/certs/ca.pem
cert: /etc/pki/tls/certs/client-cert.pem
private_key: /etc/pki/tls/private/client-key.pem
pki_authmode: name
permitted_servers:
- '*.server.example.com'
logging_flows:
- name: example_flow
inputs: [basic_input]
outputs: [relp_client]
target
This is a required parameter that specifies the host name where the remote logging system
is running.
port
Port number the remote logging system is listening.
90
CHAPTER 9. CONFIGURING LOGGING
tls
Ensures secure transfer of logs over the network. If you do not want a secure wrapper you
can set the tls variable to false. By default tls parameter is set to true while working with
RELP and requires key/certificates and triplets {ca_cert, cert, private_key} and/or
{ca_cert_src, cert_src, private_key_src}.
If the {ca_cert, cert, private_key} triplet is set, files are expected to be on the default
path before the logging configuration.
If both triplets are set, files are transferred from local path from control node to specific
path of the managed node.
ca_cert
Represents the path to CA certificate. Default path is /etc/pki/tls/certs/ca.pem and the file
name is set by the user.
cert
Represents the path to certificate. Default path is /etc/pki/tls/certs/server-cert.pem and
the file name is set by the user.
private_key
Represents the path to private key. Default path is /etc/pki/tls/private/server-key.pem and
the file name is set by the user.
ca_cert_src
Represents local CA certificate file path which is copied to the target host. If ca_cert is
specified, it is copied to the location.
cert_src
Represents the local certificate file path which is copied to the target host. If cert is
specified, it is copied to the location.
private_key_src
Represents the local key file path which is copied to the target host. If private_key is
specified, it is copied to the location.
pki_authmode
Accepts the authentication mode as name or fingerprint.
permitted_servers
List of servers that will be allowed by the logging client to connect and send logs over TLS.
inputs
List of logging input dictionary.
outputs
List of logging output dictionary.
Note that this command only validates the syntax and does not protect against a wrong but valid
91
Red Hat Enterprise Linux 8 Configuring basic system settings
Note that this command only validates the syntax and does not protect against a wrong but valid
configuration.
$ ansible-playbook ~/playbook.yml
Additional resources
/usr/share/ansible/roles/rhel-system-roles.logging/README.md file
/usr/share/doc/rhel-system-roles/logging/ directory
You can use the logging RHEL system role to configure logging in RHEL systems as a server and can
receive logs from the remote logging system with RELP by running an Ansible playbook.
This procedure configures RELP on all hosts in the server group in the Ansible inventory. The RELP
configuration uses TLS to encrypt the message transmission for secure transfer of logs over the
network.
Prerequisites
You have prepared the control node and the managed nodes
You are logged in to the control node as a user who can run playbooks on the managed nodes.
The account you use to connect to the managed nodes has sudo permissions on them.
Procedure
1. Create a playbook file, for example ~/playbook.yml, with the following content:
---
- name: Deploying remote input and remote_files output
hosts: managed-node-01.example.com
roles:
- rhel-system-roles.logging
vars:
logging_inputs:
- name: relp_server
type: relp
port: 20514
tls: true
ca_cert: /etc/pki/tls/certs/ca.pem
cert: /etc/pki/tls/certs/server-cert.pem
private_key: /etc/pki/tls/private/server-key.pem
pki_authmode: name
permitted_clients:
- '*example.client.com'
logging_outputs:
- name: remote_files_output
type: remote_files
logging_flows:
92
CHAPTER 9. CONFIGURING LOGGING
- name: example_flow
inputs: relp_server
outputs: remote_files_output
port
Port number the remote logging system is listening.
tls
Ensures secure transfer of logs over the network. If you do not want a secure wrapper you
can set the tls variable to false. By default tls parameter is set to true while working with
RELP and requires key/certificates and triplets {ca_cert, cert, private_key} and/or
{ca_cert_src, cert_src, private_key_src}.
If the {ca_cert, cert, private_key} triplet is set, files are expected to be on the default
path before the logging configuration.
If both triplets are set, files are transferred from local path from control node to specific
path of the managed node.
ca_cert
Represents the path to CA certificate. Default path is /etc/pki/tls/certs/ca.pem and the file
name is set by the user.
cert
Represents the path to the certificate. Default path is /etc/pki/tls/certs/server-cert.pem
and the file name is set by the user.
private_key
Represents the path to private key. Default path is /etc/pki/tls/private/server-key.pem and
the file name is set by the user.
ca_cert_src
Represents local CA certificate file path which is copied to the target host. If ca_cert is
specified, it is copied to the location.
cert_src
Represents the local certificate file path which is copied to the target host. If cert is
specified, it is copied to the location.
private_key_src
Represents the local key file path which is copied to the target host. If private_key is
specified, it is copied to the location.
pki_authmode
Accepts the authentication mode as name or fingerprint.
permitted_clients
List of clients that will be allowed by the logging server to connect and send logs over TLS.
inputs
List of logging input dictionary.
93
Red Hat Enterprise Linux 8 Configuring basic system settings
outputs
List of logging output dictionary.
Note that this command only validates the syntax and does not protect against a wrong but valid
configuration.
$ ansible-playbook ~/playbook.yml
Additional resources
/usr/share/ansible/roles/rhel-system-roles.logging/README.md file
/usr/share/doc/rhel-system-roles/logging/ directory
94
CHAPTER 10. TROUBLESHOOTING PROBLEMS BY USING LOG FILES
The systemd-journald daemon collects messages from various sources and forwards them to Rsyslog
for further processing. The systemd-journald daemon collects messages from the following sources:
Kernel
Syslog
The Rsyslog service sorts the syslog messages by type and priority and writes them to the files in the
/var/log directory. The /var/log directory persistently stores the log messages.
You can use the journalctl command to view messages in the system journal using the command line,
for example:
95
Red Hat Enterprise Linux 8 Configuring basic system settings
Command Description
journalctl FILEPATH Shows logs related to a specific file. For example, the
journalctl /dev/sda command displays logs related
to the /dev/sda file system.
Command Description
Command Description
96
CHAPTER 10. TROUBLESHOOTING PROBLEMS BY USING LOG FILES
Command Description
journalctl --list-boots Shows a tabular list of boot numbers, their IDs, and
the timestamps of the first and last message
pertaining to the boot. You can use the ID in the next
command to view detailed information.
Prerequisites
Procedure
2. Click Logs.
3. Open log entry details by clicking on your selected log entry in the list.
NOTE
You can use the Pause button to pause new log entries from appearing. Once you
resume new log entries, the web console will load all log entries that were reported after
you used the Pause button.
97
Red Hat Enterprise Linux 8 Configuring basic system settings
You can filter the logs by time, priority or identifier. For more information, see Filtering logs in the web
console.
Prerequisites
Procedure
2. Click Logs.
3. By default, web console shows the latest log entries. To filter by a specific time range, click the
Time drop-down menu and choose a preferred option.
4. Error and above severity logs list is shown by default. To filter by different priority, click the
Error and above drop-down menu and choose a preferred priority.
5. By default, web console shows logs for all identifiers. To filter logs for a particular identifier, click
the All drop-down menu and select an identifier.
98
CHAPTER 10. TROUBLESHOOTING PROBLEMS BY USING LOG FILES
10.4.3. Text search options for filtering logs in the web console
The text search option functionality provides a big variety of options for filtering logs. If you decide to
filter logs by using the text search, you can use the predefined options that are defined in the three
drop-down menus, or you can type the whole search yourself.
Drop-down menus
There are three drop-down menus that you can use to specify the main parameters of your search:
Time: This drop-down menu contains predefined searches for different time ranges of your
search.
Priority: This drop-down menu provides options for different priority levels. It corresponds to
the journalctl --priority option. The default priority value is Error and above. It is set every
time you do not specify any other priority.
Identifier: In this drop-down menu, you can select an identifier that you want to filter.
Corresponds to the journalctl --identifier option.
Quantifiers
There are six quantifiers that you can use to specify your search. They are covered in the Options for
filtering logs table.
Log fields
If you want to search for a specific log field, it is possible to specify the field together with its content.
99
Red Hat Enterprise Linux 8 Configuring basic system settings
10.4.4. Using a text search box to filter logs in the web console
You can filter logs according to different parameters by using the text search box in the web console.
The search combines usage of the filtering drop-down menus, quantifiers, log fields, and free-form
string search.
Prerequisites
Procedure
2. Click Logs.
3. Use the drop-down menus to specify the three main quantifiers - time range, priority, and
identifier(s) - you want to filter.
The Priority quantifier always has to have a value. If you do not specify it, it automatically filters
the Error and above priority. Notice that the options you set reflect in the text search box.
5. You can use a free-form string to search for anything else. The search box also accepts regular
100
CHAPTER 10. TROUBLESHOOTING PROBLEMS BY USING LOG FILES
5. You can use a free-form string to search for anything else. The search box also accepts regular
expressions.
identifier Show messages for the specified Covered in the Identifier drop-
syslog identifier down menu.
SYSLOG_IDENTIFIER. Can be
specified multiple times.
101
Red Hat Enterprise Linux 8 Configuring basic system settings
102
CHAPTER 11. MANAGING USERS AND GROUPS
Each user is associated with a unique numerical identification number called user ID (UID). Each group is
associated with a group ID (GID). Users within a group share the same permissions to read, write, and
execute files owned by that group.
cat /usr/share/doc/setup*/uidgid
It is recommended to assign IDs to the new users and groups starting at 5000, as the reserved range
can increase in the future.
To make the IDs assigned to new users start at 5000 by default, modify the UID_MIN and GID_MIN
parameters in the /etc/login.defs file.
Procedure
To modify and make the IDs assigned to new users start at 5000 by default:
2. Find the lines that define the minimum value for automatic UID selection.
103
Red Hat Enterprise Linux 8 Configuring basic system settings
4. Find the lines that define the minimum value for automatic GID selection.
The dynamically assigned UIDs and GIDs for the regular users now start at 5000.
NOTE
The UID’s and GID’s of users and groups created before you changed the
UID_MIN and GID_MIN values do not change.
This will allow new user’s group to have same 5000+ ID as UID and GID.
WARNING
UPGs simplify the collaboration on a project between multiple users. In addition, UPG system
configuration makes it safe to set default permissions for a newly created file or directory, as it allows
both the user, and the group this user is a part of, to make modifications to the file or directory.
Normal accounts are created for users of a particular system. Such accounts can be added,
104
CHAPTER 11. MANAGING USERS AND GROUPS
Normal accounts are created for users of a particular system. Such accounts can be added,
removed, and modified during normal system administration.
WARNING
For system accounts, user IDs below 1000 are reserved. For normal accounts, you can use IDs
starting at 1000. However, the recommended practice is to assign IDs starting at 5000. For
assigning IDs, see the /etc/login.defs file.
Group:
A group is an entity which ties together multiple user accounts for a common purpose, such as
granting access to particular files.
$ id
uid=1000(example.user) gid=1000(example.user) groups=1000(example.user),10(wheel)
context=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023
# useradd example.user
# passwd example.user
Additional resources
105
Red Hat Enterprise Linux 8 Configuring basic system settings
Prerequisites
Root access
Procedure
Replace options with the command-line options for the useradd command, and replace
username with the name of the user.
Verification
# id sarah
Additional resources
Prerequisites
Root access
Procedure
106
CHAPTER 11. MANAGING USERS AND GROUPS
Replace options with the command-line options for the groupadd command, and replace
group-name with the name of the group.
Verification
# tail /etc/group
sysadmins:x:5000:
Additional resources
Prerequisites
root access
Procedure
Replace group-name with the name of the group, and replace username with the name of the
user.
107
Red Hat Enterprise Linux 8 Configuring basic system settings
Verification
To verify the new groups is added to the supplementary groups of the user sysadmin, use:
# groups sysadmin
Prerequisites
Root access
Procedure
1. Create a directory:
# mkdir directory-name
2. Create a group:
# groupadd group-name
Replace group-name with the name of the group, and replace username with the name of the
user.
4. Associate the user and group ownership of the directory with the group-name group:
Replace group-name with the name of the group, and replace directory-name with the name of
the directory.
5. Set the write permissions to allow the users to create and modify files and directories and set
108
CHAPTER 11. MANAGING USERS AND GROUPS
5. Set the write permissions to allow the users to create and modify files and directories and set
the setgid bit to make this permission be applied within the directory-name directory:
Now all members of the group-name group can create and edit files in the directory-name
directory. Newly created files retain the group ownership of group-name group.
Verification
# ls -ld directory-name
Prerequisites
Procedure
To only remove the user account, and not the user data:
# userdel user-name
a. Remove the user, their home directory, their mail spool, and their SELinux user mapping:
# rm -rf /var/lib/AccountsService/users/user-name
This directory stores information that the system needs about the user before the home
109
Red Hat Enterprise Linux 8 Configuring basic system settings
This directory stores information that the system needs about the user before the home
directory is available. Depending on the system configuration, the home directory might not
be available until the user authenticates at the login screen.
IMPORTANT
If you do not remove this directory and you later recreate the same user, the
recreated user will still use certain settings inherited from the removed user.
Additional resources
You can also set password expiration and terminate user sessions in the web console.
Prerequisites
Procedure
2. Click Accounts.
4. In the Full Name field, enter the full name of the user.
The RHEL web console automatically suggests a user name from the full name and fills it in the
User Name field. If you do not want to use the original naming convention consisting of the first
letter of the first name and the whole surname, update the suggestion.
5. In the Password/Confirm fields, enter the password and retype it for verification that your
password is correct.
The color bar below the fields shows you the security level of the entered password, which does
not allow you to create a user with a weak password.
6. Click Create to save the settings and close the dialog box.
8. In the Groups drop-down menu, select the groups that you want to add to the new account.
110
CHAPTER 11. MANAGING USERS AND GROUPS
Now you can see the new account in the Accounts settings and you can use its credentials to
connect to the system.
Prerequisites
Procedure
2. Click Accounts.
3. Select the user account for which you want to enforce password expiration.
5. In the Password expiration dialog box, select Require password change every … days and
enter a positive whole number representing the number of days after which the password
expires.
6. Click Change.
The web console immediately shows the date of the future password change request on the
Password line.
111
Red Hat Enterprise Linux 8 Configuring basic system settings
On Linux, user groups can act as primary or supplementary. Primary and supplementary groups have the
following properties:
Primary group
Supplementary groups
You can add an existing user to an existing supplementary group to manage users with the
same security and access privileges within the group.
Procedure
Display the names of the primary and any supplementary group of a user:
$ groups user-name
Replace user-name with the name of the user. If you do not provide a user name, the command
displays the group membership for the current user. The first group is the primary group
followed by the optional supplementary groups.
$ groups sarah
User sarah has a primary group sarah and is a member of supplementary groups wheel and
developer.
$ groups marc
112
CHAPTER 11. MANAGING USERS AND GROUPS
marc : marc
User marc has only a primary group marc and no supplementary groups.
Prerequisites:
1. root access
Procedure
Replace group-name with the name of the new primary group, and replace user-name with the
name of the user.
NOTE
When you change a user’s primary group, the command also automatically
changes the group ownership of all files in the user’s home directory to the new
primary group. You must fix the group ownership of files outside of the user’s
home directory manually.
If the user sarah belongs to the primary group sarah1, and you want to change the primary
group of the user to sarah2, use:
Verification
$ groups sarah
sarah : sarah2
You can add a user to a supplementary group to manage permissions or enable access to certain files or
113
Red Hat Enterprise Linux 8 Configuring basic system settings
You can add a user to a supplementary group to manage permissions or enable access to certain files or
devices.
Prerequisites
root access
Procedure
Replace group-name with the name of the group, and replace username with the name of the
user.
Verification
To verify the new groups is added to the supplementary groups of the user sysadmin, use:
# groups sysadmin
Prerequisites
root access
Procedure
Replace user-name with the name of the user, and replace group-name with the name of the
supplementary group.
114
CHAPTER 11. MANAGING USERS AND GROUPS
If the user sarah has a primary group sarah2, and belongs to the secondary groups wheel
and developers, and you want to remove that user from the group developers, use:
Verification
Verify that you removed the user sarah from the secondary group developers:
$ groups sarah
Prerequisites
root access
Procedure
Replace group-names with the name of one or more supplementary groups. To add the user to
several supplementary groups at once, separate the group names using commas and no
intervening spaces. For example: wheel,developer.
IMPORTANT
If the user is currently a member of a group that you do not specify, the
command removes the user from the group.
If the user sarah has a primary group sarah2, and belongs to the supplementary group
wheel, and you want the user to belong to three more supplementary groups developer,
sysadmin, and security, use:
115
Red Hat Enterprise Linux 8 Configuring basic system settings
Verification
Verify that you set the list of the supplementary groups correct:
# groups sarah
Prerequisites
Root access
Procedure
# passwd
You are prompted to enter your current password before you can change it.
Prerequisites
Procedure
To change or reset the root password as a non-root user that belongs to the wheel group, use:
You are prompted to enter your current non-root password before you can change the root
password.
If you are unable to log in as a non-root user or do not belong to the administrative wheel group, you can
116
CHAPTER 11. MANAGING USERS AND GROUPS
If you are unable to log in as a non-root user or do not belong to the administrative wheel group, you can
reset the root password on boot by switching into a specialized chroot jail environment.
Procedure
1. Reboot the system and, on the GRUB 2 boot screen, press the e key to interrupt the boot
process.
The kernel boot parameters appear.
load_video
set gfx_payload=keep
insmod gzio
linux ($root)/vmlinuz-4.18.0-80.e18.x86_64 root=/dev/mapper/rhel-root ro crash\
kernel=auto resume=/dev/mapper/rhel-swap rd.lvm.lv/swap rhgb quiet
initrd ($root)/initramfs-4.18.0-80.e18.x86_64.img $tuned_initrd
3. Add rd.break to the end of the line that starts with linux.
The file system is mounted as read-only in the /sysroot directory. Remounting the file system
as writable allows you to change the password.
chroot /sysroot
passwd
Follow the instructions displayed by the command line to finalize the change of the root
password.
touch /.autorelabel
117
Red Hat Enterprise Linux 8 Configuring basic system settings
exit
exit
11. Wait until the SELinux relabeling process is finished. Note that relabeling a large disk might take
a long time. The system reboots automatically when the process is complete.
Verification
1. To verify that the root password is successfully changed, log in as a normal user and open the
Terminal.
$ su
4. Print the user name associated with the current effective user ID:
# whoami
root
118
CHAPTER 12. MANAGING SUDO ACCESS
When a user enters a command with sudo for which the user does not have authorization, the system
records a message that contains the string <username> : user NOT in sudoers to the journal log.
The default /etc/sudoers file provides information and examples of authorizations. You can activate a
specific example rule by uncommenting the corresponding line. The section with user authorizations is
marked with the following introduction:
## Next comes the main part: which users can run what software on
## which machines (the sudoers file can be shared between multiple
## systems).
You can create new sudoers authorizations and modify existing authorizations by using the following
format:
Where:
<username> is the user that enters the command, for example, user1. If the value starts with %,
it defines a group, for example, %group1.
<path/to/command> is the complete absolute path to the command. You can also limit the user
to only performing a command with specific options and arguments by adding those options
after the command path. If you do not specify any options, the user can use the command with
all options.
You can apply the rule to all users, hosts, or commands by replacing any of these variables with ALL.
WARNING
With overly permissive rules, such as ALL ALL=(ALL) ALL, all users can run all
commands as all users on all hosts. This presents serious security risks.
119
Red Hat Enterprise Linux 8 Configuring basic system settings
You can specify the arguments negatively by using the ! operator. For example, !root specifies all users
except root. Note that allowing specific users, groups, and commands is more secure than disallowing
specific users, groups, and commands. This is because allow rules also block new unauthorized users or
groups.
WARNING
Avoid using negative rules for commands because users can overcome such rules by
renaming commands with the alias command.
The system reads the /etc/sudoers file from beginning to end. Therefore, if the file contains multiple
entries for a user, the entries are applied in order. In case of conflicting values, the system uses the last
match, even if it is not the most specific match.
To preserve the rules during system updates and for easier fixing of errors, enter new rules by creating
new files in the /etc/sudoers.d/ directory instead of entering rules directly to the /etc/sudoers file. The
system reads the files in the /etc/sudoers.d directory when it reaches the following line in the
/etc/sudoers file:
#includedir /etc/sudoers.d
Note that the number sign (#) at the beginning of this line is part of the syntax and does not mean the
line is a comment. The names of files in that directory must not contain a period and must not end with a
tilde (~).
Additional resources
When users need to perform an administrative command, they can precede that command with sudo. If
the user has authorization for the command, the command is executed as if they were root.
Only users listed in the /etc/sudoers configuration file can use the sudo command.
The command is executed in the shell of the user, not in the root shell. However, there are some
exceptions such as when full sudo privileges are granted to any user. In such cases, users can
switch to and run the commands in root shell. For example:
sudo -i
sudo su -
Prerequisites
120
CHAPTER 12. MANAGING SUDO ACCESS
Prerequisites
Procedure
# visudo
The /etc/sudoers file defines the policies applied by the sudo command.
2. In the /etc/sudoers file, find the lines that grant sudo access to users in the administrative
wheel group.
3. Make sure the line that starts with %wheel is not commented out with the number sign ( #).
5. Add users you want to grant sudo access to into the administrative wheel group.
Verification
# id <username>
uid=5000(<username>) gid=5000(<username>) groups=5000(<username>),10(wheel)
Additional resources
More granular control over privileged actions. You can allow a user to perform certain actions on
specific hosts instead of giving them full administrative access.
Better logging. When a user performs an action through sudo, the action is logged with their
user name and not just root.
Transparent control. You can set email notifications for every time the user attempts to use
sudo privileges.
Prerequisites
121
Red Hat Enterprise Linux 8 Configuring basic system settings
Prerequisites
Procedure
# mkdir -p /etc/sudoers.d/
# visudo -f /etc/sudoers.d/<filename>
Replace <path/to/command> with the complete absolute path to the command. You can
also limit the user to only performing a command with specific options and arguments by
adding those options after the command path. If you do not specify any options, the user
can use the command with all options.
To allow two and more commands on the same host on one line, you can list them separated
by a comma followed by a space.
For example, to allow user1 to execute the dnf and reboot commands on
host1.example.com, enter user1 host1.example.com = /bin/dnf, /sbin/reboot.
4. Optional: To receive email notifications every time the user attempts to use sudo privileges,
add the following lines to the file:
Defaults mail_always
Defaults mailto="<[email protected]>"
Verification
1. To verify if a user can run a command with sudo privileges, switch the account:
# su <username> -
122
CHAPTER 12. MANAGING SUDO ACCESS
$ sudo <command>
[sudo] password for <username>:
3. If the privileges are configured correctly, the system displays the list of commands and options.
For example, with the dnf command, it shows the following output:
...
usage: dnf [options] COMMAND
...
If the system returns the error message <username> is not in the sudoers file. This incident
will be reported, the file for <username> in /etc/sudoers.d/ does not exist.
If the system returns the error message <username> is not allowed to run sudo on
<host.example.com>, the configuration was not completed correctly. Ensure that you are
logged in as root and that the configuration was performed correctly.
If the system returns the error message Sorry, user <username> is not allowed to execute
'<path/to/command>' as root on <host.example.com>., the command is not correctly defined
in the rule for the user.
Additional resources
123
Red Hat Enterprise Linux 8 Configuring basic system settings
Others (o).
Read (r).
Write (w).
Execute (x).
Note that the execute permission for a file allows you to execute that file. The execute permission for a
directory allows you to access the contents of the directory, but not execute it.
When a new file or directory is created, the default set of permissions are automatically assigned to it.
The default permissions for a file or directory are based on two factors:
Base permission.
No permission --- 0
Execute --x 1
Write -w- 2
Read r-- 4
124
CHAPTER 13. MANAGING FILE SYSTEM PERMISSIONS
The base permission for a directory is 777 (drwxrwxrwx), which grants everyone the permissions to
read, write, and execute. This means that the directory owner, the group, and others can list the
contents of the directory, create, delete, and edit items within the directory, and descend into it.
Note that individual files within a directory can have their own permission that might prevent you from
editing them, despite having unrestricted access to the directory.
The base permission for a file is 666 (-rw-rw-rw-), which grants everyone the permissions to read and
write. This means that the file owner, the group, and others can read and edit the file.
$ ls -l
-rwxrw----. 1 sysadmins sysadmins 2 Mar 2 08:43 file
- indicates it is a file.
rwx indicates that the file owner has permissions to read, write, and execute the file.
rw- indicates that the group has permissions to read and write, but not execute the file.
--- indicates that other users have no permission to read, write, or execute the file.
. indicates that the SELinux security context is set for the file.
$ ls -dl directory
drwxr-----. 1 sysadmins sysadmins 2 Mar 2 08:43 directory
d indicates it is a directory.
rwx indicates that the directory owner has the permissions to read, write, and access the
contents of the directory.
As a directory owner, you can list the items (files, subdirectories) within the directory, access
the content of those items, and modify them.
r-x indicates that the group has permissions to read the content of the directory, but not
write - create new entries or delete files. The x permission means that you can also access
the directory using the cd command.
--- indicates that other users have no permission to read, write, or access the contents of the
directory.
As someone who is not a user owner, or as group owner of the directory, you cannot list the
125
Red Hat Enterprise Linux 8 Configuring basic system settings
As someone who is not a user owner, or as group owner of the directory, you cannot list the
items within the directory, access information about those items, or modify them.
. indicates that the SELinux security context is set for the directory.
NOTE
The base permission that is automatically assigned to a file or directory is not the default
permission the file or directory ends up with. When you create a file or directory, the base
permission is altered by the umask. The combination of the base permission and the
umask creates the default permission for files and directories.
Read r-- 3
Write -w- 5
Execute --x 6
No permissions --- 7
The default umask for a standard user is 0002. The default umask for a root user is 0022.
The first digit of the umask represents special permissions (sticky bit, ). The last three digits of the
umask represent the permissions that are removed from the user owner ( u), group owner (g), and
others (o) respectively.
The following example illustrates how the umask with an octal value of 0137 is applied to the file with
the base permission of 777, to create the file with the default permission of 640.
126
CHAPTER 13. MANAGING FILE SYSTEM PERMISSIONS
When a standard user creates a new directory, the umask is set to 002 (rwxrwxr-x), and the base
permissions for a directory are set to 777 (rwxrwxrwx). This brings the default permissions to 775
(drwxrwxr-x).
This means that the directory owner and the group can list the contents of the directory, create, delete,
and edit items within the directory, and descend into it. Other users can only list the contents of the
directory and descend into it.
When a standard user creates a new file, the umask is set to 002 (rwxrwxr-x), and the base
permissions for a file are set to 666 (rw-rw-rw-). This brings the default permissions to 664 (-rw-rw-r-
-).
127
Red Hat Enterprise Linux 8 Configuring basic system settings
This means that the file owner and the group can read and edit the file, while other users can only
read the file.
Example 13.6. Default permissions for a directory created by the root user
When a root user creates a new directory, the umask is set to 022 (rwxr-xr-x), and the base
permissions for a directory are set to 777 (rwxrwxrwx). This brings the default permissions to 755
(rwxr-xr-x).
This means that the directory owner can list the contents of the directory, create, delete, and edit
items within the directory, and descend into it. The group and others can only list the contents of the
directory and descend into it.
Example 13.7. Default permissions for a file created by the root user
When a root user creates a new file, the umask is set to 022 (rwxr-xr-x), and the base permissions
for a file are set to 666 (rw-rw-rw-). This brings the default permissions to 644 (-rw-r—r--).
This means that the file owner can read and edit the file, while the group and others can only read
the file.
128
CHAPTER 13. MANAGING FILE SYSTEM PERMISSIONS
NOTE
For security reasons, regular files cannot have execute permissions by default, even if the
umask is set to 000 (rwxrwxrwx). However, directories can be created with execute
permissions.
Read (r)
Write (w)
Execute (x)
Other (o)
All (a)
= to remove the existing permissions and explicitly define the new ones
Procedure
Replace <level> with the level of ownership you want to set the permissions for. Replace
<operation> with one of the signs. Replace <permission> with the permissions you want to
assign. Replace file-name with the name of the file or directory. For example, to grant everyone
the permissions to read, write, and execute (rwx) my-script.sh, use the chmod a=rwx my-
script.sh command.
Verification
$ ls -l file-name
129
Red Hat Enterprise Linux 8 Configuring basic system settings
$ ls -dl directory-name
To see the permissions for all the files within a particular directory, use:
$ ls -l directory-name
$ ls -l my-file.txt
-rw-rw-r--. 1 username username 0 Feb 24 17:56 my-file.txt
2. Remove the permissions to read, write, and execute (rwx) the file from group owner ( g)
and others (o):
Note that any permission that is not specified after the equals sign (=) is automatically
prohibited.
$ ls -l my-file.txt
-rw-------. 1 username username 0 Feb 24 17:56 my-file.txt
$ ls -dl my-directory
drwxrwx---. 2 username username 4096 Feb 24 18:12 my-directory
2. Add the read and execute (r-x) access for all users ( a):
3. Verify that the permissions for my-directory and its content were set correctly:
$ ls -dl my-directory
drwxrwxr-x. 2 username username 4096 Feb 24 18:12 my-directory
130
CHAPTER 13. MANAGING FILE SYSTEM PERMISSIONS
Procedure
Replace file-name with the name of the file or directory. Replace octal_value with an octal value.
See Base file permissions for more details.
Procedure
$ getfacl file-name
Prerequisites
root access.
Procedure
Replace username with the name of the user, symbolic_value with a symbolic value, and file-name with
the name of the file or directory. For more information see the setfacl man page on your system.
The following example describes how to modify permissions for the group-project file owned by the
root user that belongs to the root group so that this file is:
131
Red Hat Enterprise Linux 8 Configuring basic system settings
Procedure
Verification
To verify that the user andrew has the rw- permission, the user susan has the ---
permission, and other users have the r-- permission, use:
$ getfacl group-project
# file: group-project
# owner: root
# group: root
user:andrew:rw-
user:susan:---
group::r--
mask::rw-
other::r--
Procedure
$ umask -S
To display the current value of the umask in the octal mode, use:
$ umask
NOTE
132
CHAPTER 13. MANAGING FILE SYSTEM PERMISSIONS
NOTE
When displaying the umask in octal mode, you may notice it displayed as a four
digit number (0002 or 0022). The first digit of the umask represents a special bit
(sticky bit, SGID bit, or SUID bit). If the first digit is set to 0, the special bit is not
set.
To determine whether you are executing a command in a login or a non-login shell, use the echo $0
command.
Example 13.10. Determining if you are working in a login or a non-login bash shell
If the output of the echo $0 command returns bash, you are executing the command in a
non-login shell.
$ echo $0
bash
The default umask for the non-login shell is set in the /etc/bashrc configuration file.
If the output of the echo $0 command returns -bash, you are executing the command in a
login shell.
# echo $0
-bash
The default umask for the login shell is set in the /etc/profile configuration file.
Procedure
To display the default bash umask for the non-login shell, use:
# By default, we want umask to get set. This sets it for non-login shell.
umask 002
umask 022
To display the default bash umask for the login shell, use:
133
Red Hat Enterprise Linux 8 Configuring basic system settings
# By default, we want umask to get set. This sets it for login shell
umask 002
umask 022
Read (r)
Write (w)
Execute (x)
Other (o)
All (a)
= to remove the existing permissions and explicitly define the new ones
NOTE
Any permission that is not specified after the equals sign (=) is automatically
prohibited.
Procedure
$ umask -S <level><operation><permission>
Replace <level> with the level of ownership you want to set the umask for. Replace
<operation> with one of the signs. Replace <permission> with the permissions you want to
assign. For example, to set the umask to u=rwx,g=rwx,o=rwx, use umask -S a=rwx.
NOTE
134
CHAPTER 13. MANAGING FILE SYSTEM PERMISSIONS
Procedure
$ umask octal_value
Replace octal_value with an octal value. See User file-creation mode mask for more details.
NOTE
Prerequisites
root access
Procedure
Replace the default octal value of the umask (002) with another octal value. See User file-
creation mode mask for more details.
Prerequisites
root access
Procedure
135
Red Hat Enterprise Linux 8 Configuring basic system settings
Replace the default octal value of the umask (022) with another octal value. See User file-
creation mode mask for more details.
Procedure
Append the line that specifies the octal value of the umask into the .bashrc file for the
particular user.
Replace octal_value with an octal value and replace username with the name of the user. See
User file-creation mode mask for more details.
Procedure
# HOME_MODE is used by useradd(8) and newusers(8) to set the mode for new
# home directories.
# If HOME_MODE is not set, the value of UMASK is used to create the mode.
HOME_MODE 0700
Replace the default octal value (0700) with another octal value. The selected mode will be used
to create the permissions for the home directory.
4. If HOME_MODE is not set, modify the UMASK to set the mode for the newly created home
directories:
136
CHAPTER 13. MANAGING FILE SYSTEM PERMISSIONS
# for increased privacy. There is no One True Answer here: each sysadmin
# must make up their mind.
UMASK 022
Replace the default octal value (022) with another octal value. See User file-creation mode
mask for more details.
137
Red Hat Enterprise Linux 8 Configuring basic system settings
The basic object that systemd manages is a systemd unit, a representation of system resources and
services. A systemd unit consists of a name, type and a configuration file that defines and manages a
particular task. You can use unit files to configure system behavior. See the following examples of
various systemd unit types:
Service
Controls and manages individual system services.
Target
Represents a group of units that define system states.
Device
Manages hardware devices and their availability.
Mount
Handles file system mounting.
Timer
Schedules tasks to run at specific intervals.
NOTE
# systemctl -t help
Directory Description
138
CHAPTER 14. MANAGING SYSTEMD
Directory Description
The default configuration of systemd is defined during the compilation and you can find the
configuration in the /etc/systemd/system.conf file. By editing this file, you can modify the default
configuration by overriding values for systemd units globally.
For example, to override the default value of the timeout limit, which is set to 90 seconds, use the
DefaultTimeoutStartSec parameter to input the required value in seconds.
DefaultTimeoutStartSec=required value
Procedure
Use the systemctl command to perform any of the following tasks:
46 loaded units listed. Pass --all to see loaded but inactive units, too.
To show all installed unit files use 'systemctl list-unit-files'
By default, the systemctl list-units command displays only active units. For each service unit
file, the command provides an overview of the following parameters:
139
Red Hat Enterprise Linux 8 Configuring basic system settings
UNIT
The full name of the service unit
LOAD
The load state of the configuration file
ACTIVE or SUB
The current high-level and low-level unit file activation state
DESCRIPTION
A short description of the unit’s purpose and functionality
List all loaded units regardless of their state, by using the following command with the --all or
-a command line option:
UNIT FILE
The full name of the service unit
STATE
The information whether the service unit is enabled or disabled to start automatically during
boot
Additional resources
Procedure
Use the systemctl command to perform any of the following tasks:
Display detailed information about a service unit that corresponds to a system service:
140
CHAPTER 14. MANAGING SYSTEMD
Replace <name> with the name of the service unit you want to inspect (for example, gdm).
The execution of the service unit: if the unit is executed by the root user
Field Description
The service unit for the GNOME Display Manager is named gdm.service. To determine the
current status of this service unit, type the following at a shell prompt:
141
Red Hat Enterprise Linux 8 Configuring basic system settings
NOTE
Check what services systemd orders to start before the specified service unit
For example, to view the list of services ordered to start before gdm, enter:
Check what services systemd orders to start after the specified service unit:
For example, to view the list of services systemd orders to start after gdm, enter:
Additional resources
142
CHAPTER 14. MANAGING SYSTEMD
Prerequisites
Root access
Procedure
Replace <name> with the name of the service unit you want to start (for example,
httpd.service).
NOTE
When you attempt to start a new service, systemd resolves all dependencies
automatically, without explicit notification to the user. This means that if you are
already running a service, and you attempt to start another service with a
negative dependency, the first service is automatically stopped.
For example, if you are running the postfix service, and you attempt to start the
sendmail service, systemd first automatically stops postfix, because these two
services are conflicting and cannot run on the same port.
Additional resources
Prerequisites
Root access
Procedure
143
Red Hat Enterprise Linux 8 Configuring basic system settings
Replace <name> with the name of the service unit you want to stop (for example, bluetooth).
Additional resources
Stop the selected service unit in the current session and immediately start it again.
Prerequisites
Root access
Procedure
Replace <name> with the name of the service unit you want to restart (for example, httpd).
NOTE
If the selected service unit is not running, this command starts it too.
Optional: Restart a service unit only if the corresponding service is already running:
NOTE
System services that do not support this feature, ignore this command. To restart
such services, use the reload-or-restart and reload-or-try-restart commands
instead.
Additional resources
144
CHAPTER 14. MANAGING SYSTEMD
Prerequisites
Root access
The service you want to enable must not be masked. If you have a masked service, unmask it
first:
Procedure
Replace <name> with the name of the service unit you want to enable (for example, httpd).
Optional: You can also enable and start a service by using a single command:
Additional resources
Prerequisites
Root access
Procedure
145
Red Hat Enterprise Linux 8 Configuring basic system settings
Replace <name> with the name of the service unit you want to disable (for example,
bluetooth).
Optional: If you want to make a service permanently unusable, mask the service:
Additional resources
The graphical.target unit for starting a graphical session, starts system services such as the
GNOME Display Manager (gdm.service) or Accounts Service (accounts-daemon.service),
and also activates the multi-user.target unit.
Similarly, the multi-user.target unit starts other essential system services such as
NetworkManager (NetworkManager.service) or D-Bus (dbus.service) and activates another
target unit named basic.target.
You can set the following systemd targets as default or current targets:
rescue unit target that pulls in the base system and spawns a rescue shell
emergency unit target that starts an emergency shell on the main console
146
CHAPTER 14. MANAGING SYSTEMD
Additional resources
Prerequisites
Root access
Procedure
1. Determine the current default target unit systemd uses to start the system:
# systemctl get-default
graphical.target
Replace <name> with the name of the target unit you want to use by default.
Example:
# systemctl set-default multi-user.target
Removed /etc/systemd/system/default.target
Created symlink /etc/systemd/system/default.target -> /usr/lib/systemd/system/multi-
user.target
# systemctl get-default
multi-user.target
# reboot
Additional resources
147
Red Hat Enterprise Linux 8 Configuring basic system settings
Procedure
# systemctl get-default
graphical.target
NOTE
You can only isolate targets that have the AllowIsolate=yes option set in the
unit files.
Replace <name> with the name of the target unit you want to use in the current boot.
Example:
# systemctl isolate multi-user.target
This command starts the target unit named multi-user and all dependent units, and immediately
stops all other unit.
Additional resources
Prerequisites
Root access
Procedure
To enter the rescue mode, change the current target in the current session:
148
CHAPTER 14. MANAGING SYSTEMD
# systemctl rescue
NOTE
To prevent systemd from sending a message, enter the following command with
the --no-wall command-line option:
Troubleshooting steps
If your system is not able to enter the rescue mode, you can boot to emergency mode, which provides
the most minimal environment possible. In emergency mode, the system mounts the root file system
only for reading, does not attempt to mount any other local file systems, does not activate network
interfaces, and only starts a few essential services.
Procedure
1. Reboot the system, and interrupt the boot loader menu countdown by pressing any key except
the Enter key, which would initiate a normal boot.
2. Move the cursor to the kernel entry that you want to start.
4. Move to the end of the line that starts with linux and press Ctrl+E to jump to the end of the line:
5. To choose an alternate boot target, append the systemd.unit= parameter to the end of the line
that starts with linux:
Replace <name> with the name of the target unit you want to use. For example,
systemd.unit=emergency.target
149
Red Hat Enterprise Linux 8 Configuring basic system settings
You can schedule a shutdown by using the time argument. This also gives users warning that a
system shutdown has been scheduled.
Additional resources
Shut down the system and power off the machine at a certain time
Shut down and halt the system without powering off the machine
Prerequisites
Root access
Procedure
Use the shutdown command to perform any of the following tasks:
Specify the time at which you want to shut down the system and power off the machine:
Where hh:mm is the time in the 24-hour time notation. To prevent new logins, the /run/nologin
file is created 5 minutes before system shutdown.
When you use the time argument, you can notify users logged in to the system of the planned
shutdown by specifying an optional wall message, for example shutdown --poweroff 13:59
"Attention. The system will shut down at 13:59".
Shut down and halt the system after a delay, without powering off the machine:
150
CHAPTER 14. MANAGING SYSTEMD
# shutdown --halt +m
Where +m is the delay time in minutes. You can use the now keyword as an alias for +0.
# shutdown -c
Additional resources
Prerequisites
Root access
Procedure
Use the systemctl command to perform any of the following tasks:
# systemctl poweroff
Shut down and halt the system without powering off the machine:
# systemctl halt
NOTE
Prerequisites
151
Red Hat Enterprise Linux 8 Configuring basic system settings
Prerequisites
Root access
Procedure
# systemctl reboot
NOTE
By default, when you use this command, systemd sends an informative message to all
users that are currently logged into the system. To prevent systemd from sending this
message, run this command with the --no-wall option.
Suspend
Suspending saves the system state in RAM and with the exception of the RAM module, powers off
most of the devices in the machine. When you turn the machine back on, the system then restores its
state from RAM without having to boot again. Because the system state is saved in RAM and not on
the hard disk, restoring the system from suspend mode is significantly faster than from hibernation.
However, the suspended system state is also vulnerable to power outages.
Hibernate
Hibernating saves the system state on the hard disk drive and powers off the machine. When you
turn the machine back on, the system then restores its state from the saved data without having to
boot again. Because the system state is saved on the hard disk and not in RAM, the machine does
not have to maintain electrical power to the RAM module. However, as a consequence, restoring the
system from hibernation is significantly slower than restoring it from suspend mode.
Hybrid sleep
This combines elements of both hibernation and suspending. The system first saves the current
state on the the hard disk drive, and enters a low-power state similar to suspending, which allows the
system to resume more quickly. The benefit of hybrid sleep is that if the system loses power during
the sleep state, it can still recover the previous state from the saved image on the hard disk, similar to
hibernation.
Suspend-then-hibernate
This mode first suspends the system, which results in saving the current system state to RAM and
putting the system in a low-power mode. The system hibernates if it remains suspended for a
specific period of time that you can define in the HibernateDelaySec parameter. Hibernation saves
the system state to the hard disk drive and shuts down the system completely. The suspend-then-
hibernate mode provides the benefit of conserving battery power while you are still able to quickly
resume work. Additionally, this mode ensures that your data is saved in case of a power failure.
Prerequisites
Root access
Procedure
152
CHAPTER 14. MANAGING SYSTEMD
# systemctl suspend
# systemctl hibernate
# systemctl hybrid-sleep
# systemctl suspend-then-hibernate
When you press the power button in a non-graphical systemd target, it shuts down the system by
default. You can customize this behavior according to your preferences.
Prerequisites
153
Red Hat Enterprise Linux 8 Configuring basic system settings
Administrative access.
Procedure
3. If the line starts with the # symbol, remove it to enable the setting.
poweroff
Shut down the computer.
reboot
Reboot the system.
halt
Initiate a system halt.
kexec
Initiate a kexec reboot.
suspend
Suspend the system.
hibernate
Initiate system hibernation.
ignore
Do nothing.
For example, to reboot the system upon pressing the power button, use this setting:
HandlePowerKey=reboot
Next steps
If you use the graphical session, also configure the power button in GNOME. See
Section 14.4.7.2, “Changing the power button behavior in GNOME” .
On the graphical login screen or in the graphical user session, pressing the power button suspends the
machine by default. This happens both in cases when the user presses the power button physically or
when pressing a virtual power button from a remote console. You can select a different power button
behavior.
Prerequisites
You have configured the power button behavior in systemd. See Section 14.4.7.1, “Changing
the power button behavior in systemd”.
154
CHAPTER 14. MANAGING SYSTEMD
Procedure
[org/gnome/settings-daemon/plugins/power]
power-button-action='suspend'
nothing
Does nothing .
suspend
Suspends the system.
hibernate
Hibernates the system.
interactive
Shows a pop-up query asking the user what to do.
With interactive mode, the system powers off automatically after 60 seconds when pressing
the power button. However, you can choose a different behavior from the pop-up query.
2. Optional: Override the user’s setting, and prevent the user from changing it. Enter the following
configuration in the /etc/dconf/db/local.d/locks/01-power file:
/org/gnome/settings-daemon/plugins/power/power-button-action
# dconf update
4. Log out and back in again for the system-wide settings to take effect.
155
Red Hat Enterprise Linux 8 Configuring basic system settings
The user space daemon updates the system clock running in the kernel. The system clock can keep time
by using various clock sources. Usually, the Time Stamp Counter (TSC) is used. The TSC is a CPU
register which counts the number of cycles since it was last reset. It is very fast, has a high resolution,
and there are no interruptions.
Starting with Red Hat Enterprise Linux 8, the NTP protocol is implemented by the chronyd daemon,
available from the repositories in the chrony package.
The following sections describe how to use the chrony suite to configure NTP.
To synchronize the system clock with a reference clock, for example a GPS receiver
As an NTPv4(RFC 5905) server or peer to provide a time service to other computers in the
network
chrony performs well in a wide range of conditions, including intermittent network connections, heavily
congested networks, changing temperatures (ordinary computer clocks are sensitive to temperature),
and systems that do not run continuously, or run on a virtual machine.
Typical accuracy between two machines synchronized over the Internet is within a few milliseconds, and
for machines on a LAN within tens of microseconds. Hardware timestamping or a hardware reference
clock may improve accuracy between two machines synchronized to a sub-microsecond level.
chrony consists of chronyd, a daemon that runs in user space, and chronyc, a command line program
which can be used to monitor the performance of chronyd and to change various operating parameters
when it is running.
The chrony daemon, chronyd, can be monitored and controlled by the command line utility chronyc.
This utility provides a command prompt which allows entering a number of commands to query the
current state of chronyd and make changes to its configuration. By default, chronyd accepts only
commands from a local instance of chronyc, but it can be configured to accept monitoring commands
also from remote hosts. The remote access should be restricted.
156
CHAPTER 15. CONFIGURING TIME SYNCHRONIZATION
You can control chronyd by using the chronyc command line utility.
Procedure
1. To make changes to the local instance of chronyd using the command line utility chronyc in
interactive mode, enter the following command as root:
# chronyc
chronyc must run as root if some of the restricted commands are to be used.
chronyc>
3. Alternatively, the utility can also be invoked in non-interactive command mode if called together
with a command as follows:
chronyc command
NOTE
Changes made using chronyc are not permanent, they will be lost after a chronyd
restart. For permanent changes, modify /etc/chrony.conf.
Starting with Red Hat Enterprise Linux 8, ntp is no longer supported. chrony is enabled by default. For
this reason, you might need to migrate from ntp to chrony.
Migrating from ntp to chrony is straightforward in most cases. The corresponding names of the
programs, configuration files and services are:
Table 15.1. Corresponding names of the programs, configuration files and services when migrating
from ntp to chrony
/etc/ntp.conf /etc/chrony.conf
/etc/ntp/keys /etc/chrony.keys
ntpd chronyd
ntpq chronyc
157
Red Hat Enterprise Linux 8 Configuring basic system settings
ntpd.service chronyd.service
ntp-wait.service chrony-wait.service
The ntpdate and sntp utilities, which are included in the ntp distribution, can be replaced with chronyd
using the -q option or the -t option. The configuration can be specified on the command line to avoid
reading /etc/chrony.conf. For example, instead of running ntpdate ntp.example.com, chronyd could
be started as:
The ntpstat utility, which was previously included in the ntp package and supported only ntpd, now
supports both ntpd and chronyd. It is available in the ntpstat package.
A Python script called ntp2chrony.py is included in the documentation of the chrony package
(/usr/share/doc/chrony). The script automatically converts an existing ntp configuration to chrony. It
supports the most common directives and options in the ntp.conf file. Any lines that are ignored in the
conversion are included as comments in the generated chrony.conf file for review. Keys that are
specified in the ntp key file, but are not marked as trusted keys in ntp.conf are included in the generated
chrony.keys file as comments.
By default, the script does not overwrite any files. If /etc/chrony.conf or /etc/chrony.keys already exist,
the -b option can be used to rename the file as a backup. The script supports other options. The --help
option prints all supported options.
An example of an invocation of the script with the default ntp.conf provided in the ntp package is:
# python3 /usr/share/doc/chrony/ntp2chrony.py -b -v
Reading /etc/ntp.conf
Reading /etc/ntp/crypto/pw
Reading /etc/ntp/keys
Writing /etc/chrony.conf
Writing /etc/chrony.keys
The only directive ignored in this case is disable monitor, which has a chrony equivalent in the
noclientlog directive, but it was included in the default ntp.conf only to mitigate an amplification attack.
The generated chrony.conf file typically includes a number of allow directives corresponding to the
restrict lines in ntp.conf. If you do not want to run chronyd as an NTP server, remove all allow directives
from chrony.conf.
158
CHAPTER 15. CONFIGURING TIME SYNCHRONIZATION
The following sections describe how to install, start, and stop chronyd, and how to check if chrony is
synchronized. Sections also describe how to manually adjust System Clock.
Procedure
1. The chrony suite is installed by default on Red Hat Enterprise Linux. To ensure that it is, run the
following command as root:
The default location for the chrony daemon is /usr/sbin/chronyd. The command line utility will
be installed to /usr/bin/chronyc.
To ensure chronyd starts automatically at system start, issue the following command as root:
To prevent chronyd from starting automatically at system start, issue the following command
as root:
Procedure
$ chronyc tracking
Reference ID : CB00710F (ntp-server.example.net)
159
Red Hat Enterprise Linux 8 Configuring basic system settings
Stratum :3
Ref time (UTC) : Fri Jan 27 09:49:17 2017
System time : 0.000006523 seconds slow of NTP time
Last offset : -0.000006747 seconds
RMS offset : 0.000035822 seconds
Frequency : 3.225 ppm slow
Residual freq : 0.000 ppm
Skew : 0.129 ppm
Root delay : 0.013639022 seconds
Root dispersion : 0.001100737 seconds
Update interval : 64.2 seconds
Leap status : Normal
2. The sources command displays information about the current time sources that chronyd is
accessing. To check chrony sources, issue the following command:
$ chronyc sources
210 Number of sources = 3
MS Name/IP address Stratum Poll Reach LastRx Last sample
===========================================================================
====
#* GPS0 0 4 377 11 -479ns[ -621ns] /- 134ns
^? a.b.c 2 6 377 23 -923us[ -924us] +/- 43ms
^ d.e.f 1 6 377 21 -2629us[-2619us] +/- 86ms
You can specify the optional -v argument to print more verbose information. In this case, extra
caption lines are shown as a reminder of the meanings of the columns.
3. The sourcestats command displays information about the drift rate and offset estimation
process for each of the sources currently being examined by chronyd. To check chrony source
statistics, issue the following command:
$ chronyc sourcestats
210 Number of sources = 1
Name/IP Address NP NR Span Frequency Freq Skew Offset Std Dev
===========================================================================
====
abc.def.ghi 11 5 46m -0.001 0.045 1us 25us
The optional argument -v can be specified, meaning verbose. In this case, extra caption lines are
shown as a reminder of the meanings of the columns.
Additional resources
Procedure
1. To step the system clock immediately, bypassing any adjustments in progress by slewing, issue
the following command as root:
160
CHAPTER 15. CONFIGURING TIME SYNCHRONIZATION
# chronyc makestep
If the rtcfile directive is used, the real-time clock should not be manually adjusted. Random adjustments
would interfere with chrony's need to measure the rate at which the real-time clock drifts.
1. The dispatcher script might run when no route to the NTP servers exists, causing the NTP
servers to switch to the offline state.
2. If you establish the route later, the script does not run again by default, and the NTP servers
remain in the offline state.
To ensure that chronyd can synchronize with your NTP servers, which have separately managed
interfaces, disable the dispatcher script.
Prerequisites
Root access
Procedure
#!/bin/sh
exit 0
NOTE
When you upgrade or reinstall the chrony package, the packaged version of the
dispatcher script replaces your modified dispatcher script.
The following procedure describes how to set up chrony for a system in an isolated network.
161
Red Hat Enterprise Linux 8 Configuring basic system settings
Procedure
1. On the system selected to be the server, using a text editor running as root, edit
/etc/chrony.conf as follows:
driftfile /var/lib/chrony/drift
commandkey 1
keyfile /etc/chrony.keys
initstepslew 10 client1 client3 client6
local stratum 8
manual
allow 192.0.2.0/24
Where 192.0.2.0/24 is the network or subnet address from which the clients are allowed to
connect. For more details, see chrony.conf(7) man page on your system
2. On the systems selected to be direct clients of the server, using a text editor running as root,
edit the /etc/chrony.conf as follows:
server ntp1.example.net
driftfile /var/lib/chrony/drift
logdir /var/log/chrony
log measurements statistics tracking
keyfile /etc/chrony.keys
commandkey 24
local stratum 10
initstepslew 20 ntp1.example.net
allow 192.0.2.123
Where 192.0.2.123 is the address of the server, and ntp1.example.net is the host name of the
server. Clients with this configuration will resynchronize with the server if it restarts.
On the client systems which are not to be direct clients of the server, the /etc/chrony.conf file should be
the same except that the local and allow directives should be omitted.
In an isolated network, you can also use the local directive that enables a local reference mode, which
allows chronyd operating as an NTP server to appear synchronized to real time, even when it was never
synchronized or the last update of the clock happened a long time ago.
To allow multiple servers in the network to use the same local configuration and to be synchronized to
one another, without confusing clients that poll more than one server, use the orphan option of the
local directive which enables the orphan mode. Each server needs to be configured to poll all other
servers with local. This ensures that only the server with the smallest reference ID has the local
reference active and other servers are synchronized to it. When the server fails, another one will take
over.
Unix domain socket, which is accessible locally by the root or chrony user.
By default, chronyc connects to the Unix domain socket. The default path is
162
CHAPTER 15. CONFIGURING TIME SYNCHRONIZATION
By default, chronyc connects to the Unix domain socket. The default path is
/var/run/chrony/chronyd.sock. If this connection fails, which can happen for example when chronyc is
running under a non-root user, chronyc tries to connect to 127.0.0.1 and then ::1.
Only the following monitoring commands, which do not affect the behavior of chronyd, are allowed from
the network:
activity
manual list
rtcdata
smoothing
sources
sourcestats
tracking
waitsync
The set of hosts from which chronyd accepts these commands can be configured with the cmdallow
directive in the configuration file of chronyd, or the cmdallow command in chronyc. By default, the
commands are accepted only from localhost (127.0.0.1 or ::1).
All other commands are allowed only through the Unix domain socket. When sent over the network,
chronyd responds with a Not authorised error, even if it is from localhost.
The following procedure describes how to access chronyd remotely with chronyc.
Procedure
1. Allow access from both IPv4 and IPv6 addresses by adding the following to the
/etc/chrony.conf file:
bindcmdaddress 0.0.0.0
or
bindcmdaddress ::
2. Allow commands from the remote IP address, network, or subnet by using the cmdallow
directive.
Add the following content to the /etc/chrony.conf file:
cmdallow 192.168.1.0/24
Optionally, you can open port 323 permanently using the --permanent option:
163
Red Hat Enterprise Linux 8 Configuring basic system settings
# firewall-cmd --reload
Additional resources
Note that using the timesync role also facilitates migration to chrony , because you can use the same
playbook on all versions of Red Hat Enterprise Linux starting with RHEL 6 regardless of whether the
system uses ntp or chrony to implement the NTP protocol.
WARNING
The timesync role replaces the configuration of the given or detected provider
service on the managed host. Previous settings are lost, even if they are not
specified in the role variables. The only preserved setting is the choice of provider if
the timesync_ntp_provider variable is not defined.
The following example shows how to apply the timesync role in a situation with just one pool of servers.
Example 15.1. An example playbook applying the timesync role for a single pool of servers
---
- hosts: timesync-test
vars:
timesync_ntp_servers:
- hostname: 2.rhel.pool.ntp.org
pool: yes
iburst: yes
roles:
- rhel-system-roles.timesync
For a detailed reference on timesync role variables, install the rhel-system-roles package, and see the
README.md or README.html files in the /usr/share/doc/rhel-system-roles/timesync directory.
Additional resources
Preparing a control node and managed nodes to use RHEL system roles
164
CHAPTER 15. CONFIGURING TIME SYNCHRONIZATION
Another protocol for time synchronization that uses hardware timestamping is PTP.
Unlike NTP, PTP relies on assistance in network switches and routers. If you want to reach the best
accuracy of synchronization, use PTP on networks that have switches and routers with PTP support, and
prefer NTP on networks that do not have such switches and routers.
# ethtool -T eth0
Output:
165
Red Hat Enterprise Linux 8 Configuring basic system settings
hardware-receive (SOF_TIMESTAMPING_RX_HARDWARE)
software-receive (SOF_TIMESTAMPING_RX_SOFTWARE)
software-system-clock (SOF_TIMESTAMPING_SOFTWARE)
hardware-raw-clock (SOF_TIMESTAMPING_RAW_HARDWARE)
PTP Hardware Clock: 0
Hardware Transmit Timestamp Modes:
off (HWTSTAMP_TX_OFF)
on (HWTSTAMP_TX_ON)
Hardware Receive Filter Modes:
none (HWTSTAMP_FILTER_NONE)
all (HWTSTAMP_FILTER_ALL)
ptpv1-l4-sync (HWTSTAMP_FILTER_PTP_V1_L4_SYNC)
ptpv1-l4-delay-req (HWTSTAMP_FILTER_PTP_V1_L4_DELAY_REQ)
ptpv2-l4-sync (HWTSTAMP_FILTER_PTP_V2_L4_SYNC)
ptpv2-l4-delay-req (HWTSTAMP_FILTER_PTP_V2_L4_DELAY_REQ)
ptpv2-l2-sync (HWTSTAMP_FILTER_PTP_V2_L2_SYNC)
ptpv2-l2-delay-req (HWTSTAMP_FILTER_PTP_V2_L2_DELAY_REQ)
ptpv2-event (HWTSTAMP_FILTER_PTP_V2_EVENT)
ptpv2-sync (HWTSTAMP_FILTER_PTP_V2_SYNC)
ptpv2-delay-req (HWTSTAMP_FILTER_PTP_V2_DELAY_REQ)
hwtimestamp eth0
hwtimestamp eth1
hwtimestamp *
The following directive in /etc/chrony.conf specifies a local NTP server using one second polling
interval:
166
CHAPTER 15. CONFIGURING TIME SYNCHRONIZATION
corresponds. In order to enable NTP clients receiving transmit timestamps that were generated after
the transmission, configure the clients to use the NTP interleaved mode by adding the xleave option to
the server directive in /etc/chrony.conf:
clientloglimit 100000000
Example 15.4. Log messages for interfaces with enabled hardware timestamping
When chronyd is configured as an NTP client or peer, you can have the transmit and receive
timestamping modes and the interleaved mode reported for each NTP source by the chronyc ntpdata
command:
Example 15.5. Reporting the transmit, receive timestamping and interleaved mode for each NTP
source
# chronyc ntpdata
Output:
167
Red Hat Enterprise Linux 8 Configuring basic system settings
# chronyc sourcestats
With hardware timestamping enabled, stability of NTP measurements should be in tens or hundreds
of nanoseconds, under normal load. This stability is reported in the Std Dev column of the output of
the chronyc sourcestats command:
Output:
Configure the ptp4l and phc2sys programs from the linuxptp packages to use one interface to
synchronize the system clock using PTP.
Configure chronyd to provide the system time using the other interface:
Example 15.7. Configuring chronyd to provide the system time using the other interface
bindaddress 203.0.113.74
hwtimestamp eth1
local stratum 1
168
CHAPTER 15. CONFIGURING TIME SYNCHRONIZATION
Some settings that were in previous major version of Red Hat Enterprise Linux supported by ntp, are not
supported by chrony. The following sections list such settings, and describe ways to achieve them on a
system with chrony.
To monitor the status of the system clock sychronized by chronyd, you can:
Use the ntpstat utility, which supports chrony and provides a similar output as it used to with
ntpd
$ chronyc -n tracking
Reference ID : 0A051B0A (10.5.27.10)
Stratum :2
Ref time (UTC) : Thu Mar 08 15:46:20 2018
System time : 0.000000338 seconds slow of NTP time
Last offset : +0.000339408 seconds
RMS offset : 0.000339408 seconds
Frequency : 2.968 ppm slow
Residual freq : +0.001 ppm
Skew : 3.336 ppm
Root delay : 0.157559142 seconds
Root dispersion : 0.001339232 seconds
Update interval : 64.5 seconds
Leap status : Normal
$ ntpstat
synchronised to NTP server (10.5.27.10) at stratum 2
time correct to within 80 ms
polling server every 64 s
In Red Hat Enterprise Linux 8, chronyd supports Network Time Security (NTS), a modern secure
authentication mechanism, instead of Autokey. For more information, see Overview of Network Time
Security (NTS) in chrony.
169
Red Hat Enterprise Linux 8 Configuring basic system settings
In Red Hat Enterprise Linux 7, ntpd supported ephemeral symmetric associations, which can be
mobilized by packets from peers which are not specified in the ntp.conf configuration file. In Red Hat
Enterprise Linux 8, chronyd needs all peers to be specified in chrony.conf. Ephemeral symmetric
associations are not supported.
Note that using the client/server mode enabled by the server or pool directive is more secure
compared to the symmetric mode enabled by the peer directive.
In Red Hat Enterprise Linux 8, chronyd does not support the broadcast/multicast mode. The main
reason is that it is less accurate and less secure than the ordinary client/server and symmetric modes.
PTP was designed for multicast messaging and works similarly to the NTP broadcast mode. A
PTP implementation is available in the linuxptp package.
PTP normally requires hardware timestamping and support in network switches to perform well.
However, PTP is expected to work better than NTP in the broadcast mode even with software
timestamping and no support in network switches.
In networks with very large number of PTP clients in one communication path, it is
recommended to configure the PTP clients with the hybrid_e2e option to reduce the amount
of network traffic generated by the clients. You can configure a computer running chronyd as
an NTP client, and possibly NTP server, to operate also as a primary PTP timeserver to
distribute synchronized time to a large number of computers using multicast messaging.
170
CHAPTER 15. CONFIGURING TIME SYNCHRONIZATION
WARNING
NTS is not compatible with the FIPS and OSPP profile. When you enable the FIPS
and OSPP profile, chronyd that is configured with NTS can abort with a fatal
message. You can disable the OSPP profile and FIPS mode for chronyd service by
adding the GNUTLS_FORCE_FIPS_MODE=0 to the /etc/sysconfig/chronyd file.
15.5.1. Enabling Network Time Security (NTS) in the client configuration file
By default, Network Time Security (NTS) is not enabled. You can enable NTS in the /etc/chrony.conf.
For that, perform the following steps:
Prerequisites
Procedure
In the client configuration file:
1. Specify the server with the nts option in addition to the recommended iburst option.
For example:
server time.example.com iburst nts
server nts.netnod.se iburst nts
server ptbtime1.ptb.de iburst nts
2. To avoid repeating the Network Time Security-Key Establishment (NTS-KE) session during
system boot, add the following line to chrony.conf, if it is not present:
ntsdumpdir /var/lib/chrony
3. Add the following line to /etc/sysconfig/network to disable synchronization with Network Time
Protocol (NTP) servers provided by DHCP:
PEERNTP=no
Verification
# chronyc -N authdata
Name/IP address Mode KeyID Type KLen Last Atmp NAK Cook CLen
171
Red Hat Enterprise Linux 8 Configuring basic system settings
================================================================
time.example.com NTS 1 15 256 33m 0 0 8 100
nts.sth1.ntp.se NTS 1 15 256 33m 0 0 8 100
nts.sth2.ntp.se NTS 1 15 256 33m 0 0 8 100
The KeyID, Type, and KLen should have non-zero values. If the value is zero, check the system
log for error messages from chronyd.
# chronyc -N sources
The Reach column should have a non-zero value; ideally 377. If the value rarely gets 377 or
never gets to 377, it indicates that NTP requests or responses are getting lost in the network.
Additional resources
If the NTP server is a client of other servers, that is, it is not a Stratum 1 server, it should use NTS or
symmetric key for its synchronization.
Prerequisites
Procedure
1. Specify the private key and the certificate file in chrony.conf. For example:
ntsserverkey /etc/pki/tls/private/<ntp-server.example.net>.key
ntsservercert /etc/pki/tls/certs/<ntp-server.example.net>.crt
2. Ensure that both the key and certificate files are readable by the chrony system user, by setting
the group ownership. For example:
172
CHAPTER 15. CONFIGURING TIME SYNCHRONIZATION
IMPORTANT
If the server has a firewall, it needs to allow both the UDP 123 and TCP 4460
ports for NTP and Network Time Security-Key Establishment (NTS-KE).
Verification
Perform a quick test from a client machine with the following command:
$ chronyd -Q -t 3 'server
The System clock wrong message indicates the NTP server is accepting NTS-KE connections
and responding with NTS-protected NTP messages.
Verify the NTS-KE connections and authenticated NTP packets observed on the server:
# chronyc serverstats
If the value of the NTS-KE connections accepted and Authenticated NTP packets field is a
non-zero value, it means that at least one client was able to connect to the NTS-KE port and
send an authenticated NTP request.
173
Red Hat Enterprise Linux 8 Configuring basic system settings
On a Red Hat Enterprise Linux 8 system, langpacks installation is based on the langpacks-<langcode>
language meta-packages and RPM weak dependencies (Supplements tag).
There are two prerequisites to be able to use langpacks for a selected language. If these prerequisites
are fulfilled, the language meta-packages pull their langpack for the selected language automatically in
the transaction set.
Prerequisites
The langpacks-<langcode> language meta-package for the selected language has been
installed on the system.
On Red Hat Enterprise Linux 8, the langpacks meta packages are installed automatically with
the initial installation of the operating system using the Anaconda installer, because these
packages are available in the in Application Stream repository.
The base package, for which you want to search the locale packages, has already been installed
on the system.
Procedure
Procedure
174
CHAPTER 16. USING LANGPACKS
To check if language support is available for any language, use the following procedure.
Procedure
Procedure
Procedure
Procedure
On systems where disk space is a critical issue, such as containers and cloud images, or only a few locales
are needed, you can use the glibc locale langpack packages (glibc-langpack-<locale_code>).
To install locales individually, and thus gain a smaller package installation footprint, use the following
procedure.
Procedure
175
Red Hat Enterprise Linux 8 Configuring basic system settings
When installing the operating system with Anaconda, glibc-langpack-<locale_code> is installed for the
language you used during the installation and also for the languages you selected as additional
languages. Note that glibc-all-langpacks, which contains all locales, is installed by default, so some
locales are duplicated. If you installed glibc-langpack-<locale_code> for one or more selected
languages, you can delete glibc-all-langpacks after the installation to save the disk space.
NOTE
If disk space is not an issue, keep all locales installed by using the glibc-all-langpacks
package.
176
CHAPTER 17. DUMPING A CRASHED KERNEL FOR LATER ANALYSIS
IMPORTANT
A kernel crash dump can be the only information available if a system failure occur.
Therefore, operational kdump is important in mission-critical environments. Red Hat
advises to regularly update and test kexec-tools in your normal kernel update cycle. This
is especially important when you install new kernel features.
You can enable kdump for all installed kernels on a machine or only for specified kernels. This is useful
when there are multiple kernels used on a machine, some of which are stable enough that there is no
concern that they could crash. When you install kdump, a default /etc/kdump.conf file is created. The
/etc/kdump.conf file includes the default minimum kdump configuration, which you can edit to
customize the kdump configuration.
Prerequisites
Procedure
1. In the web console, open the Kernel dump tab and start the kdump service by setting the
Kernel crash dump switch to on.
3. In the Kernel dump tab, click Edit at the end of the Crash dump location field.
177
Red Hat Enterprise Linux 8 Configuring basic system settings
4. Specify the target directory for saving the vmcore dump file:
For a local filesystem, select Local Filesystem from the drop-down menu.
For a remote system by using the SSH protocol, select Remote over SSH from the drop-
down menu and specify the following fields:
For a remote system by using the NFS protocol, select Remote over NFS from the drop-
down menu and specify the following fields:
In the Export field, enter the location of the shared folder of an NFS server.
NOTE
178
CHAPTER 17. DUMPING A CRASHED KERNEL FOR LATER ANALYSIS
NOTE
You can reduce the size of the vmcore file by selecting the
Compression checkbox.
Verification
WARNING
When you initiate the system crash, the kernel operation stops and results in
a system crash with data loss.
Additional resources
179
Red Hat Enterprise Linux 8 Configuring basic system settings
WARNING
The kdump role replaces the kdump configuration of the managed hosts entirely
by replacing the /etc/kdump.conf file. Additionally, if the kdump role is applied, all
previous kdump settings are also replaced, even if they are not specified by the role
variables, by replacing the /etc/sysconfig/kdump file.
The following example playbook shows how to apply the kdump system role to set the location of the
crash dump files:
---
- hosts: kdump-test
vars:
kdump_path: /var/crash
roles:
- rhel-system-roles.kdump
For a detailed reference on kdump role variables, install the rhel-system-roles package, and see the
README.md or README.html files in the /usr/share/doc/rhel-system-roles/kdump directory.
Additional resources
180
CHAPTER 18. RECOVERING AND RESTORING A SYSTEM
You can use the utility as a disaster recovery solution and also for system migration.
Produce a bootable image and restore the system from an existing backup, using the image.
Additionally, for disaster recovery, you can also integrate certain backup software with ReaR.
1. Install ReaR.
Prerequisites
Procedure
2. Modify the ReaR configuration file in an editor of your choice, for example:
# vi /etc/rear/local.conf
3. Add the backup setting details to /etc/rear/local.conf. For example, in the case of the NETFS
backup method, add the following lines:
BACKUP=NETFS
BACKUP_URL=backup.location
181
Red Hat Enterprise Linux 8 Configuring basic system settings
4. To configure ReaR to keep the previous backup archive when the new one is created, also add
the following line to the configuration file:
NETFS_KEEP_OLD_BACKUP_COPY=y
5. To make the backups incremental, meaning that only the changed files are backed up on each
run, add the following line:
BACKUP_TYPE=incremental
# rear mkrescue
7. Take a backup as per the restore plan. For example, in the case of the NETFS backup method,
run the following command:
# rear mkbackuponly
Alternatively, you can create the rescue system and the backup in a single step by running the
following command:
# rear mkbackup
This command combines the functionality of the rear mkrescue and rear mkbackuponly
commands.
Procedure
You can add another crontab that will schedule the rear mkbackuponly command.
You can also change the existing crontab to run the rear mkbackup command instead of the
default /usr/sbin/rear checklayout || /usr/sbin/rear mkrescure command.
You can schedule an external backup, if an external backup method is in use. The details depend
on the backup method that you are using in ReaR.
NOTE
The /etc/cron.d/rear crontab file provided in the rear package is considered deprecated,
see Deprecated functionality shell and command line , because it is not sufficient by
default to perform a backup.
182
CHAPTER 18. RECOVERING AND RESTORING A SYSTEM
IMPORTANT
ReaR on the 64-bit IBM Z architecture is supported only with the rear package version
2.6-9.el8 or later. Earlier versions are available as a Technology Preview feature only. For
more information about the support scope of Red Hat Technology Preview features, see
https://access.redhat.com/support/offerings/techpreview.
The only output method currently available is Initial Program Load (IPL). IPL produces a kernel and an
initial RAM disk (initrd) that can be used with the zIPL boot loader.
Prerequisites
ReaR is installed.
Procedure
Add the following variables to the /etc/rear/local.conf to configure ReaR for producing a rescue image
on the 64-bit IBM Z architecture:
2. To configure the backup method and destination, add BACKUP and BACKUP_URL variables.
For example:
BACKUP=NETFS
IMPORTANT
The local backup storage is currently not supported on the 64-bit IBM Z
architecture.
3. Optional: You can also configure the OUTPUT_URL variable to save the kernel and initrd files.
By default, the OUTPUT_URL is aligned with BACKUP_URL.
# rear mkbackup
5. This creates the kernel and initrd files at the location specified by the BACKUP_URL or
OUTPUT_URL (if set) variable, and a backup using the specified backup method.
6. To recover the system, use the ReaR kernel and initrd files created in step 3, and boot from a
Direct Attached Storage Device (DASD) or a Fibre Channel Protocol (FCP)-attached SCSI
183
Red Hat Enterprise Linux 8 Configuring basic system settings
device prepared with the zipl boot loader, kernel, and initrd. For more information, see Using a
Prepared DASD.
7. When the rescue kernel and initrd get booted, it starts the ReaR rescue environment. Proceed
with system recovery.
WARNING
Currently, the rescue process reformats all the DASDs (Direct Attached Storage
Devices) connected to the system. Do not attempt a system recovery if there is any
valuable data present on the system storage devices. This also includes the device
prepared with the zipl boot loader, ReaR kernel, and initrd that were used to boot
into the rescue environment. Ensure to keep a copy.
Additional resources
184
CHAPTER 19. INSTALLING AND USING DYNAMIC PROGRAMMING LANGUAGES
With Red Hat Enterprise Linux, many packages that are installed on the system, such as packages
providing system tools, tools for data analysis, or web applications, are written in Python. To use these
packages, you must have the python* packages installed.
For details about the length of support, see Red Hat Enterprise Linux Life Cycle and Red Hat Enterprise
Linux Application Streams Life Cycle.
Each of the Python versions up to 3.9 is distributed in a separate module. Python 3.11 and Python 3.12
are distributed as suites of non-modular RPM packages, including the python3.11 and python3.12
packages.
You can install multiple Python versions in parallel on the same RHEL 8 system.
IMPORTANT
185
Red Hat Enterprise Linux 8 Configuring basic system settings
IMPORTANT
Always specify the version of Python when installing it, invoking it, or otherwise
interacting with it. For example, use python3 instead of python in package and
command names. All Python-related commands must also include the version, for
example, pip3, pip2, pip3.8, pip3.9, pip3.11, or pip3.12.
Any manual changes to /usr/bin/python, except changes made using the alternatives
command, might be overwritten upon an update.
Python 2 in Red Hat Enterprise Linux 8 will have a shorter life cycle and aims to facilitate a
smoother transition to Python 3 for customers.
Python 3 enables you to write expressive, maintainable, and correct code more easily.
Python 3 has new features, including asyncio, f-strings, advanced unpacking, keyword-only
arguments, and chained exceptions.
However, legacy software might require /usr/bin/python to be configured to Python 2. For this reason,
no default python package is distributed with Red Hat Enterprise Linux 8, and you can choose between
using Python 2 and 3 as /usr/bin/python, as described in Configuring the unversioned Python.
IMPORTANT
System tools in Red Hat Enterprise Linux 8 use Python version 3.6 provided by the
internal platform-python package, which is not intended to be used directly by
customers. It is recommended to use the python3 or python3.6 command from the
python36 package for Python 3.6, or to use later Python versions.
Do not remove the platform-python package from RHEL 8 because other packages
require it.
Python bindings
The python38 and python39 modules and the python3.11 and python3.12 package suites do not
include the same bindings to system tools (RPM, DNF, SELinux, and others) that are provided for the
186
CHAPTER 19. INSTALLING AND USING DYNAMIC PROGRAMMING LANGUAGES
python36 module. Therefore, use python36 in instances where the greatest compatibility with the base
operating system or binary compatibility is necessary. In unique instances where system bindings are
necessary together with later versions of various Python modules, use the python36 module in
combination with third-party upstream Python modules installed through pip into Python’s venv or
virtualenv environments.
Python 3.11 and Python 3.12 virtual environments must be created using venv instead of
virtualenv
The virtualenv utility in RHEL 8, provided by the python3-virtualenv package, is not compatible with
Python 3.11 and Python 3.12. An attempt to create a virtual environment by using virtualenv will fail with
an error message, for example:
To create Python 3.11 or Python 3.12 virtual environments, use the python3.11 -m venv or python3.12 -
m venv commands instead, which use the venv module from the standard library.
WARNING
Using the unversioned python command to install or run Python does not work by
default due to ambiguity. Always specify the version of Python, or configure the
system default version by using the alternatives command.
You can install Python 3.8, Python 3.9, Python 3.11, and Python 3.12, including packages built for each
version, in parallel with Python 3.6 on the same system, with the exception of the mod_wsgi module.
Due to a limitation of the Apache HTTP Server, only one of the python3-mod_wsgi, python38-
mod_wsgi, python39-mod_wsgi, python3.11-mod_wsgi, or python3.12-mod_wsgi packages can be
installed on a system.
Procedure
187
Red Hat Enterprise Linux 8 Configuring basic system settings
Verification
To verify the Python version installed on your system, use the --version option with the python
command specific for your required version of Python.
$ python3 --version
$ python3.8 --version
$ python3.9 --version
$ python3.11 --version
$ python3.12 --version
Additional resources
188
CHAPTER 19. INSTALLING AND USING DYNAMIC PROGRAMMING LANGUAGES
Packages with add-on modules for Python 3.6 generally use the python3- prefix, packages for Python
3.8 include the python38- prefix, packages for Python 3.9 include the python39- prefix, packages for
Python 3.11 include the python3.11- prefix, and packages for Python 3.12 include the python3.12- prefix.
Always include the prefix when installing additional Python packages, as shown in the examples below.
Procedure
Additional resources
The python3-pytest package (for Python 3.6) and its dependencies are available in the AppStream
repository.
The python38-devel module, which contains the python38-pytest package and its
dependencies.
The python39-devel module, which contains the python39-pytest package and its
dependencies, and the python39-debug and python39-Cython packages.
python3.11-idle
189
Red Hat Enterprise Linux 8 Configuring basic system settings
python3.11-debug
python3.11-Cython
IMPORTANT
The content in the CodeReady Linux Builder repository is unsupported by Red Hat.
NOTE
Procedure
1. For Python 3.8 and later, enable the CodeReady Linux Builder repository:
2. For Python 3.8 or 3.9, enable the respective python3*-devel module, for example:
Additional resources
How to enable and make use of content within CodeReady Linux Builder
190
CHAPTER 19. INSTALLING AND USING DYNAMIC PROGRAMMING LANGUAGES
Package manifest
WARNING
Note that Python 3 is the main development direction of the Python project.
Support for Python 2 is being phased out. The python27 module has a shorter
support period than Red Hat Enterprise Linux 8.
Procedure
Packages with add-on modules for Python 2 generally use the python2- prefix. Always include the prefix
when installing additional Python packages, as shown in the examples below.
Verification
$ python2 --version
NOTE
By design, you can install RHEL 8 modules in parallel, including the python27, python36,
python38, and python39 modules.
Additional resources
191
Red Hat Enterprise Linux 8 Configuring basic system settings
For more information about how to migrate large code bases to Python 3, see The Conservative Python
3 Porting Guide.
Note that after this migration, the original Python 2 code becomes interpretable by the Python 3
interpreter and stays interpretable for the Python 2 interpreter as well.
Prerequisites
If you want to download and install third-party applications for Python 3.11 or Python 3.12, install
the python3.11-pip or python3.12-pip package.
Procedure
To run the Python 3.6 interpreter or related commands, use, for example:
$ python3
$ python3 -m venv --help
$ python3 -m pip install package
$ pip3 install package
To run the Python 3.8 interpreter or related commands, use, for example:
$ python3.8
$ python3.8 -m venv --help
$ python3.8 -m pip install package
$ pip3.8 install package
To run the Python 3.9 interpreter or related commands, use, for example:
$ python3.9
$ python3.9 -m venv --help
$ python3.9 -m pip install package
$ pip3.9 install package
To run the Python 3.11 interpreter or related commands, use, for example:
$ python3.11
$ python3.11 -m venv --help
$ python3.11 -m pip install package
$ pip3.11 install package
To run the Python 3.12 interpreter or related commands, use, for example:
$ python3.12
192
CHAPTER 19. INSTALLING AND USING DYNAMIC PROGRAMMING LANGUAGES
$ python2
$ python2 -m pip install package
$ pip2 install package
IMPORTANT
Prerequisites
Procedure
193
Red Hat Enterprise Linux 8 Configuring basic system settings
Prerequisites
Procedure
3. To reset this configuration and remove the unversioned python command, use:
You can also package your Python project into an RPM package, which provides the following
advantages compared to Setuptools packaging:
Cryptographic signing
With cryptographic signing, content of RPM packages can be verified, integrated, and tested
with the rest of the operating system.
Preamble (contains a series of metadata items that are used in the Body)
194
CHAPTER 19. INSTALLING AND USING DYNAMIC PROGRAMMING LANGUAGES
An RPM SPEC file for Python projects has some specifics compared to non-Python RPM SPEC files.
Most notably, a name of any RPM package of a Python library must always include the prefix
determining the version, for example, python3 for Python 3.6, python38 for Python 3.8, python39 for
Python 3.9, python3.11 for Python 3.11, or python3.12 for Python 3.12.
Other specifics are shown in the following spec file example for the python3-detox package. For
description of such specifics, see the notes below the example.
Name: python3-detox 2
Version: 0.12
Release: 4%{?dist}
Summary: Distributing activities of the tox tool
License: MIT
URL: https://pypi.io/project/detox
Source0: https://pypi.io/packages/source/d/%{modname}/%{modname}-%{version}.tar.gz
BuildArch: noarch
BuildRequires: python36-devel 3
BuildRequires: python3-setuptools
BuildRequires: python36-rpm-macros
BuildRequires: python3-six
BuildRequires: python3-tox
BuildRequires: python3-py
BuildRequires: python3-eventlet
%?python_enable_dependency_generator 4
%description
Detox is the distributed version of the tox python testing tool. It makes efficient use of multiple CPUs
by running all possible activities in parallel.
Detox has the same options and configuration that tox has, so after installation you can run it in the
same way and with the same options that you use for tox.
$ detox
%prep
%autosetup -n %{modname}-%{version}
%build
%py3_build 5
%install
%py3_install
%check
%{__python3} setup.py test 6
%files -n python3-%{modname}
%doc CHANGELOG
195
Red Hat Enterprise Linux 8 Configuring basic system settings
%license LICENSE
%{_bindir}/detox
%{python3_sitelib}/%{modname}/
%{python3_sitelib}/%{modname}-%{version}*
%changelog
...
1 The modname macro contains the name of the Python project. In this example it is detox.
2 When packaging a Python project into RPM, the python3 prefix always needs to be added to the
original name of the project. The original name here is detox and the name of the RPM is
python3-detox.
3 BuildRequires specifies what packages are required to build and test this package. In
BuildRequires, always include items providing tools necessary for building Python packages:
python36-devel and python3-setuptools. The python36-rpm-macros package is required so
that files with /usr/bin/python3 interpreter directives are automatically changed to
/usr/bin/python3.6.
4 Every Python package requires some other packages to work correctly. Such packages need to be
specified in the spec file as well. To specify the dependencies, you can use the
%python_enable_dependency_generator macro to automatically use dependencies defined in
the setup.py file. If a package has dependencies that are not specified using Setuptools, specify
them within additional Requires directives.
5 The %py3_build and %py3_install macros run the setup.py build and setup.py install commands,
respectively, with additional arguments to specify installation locations, the interpreter to use, and
other details.
6 The check section provides a macro that runs the correct version of Python. The %{__python3}
macro contains a path for the Python 3 interpreter, for example /usr/bin/python3. We recommend
to always use the macro rather than a literal path.
In macro names, always use python3 or python2 instead of unversioned python. Configure the
particular Python 3 version in the BuildRequires section of the SPEC file to python36-rpm-macros,
python38-rpm-macros, python39-rpm-macros, python3.11-rpm-macros, or python3.12-rpm-
macros.
196
CHAPTER 19. INSTALLING AND USING DYNAMIC PROGRAMMING LANGUAGES
.dist-info
.egg-info
.egg-link
From these directories, the RPM build process automatically generates virtual pythonX.Ydist provides,
for example, python3.6dist(detox). These virtual provides are used by packages that are specified by
the %python_enable_dependency_generator macro.
#!/usr/bin/python3
#!/usr/bin/python3.6
#!/usr/bin/python3.8
#!/usr/bin/python3.9
#!/usr/bin/python3.11
#!/usr/bin/python3.12
#!/usr/bin/python2
The BRP script generates errors when encountering a Python script with an ambiguous interpreter
directive, such as:
197
Red Hat Enterprise Linux 8 Configuring basic system settings
#!/usr/bin/python
or
#!/usr/bin/env python
Prerequisites
Some of the interpreter directives in your Python scripts cause a build error.
Procedure
To modify interpreter directives, complete one of the following tasks:
Note that multiple PATHs can be specified. If a PATH is a directory, pathfix.py recursively
scans for any Python scripts matching the pattern ^[a-zA-Z0-9_]+\.py$, not only those with an
ambiguous interpreter directive. Add this command to the %prep section or at the end of the
%install section.
Modify the packaged Python scripts so that they conform to the expected format. For this
purpose, pathfix.py can be used outside the RPM build process, too. When running pathfix.py
outside an RPM build, replace %{__python3} from the example above with a path for the
interpreter directive, such as /usr/bin/python3.
If the packaged Python scripts require a version other than Python 3.6, adjust the preceding commands
to include the required version.
Procedure
To build your package for a specific version of Python, add the python*-rpm-macros
subpackage of the respective python package to the BuildRequires section of the spec file.
For example, for Python 3.6, include the following line:
BuildRequires: python36-rpm-macros
NOTE
198
CHAPTER 19. INSTALLING AND USING DYNAMIC PROGRAMMING LANGUAGES
NOTE
To prevent the BRP script from checking and modifying interpreter directives, use the
following RPM directive:
%undefine __brp_mangle_shebangs
In RHEL 8, the PHP scripting language is provided by the php module, which is available in multiple
streams (versions).
Depending on your use case, you can install a specific profile of the selected module stream:
common - The default profile for server-side scripting using a web server. It includes several
widely used extensions.
minimal - This profile installs only the command-line interface for scripting with PHP without
using a web server.
devel - This profile includes packages from the common profile and additional packages for
development purposes.
Procedure
The default common profile installs also the php-fpm package, and preconfigures PHP for use
with the Apache HTTP Server or nginx.
Replace stream with the desired version and profile with the name of the profile you wish to
install.
For example, to install PHP 8.0 for use without a web server:
199
Red Hat Enterprise Linux 8 Configuring basic system settings
Additional resources
If you want to upgrade from an earlier version of PHP available in RHEL 8, see Switching to a
later stream.
For more information about managing RHEL 8 modules and streams, see Installing, managing,
and removing user-space components.
In Red Hat Enterprise Linux 8, the Apache HTTP Server enables you to run PHP as a FastCGI process
server. FastCGI Process Manager (FPM) is an alternative PHP FastCGI daemon that allows a website to
manage high loads. PHP uses FastCGI Process Manager by default in RHEL 8.
You can run the PHP code using the FastCGI process server.
Prerequisites
Procedure
Or, if the Apache HTTP Server is already running on your system, restart the httpd service
after installing PHP:
5. To obtain information about your PHP settings, create the index.php file with the following
content in the /var/www/html/ directory:
200
CHAPTER 19. INSTALLING AND USING DYNAMIC PROGRAMMING LANGUAGES
http://<hostname>/
Example 19.1. Running a "Hello, World!" PHP script using the Apache HTTP Server
# mkdir hello
2. Create a hello.php file in the /var/www/html/hello/ directory with the following content:
# <!DOCTYPE html>
<html>
<head>
<title>Hello, World! Page</title>
</head>
<body>
<?php
echo 'Hello, World!';
?>
</body>
</html>
http://<hostname>/hello/hello.php
Additional resources
201
Red Hat Enterprise Linux 8 Configuring basic system settings
You can run PHP code through the nginx web server.
Prerequisites
Procedure
Or, if the nginx server is already running on your system, restart the nginx service after
installing PHP:
5. To obtain information about your PHP settings, create the index.php file with the following
content in the /usr/share/nginx/html/ directory:
http://<hostname>/
202
CHAPTER 19. INSTALLING AND USING DYNAMIC PROGRAMMING LANGUAGES
Example 19.2. Running a "Hello, World!" PHP script using the nginx server
# mkdir hello
# <!DOCTYPE html>
<html>
<head>
<title>Hello, World! Page</title>
</head>
<body>
<?php
echo 'Hello, World!';
?>
</body>
</html>
http://<hostname>/hello/hello.php
Additional resources
If you want to run php scripts using only command-line, install the minimal profile of a php module
stream.
Prerequisites
Procedure
203
Red Hat Enterprise Linux 8 Configuring basic system settings
# php filename.php
Example 19.3. Running a "Hello, World!" PHP script using the command-line interface
1. Create a hello.php file with the following content using a text editor:
<?php
echo 'Hello, World!';
?>
# php hello.php
httpd.conf(5) — The manual page for httpd configuration, describing the structure and location
of the httpd configuration files.
nginx(8) — The manual page for the nginx web server containing the complete list of its
command-line options and list of signals.
php-fpm(8) — The manual page for PHP FPM describing the complete list of its command-line
options and configuration files.
Using Tcl paired with Tk (Tcl/Tk) enables creating cross-platform GUI applications. Tk is provided by
the tk package.
A Tk C library bindings available for multiple languages, such as C, Ruby, Perl and Python
204
CHAPTER 19. INSTALLING AND USING DYNAMIC PROGRAMMING LANGUAGES
For more information about Tcl/Tk, see the Tcl/Tk manual or Tcl/Tk documentation web page .
List processing
Two new commands, lmap and dict map are available, which allow the expression of
transformations over Tcl containers.
Busy windows
A new command, tk busy is available, which disables user interaction for a window or a widget
and shows the busy cursor.
For the detailed list of changes between Tcl 8.5 and Tcl 8.6, see Changes in Tcl/Tk 8.6 .
205
Red Hat Enterprise Linux 8 Configuring basic system settings
Developers writing Tcl extensions or embedding Tcl interpreter into their applications
To make your code compatible with Tcl 8.6, use the following procedure.
Procedure
1. Rewrite the code to use the interp structure. For example, if your code reads
interp→errorLine, rewrite it to use the following function:
Tcl_GetErrorLine(interp)
This is necessary because Tcl 8.6 limits direct access to members of the interp structure.
2. To make your code compatible with both Tcl 8.5 and Tcl 8.6, use the following code snippet in
a header file of your C or C++ application or extension that includes the Tcl library:
# include <tcl.h>
# if !defined(Tcl_GetErrorLine)
# define Tcl_GetErrorLine(interp) (interp→errorLine)
# endif
19.7.3.2. Migration path for users scripting their tasks with Tcl/Tk
In Tcl 8.6, most scripts work the same way as with the previous version of Tcl.
Procedure
When writing a portable code, make sure to not use the commands that are no longer supported
in Tk 8.6:
tkIconList_Arrange
tkIconList_AutoScan
tkIconList_Btn1
tkIconList_Config
tkIconList_Create
tkIconList_CtrlBtn1
tkIconList_Curselection
tkIconList_DeleteAll
tkIconList_Double1
tkIconList_DrawSelection
tkIconList_FocusIn
tkIconList_FocusOut
tkIconList_Get
tkIconList_Goto
tkIconList_Index
tkIconList_Invoke
tkIconList_KeyPress
tkIconList_Leave1
206
CHAPTER 19. INSTALLING AND USING DYNAMIC PROGRAMMING LANGUAGES
tkIconList_LeftRight
tkIconList_Motion1
tkIconList_Reset
tkIconList_ReturnKey
tkIconList_See
tkIconList_Select
tkIconList_Selection
tkIconList_ShiftBtn1
tkIconList_UpDown
Note that you can check the list of unsupported commands also in the
/usr/share/tk8.6/unsupported.tcl file.
207