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 pidginIf 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…
Aucun commentaire:
Enregistrer un commentaire