Using openSUSE zypper for package management (adding, removing, repository management)
First a quick introduction on zypper. Zypper is a command line package and software repository manager that will do about everything you need. Zypper will allow you to install a package from a repository, a local RPM, protect (lock) a package, add and remove repositories, let you run different query types and even more if you wanted it to.
First, lets go over the basic and most used options of zypper:
zypper help # This will give you the help and usage list
zypper help command # This will give you the help option of a specific zypper function
zypper lu # This will list updates (use the -t switch to change what package type)
zypper up # This will update patches by default (you can update packages by using -t package)
zypper in package # Install application named package
zypper rm package # Remove application named package
zypper se package # Search for application named package
Now there are some of the most used uses of zypper. So lets go into more detailed usage. First we will work with repositories:
Repositories
Listing, adding and deleting a repository.
To list your repositories:
zypper lr
Note: to get more details on them run it with the –detail switch (note that’s 2 -’s and not 1 big -).
Example output of zypper lr:

figure 1
To add a repository:
sudo zypper ar http://location/of/repository Name\ Of\ Repository
To remove a repository:
sudo zypper rr Name\ Of\ Repository
Note: you can also remove a repository by the repo number from the zypper lr output. (Figure 1)
Now that we have repositories, what are other things we can do with them, here we are going to look at enabling and disabling a repo:
Note: with these you can use name of repo or number gathered from lr output in figure 1
Enabling a repository:
sudo zypper mr -e Name\ Of\ Repo
Disabling a repository:
sudo zypper mr -d Name\ Of\ Repo
Renaming a repository:
sudo zypper nr Name\ Of\ Repo New\ Name\ Of\ Repo
The last great overlooked zypper tool is to export/import your repo list:
zypper lr –export /location/of/saved/repo.repo
You can later import this repo file on this or another machine by running
sudo zypper ar /location/of/saved/repo.repo
Bonus: To force a refresh of all your repositories run:
sudo zypper ref –force
This sometimes helps if you have a cached issue.
Ok, now we have our repositories and we’ve enabled em. Now lets get to managing our packages:
Installing a package via the name:
sudo zypper in bluefish
This would install the bluefish application.
Installing a package via a requirement:
sudo zypper in libnm-util.so.0
This would install NetworkManager-glib
Installing a local rpm package:
sudo zypper in /location/of/rpmpackage.rpm
Installing a package from a specific repo:
sudo zypper in education:bluefish
This would install the bluefish package from the education repo.
Force the re-installation of a package:
sudo zypper in -f bluefish
Bonus: You can install a package pattern using:
sudo zypper in -t pattern pattern_name
You can get the pattern names from:
sudo zypper se -t pattern
Now lets remove those pesky files we just installed:
sudo zypper rm bluefish
This will remove the bluefish package
Bonus: You can remove and install an application together
sudo zypper in bluefish -fslint
This will conclude this poriton of the zypper tutorial. I’ll do a part 2 which will include queries, searching, updating and distribution updating. Part 2 will hopefully be followed up later this week.
6 Comments to Using openSUSE zypper for package management (adding, removing, repository management)
[...] (and preference) distribution. Here is a similar one for Counter Strike. To be fair, Ben also wrote about Free software, but it’s OpenSUSE-flavoured most of the time. So why am I telling you about these [...]
November 11, 2008
Dear openSuSE minion, XD
I have these problem, during an update, in the many alternatives have flash-player v 9.0.151 available. But its more than a month that Adobe released Flash 10, which one is better and why Flash 10 isn’t available yet.
Second, which is related and certainly you’re in the position to answer this question: How can I use zypper to procede with an update (I use zypper up -t package) but not allowing the update of just one application? like in this case, flash-player.
Thanks for your attention and the always appreciated answers.
November 11, 2008
Carlos A.
Thanks for the comment. Unfortunatly openSUSE has not released the 10.x package in their openSUSE buildservice (except for openSUSE 11.1 which is currently in beta)… however, it’s easily installed :).
First remove the installed flash version:
sudo rpm -e `rpm -qa | grep flash-player`
You can then download the RPM based package from Adobe’s website. Once downloaded you can run:
sudo rpm -Uvh flash-package-name.rpm
That will then install (it should install in the path that all browsers look in). If not.. I have an older blog about it.
If you find that too confusing .. feel free to wait and upgrade to 11.1 when it’s released (it should be on schedule), that will ship with 10.x.
Also, not sure if I understand your last question.. do you want to update just 1 package? Or update all except one package? I’ll start working on part 2 of my zypper blab..
November 12, 2008
Hey there, thanks for the advice, although I already did the reinstallation of flash-plugin with zypper, because I spoiled the previous one when I uninstalled flash-player, long story but doesn’t matter now. right?
About the second question, I usually do:
zypper up -t package
to do a complete update but, how can I make zypper update all with one or two exceptions? Like in the above case: update all the packages (usually are KDE) but not update flash-player.
Happy with the fast answer, and a grateful for the advices.
November 12, 2008
My english sucks, have to use more of my time checking it. =P Thanks again for the answer to: update all but one package.
November 19, 2008
Though I am quite new to openSuse I believe the addlock-function of zypper will do what you want. See
$zypper help addlock
for more details.
- Delphi
Leave a comment
Search
Powered by
Tags
10.3 11.0 11.1 apache bash beta bootchart codeweavers compiz drivers emerald emulation esx fat ass tomato man filesystems flash fonts gnome grub ibm kde kde4 kernel knoppix linux lotus notes lvm Microsoft nomad nvidia openoffice opensuse performance repositories review scripting security tech tutorial ubuntu user management VMWare windows wine workstationArchives
- December 2008
- November 2008
- October 2008
- September 2008
- August 2008
- July 2008
- June 2008
- May 2008
- April 2008
- February 2008
- January 2008
- November 2007
- October 2007
- September 2007
- August 2007
- July 2007
- June 2007
- May 2007
- April 2007
- February 2007
- January 2007
- December 2006
- November 2006
- October 2006
- September 2006
Ben Kevan's Blog
- Connecting to Linux via RDP using NOMAD on openSUSE 11.1
- Red Hat (RHT) Profits Soar, is Novell (NOVL) Next?
- Dropping KDE 3.5 for openSUSE 11.2 isn’t really a bad thing
- 5 Days on openSUSE 11.1 was an early X-Mas present
- Unexpected Downtime
- Amarok 2.0 Final Released - Shipping with openSUSE 11.1
- PCLinuxOS 2009 Beta 2 - Review, Thoughts and Screenshots
- Opera 10.0 Alpha 1 on openSUSE 11.1 - Review
- Ding Dong the Emeralds Back Compiz
- 11.1 Build Service Repositories being Built
November 8, 2008