How to fix zypper command not found

Endrit Qerreti

Endrit Qerreti

In this tutorial, you will learn how to fix "zypper command not found" error.

Zypper is the default package manager on OpenSUSE, which you can use to manage packages on your OpenSUSE machine.

If you don't have zypper installed on your machine, you will encounter the error " zypper command not found" when trying to run zypper.

This error happens in cases when zypper is not installed, but also in cases when zypper is installed but the installation is either broken or misconfigured.

This error can be fixed by installing zypper manually.

Step 1 - Check if zypper is installed

Since this error happens in cases when zypper is not installed or added to your PATH, then you can easily fix this error, by installing zypper manually, and by adding zypper to your PATH.

However, before proceeding to install or add zypper to your PATH, first you must check if zypper is installed on your machine.

To check if zypper is installed on your system, you can do so by using which or whereis commands.

If zypper is installed, both commands which and whereis will show you where zypper's binary is located, and the other files too.

For example, To check if zypper is installed by using which command, run the following.

which zypper

Assuming zypper is not installed, you will get the following error

Step 2 - Install zypper

zypper can be easily installed on OpenSUSE, by downloading it from the official repository on OpenSUSE.

1) Download zypper using wget

Downloading zypper is very easy, all you need to do is run the command below to do so.

wget https://download.opensuse.org/distribution/leap/15.3/repo/oss/x86_64/zypper-1.14.43-3.20.1.x86_64.rpm

2) Install zypper with

Once zypper has been downloaded on your system, proceed to install it by running the command below.

sudo rpm -ivh zypper-1.14.43-3.20.1.x86_64.rpm

3) Verify Zypper installation

Zypper is now installed on your system, ensure that you are able to run zypper, by checking zypper version.

zypper --version

Step 3 - Add zypper to PATH

After installing zypper, zypper should be added automatically to your PATH, which means you should be able to use zypper without having to add it on your PATH manually.

However, if you get again the same error "zypper command not found" when trying to run zypper, you need to add zypper to your PATH. To do so, run the command below.

export PATH=$PATH:/usr/bin

Next, restart your session, or simply source your shell configuration.

source ~/.bashrc

Step 4 - Use Zypper

Zypper should be now installed on your OpenSUSE machine. To use Zypper, you can do so by running the command below.

sudo zypper command

For example, to update your machine, run the command.

sudo zypper update

Conclusion

In this tutorial, you learned how to fix "zypper command not found" error on OpenSUSE. In this tutorial, we used OpenSUSE leap 15.3. However, this tutorial, also applies to other versions of OpenSUSE if you are getting the same error.