OpenSUSE Linux Rants

OpenSUSE Linux Tips, tricks, how-tos, opinions, and news

My Resume  -  My LinkedIn Profile

June 12, 2008

How many ways can you install an RPM in OpenSUSE Linux?

by @ 7:02 am. Filed under command-line, How-To, SUSE Tips & Tricks
Introduction

Package management in OpenSUSE in recent years has had its share of challenges. In OpenSUSE 10.1, the package management was an epic trainwreck. Package management in OpenSUSE 10.3 is as good as that was bad. There are various types of speed improvements. Some of them huge. There is some caching of the repository package info. Progress bars so the user knows what’s going on. All sorts of goodness.

But I wanted to see how many ways I could install a package on OpenSUSE 10.3 (and 11.0, for that matter) without any help from any third-party package management tools that don’t come stock on a fresh OpenSUSE install. Like no apt, yum, smart, etc. Just using the package management tools that come on the fresh install, how many ways can one install a package? There’s a method to this madness, too. You never know under what circumstances you’ll have what access to the machine you’re working on, especially if it is remote. One of the mantras of Linux pros is that there is four billion ways to skin a cat. OK, so I made that up. It’s good to know many ways of doing the same thing, though.

Especially if we want to automate something. If we do it one way, maybe it requires human interaction. If we do it a different way, no human interaction is required, and thus, we can automate that process.

OK, without any more excessive yammer, let’s take a look, shall we?

RPM Installation Methods

1. Use YAST – Let’s get the obvious one out of the way. Click on the YAST icon, put in your root password. In the window that appears, select SOFTWARE from the left, and SOFTWARE MANAGEMENT on the right. At some point, the YAST Package Management window appears. Search for the desired package, click ACCEPT. Approve any additional necessary packages. YAST installs everything, and asks if you want to install or remove more packages. Say no, and you’re done.

This is the classic way to install packages in OpenSUSE using YAST. One benefit is that it does a good job of resolving dependencies for you. One possible drawback is that it reauires all kinds of human interaction. So there’s our first way.

2. Use zypper – This is a powerful command-line tool used in OpenSUSE much in the same way we might use something like apt-get. To see all the ways you can use this tool, run zypper –help from a command line:

[2318][root@linux:/]$ zypper --help
  Options:
        --help, -h              Help.
        --version, -V           Output the version number.
        --quiet, -q             Suppress normal output, print only error messages.
        --verbose, -v           Increase verbosity.
        --terse, -t             Terse output for machine consumption.
        --table-style, -s       Table style (integer).
        --rug-compatible, -r    Turn on rug compatibility.
        --non-interactive, -n   Don't ask anything, use default answers automatically.
        --no-gpg-checks         Ignore GPG check failures and continue.
        --root, -R <dir>        Operate on a different root directory.

  Commands:
        help, ?                 Help
        shell, sh               Accept multiple commands at once
        install, in             Install packages or resolvables
        remove, rm              Remove packages or resolvables
        search, se              Search for packages matching a pattern
        repos, lr               List all defined repositories.
        addrepo, ar             Add a new repository
        removerepo, rr          Remove specified repository
        renamerepo, nr          Rename specified repository
        modifyrepo, mr          Modify specified repository
        refresh, ref            Refresh all repositories
        patch-check, pchk       Check for patches
        patches, pch            List patches
        list-updates, lu        List updates
        xml-updates, xu         List updates and patches in xml format
        update, up              Update installed resolvables with newer versions.
        info, if                Show full information for packages
        patch-info              Show full information for patches
        source-install, si      Install a source package
[2319][root@linux:/]$

To install a package from the command line using zypper, you’ll do that this way:

[2321][root@linux:/]$ zypper install bzflag
* Reading repository 'openSUSE-10.3-Updates' cache
* Reading repository 'openSUSE-10.3-OSS-KDE 10.3' cache
* Reading repository 'Jpackage' cache
* Reading repository 'Main Repository (NON-OSS)' cache
* Reading repository 'Eric Lavar - Germany' cache
* Reading repository 'Main Repository (OSS)' cache
* Reading installed packages [100%]


The following NEW package is going to be installed:
  bzflag

Overall download size: 10.8 M. After the operation, additional 15.0 M will be used.
Continue? [yes/no]: yes
Downloading package bzflag-2.0.8-78.x86_64, 10.8 M (15.0 M unpacked)
Downloading: media
* Downloading [100%]
Downloading: bzflag-2.0.8-78.x86_64.rpm
* Downloading [100%]
* Installing: bzflag-2.0.8-78 [100%]
[2323][root@linux:/]$

It resolves all dependencies, and installs everything it needs. Great way to do things without so much human interaction. There are even flags that will allow us to omit human interaction entirely (–non-interactive and –no-gpg-checks). Very nice.

3. Use the rpm command – Every once in awhile, there is a package that YAST cannot find in the available repositories. When this happens, I head over to one of three places: rpmseek.com, Rpmfind, or pbone.net. In almost every case, I can find an RPM that was built for whatever version of OpenSUSE that I am using on that particular box. I just download the RPM in question, and install it with the rpm command. Many people suggest doing this in the following manner:

[2215][scott@linux:~]$ rpm -Uvh [full path to RPM here]

This is one of the possibly more difficult ways to install an RPM. Not because it’s a difficult command, but because it doesn’t resolve dependencies. If there are dependencies, you get to resolve those babies yourself. It’s possible, but I would definitely prefer a poke in the eye with a sharp stick.

4. 1-Click Install – Tell you what, one of the coolest things that OpenSUSE has come up with thus far is the 1-Click Install. At first, I thought it was an April Fool’s Joke. But realizing it wasn’t April, I decided to give it a try. To see how cool this is, head over to the OpenSUSE Build Service. Search for a package like kopete. Scroll through the results. When you find the one you want to install, click on the “1-Click Install” button off to the right side. You’ll have to verify some things and provide your root password, but other than that, it is virtually hands-off installation of the package. Hands-down easiest way to install packages in OpenSUSE.

5. Install with YAST from custom installation repository – Sometimes, you will have an rpm that you want installed, but cannot find it in YAST. You can download it and try to install it with rpm. The problem is that it has 12 dependencies. What then? Switch distributions to something more sensible? No way, we’ll just take the easy way out. Create our own repository and point YAST to that. This process is very simple.

Install the createrepo package. Then, create a directory to be used as the repository. Dump the RPM in there. Then, run the createrepo command on that directory. For example, make a directory called /my_inst_src. Throw your RPM (as hard as you can) into that folder. Then, create the repository with this command:

[2246][root@linux:/home/scott]$ createrepo /my_inst_src
1/1 - pidgin-2.4.2-5.1.i586.rpm
Saving Primary metadata
Saving file lists metadata
Saving other metadata
[2247][root@linux:/home/scott]$

Then, just add that directory as an installation source in YAST=>SOFTWARE=>SOFTWARE REPOSITORIES.

Finally, go into YAST=>SOFTWARE=>SOFTWARE MANAGEMENT and search for the RPM you placed into your new repository. You should be able to find and install it easily. The great part here is that YAST should be able to resolve the package dependencies.

Yes, there are a few steps involved here. However, you can take this concept and apply it to an entire network of desktop or server machines. Pick a repository server on your network and create your own repository on it. Then, export that repo via NFS to the rest of the network. Next, just add that repository to the other machines on the network. The great part is that you only have to add the repository to each of the other machines once. But then, instant access to install that package on any of those boxes. This particular solution has been very helpful for me on several occasions.

6. Install with zypper from custom installation repository – Same thing as the previous method. We download a stand-alone RPM that has many dependencies. So the approach will be similar. Install createrepo, make a repository directory, and put your RPM in there. Use createrepo to build your repository as demonstrated above.

Then, instead of YAST, go ahead and add your new repository using the zypper command, like so:

[2308][root@linux:/home/scott]$ zypper addrepo /my_inst_src "My Installation Source"
* Adding repository 'My Installation Source'
Repository 'My Installation Source' successfully added:
Enabled: Yes
Autorefresh: Yes
URL: dir:///my_inst_src
[2309][root@linux:/home/scott]$

Make sure it was installed properly, again using zypper:

[2258][root@linux:/home/scott]$ zypper repos
# | Enabled | Refresh | Type   | Alias                                                             | Name
--+---------+---------+--------+-------------------------------------------------------------------+-----------------------------------------------------------
1 | Yes     | Yes     | rpm-md | openSUSE-10.3-Updates                                             | openSUSE-10.3-Updates
2 | Yes     | No      | yast2  | openSUSE-10.3-OSS-KDE 10.3                                        | openSUSE-10.3-OSS-KDE 10.3
3 | No      | Yes     | NONE   | http://download.opensuse.org/distribution/10.3/repo/debug/        | http://download.opensuse.org/distribution/10.3/repo/debug/
4 | Yes     | Yes     | rpm-md | Jpackage                                                          | Jpackage
5 | Yes     | Yes     | yast2  | http://download.opensuse.org/distribution/10.3/repo/non-oss/      | Main Repository (NON-OSS)
6 | Yes     | Yes     | rpm-md | Eric_Lavar_-_Germany                                              | Eric Lavar - Germany
7 | Yes     | Yes     | rpm-md  | My Installation Source                                            | My Installation Source
8 | Yes     | Yes     | yast2  | http://download.opensuse.org/repositories/openSUSE:10.3/standard/ | Main Repository (OSS)
[2259][root@linux:/home/scott]$

There it is, highlighted in red. Rock on, now we can make sure zypper finds our new package, thusly:

[2309][root@linux:/home/scott]$ zypper search pidgin
Refreshing 'My Installation Source'
repomd.xml is unsigned, continue? [yes/no]: yes
* Building repository 'My Installation Source' cache
* Reading installed packages [100%]

S | Repository                                                        | Type    | Name                   | Version    | Arch
--+-------------------------------------------------------------------+---------+------------------------+------------+-------
  | http://download.opensuse.org/repositories/openSUSE:10.3/standard/ | package | pidgin                 | 2.1.1-13   | i586
i | http://download.opensuse.org/repositories/openSUSE:10.3/standard/ | package | pidgin                 | 2.1.1-13   | x86_64
v | My Installation Source                                            | package | pidgin                 | 2.4.2-10.1 | x86_64
  | http://download.opensuse.org/repositories/openSUSE:10.3/standard/ | package | pidgin-bot-sentry      | 1.1.0-45   | i586
  | http://download.opensuse.org/repositories/openSUSE:10.3/standard/ | package | pidgin-bot-sentry      | 1.1.0-45   | x86_64
  | http://download.opensuse.org/repositories/openSUSE:10.3/standard/ | package | pidgin-bot-sentry-lang | 1.1.0-45   | i586
  | http://download.opensuse.org/repositories/openSUSE:10.3/standard/ | package | pidgin-bot-sentry-lang | 1.1.0-45   | x86_64
  | http://download.opensuse.org/repositories/openSUSE:10.3/standard/ | package | pidgin-devel           | 2.1.1-13   | i586
  | http://download.opensuse.org/repositories/openSUSE:10.3/standard/ | package | pidgin-devel           | 2.1.1-13   | x86_64
[2309][root@linux:/home/scott]$ 

The one we’re looking for is highlighted in red. Looks like we’re ready to go ahead and install the application:

[2313][root@linux:/home/scott]$ zypper in pidgin

If the package is so brand-new that it has dependencies that are unresolvable, obviously you’ll have problems. But for many common packages, this method works great.

As a side note, you can also set your machines up so that you don’t even need the discs to install packages. Put the DVD ISO on your machine and you can put that into YAST as an installation source. Disable the source that uses the local optical drive. Then, it will pull packages from the ISO.

Even better, you can put that DVD ISO on a server on your network. Mount it on that server, and export the mount point via NFS to the rest of the network. Go to each machine in the network. Disable the source that uses the local optical drive. Add the NFS share from the server as an installation source on each box. Then, the machines on the network will pull packages from the NFS share.

Conclusion

There are at least a handful of ways to get installed what you need installed on your box. Depending on whether you are a home user with one computer or a Linux system administrator with 100 servers, or anything in between, you’re bound to use one or more of these methods. And these methods work on both OpenSUSE 10.3 and 11.0. Have a lot of fun…

11 Responses to “How many ways can you install an RPM in OpenSUSE Linux?”

  1. Marek Stopka Says:

    Exactly, you have one more way to install local RPM in openSUSE 11.0 via zypper. You can just use zypper install ./some-rpm.rpm You do not have to create own local repository….

  2. Scott Morris Says:

    Marek and Pavol,
    Excellent tips, gentlemen. Thanks a ton for the heads-up. Have a good one, and thanks for stopping by.

  3. Pavol Rusnak Says:

    You can use zypper to install RPMs directly. No need for custom repository. Try

    zypper install package.rpm

    or even

    zypper install http://some.web.page.com/rpms/package.rpm

    And zypper will (download and) install package and all of its dependencies.

  4. How many ways can you install an RPM in OpenSUSE Linux? « Linux and Open Source Blog Says:

    […] Read More […]

  5. Jeremy Says:

    Sorry if this appears to rabbittrail this post. I think the apt/deb system has had these abilities for a while. It’s good to see RPM approaching feature-equivalence. I don’t want to be locked into Ubuntu, but I find package management to still be more intuitive there than on Fedora or OpenSUSE. I’ll still keep trying though and openSUSE 11 is a lot better than when I tried 10.1 or 10.2.

  6. Scott Morris Says:

    Jeremy,
    It’s all good, as long as you are using *any* distro and not that proprietary junk, we’re all cool. 🙂 Do what works for you. OpenSUSE 11 apparently has some fairly nice updates in this arena. Thanks for stopping by.

  7. Scott Morris Says:

    OK, everyone, apparently in 11.0, you’ll be able to install 1-click applications from the commandline. Take a look: http://dev.compiz-fusion.org/~cyberorg/2008/06/10/useful-opensuse-one-click-installs-from-command-line/

  8. Boycott Novell » Do-No-Evil Saturday - Part I: OpenSUSE 11.0 Just Days Away Says:

    […] shows the many different ways of installing software in OpenSUSE. One blogger shares his list of repos. With openSUSE 11.0’s […]

  9. Anatolii Bondar Says:

    Dear Scott Morris,
    smart is yet one way to install packages in openSUSE 11.0, I suppose.

    Use:

    smart –help

    to see all the ways you can use this tool.

  10. Scott Morris Says:

    Anatolii,
    Absolutely true. I was focusing primarily on ways to install software without having to install a package manager that did not come stock with OpenSUSE. I believe you have to install smart to use it. However, you are absolutely correct. Smart is a great method whereby you can install software. Thanks for the suggestion and thanks for stopping by.

  11. Jay Says:

    Great article (esp for newbies)!

    Thanks,

    Jay

OpenSUSE Linux Rants
Official OpenSUSE Linux Site

internal links:

categories:

SUSE Resources

search blog:

archives:

September 2019
S M T W T F S
« Feb    
1234567
891011121314
15161718192021
22232425262728
2930  

60 queries. 60.752 seconds