{"id":12566,"date":"2019-03-28T01:39:36","date_gmt":"2019-03-28T01:39:36","guid":{"rendered":"http:\/\/www.appservgrid.com\/paw92\/?p=12566"},"modified":"2019-03-28T01:39:36","modified_gmt":"2019-03-28T01:39:36","slug":"install-security-patches-or-updates-automatically-on-centos-and-rhel-2","status":"publish","type":"post","link":"https:\/\/www.appservgrid.com\/paw92\/index.php\/2019\/03\/28\/install-security-patches-or-updates-automatically-on-centos-and-rhel-2\/","title":{"rendered":"Install Security Patches or Updates Automatically on CentOS and RHEL"},"content":{"rendered":"<p>One of the serious needs of a Linux system is to be kept up to date regularly with the latest security patches or updates available for the corresponding distribution.<\/p>\n<p>In a previous article, we\u2019ve explained how to\u00a0<a href=\"https:\/\/www.tecmint.com\/auto-install-security-updates-on-debian-and-ubuntu\/\" target=\"_blank\" rel=\"noopener\">configure automatic security update in Debian\/Ubuntu<\/a>, in this article we will explain how to set up your\u00a0<strong>CentOS\/RHEL 7\/6<\/strong>\u00a0distribution to auto update essential security packages when needed.<\/p>\n<p>Other Linux distributions in the same families (<strong>Fedora<\/strong>\u00a0or\u00a0<strong>Scientific Linux<\/strong>) can be configured similarly.<\/p>\n<h3>Configure Automatic Security Updates on CentOS\/RHEL Systems<\/h3>\n<p>On\u00a0<strong>CentOS\/RHEL 7\/6<\/strong>, you will need to install the following package:<\/p>\n<pre># yum update -y &amp;&amp; yum install yum-cron -y\r\n<\/pre>\n<h4>Enable Automatic Security Updates on CentOS\/RHEL 7<\/h4>\n<p>Once the installation is complete, open\u00a0<strong>\/etc\/yum\/yum-cron.conf<\/strong>\u00a0and locate these lines \u2013 you will have to make sure that the values matches those listed here:<\/p>\n<pre>update_cmd = security\r\nupdate_messages = yes\r\ndownload_updates = yes\r\napply_updates = yes\r\n<\/pre>\n<p>The first line indicates that the unattended update command will be:<\/p>\n<pre># yum --security upgrade\r\n<\/pre>\n<p>whereas the other lines enable notifications and automatic download and installation of security upgrades.<\/p>\n<p>The following lines are also required to indicate that notifications will be sent via email from\u00a0<strong>root@localhost<\/strong>\u00a0to the same account (again, you may choose another one if you want).<\/p>\n<pre>emit_via = email\r\nemail_from = root@localhost\r\nemail_to = root\r\n<\/pre>\n<h4>Enable Automatic Security Updates on CentOS\/RHEL 6<\/h4>\n<p>By default, the cron is configured to download and install all updates immediately, but we can change this behavior in\u00a0<strong>\/etc\/sysconfig\/yum-cron<\/strong>\u00a0configuration file by modifying these two parameters to\u00a0<code>yes<\/code>.<\/p>\n<pre># Don't install, just check (valid: yes|no)\r\n<strong>CHECK_ONLY=yes<\/strong>\r\n\r\n# Don't install, just check and download (valid: yes|no)\r\n# Implies CHECK_ONLY=yes (gotta check first to see what to download)\r\n<strong>DOWNLOAD_ONLY=yes<\/strong><\/pre>\n<p>To enable email notification that about the security package updates, set the\u00a0<strong>MAILTO<\/strong>\u00a0parameter to a valid mail address.<\/p>\n<pre># by default MAILTO is unset, so crond mails the output by itself\r\n# example:  MAILTO=root\r\n<strong>MAILTO=admin@tecmint.com<\/strong>\r\n<\/pre>\n<p>Finally, start and enable the\u00a0<strong>yum-cron<\/strong>\u00a0service:<\/p>\n<pre><strong>------------- On CentOS\/RHEL 7 -------------<\/strong> \r\nsystemctl start yum-cron\r\nsystemctl enable yum-cron\r\n\r\n<strong>------------- On CentOS\/RHEL 6 -------------<\/strong>  \r\n# service yum-cron start\r\n# chkconfig --level 35 yum-cron on\r\n<\/pre>\n<p>Congrats! You have successfully set up unattended upgrades on\u00a0<strong>CentOS\/RHEL 7\/6<\/strong>.<\/p>\n<h5>Summary<\/h5>\n<p>In this article we have discussed how to keep your server updated regularly with the latest security patches or updates. Additionally, you learned how to configure email notifications in order to keep yourself updated when new patches are applied.<\/p>\n<p>If you have any concerns about this article? Feel free to drop us a note using the comment form below. We look forward to hearing from you.<\/p>\n<p><a href=\"https:\/\/www.tecmint.com\/auto-install-security-patches-updates-on-centos-rhel\/\" target=\"_blank\" rel=\"noopener\">Source<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>One of the serious needs of a Linux system is to be kept up to date regularly with the latest security patches or updates available for the corresponding distribution. In a previous article, we\u2019ve explained how to\u00a0configure automatic security update in Debian\/Ubuntu, in this article we will explain how to set up your\u00a0CentOS\/RHEL 7\/6\u00a0distribution to &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/www.appservgrid.com\/paw92\/index.php\/2019\/03\/28\/install-security-patches-or-updates-automatically-on-centos-and-rhel-2\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Install Security Patches or Updates Automatically on CentOS and RHEL&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-12566","post","type-post","status-publish","format-standard","hentry","category-linux"],"_links":{"self":[{"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts\/12566","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/comments?post=12566"}],"version-history":[{"count":1,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts\/12566\/revisions"}],"predecessor-version":[{"id":12567,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts\/12566\/revisions\/12567"}],"wp:attachment":[{"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/media?parent=12566"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/categories?post=12566"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/tags?post=12566"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}