One, RPM installation
Package Manager is the assembly of the compiled application of the constituent files package one or several package files, so as to quickly and easily implement the package installation, uninstall queries, upgrades and checks and other management operations, on the CentOS system using the RPM command management package for installation, uninstallation, upgrade, query, check, Database maintenance and other operations, you need to mount the disc, mount the CD command as follows
[[Email protected] ~] # Mount/dev/cdrom/mediaMount:/dev/sr0 is write-protected, mounting read-only
The following command appears to display the Mount success, and the next step is to demonstrate the specific application of the RPM command.
RPM {-i|--install} [install-options] package_file ...
-IV Display Package Management execution progress
-IVH package_file display process and installation progress percentage
--test: Test installation, but do not actually perform the installation, that is, dry run mode
--nodeps: Ignore dependencies during installation
--replacepkgs repeatedly installs installed packages, overwriting files
--replacefiles the part of the file that will install the package conflicts with other installed package files, you can continue the installation, the file does not overwrite
--noscripts do not execute the script that comes with the package during installation
-A: All packages
-F: To see which package installs the specified file for build
-P rpmfile: query operation for package files not yet installed
--provides: See which capability the specified package provides
- R Query Common query usage
-QI Package Name shows the package details
-QF file path query specifies which of the installed RPM packages the file is from
-QC Package
-E Unload Package
The relevant application for RPM is the installation of the application, but the installation is generally relatively single, I say the single is most of the RPM–IVH to install the program, here I do not do too much demonstration, I will demonstrate the use of RPM to recover files.
Experiment 1 Delete files and use Rpm2cpio to unlock rpm to recover files
Delete the specified file
[[Email protected] ~] # cat/etc/rc.d/init.d/functions Cat:/etc/rc.d/init.d/functions:no such file or directory
Verify that the deletion was successful
[[Email protected] ~] # cat/etc/rc.d/init.d/functions Cat:/etc/rc.d/init.d/functions:no such file or directory
[[Email protected] ~] #rpm-qf/etc/rc.d/init.d/functions
Initscripts-9.49.41-1.el7.x86_64
Get the version information you've installed
[[Email protected] ~] #mount/dev/cdrom/media/
Mount:/dev/sr0 is write-protected, mounting read-only
To mount a disc
[[Email protected] ~] #cp/media/packages/initscripts-9.49.41-1.el7.x86_64.rpm/app
Copy to temp directory
[[Email protected] ~] #cd/app
[[email protected] app] #rpm2cpio Initscripts-9.49.41-1.el7.x86_64.rpm|cpio-id
3039 Blocks
Use Rpm2cpio to untie files
[[email protected] app] #cp etc/rc.d/init.d/functions/etc/rc.d/init.d/
Copy to the original directory
[[email protected] app] #cat/etc/rc.d/init.d/functions
#-*-shell-script-*-
#
# functions This file contains functions to be used by most or all
# shell scripts in The/etc/init.d directory.
#
Cat test the results of the experiment, too much file content here do not show too much.
Ii. Management of Yum
yum:yellowdog Update modifier,rpm's front-end program, which resolves package dependencies, locates packages between multiple libraries, YUM Repository:yum repo, stores many RPM packages, And the related metadata file of the package (placed under a specific directory repodata), mainly for the purpose of solving the installation of a package, the need to meet other package dependencies, more easy to operate than RPM, focusing on the configuration of the warehouse.
1, the configuration of the RPM warehouse
/etc/yum.repos.d/*.repo Warehouse Path
[Repoid] The name of the warehouse, cannot be duplicated
Name= Warehouse Description, can not write, will use Repoid as name
Enabled=1|0 activates or disables the warehouse, which is enabled by default if the row is not written
Gpgcheck=1|0 whether the installation package is detection GPG signature, default detection, that is, 1
Gpgkey=file:///etc/pki/rpm-gpg/rpm-gpg-key-centos-7 specifying the path to GPG KEY
2. After the warehouse is successfully configured, install the package directly with the Yum command.
Yum Install package name [* Package name *] [package Name 2 ...]
- y Auto Answer
Reinstall Package name to reinstall the specified package
Update package
Remove Uninstall package does not unload with dependent packages
Info Package Name View detailed information for the specified package
yum list
All default means list all packages
Updates list updatable packages
installed list installed packages
@repoid indicates that the package is installed from the specified warehouse
installed indicates that the package is manually installed by the rpm command
base Packages not installed, from base
Epel Packages not installed, from Epel
@base The package is installed and is installed from the base
@anaconda The package is installed and is installed from the operating system installer Anaconda
repolist [enabled] defaults to show only the activated warehouses
Disabled only the disabled warehouses are displayed
All Show All warehouses
3. When Yum installs, it is necessary to empty and rebuild the cache for Yum
Yum Clean all empties the Yum cache
Yum Makecache rebuilds the cache (any command that uses Yum for the first time will be rebuilt automatically without caching)
4, Yum provides "*/rz" search for a file from which RPM package, can be a package that is not installed
Yum Search keyword Fuzzy searching package and description
Yum deplist PHP Lists all packages that the specified package depends on
5. Yum history Lists all Yum histories
Info # View details about a history
Redo # Redo a piece of history
Undo # Undoing a piece of history
If the history is install, Undo is the Remove
If this history is remove, then undo is the install
Experiment 2 configuration of the Yum repository
[[Email protected] ~] #vim/etc/yum.repos.d/wsy.repo
[Base] Classroom local base
name=red Hat Enterprise Linux $releasever Repo
Baseurl=http://172.18.0.1/centos/$releasever
Enabled=1
Gpgcheck=0
[Epel] Online Epel
Name=mage Epel
Baseurl=https://mirrors.tuna.tsinghua.edu.cn/epel/7/x86_64/
Enabled=1
Gpgcheck=0
The WQ is saved and can be used to install the package with the Yum command.
Third, DNF package management
DNF introduces a new generation of RPM Package manager. He first appeared in the release of Fedora 18. Recently, he replaced YUM, officially becoming the Package manager for Fedora 22. But the current use is not many, the most commonly used is the top of the two installation package management, DNF and Yum installation and use is very similar to the configuration file stored in/etc/dnf/dnf.conf
1. Common usage is as follows
DNF [Options] <command> [<arguments> ...]
dnf–version
DNF Repolist
DNF Clean All
DNF Makecache
DNF List installed
DNF List available
DNF Search Nano
DNF History
DNF History undo 1
2. The process of compiling the package is source code-------------------
Compile the installation three steps with the C language source code as an example:
- Configure (1) Pass parameters by option, specify enable feature, install path, etc, refer to User's designation and makefile.in file Generation Makefile (2) to check dependent external environment, such as dependent package
- Make based on the makefile file, build the application
- Make install to copy files to the appropriate path
Next I'm using an experiment to install the source package Apache
Lab 3 Compile and install the Apache 2.4 source package on CentOS7 and start the service
Lftp 172.18.0.1
User Thirty-three Pass:thirty-three
Get files/httpd-2.4.27.tar.bz2
Exit
Connect the classroom server, download the source code
Tar xvf httpd-2.4.27.tar.bz2
Extract the file to be extracted
Yum Groupinstall Development Tools
Switch to http-2.4.27/for development tools installation
./configure--help
./configure--prefix=/app/apache24--sysconfdir=/etc/apache24
Other software running support, option parameters, features, paths, etc.
Make
Make install
vim/etc/profile.d/mg.sh
Apachectl Start Apachectl
vim/app/apache24/htdocs/index.html Editing of Web pages
Iptables–f shutting down the firewall
Access to the browser, access to the final results
Linux Starter Package Management