Brief Introduction and demo of rpm and yum

Source: Internet
Author: User

1 Software Package Manager

1.1 Main functions: Package A software binary program, library file, configuration file, and help file into a file. You can also package the file, expand the binary program to the relevant path according to the specified location. 1.2 generate the database, track every file installed, and install, uninstall, upgrade, and query the software package, verify 2 rpm2. 1 rpm the rpm command of the basic structure is a software package. This software package provides some commands, then, the rpm command is used to manage the 2.2 rpm of the software package. When managing the software package, you also need to provide the tracking and Installation File function so that you can uninstall the software later. More importantly, you need to provide the query function, queries include the files installed by the software package, or a file to find which software package is generated by the installation, therefore, rpm itself has a large database/var/lib/rpm2.3 package introduction. An rpm package is generally made into one or more sub-packages to avoid a large master package. For example: bind-9.7.1-1.i586.rpm) Sub-package: added a sub-Name under the main package, the version, such as: bind-libs-9.7.1-1.e15.i586.rpm, bind-utiles-9.7.1-1.e15.i586.rpm) 2.3.1 rpm package Name format: Name (Name)-version number) -release number ). arch Platform Architecture) bind-major main version ). minor (minor version ). release correction number,-release. arch. rpm Main version: the rpm package has been significantly improved; minor version: a major change in a sub-function; release number; fixed some bugs, adjusted a little function 2.4 rpm command 2.4.1 installation rpm-h: To # display the installation progress, each # indicates 2% rpm-v: display details rpm-vv: A more detailed installation process is usually indicated by the command rpm-ivh command to install the software package -- nodeps: Ignore dependency; this will cause the software to fail to run after installation -- replacepkgs; reinstall, replace the original installation; -- replacefiles replacement file -- oldpackage downgrade -- force: force installation, which can be reinstalled or downgraded; -- test: test whether the software package can be installed 2.4.2 to query whether the rpm-q package command is not followed by the path): Only query the specified package (without the following version information). For example, a software package is: zsh-4.2.6-6.el5.i386.rpmrpm-q zshrpm-qa queries all installed packages rpm-qa | gerp "^ z" queries software packages starting with z rpm-qi package name: queries description information for a specified software package, for example: rpm-q zshrpm-ql package name: queries the list of files generated after the specified package is installed, for example, rpm-ql zshrpm-qf/path/to/somefile: query the rpm package generated by the specified file, for example, rpm-qf/etc/passwdrpm-qc package name. query the configuration file installed by the specified package, for example: rpm-qc zshrpm-qd package name; query the Help file of the specified package, for example, rpm-qd zshrpm-q -- scripts package name: query the script contained in the specified package, for example: rpm-q -- scripts zsh1) If an rpm package has not been installed, We need to query its instructions, files generated after installation: rpm-qpi package Path: rpm-qpl which files will be generated after installation 2.4.3 upgrade rpm-Uvh/Path/to/new_package_file if older versions, otherwise, the rpm-fvl/Path/to/new_package_file will be installed. If the old version is installed, the system will exit the downgrade: -- oldpackagerpm-ivh -- oldpackagerpm-Uvh -- oldpackage downgrade 2.4.4 uninstall rpm-e PACKAGE_NAME: uninstall not allow other package dependencies -- nodeps force uninstall 2.4.5 verify rpm-V PACKAGE_NAME: check whether the software package has been illegally changed by 2.5 check the source validity, and software integrity 2.5.1 key file Red Hat installed linux system stores a file, that is, the key file of the Red Hat series rpm package, this file is:/et/pki/rpm-gpg/RPM-GPG-KEY-redhat-release: Only Red Hat software can be verified) when using this file, you need to import it to the rpm package. The command rpm-K -- nosignature (without verifying the signature) is verified in the rpm command) /PATH/TO/PACKAGE_FILErpm-K-nodigest (only verify the signature, not verify the integrity)/APTH/TO/PACKAGE_FILE the command TO import the key file TO the rpm package is: rpm-import/et/pki/rpm-gpg/RPM-GPG-KEY-redhat-release: import the KEY file dsa, gpg: verify the source validity, that is, verify the signature, you can use -- nosignature. skip this sha1 and md5: verify the integrity of the software package. You can use -- nodigest to skip this usage process.

1) view the file address where the key is stored in the system.

650) this. width = 650; "border =" 0 "alt =" "src =" http://www.bkjia.com/uploads/allimg/131228/02194131Y-0.jpg "/>

View the key file 2) Test the verification result 2 when no import is made.

650) this. width = 650; "border =" 0 "alt =" "src =" http://www.bkjia.com/uploads/allimg/131228/021941D17-1.jpg "/>

Failed verification: import the key file before verification.) 3) import the key file, as shown in figure 3.

650) this. width = 650; "border =" 0 "alt =" "src =" http://www.bkjia.com/uploads/allimg/131228/02194113U-2.jpg "/>

Import key file command 4) Verify again rpm package 4

650) this. width = 650; "border =" 0 "alt =" "src =" http://www.bkjia.com/uploads/allimg/131228/021941IN-3.jpg "/>

Verification Successful 2.6 re-built Database rpm -- rebuildb: re-built Database (whether or not it will be re-established) rpm -- initdb: the initial database is not created, and you do not need to create it if any )) 3. yum introduction 3.1 yum (Yellowdog Update Modifier) is a front-end tool provided by the Red Hat software package. It is used to manually manage the dependency between rpms, instead of detaching rpm, instead, a higher tool 3.2 yum job analysis tool is provided on rpm. The entire job process of yum depends on the yum repository. The yum repository is a place where we expect all rpm packages to be used; yum has its own client, which is dependent on the configuration file when working. The file can be ftp, web, or a specified file path, that is, the location where the rpm package is stored in the yum warehouse and the metadata file). When a package is installed, yum depends on its own attributes, analyze with all the rpm packages installed on our system, and analyze whether the package is dependent, or whether the dependent packages are installed or not, y Um will go to the yum warehouse to find uninstalled packages for simultaneous installation. Yum will analyze the Dependencies by itself. 3.3 yum metadata file (1) Metadata File in yum Repository: primar.xml.gz: 1 List of all RPM packages current yum repository) 2 contains dependency 3 each rpmpackage is installed and generated file named filelists.xml.gz: size Timestamp and checksum metadata) comps-rhel5-server-core.xml: defines the grouping relationships of software packages in the current yum repository in this file (2)/etc/yum. the conf file is the yum configuration file. The configuration content is described as follows: cachedir =/var/cache/yum cache path keepcache = 0 whether to save the cached file debuglevel = 2 level of output information during yum Installation logfile = the log storage path distroverkg is the process of installing the yum software package: release Version name tolernat = 1 fault tolerexactarch = 1 when installing the rpm package, the version obtained from the yum repository must match exactly with the version we are currently using. check whether the integrity of the file source is checked, and source validity plugins = 1 yum plug-in use (3) for yum definition repo file [Repo_id] repo name = description information baseurl = repository location, there are three formats)

Ftp: // http: // file :///

Enabled = 1 | 0) whether the current repository allows the use of "1" indicates that the use of "0" indicates that the gpgcheck = {1 | 0} is disabled. Whether the gpg mechanism is used to verify the validity and integrity of the software package is 1 gpgkey = by default step 1: Specify the path of the gpg file: in/etc/yum. repos. d. file 5 at the end of the repo File

650) this. width = 650; "border =" 0 "alt =" "src =" http://www.bkjia.com/uploads/allimg/131228/0219412R3-4.jpg "/>

Step 2: edit content 6

650) this. width = 650; "border =" 0 "alt =" "src =" http://www.bkjia.com/uploads/allimg/131228/0219411408-5.jpg "/>

Specify the location of the Repository. The 3.4 yum command uses the format 1) list: lists information displayed in the rpm package list of the current yum repository. 7. The first is the name of the package, followed by the software running platform, followed by the rpm package displayed after the version number and release number. in which warehouse, if install is installed, install

650) this. width = 650; "border =" 0 "alt =" "src =" http://www.bkjia.com/uploads/allimg/131228/02194113O-6.jpg "/>

Repolist all | enabled | disabledall: displays the available and disabled information of all repositories) enabled display available disabled display disabled repolist is by default the function is enabled option list Command supports globbing with the same character) for example: yum list all zsh * Show all packages starting with zsh) available: installed: installed updates: available upgrade clean: Clear cache [packages | headers | metadata | dbcache | all] clean packages: only clear rpm package clean headers: header information clean metadata: only clear metadata file clean dbcache: Library cache clean all: Clear all above 2) install: install yum install PACKAGE_NAME-y: if yes is automatically answered, the dependency-dependent rpm packages are automatically installed, as shown in Figure 8 and 9.

650) this. width = 650; "border =" 0 "alt =" "src =" http://www.bkjia.com/uploads/allimg/131228/0219413M6-7.jpg "/>

Figure 8 install php53-mysql

650) this. width = 650; "border =" 0 "alt =" "src =" http://www.bkjia.com/uploads/allimg/131228/0219411910-8.gif "/>

Figure 9 yum automatically analyzes the dependent libraries and downloads them from the specified repository to the local device for installation. 3) update: update-to: upgrade to the specified version. 4) uninstall: remove | erase: when the package is uninstalled, the packages dependent on this package will also be uninstalled (5) view information rpm-qiinfo) zsh view information info view information ratio-qi brief provides | whatprovides: view which package is generated by the specified file or feature Installation

For example, yum provides/etc/inittab (view the installation package of the/etc/inittab file)

4. How to Create a yum Repository: 1) The command is: the rpm package name of the createrepo Command provided by ceraterepo is also createrepo. To use the ceraterpo command, you must first install this package.) 10

650) this. width = 650; "border =" 0 "alt =" "src =" http://www.bkjia.com/uploads/allimg/131228/02194155a-9.jpg "/>

0 manually install the createrepo package. 2) create a file named 11 ending with. repo in the/etc/yum. repos. d directory.

650) this. width = 650; "border =" 0 "alt =" "src =" http://www.bkjia.com/uploads/allimg/131228/0219412491-10.jpg "/>

11. Create the cd. repo file. 3) edit the cd. repo file 12.

650) this. width = 650; "border =" 0 "alt =" "src =" http://www.bkjia.com/uploads/allimg/131228/0219411395-11.jpg "/>

2. Edit the cd. repo file and specify the repository name and source location. 3) Check whether VT 13 exists first.

650) this. width = 650; "border =" 0 "alt =" "src =" http://www.bkjia.com/uploads/allimg/131228/02194133F-12.jpg "/>

3 VT exists, but there are missing files that need to be manually installed. 4) create a yum source. The missing files will be automatically installed. 14 is shown in.

650) this. width = 650; "border =" 0 "alt =" "src =" http://www.bkjia.com/uploads/allimg/131228/02194111B-13.jpg "/>

4 manually create yum source 5) view/yum/VT source content 15

650) this. width = 650; "border =" 0 "alt =" "src =" http://www.bkjia.com/uploads/allimg/131228/0219411127-14.jpg "/>

5 view/yum/VT content 6) view repo list again 16

650) this. width = 650; "border =" 0 "alt =" "src =" http://www.bkjia.com/uploads/allimg/131228/0219411215-15.jpg "/>

6 VT generation successful

7) The definition of creating a group for VT 17 is shown in

650) this. width = 650; "border =" 0 "alt =" "src =" http://www.bkjia.com/uploads/allimg/131228/021941N25-16.gif "/>

7. Add group definitions for VT

Here, you can manually create the yum library.

 

 

This article from "Deng junyang's Blog" Blog, please be sure to keep this source http://djy0000.blog.51cto.com/5816828/1156368

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.