Linux kit upgrade-RPM and Tarball

Source: Internet
Author: User
Tags gz file
Article title: Linux kit upgrade-RPM and Tarball. Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.
Why do we need to upgrade the suite?
This is really an interesting topic. why do we need to upgrade the suite? There are usually three reasons for our upgrade:
1. new features are required, so a new suite needs to be installed;
2. the old version of the suite may have security concerns, so you need to update it to the new version of the suite;
3. the execution efficiency of the earlier version of the suite is poor, or the execution capability cannot be satisfied by managers.
In particular, when a suite has security concerns, do not doubt it. update the suite now! So what are the update methods? There are basically two types:
1. install the program directly using the binary source code method: install the program using the Tarball method;
2. install the package manager with a package file, such as RPM (Red Hat), apt (Mandrake), pkg (Sun Unix), and dpkg (Dabien.
The two methods have their own advantages and disadvantages. here we want to talk about the installation methods of RPM and Tarball!
  
What are RPM and SRPM?
The RPM full name is "RedHat Package Manager! As the name suggests, the suite management program was developed by Red Hat, but many other suites also have similar Suite management programs. However, RPM is easy to use, so it is now the most popular suite management program! What is RPM? To put it simply, RPM installs the required suite to a set of management programs on your Linux host in a way recorded by the database. Its biggest feature is to package the package you want to install first, and record it through the preset database records in the package, record the dependent attribute modules required for installation of this package (that is, the first few required suites required for your Linux host). when installed on your Linux host, RPM will first query whether the dependency attribute suite of the Linux host meets the requirements according to the records in the suite. If yes, it will be installed. if not, it will not be installed. During the installation, the information of the suite is written into the RPM database for future query, verification, and anti-installation!
The advantage is:
1. the installation is convenient because the package has been completed;
2. the information of the suite has been recorded in the database of the Linux host, which makes it easy to query, upgrade, and reverse install;
But this also caused a lot of trouble, because the RPM program is packed with information, that is to say, the information in it has been "compiled! Therefore, you must first install the host environment at the time of installation. that is to say, the installation environment of this suite must also appear on your host! For example, the rp-pppoe ADSL dial-up kit must be installed in the environment where the ppp suite exists! If your host does not have the ppp package, sorry. rp-pppoe won't let you install it unless you install ppp first (of course, you can install it forcibly, however, a problem usually occurs !)
In this way, we can find that his shortcomings are:
1. the installation environment must be consistent with or equal to the environment requirements during packaging;
2. the dependency attribute needs to be met;
3. be careful when installing anti-installation. the lowest-level suite cannot be removed first, otherwise it may cause problems in the entire system!
What should we do? Haha! Okay, there's SRPM! What is SRPM? He is also an RPM! However, since the original code is included in the package together with the original code, you can re-compile the code. Generally, the file name of SRPM is ***. src. rpm. Because SRPM contains the original code, you must re-compile the packaged information file suite before installation! Of course ??? Why? Tomb? Excuse me? Song Shi? Is it easy to move your shirt back to your brain? Too many ?? Scallions? Shi Baday? Awkward? Br>
What is i386, i586, i686, noarch?
Okay! Now we know the RPM and SRPM formats, respectively:
   
In this way, you can clearly find the name, version information, number of packages, and operating hardware platform of the suite! Okay. let's talk about each different place:
· Kit name: of course, the name of each suite!
· Version information: each time a version is updated, a version information is required. Otherwise, how can I know whether the version is new or old?
· Number of releases: that is, the number of compilations! So why do we need repeated compilation? This is because the same version of the suite may have some bugs or security concerns, so you must reset the set parameters when packaging, after setting, recompile and package it into an RPM file! So there are different packages!
· Operating the hardware platform: this is a very interesting part. since RPM can be applied to different operating platforms, the parameters set by different platforms are still different! So the so-called i386, i586, i686 and noarch file names appear!
Oi386: it can work normally on almost all x86 platforms, including the old pentum or the new pentum-III! That I refers to Intel compatible CPU. as for 386, it is the CPU level!
Oi586, i686: higher-level CPU level!
Onoarch: there is no hardware level limit.
Note that i386 files can be installed on any machine, whether 586 or 686, but i386 may not be used on 586 or 686 hardware, in addition, i686 files may be better executed on 686 of machines than i386 files! In any case, using i386 should be okay! In addition, because different distirbution environments and function libraries are different, you may also add the abbreviated version of this suite after i386!
Okay! Next, let's talk about the directory to be used during installation!
  
Installation directory required for SRPM and RPM
As SRPM still needs a compiled program, let's start with the work of SRPM! Okay, first catch a file back to try: rp-pppoe-2.6-5.src.rpm!
SRPM compilation process:
As mentioned above, some original codes are included in SRPM, so we need to compile and package SRPM! Where is the compilation performed? Because the original code is decompressed during compilation and the parameter control options are also removed at the same time, some materials will appear. where should these materials be stored? You can go to your/usr/src/redhat and have a look! Run the following command first:
Rpm-I rp-pppoe-2.6-5.src.rpm unlinks the data to/usr/src/redhat!
·/Usr/src/redhat/SPEC;
·/Usr/src/redhat/SOURCE: The original file of the suite (* .tar.gz file) and the config file are placed in this directory;
·/Usr/src/redhat/BUILD: during compilation, some temporary data will be stored in this directory;
·/Usr/src/redhat/RPMS: After compilation and successful compilation, put the packaged files in this directory. There are sub-directories including i386, i586, i686, noarch... and so on.
In addition, unknown errors or set errors may occur during the compilation process. at this time, a corresponding error file will be generated under/tmp, you can perform the debugging based on this error file! After all the problems are solved, the compilation is successful. the files after decompression are in/usr/src/redhat/SPEC, SOURCE, all files such as BUILD will be killed, and only files placed under/usr/src/redhat/RPMS will be left!
RPM installation process:
When RPM is installed, it will first read the set parameter content in the suite, that is, information about/usr/src/redhat/SPEC! Use this document to compare the Linux system environment. if the environment is consistent, install it. if the environment does not match, the information will be displayed! After the installation is complete, the rpm will write the information about the suite to the/var/lib/rpm directory! Therefore, when you perform a query or are expected to upgrade, the relevant information will be provided by the content of the/var/lib/rpm Directory ??? Br>
RPM command usage: installation, upgrade and update, query, verification, anti-installation and re-creation of the database
The RPM features are quite rich. let's explain it one by one!
· Installation:
Installation is now available from scratch! So what is the installation method? If RPM is used, use ivh! If SRPM is used, will rebuild or recompiler be used ??
   
  
O -- rebuild: this parameter will compile and package the SRPM, but it is not installed. when you use -- rebuild, at last, we usually find a line of font:
Wrote:/usr/src/redhat/RPMS/i386/rp-pppoe-2.6-5.i386.rpm
Is this the compiled RPM file ?? When I knocked together, the Egg Lady coated the beautiful window, and the cool glass, "Cang dark neon roasting and swimming? Yueda Singtao Shangwa pure sang
O -- recompile: This action will directly "compile" and "package" and "install 』??
O-ivh: this parameter is used to install RPM. under this parameter, there may be "dependency attribute" problems or files that have been installed, therefore, you can add the following parameters to force the installation:
-- Nodeps: forcibly install nodeps without considering the dependency attribute;
§ -- Replacepkgs: if this suite has been installed before and you want to overwrite it, you can add -- replacepkgs to force overwrite it without installing it;
§ -- Replacefiles: what if the file has been modified after the package is installed? If "confilcting files" appears during the installation process, replacefiles will overwrite this file!
   
§ Upgrade:
Upgrading with RPM is really easy! Upgrade it with Uvh! However, in a large number of upgraded versions, it is better to use FVL. However, if you are using Uvh, but you do not have this suite on your machine, sorry, this suite will not be installed on your Linux host, so install ivh again!
   
· Note that Uvh is only used to upgrade the kits you write, and FVL is used to upgrade the kits that only exist in your system 』, so when some friends fix a large number of kit versions:
O capture the latest i386 files on the Red Hat errata website;
 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.