How to patch update Suse Enterprise Linux server command

last updated in Categories , , ,

How do I patch and update Suse Enterprise Linux server from the command line option over ssh based session?

You need to use the zypper command to keep your system secure and upgrade installed packages including security updates. This page shows how to patch update Suse Enterprise Linux server version 12 SP 3.

Use the zypper to patch update Suse Enterprise Linux

zypper is a command line for software management. Both SUSE Enterprise Linux and OpenSUSE use the zypper command. We can use zypper for the following purpose:

  1. Install new software
  2. Update software
  3. Remove or delete unwanted software
  4. Manage repositories
  5. Perform various queries, and more.

Syntax

The syntax is as follows:
zypper command
zypper [options] command
zypper help command

Let us see common examples of zypper command.

How to refresh all repositories

$ sudo zypper refresh
SUSE Enterprise Linux Refresh all repositories

How to list available updates on SUSE Enterprise Linux server

We need to see all applicable patches, run:
zypper lp
zypper list-updates

How to update installed packages with newer versions

Let us patch update Suse Enterprise Linux server, execute:
$ sudo zypper update


Please note that there are some running programs that might use files deleted by recent upgrade. You may wish to check and restart some of them. Run the following command to list these programs:
$ zypper ps -s
zypper ps command
You can restart those services using the systemctl command:
$ sudo systemctl restart sshd

Reboot the box

First note down the current running Linux kernel version:
$ uname -mrs
Sample outputs:

Linux 4.4.114-94.14-default x86_64

You must reboot the box for the SUSE Enterprise Linux kernel update:
$ sudo reboot
OR
$ sudo shutdown -r now
Verify new Linux kernel version after the system reboot:
$ uname -mrs
Sample outputs:

Linux 4.4.126-94.22-default x86_64

Summary

And there you have it, SUSE Enterprise Linux Server version 12 SP3 patched and updated. We got a new kernel running too. Here is a summary of all of the options used so far in this tutorial:

zypper commandDescriptionExample(s)
refresh, ref Refresh all repositories. zypper ref
refresh-services, refs Refresh all services. zypper refs
list-updates, lu List available updates. zypper lu
list-patches, lp List needed patches. zypper lp
update, up Update installed packages with newer versions. zypper up
ps List running processes which might still use files and libraries deleted by recent upgrades. zypper ps -s

For more info see zypper command help page here or type the following two commands at the shell:
$ zypper help up
$ man zypper

Posted by: Vivek Gite

The author is the creator of nixCraft and a seasoned sysadmin, DevOps engineer, and a trainer for the Linux operating system/Unix shell scripting. Get the latest tutorials on SysAdmin, Linux/Unix and open source topics via RSS/XML feed or weekly email newsletter.