Writing a Java Class to Manage RPM Package Content
Installing a Linux system for the first time is quite straightforward. You can find good and cheap Linux packages on the market that will quickly install themselves. You need only choose some configuration options describing the type of hardware on which you want to install, and that's it.
As time goes on, you will add some new components to your Linux system, and that's where the nightmare may begin. A Linux system is composed of hundreds of components and dynamic libraries. In order to keep your system up and running, you should be careful, since installing a new version of a component may introduce incompatibilities in your system, making it more unstable as time goes on.
Replacing an existing component with a new version at first looks like a trivial task: you just need to pick up a new compiled version of the component, generally available on the Net in a .tgz file (tar + gzip compression), and install it on your system. Some dynamic libraries of the component you just upgraded may already be used by other installed components and might not be compatible with the new version you just installed.
It would be great to have a tool which could report the dependencies of each component installed on your system. Such a tool could tell you the version of Samba (for instance) installed on your system or that you can't install egcs-1.0.2-8 on your system prior to having binutils 2.9 up and running. This tool already exists on Linux—it is called RPM—and is on many existing Linux distributions, including Red Hat, Caldera, SuSE and Linux Mandrake.
RPM stands for Red Hat Package Manager and is described by its creator as “an open packaging system available for anyone to use and works on Red Hat Linux as well as other Linux and UNIX systems” (from the Red Hat installation guide).
Before starting the programming discussion, I will introduce the RPM package manager and give a general overview of it. If you need more information, see Resources for more than 400 pages of interesting details on RPM's history, design, usage and programming.
The diagram in Figure 1 represents the different components involved in the RPM tool. RPM is composed of three main parts:
RPM utilities, which modify the database and packages
The RPM database, located in /var/lib/rpm on Red Hat distributions, is owned by root; it is a mirror of all the packages which are presently installed on your system. The RPM utility accepts various commands which query the database for installed packages, install or update the system with new RPM packages, remove unused packages from the system, and verify and check installed package dependencies. Usually, when a new version of a given component becomes available on the Net, you have two choices:
Look for a tar gzip file containing the sources. Compile the sources on your system, then proceed with installation of the binaries. The given package generally provides a README, a make and make install procedure to help you.
Look for a tar, gzip file containing the binaries, meaning that someone else has already compiled the sources for you on the same kind of computer as yours. Then proceed with installation of the binaries.
Let's say you are interested in installing version 1.9.18 of Samba. First, you should look on the Net for an RPM of the Samba package (instead of a tar, gzip package). Once you have it, type:
rpm -uvh samba-1.9.18p8-50.1.i386.rpm
This command will install (or upgrade) a copy of Samba on your system. It will also check that all dependencies needed by this version of Samba are present on your system. If the rpm command completes with no error messages, you're guaranteed the installed package will be ready to run without trouble at the end of the installation process.
This installation process will also update the RPM database which keeps track of all installed packages on your system and all their dependencies.
So if, six months later, you want to find out which version of Samba is installed on your system, typing the following command:
rpm -q samba
will tell you
samba-1.9.18p8-50.1If you want to remove a package from your system, the RPM utilities will remove the files which were installed on your system during installation.
|Daily Giveaway - Fun Prizes from Red Hat!||Oct 25, 2016|
|Installing and Running a Headless Virtualization Server||Oct 25, 2016|
|Ubuntu MATE, Not Just a Whim||Oct 21, 2016|
|Non-Linux FOSS: Screenshotting for Fun and Profit!||Oct 20, 2016|
|Nasdaq Selects Drupal 8||Oct 19, 2016|
|Canonical Ltd.'s Ubuntu Core||Oct 19, 2016|
- Installing and Running a Headless Virtualization Server
- Daily Giveaway - Fun Prizes from Red Hat!
- Daily Giveaway
- Ubuntu MATE, Not Just a Whim
- Nasdaq Selects Drupal 8
- Build Your Own Raspberry Pi Camera
- Secure Desktops with Qubes: Compartmentalization
- Returning Values from Bash Functions
- Non-Linux FOSS: Screenshotting for Fun and Profit!
- Canonical Ltd.'s Ubuntu Core
Pick up any e-commerce web or mobile app today, and you’ll be holding a mashup of interconnected applications and services from a variety of different providers. For instance, when you connect to Amazon’s e-commerce app, cookies, tags and pixels that are monitored by solutions like Exact Target, BazaarVoice, Bing, Shopzilla, Liveramp and Google Tag Manager track every action you take. You’re presented with special offers and coupons based on your viewing and buying patterns. If you find something you want for your birthday, a third party manages your wish list, which you can share through multiple social- media outlets or email to a friend. When you select something to buy, you find yourself presented with similar items as kind suggestions. And when you finally check out, you’re offered the ability to pay with promo codes, gifts cards, PayPal or a variety of credit cards.Get the Guide