In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
Software installation and Management under Linux system
Overview of binary (RPM) packages
1. The components of the binary package:
Binaries, library files, configuration files, help files
[root@dayi123] # rpm-qpl/mnt/cdrom/Packages/httpd-2.4.6-40.el7.centos.x86_64.rpm
/ etc/httpd
/ etc/httpd/conf # binary package component profile
/ etc/httpd/conf.d
……
/ usr/sbin/httpd # binary package component binaries
……
/ usr/lib64/httpd/modules/mod_access_compat.so
/ usr/lib64/httpd/modules/mod_actions.so # binary package component library file
……
/ usr/share/man/man8/rotatelogs.8.gz # binary package component help file
/ usr/share/man/man8/suexec.8.gz
……
2. Binary package Manager
(1) debian:deb file, dpkg package manager
(2) redhat: rpm file, rpm package manager
3. The naming of the binary package:
Such as: httpd-2.4.6-40.el7.centos.x86_64.rpm
Description:
Http: package name
2.4.6: software version
40: software compiled version
El7.centos: a suitable hardware platform
X86room64: a suitable hardware platform
.rpm: package extension
4. Classification of rpm packets:
1) main package: Application-VERSION-ARCH.rpm
2) Development subpackage: Application-devel-VERSION-ARCH.rpm
3) other subpackages: Application-utils-VERSION-ARHC.rpm
4) other subpackages: Application-libs-VERSION-ARHC.rpm
For example, httpd package:
[root@dayi123 ~] # ls / mnt/cdrom/Packages/httpd*
/ mnt/cdrom/Packages/httpd-2.4.6-40.el7.centos.x86_64.rpm
/ mnt/cdrom/Packages/httpd-devel-2.4.6-40.el7.centos.x86_64.rpm
/ mnt/cdrom/Packages/httpd-manual-2.4.6-40.el7.centos.noarch.rpm
/ mnt/cdrom/Packages/httpd-tools-2.4.6-40.el7.centos.x86_64.rpm
5. Dependencies between packages
(1) dependencies: the general dependencies between binary packages are tree dependency, circular dependency and module dependency.
(2) View the library files and dependencies:
1) View the library file that the binary program depends on: ldd / PATH/TO/BINARY_FILE
2) display all available library file names and file path mappings that have been cached on this machine: / sbin/ldconfig-p
3) configuration file of the library file (if you want to add a new library file, you can create a new file ending in .conf under / etc/ld.so.conf.d and add the strength of the library file to the file): / etc/ld.so.conf, / etc/ld.so.conf.d/*.conf
4) Cache file of library file: / etc/ld.so.cache
[root@dayi123 ld.so.conf.d] # ldd / bin/ls # View the library files that the binary program depends on
Linux-vdso.so.1= > (0x00007ffc17f8c000)
Libselinux.so.1= > / lib64/libselinux.so.1 (0x00007f91c6e60000)
Libcap.so.2 = > / lib64/libcap.so.2 (0x00007f91c6c5b000)
……
[root@dayi123 ld.so.conf.d] # / sbin/ldconfig-p # View the available library files cached on this machine
302 libs found in cache `/ etc/ld.so.cache'
P11-kit-trust.so (libc6,x86-64) = > / lib64/p11-kit-trust.so
Libzzipwrap-0.so.13 (libc6,x86-64) = > / lib64/libzzipwrap-0.so.13
Libzzipmmapped-0.so.13 (libc6,x86-64) = > / lib64/libzzipmmapped-0.so.13
(3) Management tools for solving dependent packages:
1) Front-end tools for yum:rpm package manager
2) apt-get:deb package Manager front-end tools
3) zypper: rpm front-end management tool on suse
4) dnf: Fedora 18 + rpm package Manager front-end management tool
6. Package Manager:
(1) function: package one or more package files of each component file of the compiled application, so as to easily and quickly realize the management operations such as installation, uninstallation, query, upgrade and verification of the package.
(2) composition of package files (unique to each package)
Files in the RPM package, metadata for RPM (such as name, version, dependency, description, etc.), scripts to run on installation or uninstallation
(3) Database (public): / var/lib/rpm
Contains: package name and version, dependencies between packages, package function description, file paths and checkcode information generated after package installation
II. RPM package management
1. Package name and package full name:
(1) full package name: when operating a package that does not have an installed rpm package, use the full package name and pay attention to the path
(2) package name: when operating an installed package, use the package name, which is to search the database in / var/lib/rpm
2. Install the software package through rpm:
(1) install: rpm {- I |-- install} [install-options] PACKAGE_FILE …
Option description:-I (install): install
-v (verbose): displays details
-h (hash): displays the progress
(2) Common installation options
-- test: test the installation, but do not actually perform the installation, that is, dry run mode
-- nodeps: ignore dependencies
-- replacepkgs to achieve software coverage installation
-- replacefiles overwrites a file that already exists
-- nosignature: source validity is not checked during installation
-- nodigest: package integrity is not checked during installation
-- noscripts: package scripts are not executed during installation
# install software with rpm
[root@dayi123 ld.so.conf.d] # rpm-ivh / mnt/cdrom/Packages/tree-1.6.0-10.el7.x86_64.rpm
Preparing... # # [100%]
Updating / installing...
1:tree-1.6.0-10.el7 # # [100%]
# prompt for installation after the installation is complete
[root@dayi123 ld.so.conf.d] # rpm-ivh/mnt/cdrom/Packages/tree-1.6.0-10.el7.x86_64.rpm
Preparing... # # [100%]
Packagetree-1.6.0-10.el7.x86_64 is already installed
# implement overlay installation
[root@dayi123 ld.so.conf.d] # rpm-ivh / mnt/cdrom/Packages/tree-1.6.0-10.el7.x86_64.rpm
-- replacepkgs
Preparing... # # [100%]
Updating / installing...
1:tree-1.6.0-10.el7 # # [100%]
[root@dayi123 ld.so.conf.d] # rpm-ivh/mnt/cdrom/Packages/php-5.4.16
-36.el7_1.x86_64.rpm
Error: Failed dependencies: # some software needs to be installed when installing dependent software
Php-common (x86-64) = 5.4.16-36.el7_1 is needed byphp-5.4.16-36.el7_1.x86_64
Php-cli (x86-64) = 5.4.16-36.el7_1 is needed byphp-5.4.16-36.el7_1.x86_64
3. Upgrade the software package through rpm
(1) upgrade: if the configuration file of the original package has been modified after installation, the same configuration file provided by the new version will not directly overwrite the configuration file of the old version, but the new version of the file will be renamed (FILENAME.rpmnew) and retained.
1) upgrade method
Rpm {- U |-- upgrade} [install-options] PACKAGE_FILE... (i.e., rpm-Uvh PACKAGE_FILE)
Rpm {- F |-- freshen} [install-options] PACKAGE_FILE... (i.e., rpm-Fvh PACKAGE_FILE)
2) the difference between the two methods:
Upgrade: if a legacy package is installed, "upgrade" if there is no legacy package, then "install"
Freshen: if a legacy package is installed, upgrade will not be performed if the legacy package does not exist
(2) downgrade:-- oldpackage
(3) forced installation (function is equivalent to override installation):-- force
Rpm-ivh-force PACKAGE_FILE
# Update the software
[root@dayi123] # rpm-Uvh/mnt/cdrom/Packages/tree-1.6.0-10.el7.x86_64.rpm
Preparing... # # [100%]
Updating / installing...
1:tree-1.6.0-10.el7 # # [100%]
# forced installation of software packages
[root@dayi123] # rpm-ivh-- force/mnt/cdrom/Packages/tree-1.6.0-10.el7.x86_64.rpm
Preparing... # # [100%]
Updating / installing...
1:tree-1.6.0-10.el7 # # [100%]
(4) upgrade the kernel (Linux supports multiple kernels. It is not recommended to upgrade the kernel. Just install the new kernel):
[root@dayi123 Packages] # uname-r # View the current system version
2.6.32-642.el6.x86_64
[root@dayi123 Packages] # rpm-ivhkernel-2.6.32-696.el6.x86_64.rpm
Error: Failed dependencies: # prompt to install the dependency package when installing the kernel
Kernel-firmware > = 2.6.32-696.el6 is needed bykernel-2.6.32-696.el6.x86_64
[root@dayi123 Packages] # rpm-ivhkernel-2.6.32-696.el6.x86_64.rpm kernel-firmware
-2.6.32-696.el6.noarch.rpm # installs both kernel and dependency packages
Preparing... # [100%]
1:kernel-firmware # # [50%]
2:kernel # # [100%]
Rebooting the system takes effect after the installation is completed. There will be one more boot option in the configuration file / etc/grub.conf after installation, and one more option when rebooting the system. The main configuration files are as follows:
Which item is launched by default in default=0 #
Timeout=5 # grub wait time when booting
Splashp_w_picpath= (hd0,0) / grub/splash.xpm.gz
Hiddenmenu
Title CentOS (2.6.32-696.el6.x86_64) # 0th startup item
Root (hd0,0)
Kernel/vmlinuz-2.6.32-696.el6.x86_64 ro root=UUID=68b0f8ab-7ccc-4fc4-8bbc-a9
92f91e9847 rd_NO_LUKS rd_NO_LVM.UTF-8 rd_NO_MDSYSFONT=latarcyrheb
-sun16 c
Rashkernel=auto KEYBOARDTYPE=pcKEYTABLE=us rd_NO_DM rhgb quiet
Initrd/initramfs-2.6.32-696.el6.x86_64.img
Title CentOS 6 (2.6.32-642.el6.x86_64) # first startup item
Root (hd0,0)
Kernel/vmlinuz-2.6.32-642.el6.x86_64 ro root=UUID=68b0f8ab-7ccc-4fc4-8bbc-a9
92f91e9847 rd_NO_LUKS rd_NO_LVM.UTF-8 rd_NO_MDSYSFONT=latarcyrheb
-sun16 c
4. Query through rpm software package
(1) query command: rpm {- Q |-- query} [select-options] [query-options]
(2) [select-options]
-a: all packages
-f: check which package installation generates the specified file
-p rpmfile: query for package files that have not been installed
-- whatprovides: query which package provides the specified CAPABILITY (capability)
-- whatrequires: query which package the specified CAPABILITY (capability) is dependent on
[root@dayi123 ~] # rpm-qf / bin/ls # query which software package is generated by the ls command
Coreutils-8.4-43.el6.x86_64
# query information about uninstalled software packages
[root@dayi123] # rpm-qp/mnt/cdrom/Packages/php-5.3.3-49.el6.x86_64.rpm
Php-5.3.3-49.el6.x86_64
# querying the capabilities provided by bash is dependent on those packages
[root@dayi123] # rpm-Q-- whatrequires / bin/bash
Glibc-common-2.12-1.192.el6.x86_64
Nss-softokn-freebl-3.14.3-23.el6_7.x86_64
Groff-1.18.1.4-21.el6.x86_64
……
(3) [query-options]
-- changelog: query the changelog of the rpm package
-c: the configuration file of the query program
-d: query the documentation of the program
-I: query package information
-l: view all files generated after the specified package is installed
-- scripts: the script that comes with the package
-- provides: lists the CAPABILITY provided by the specified package
-R: query the CAPABILITY on which the specified package depends
# View all configuration files generated after php installation is completed
[root@dayi123] # rpm-qpl/mnt/cdrom/Packages/php-5.3.3-49.el6.x86_64.rpm
/ etc/httpd/conf.d/php.conf
/ usr/lib64/httpd/modules/libphp5.so
/ var/lib/php/session
/ var/www/icons/php.gif
# query the information of installed software packages (only those installed through rpm can be queried)
[root@dayi123 Packages] # rpm-qi tree
Name: tree Relocations: (not relocatable)
Version: 1.5.3 Vendor: CentOS
Release: 3.el6 Build Date:Wed 14 Jan 2015 08:21:02 PM
……
# query information about uninstalled software packages
[root@dayi123] # rpm-qpi/mnt/cdrom/Packages/net-tools-1.60-114.el6.x86_64.rpm
Name: net-tools Relocations: (not relocatable)
Version: 1.60 Vendor:CentOS
Release: 114.el6 Build Date:Wed 22 Mar 2017 07:52:14
……
# View the information of vim's configuration file
[root@dayi123 ~] # rpm-qc vim-common--5.el6_8.1.x86_64.rpm
/ etc/vimrc
# query the configuration information of the software installed
[root@dayi123 cdrom] # rpm-qpc/mnt/cdrom/Packages/php-5.3.3-49.el6.x86_64.rpm
/ etc/httpd/conf.d/php.conf
[root@dayi123 cdrom] # rpm-qR tree # query the dependencies of installed software packages
Libc.so.6 () (64bit)
Libc.so.6 (GLIBC_2.2.5) (64bit)
Libc.so.6 (GLIBC_2.3) (64bit)
# query the dependencies of installed software packages
[root@dayi123 cdrom] # rpm-qpR/mnt/cdrom/Packages/java-1.5.0-gcj-1.5.0.0
-29.1.el6.x86_64.rpm
……
/ usr/bin/gij
/ usr/bin/rebuild-gcj-db
/ usr/bin/rebuild-gcj-db
/ usr/lib64/security/classpath.security
……
5. Rpm packet check
(1) Verification method: the name of the package installed by rpm-V
Rpm-V specifies the files in the RPM package
(2) the information of the verification:
1) S: whether the file size has changed
2) M: whether the type or permission of the file has changed
3) whether the 5:md5 checksum has changed (that is, to determine whether the content of the file has changed)
4) D: whether the slave code in the device has changed
5) L: whether the file path has changed
6) U: whether the owner of the document has changed
7) G: whether the group of the file has changed
8) T: whether the modification time of the file has changed
[root@dayi123 cdrom] # rpm-V vim-common # verify the information of the vim package
S.5. C/etc/vimrc # size and MD5 value changed
S.5. C/etc/vimrc
6. File extraction in rpm package
(1) usage: rpm2cpio package full name | cpio-idv. File absolute path
Description: rpm2cpio: command to convert rpm to cpio format
Cpio: weaving software archives and extracting files from archives
(2) cpio option description:
-I: restore
-d: automatically create a new directory when you restore
-v: displays the reduction process
(3) delete the / bin/ls command and restore it
[root@dayi123 Packages] # rpm-qf / bin/ls # check which package / bin/ls belongs to
Coreutils-8.4-43.el6.x86_64
[root@dayi123 Packages] # mv / bin/ls / tmp/ # remove / bin/ls
[root@dayi123 Packages] # ls # ls command does not work properly
-bash: ls: command not found [root@dayi123 ~] # rpm2cpio/mnt/cdrom/Packages/coreutils
-8.4-46.el6.x86_64.rpm | cpio-idv. / bin/ls # extract the ls command to the current / bin/ls directory
. / bin/ls
25240 blocks
[root@dayi123 ~] # cp. / bin/ls / bin/ # copy the current directory ls command to / bin/ls
The [root@dayi123 ~] # ll # ls command can be used normally
Total 116
-rw-r--r--. 1 root root 3944 Apr 2 22:12 1.txt.Z
-rw-. 1 root root 1057 Mar 30 16:07 anaconda-ks.cfg
Drwxr-xr-x. 2 root root 4096 Apr 17 22:16 bin
7. File extraction in rpm package
(1) Database directory: / var/lib/rpm
(2) Database initialization:
Rpm {--initdb |-- rebuilddb}: create a new database if it does not exist in advance, otherwise, no action will be performed.
Rebuilddb: rebuild the database index directory of the installed package header
III. YUM
1. Overview of yum
(1) function:
1) resolve package-related dependencies and locate software packages among multiple libraries
2) many rpm packages are stored, as well as the related metadata files of the package (placed in a specific directory repodata)
(2) File server supported by yum: ftp://,http://,file://
2. Yum configuration file
(1) yum configuration file:
/ etc/yum.conf: provide common configuration for all warehouses
/ etc/yum.repos.d/*.repo: provides configuration for pointing to the warehouse
(2) variables available in the yum configuration file:
$releasever: the major version number of the current OS release
$arch: platform, i386, 486, i486, 586, x86, 64, etc.
$basearch: basic platform; i386, x86x64
$YUM0-$YUM9: custom variable
(3) self-built yum configuration file:
You need to comment or delete all files under / etc/yum.repos.d/, and create a new "* .repo" yum configuration file. The configuration and instructions are as follows
[centos7] # for digital verification of rpm packets
Name description of the name=CentOS-$releasever-Plus # container
Baseurl= http://172.18.0.1/cobbler/ks_mirror/$releasever/ # configure yum source address
Http://mirrors.aliyun.com/repo/ # can specify multiple yum source addresses
Whether gpgcheck=0 # verifies the digital signature of the software package. If 0 is used, it will not be verified. If 1, verification is required.
For # gpgcheck=1, you need to specify a public key address
# gpgkey= file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
Enabled=1 # enable yum warehouse
[epel] # configure extended yum repository
Baseurl= http://172.18.0.1/fedora-epel/$releasever/$arch/
Gpgcheck=0
Enabled=1
(4) configure local CD yum source
1) Mount the CD to the specified directory (or do not mount it, automatically mount the CD to the / misc/cd directory. You need to install the "autofs" software under centos7, and automatically mount the CD to the / misc/cd directory when using CD files).
[root@dayi123 cd] $yum install autofs-y # centos7 install autofs software
[root@dayi123 cd] $systemctl start autofs # start the autofs software
[root@dayi123 cd] $systemctl enable autofs # set autofs self-startup
Created symlink from / etc/systemd/system/multi-user.target.wants/autofs.service
To / usr/lib/systemd/system/autofs.service.
[root@dayi123 cd] $cd / misc/cd # enter the / misc/cd directory
[root@dayi123 cd] $df-h
Filesystem Size Used Avail Use% Mounted on
/ dev/sda3 18G 3.8G 14G 22% /
/ dev/sda1 497M 118M 379M 24% / boot
Tmpfs 98M 36K 98m 1% / run/user/1020
/ dev/sr0 7.3G 7.3G 0% / misc/cd # when using the CD is automatically mounted to this directory
……
2) configure CD yum source
[root@dayi123 yum.repos.d] $cat test.repo # CD Yum source configuration file
[centosCD]
Name=centos7
Baseurl= file:///misc/cd
Gpgcheck=1
Gpgkey= file:////misc/cd/RPM-GPG-KEY-CentOS-7
[root@dayi123 yum.repos.d] $yum repolist # View available yum feeds
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
Repo id repo name status
CentosCD centos7_cdrom 9007
Repolist: 9007
(5) yum addresses commonly used in China:
Ali Yun: https://mirrors.aliyun.com/centos/$releasever/os/x86_64/S
Ali Cloud (epel): https://mirrors.aliyun.com/epel/$releasever/x86_64
You can also comment out your yum and use wget to download the domestic yum source repo file:
Common Yum source repo file address:
NetEase yum Source:
Modify "vi / etc/yum/pluginconf.d/fastestmirror.conf" and set "enable=0"
Cd / etc/yum.repos.d/
Wget-O / etc/yum.repos.d/CentOS-Base.repo wget http://mirrors.163.com/.help/CentOS
-Base-163.repo
Yum makecache / / generate cache
Sohu yum address:
Wget-O / etc/yum.repos.d/CentOS-Base.repo http://mirrors.sohu.com/help/CentOS-Base-sohu.repo
Ali Yumyuan:
CentOS 6
Wget-O / etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo
CentOS 7
Wget-O / etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
3. Generate .repo file with command
(1) generate: yum-config-manager-- add-repo= http://172.16.0.1/cobbler/ks_mirror/7/
(2) enable and close yum warehouse:
Disable warehouse: yum-config-manager-- disable "warehouse name"
Enable warehouse: yum-config-manager-- enable "warehouse name"
Note: if the yum-config-manager command is not available, you need to install the yum-utils package, that is, yum- y install yum-utils
[root@dayi123 ~] # yum-config-manager--add-repo= http://172.16.0.1/cobbler/ks_mirror/7/
Loaded plugins: fastestmirror # generate yum source
Adding repo from: http://172.16.0.1/cobbler/ks_mirror/7/
[172.16.0.1_cobbler_ks_mirror_7_]
Name=added from: http://172.16.0.1/cobbler/ks_mirror/7/
Baseurl= http://172.16.0.1/cobbler/ks_mirror/7/
Enabled=1
[root@dayi123 ~] # yum-config-manager-- disable centos7 # closes the source with the name centos
Loaded plugins: fastestmirror
Repo:centos7 =
[centos7]
……
[root@dayi123 ~] # yum repolist all # View a list of all yum sources
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
Repo id repo name status
172.16.0.1: http://172.16.0.1/cobbler/ks_mirror/7 cobblerksmirrorship 7 _ added from
/ enabled: 9007 # newly generated yum source
Centos7/7 centos7 disabled
! epel/7 centosepel enabled: 11349
Repolist: 20356
4. Yum command:
(1) usage of yum command:
Yum [options] [command] [package...]
(2) commonly used yum commands:
1) display warehouse list: yum repolist [all | enabled | disabled]
[root@dayi123 ~] # yum repolist # shows only the list of available yum repositories
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
Repo id repo name status
172.16.0.1_cobbler_ks_mirror_7_ added from: http://172.16.0.1/cobbler/ks_mirr 9007
! epel/7 centosepel 11349
Repolist: 20356
2) display the package:
Yumlist
Yumlist [all | glob_exp1] [glob_exp2] [...]
Yumlist {available | installed | updates} [glob_exp1] [...]
3) install the package:
Yuminstall package1 [package2] [...]
Yumreinstall package1 [package2] [...] (reinstall)
[root@dayi123 ~] # yum install remove telnet # install multiple packages at the same time
Loaded plugins: fastestmirror
Resolving Dependencies
-> Running transaction check
……
[root@dayi123 ~] # yum install telnet vim # reinstall package
Loaded plugins: fastestmirror
……
4) upgrade package:
Yumupdate [package1] [package2] [...]
Yumdowngrade package1 [package2] [...] (demoted)
5) check which packages can be upgraded:
Yumcheck-update
6) Uninstall the package:
Yumremove | erase package1 [package2] [...]
(3) the viewing function of yum command:
1) yum info [package name] to view program information
2) to see which package the specified feature (which can be a file) is provided:
Yumprovides | whatprovides [feature1].
3) Clean up the local cache (/ var/cache/yum/$basearch/$releasever cache is cleared):
Yumclean all
Build cache: yum makecache
[root@dayi123 ~] # yum clean all # Clean all caches
Loaded plugins: fastestmirror
Cleaning repos: centos7 epel
Cleaning up everything
Cleaning up list of fastest mirrors
[root@dayi123 ~] # ll-dh / var/cache/yum/x86_64/7/ # View the cache size after cleanup
Drwxr-xr-x. 9 root root 4.0K Apr 15 13:07/var/cache/yum/x86_64/7/
4) search for the package name and the package in which the command is located with the specified keywords
[root@dayi123 yum.repos.d] # yum search ifconfig # check which package ifconfg belongs to
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
……
Moreutils.x86_64: Additional unix utilities
Net-tools.x86_64: Basic networking tools
Python-psutil.x86_64: A process and system utilitiesmodule for Python
5) View the capabilities on which the specified package depends:
[root@dayi123 yum.repos.d] # yum deplist net-tools # View the features that the net-tools package depends on
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
Package: net-tools.x86_64 2.0-0.17.20131004git.el7
Dependency:/bin/sh
Provider:bash.x86_64 4.2.46-19.el7
Dependency:libc.so.6 (GLIBC_2.14) (64bit)
Provider:glibc.x86_64 2.17-105.el7
6) View yum transaction history:
Yumhistory [info | list | packages-list | packages-info | summary | addon-info | redo | undo | rollback | new | sync | stats]
Yumhistory
Yumhistory info 6
Yumhistory undo 6
[root@dayi123 yum.repos.d] # yum history # View yum installation history
Loaded plugins: fastestmirror
ID | Commandline | Date and time | Action (s) | Altered
23 | reinstallvim | 2017-04-15 12:49 | Reinstall | 1
22 | removetelnet | 2017-04-15 12:48 | Erase | 1
21 |-y install yum-utils | 2017-04-15 12:31 | Install | 3
……
[root@dayi123 yum.repos.d] # yum history info 23 # View installation information in yum23 history
Loaded plugins: fastestmirror
Transaction ID: 23
Begin time: Sat Apr 15 12:49:42 2017
Begin rpmdb: 478:4a514a26dbb81641679e760948d0b5dfb41560ec
End time: 12:49:43 2017 (1seconds)
# undo the sixth action in the history (that is, uninstall the software installed in the sixth record)
[root@dayi123 yum.repos.d] # yum history undo 6
Loaded plugins: fastestmirror
Undoing transaction 6, from Wed Mar 29 11:46:39 2017
Install nano-2.3.1-10.el7.x86_64@c7-media
[root@dayi123 yum.repos.d] # yum history undo 24 # undo the previous operation, that is, install the software
Loaded plugins: fastestmirror
Undoing transaction 24, from Sat Apr 15 13:34:03 2017
Erasenano-2.3.1-10.el7.x86_64 @ c7-media
7) yum log file: / var/log/yum.log
5. Yum package group management commands
(1) View group: yum grouplist [hidden] [groupwildcard] [...]
[root@dayi123 yum.repos.d] # yum grouplist # View the list of yum groups
Loaded plugins: fastestmirror
There is no installed groups file.
Maybe run: yum groups mark convert (see man yum)
Loading mirror speeds from cached hostfile
Available Environment Groups:
Minimal Install
Compute Node
(2) install package: yum groupinstall group1 [group2] [...]
(3) Update the package: yum groupupdate group1 [group2] [...]
(4) Delete the package: yum groupremove group1 [group2] [...]
(5) View the group information yum groupinfo group1 [...]
Install the desktop after minimizing Centos7.2 installation:
[root@dayi123 yum.repos.d] # history
1047 yummakecache # New cache
1048 yumgrouplist # View available package groups
1049 yumgroupinstall "GNOME Desktop" # install Desktop
# create a linked file and boot the desktop automatically
1050 ln-sf/lib/systemd/system/graphical.target / etc/systemd/system/default.target
[root@dayi123 yum.repos.d] # reboot # restart the system to enter the desktop
6. Command line options for yum:
(1)-- nogpgcheck: gpgcheck is prohibited, that is, installation does not check the package
(2)-y: automatically answer "yes" without entering "y" to confirm
(3)-Q: silent mode, no output during installation
(4)-- disablerepo=repoidglob: temporarily disable the repo specified here
(5)-- enablerepo=repoidglob: temporarily enable the repo specified here
(7)-- noplugins: disable all plug-ins
7. Build yum warehouse
Sometimes, it is not convenient to use a network yum source or CD-ROM yum, or you need to use yum to install a self-made rpm package. At this time, you can build your own yum source and put the required software into the yum repository.
(1) preparation before installation:
1) install vsftpd software (fpt server software)
In CentOS7:
[root@dayi123 ~] $yum install vsftpd-y # install vsftpd software
Loaded plugins: fastestmirror, langpacks
……
[root@dayi123 ~] $systemctl start vsftpd # start vsftpd
[root@dayi123 ~] $systemctl enable vsftpd # set vsftpd to boot automatically
In CentOS6:
[root@dayi123] $yum install vsftpd-y
[root@dayi123 ~] $/ etc/init.d/vsftpd start
Starting vsftpd for vsftpd: [OK]
[root@dayi123 ~] $chkconfig vsftpd on
2) turn off the firewall (in order to be able to access the firewall service, you need to add rules in iptables or turn off iptables)
In CentOS7:
[root@dayi123 ~] $systemctl stop firewalld
[root@dayi123 ~] $systemctl disable firewalld
In CentOS6:
[root@dayi123 ~] $/ etc/init.d/iptables stop
[root@dayi123 ~] $chkconfig iptables off
3) after the installation is completed and the firewall is turned off, you can test the ftp through the web page and open it normally, which means that the ftp service has been successfully built (as shown in the following figure)
(2) configure yum source
1) configure yum repository
After Vsftpd is installed successfully, a directory / var/ftp/pub directory is automatically created to store fpt shared files. We also need to create a directory and repodate files under this directory to store rpm packages, and then copy the required packages to the yum repository.
[root@dayi123 ~] $mkdir / var/ftp/pub/CentOS7-p # create a yum repository directory
[root@dayi123 ~] $mkdir / var/ftp/pub/CentOS7/Packages # directories commonly used to store rpm packages
# copy rpm files to yum repository
[root@dayi123 ~] $cp / mnt/cdrom/java.* / var/ftp/pub/CentOS7/Packages/
[root@dayi123 ~] $createrepo / var/ftp/pub/CentOS7/ # generate repodate file
Spawning worker 0 with 43 pkgs
Workers Finished
Saving Primary metadata
Saving file lists metadata
Saving other metadata
Generating sqlite DBs
Sqlite DBs complete
[root@dayi123 ~] $ll / var/ftp/pub/CentOS7/
Total 4
Drwxr-xr-x. 2 root root 4096 Apr 19 07:48 repodata
2) configure the yum source on the client:
[root@dayi123 ~] $cat / etc/yum.repos.d/test.repo # client profile
[centos7.2]
Name=centos7.2
Baseurl= ftp://172.16.250.102/pub/CentOS7/
Gpgcheck=1
Gpgkey= file:////misc/cd/RPM-GPG-KEY-CentOS-7
[root@dayi123 ~] $yum repolist # View the generated Yum source information
Loaded plugins: fastestmirror, langpacks
Repository 'app' is missing name in configuration, usingid
Loading mirror speeds from cached hostfile
Repo id repo name status
Centos7.2 centos7.2 43
Repolist: 43
4. Compile and install software (take installing httpd service as an example)
1. Preparation before compilation and installation:
(1) install compilation environments such as gcc, Development and Creative Workstation (cnetos6 is Development tools)
(2) go to the corresponding official website to download the source code package to the specified directory and decompress it.
[root@dayi123 Package] $cd / data/Package
[root@dayi123 Package] $wget http://apache.fayea.com//httpd/httpd-2.2.32.tar.bz2
[root@dayi123 Package] $tar-xvf httpd-2.2.32.tar.bz2
[root@dayi123 Package] $cd httpd-2.2.32
[root@dayi123 httpd-2.2.32] $ls
ABOUT_APACHE CMakeLists.txt INSTALL NWGNUmakefile
Acinclude.m4 config.layout InstallBin.dsp os
Apache-apr2.dsw configure LAYOUT README
Apache.dsw configure.in libhttpd.dep READMENaNake
Apache_probes.d docs libhttpd.dsp README.platforms
Ap.d emacs-style libhttpd.mak ROADMAP
Build httpd.dep LICENSE server
BuildAll.dsp httpd.dsp Makefile.in srclib
BuildBin.dsp httpd.mak Makefile.win support
Buildconf httpd.spec modules test
CHANGES include NOTICE VERSIONING
Note: before compiling and installing, you need to check the INSTALL and README files, which contain installation information.
2. Compile and install
(1) execute:. / configure under the software decompression directory
There are many options when performing. / configure, which can be viewed through. / configure-help. The common options are:
-- prefix=/PATH: specify the default installation location. Default is / usr/local/.
-- sysconfdir=/PATH: configuration file installation location
System types: support for cross-compilation
Perform the role of. / configure:
1) pass parameters through the option, specify the enabled feature, installation path, etc., and generate makefile with reference to the user's assignment and the makefile.in file.
2) check the dependent external environment, such as dependent software packages
[root@dayi123 httpd-2.2.32] $. / configure-help # View options and help
`configure' configures this package to adapt to manykinds of systems.
Usage:. / configure [OPTION]... [VAR=VALUE]...
To assign environment variables (e.g., CC, CFLAGS...), specify them as
VAR=VALUE. Seebelow for descriptions of some of the useful variables.
Defaults for the options are specified in brackets.
Configuration:
-h,-- help display this help and exit
-- help=short display options specific to thispackage
-- help=recursive display theshort help of all the included packages
-VMagneWhile version display versioninformation and exit
-Q,-- quiet,--silent do not print `checking... 'messages
# execute. / configure
[root@dayi123 httpd-2.2.32] $. / configure-- prefix=/data/httpd-- sysconfdir=/etc/httpd
Checking for chosen layout... Apache
Checking for working mkdir-p. Yes
……
Note: in the process of execution, some dependent packages will report an error if they are not installed, and need to be installed through yum before executing. / configure
Checking for APR... No
Configure: error: APR not found. Please read the documentation.
# prompt there is no ARP
[root@dayi123 httpd-2.2.32] $yum search apr
# you can check which package apr belongs to through yum, which is usually the prompt information-devel package
Loaded plugins: fastestmirror, security
Loading mirror speeds from cached hostfile
Apr-devel.i686: APR library development kit
Apr-devel.x86_64: APR library development kit
……
[root@dayi123 httpd-2.2.32] $yum install apr-util-devel-y # install apr-util-devel package
# continue after installation is complete
[root@dayi123 httpd-2.2.32] $. / configure-- prefix=/data/httpd-- sysconfdir=/etc/httpd
(2) execute make
Function: build applications based on makefile files
(3) execute make install
Function: copy the file to the corresponding road strength
[root@dayi123 httpd-2.2.32] $make install # execute make install
Making install in srclib
Make [1]: Entering directory` / data/Package/httpd-2.2.32/srclib'
Making install in pcre
Make [2]: Entering directory` / data/Package/httpd-2.2.32/srclib/pcre'
# after the execution of make install, the corresponding files will be generated in the specified directory
[root@dayi123 httpd-2.2.32] $ls / data/httpd/ / etc/httpd/
/ data/httpd/:
Bin build cgi-bin error htdocs icons include logs man manual modules
/ etc/httpd/:
Extra httpd.conf magic mime.types original
3. Operation after installation and compilation
(1) Import the binary program directory into the PATH environment variable:
Edit the file / etc/profile.d/NAME.sh to join exportPATH=/PATH/TO/BIN:$PATH
[root@dayi123 ~] $cat / etc/profile.d/httpd.sh # add the httpd startup path to the PATH variable
Export PATH=$PATH:/data/httpd/bin/
[root@dayi123] $. / etc/profile.d/httpd.sh # to make the configuration effective
[root@dayi123 ~] $apachectl start # start the httpd service
(2) Import library file path
Edit / etc/ld.so.conf.d/NAME.conf and add the directory where the new library file is located to this file
Let the system regenerate the cache: ldconfig [- v]
(3) Import help manual
Edit / etc/man.config | man_db.conf file to add a MANPATH
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.