How to update OpenSUSE Linux software and kernel using CLI

last updated in Categories , ,

I am a new OpenSUSE Linux server user. How do I upgrade and update OpenSUSE Linux software and kernel from the CLI? How do I use the command line tool to upgrade your system to the latest version of openSUSE software and kernel?

Introduction : You can use zypper or yast2 command for managing and updating installed software including Linux kernel on OpenSUSE Linux. This page demonstrates how to run a zypper command to upgrade OpenSUSE Linux system.

How do I update OpenSUSE Linux software and kernel from command line?

  1. Open the terminal application.
  2. Log in to the server using ssh command as follows
    ssh user@server-ip
  3. Refersh OpenSUSE repository from the Internet, execute:
    sudo zypper refersh
  4. Upgrade OpenSUSE Linux, type:
    sudo zypper update

Let us see all commands in details.

What is a zypper command in OpenSUSE?

zypper is nothing but a command line package manager. It is equivalent to apt command/apt-get command on Debian/Ubuntu or yum command on a CentOS/RHEL. One can use the zypper command for:

  • Install new packages
  • Delete or remove software
  • Update Linux kernel on OpenSUSE
  • Update all installed packages with newer available version and more

How to update OpenSUSE system to the latest packages

First, Verify that repos are enabled, run:
$ zypper repos --uri

Repository priorities are without effect. All enabled repositories share the same priority.
 
# | Alias                             | Name                              | Enabled | GPG Check | Refresh | URI                                                          
--+-----------------------------------+-----------------------------------+---------+-----------+---------+--------------------------------------------------------------
1 | openSUSE-Leap-15.0-1              | openSUSE-Leap-15.0-1              | Yes     | (r ) Yes  | Yes     | http://download.opensuse.org/distribution/leap/15.0/repo/oss/
2 | openSUSE-Leap-15.0-Update         | openSUSE-Leap-15.0-Update         | Yes     | (r ) Yes  | Yes     | http://download.opensuse.org/update/leap/15.0/oss/           
3 | openSUSE-Leap-15.0-Update-Non-Oss | openSUSE-Leap-15.0-Update-Non-Oss | Yes     | (r ) Yes  | Yes     | http://download.opensuse.org/update/leap/15.0/non-oss/

How to refresh OpenSUSE Linux repositories

sudo zypper refresh
OR
sudo zypper ref
zypper refersh command

How to list all applicable patches for OpenSUSE

sudo zypper list-patches
OR
sudo zypper lp

OpenSUSE Linux show or list all applicable patches
OpenSUSE Linux show or list all applicable patches (click to enlarge)

Howo to list all available updates on OpenSUSE Linux

sudo zypper list-updates
OR
sudo zypper lu

OpenSUSE Linux show or list all available updates
OpenSUSE Linux show or list all available updates (click to enlarge)

How to upgrade OpenSUSE system to the latest packages and kernel

Execute the following command:
sudo zypper update
OR
sudo zypper up
Upgrade or update OpenSUSE Linux software using the cli
At the end you will see message as follows:

There are some running programs that might use files deleted by recent upgrade. You may wish to check and restart some of them. Run ‘zypper ps -s’ to list these programs.

You can view outdated process by running the following command:
$ zypper ps -s
Restart outdated process one by one using the systemctl command:
$ sudo systemctl restart sshd
Or simply reboot the Linux system by running:
$ sudo reboot
OR
$ sudo shutdown -r now

Restart outdated OpenSUSE Linux process
Restart outdated OpenSUSE Linux process

A note about YaST/YaST2 online update command line tool

YaST is universal configuration utility and comes with both GUI and TUI. Just run the following command to apply severe security updates:
$ sudo yast2 online_update

yast2 online_update command line
YaST online update via TUI (Text User Interface) tool in action

Conclusion

This page explained how to install updates on openSUSE Linux to keep your system secure. For more info see this page or type the following man command to read more about zypper tool:
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.

Start the discussion at www.nixcraft.com