Automatic update Red Hat based distro.
Installing updates on a regular basis takes a lot of time for system administrators. Additionally, it hurts too much if there are more OS. I’ll be sharing some strategies today to make this daily activity hassle-free.
Prerequisite:
- Central YUM Server
- Postfix Null Client
- SMTP Relay
Scenario:
Configuration for RHEL based OS version 8 to 9
Step01: Install required packages:
dnf install dnf-automatic -y
Step02: Configure automatic update
vim /etc/dnf/automatic.conf
[commands]
upgrade_type = default
random_sleep = 0
network_online_timeout = 60
download_updates = yes
apply_updates = yes
[emitters]
system_name = wiki.blesk.ca
emit_via = email
[email]
email_from = admin@example.com
email_to = your-email-address@example.com
email_host = relay.prival.ca
[command]
[command_email]
email_from = root@example.com
email_to = root
[base]
exclude = kernel*
debuglevel = 1
Step03: Start & Enable Required Services
systemctl enable — now dnf-automatic.timer
systemctl enable — now dnf-automatic-install.timer
systemctl restart dnf-automatic.timer dnf-automatic-install.timer
systemctl list-timers *dnf-* — all
Configuration for RHEL based OS version 7
Step01: Install required packages:
yum install yum-cron -y
Step02: Configure automatic update
vim /etc/yum/yum-cron.conf
[commands]
update_cmd = default
update_messages = yes
download_updates = yes
apply_updates = yes
random_sleep = 360
[emitters]
system_name = None
emit_via = stdio
output_width = 80
[email]
email_from = admin@example.com
email_to = your-email-address@example.com
email_host = relay.prival.ca
[groups]
group_list = None
group_package_types = mandatory, default
[base]
exclude = kernel*
debuglevel = -2
mdpolicy = group:main
Step03: Start & Enable Required Services
systemctl enable yum-cron.service
systemctl start yum-cron.service
systemctl restart yum-cron.service
Note: You have to configure this into your all Linux system. And i exclude kernel from update list so that OS did not crush anyhow. You can also and any package that you don’t want to update automatically.
Finally you will get below email after update the packages.