This chapter introduces the installation, uninstallation, configuration and maintenance of Linux system software, and how to build enterprise local YUM CD source and HTTP local source.
1 RPM package management
Linux package management can be roughly divided into binary package and source package, and the tools used are also different. There are two common linux software packages: Source Code package and Binary Code package. The Source Code package is a package that has not been compiled and needs to be compiled in GCC and C + + compiler environment to run. The binary package does not need to be compiled and can be directly installed and used.
In general, source packages and binary packages can be simply distinguished by suffixes, such as tar.gz,. zip,. The package ending in rar is usually called the source package Software packages ending in rpm are called binary packages. The real distinction between source code and binary must be based on the files in the code, such as including h,. c,. cpp,. cc and other source files at the end are called source packages, while there are executable files in the bin directory in the code, which is called binary packages.
There is a default software management tool in CentOS operating system, Red Hat Package Manager (RPM).
Using rpm tools, you can quickly install, manage and maintain software packages. rpm management tools are applicable to CentOS, RedHat, Fedora, SUSE, etc. rpm tools are commonly used for management Package ending with rpm suffix.
The RPM software package command rules are explained in detail as follows:
RPM The package naming format is: name-version.rpm name-version-noarch.rpm name-version-arch.src.rpm The following package format: epel-release-6-8.noarch.rpm perl-Pod-Plainer-1.03-1.el6.noarch.rpm with yasm-1.2.0-4.el7.x86_64.rpm The column is resolved as follows: RPM The package format is parsed as follows: name Software name, e.g yasm,perl-pod-Plainer; version Version number, 1.2.0 Common format: "major version number".Minor version number.Amendment number "; 4 Indicates the release version number RPM The package is generated after several compilation; arch Applicable hardware platforms, RPM Supported platforms are: i386,i586,i686,x86_64,sparc,alpha Wait. .rpm The suffix package represents the compiled binary package, which is available rpm Command direct installation; .src.rpm Source code package, source code compilation and generation.rpm Formatted RPM Available to the contractor; el* Package release, el6 Indicates that the package is suitable for RHEL 6.x/CentOS 6.x; devel: Development package; noarch: Packages can be installed on any platform.
The RPM tool commands are explained in detail as follows:
RPM option PACKAGE_NAME -a, --all Query all installed software packages; -q,--query Means to ask the user and output information; -l, --list Print the list of software packages; -f, --file FILE Query contains FILE Software package; -i, --info Display software package information, including name, version and description; -v, --verbose Printout details; -U, --upgrade upgrade RPM Software package; -h,--hash For software installation, you can print the installation progress bar; --last When the software packages are listed, they are sorted according to the installation time, and the latest one is above; -e, --erase uninstall rpm software package --force Indicates mandatory installation or uninstallation; --nodeps RPM Package independent -l, --list List the files in the software package; --provides List the features provided by the software package; -R, --requires List other software packages that the software package depends on; --scripts Lists the applets customized by the package.
RPM enterprise case presentation:
# Check whether the sysstat package is installed; [root@superman-vm01 ~]# rpm -q sysstat package sysstat is not installed [root@superman-vm01 ~]# # Install sysstat software package; [root@superman-vm01 ~]# rpm -ivh sysstat-10.1.5-17.el7.x86_64.rpm Preparing... ################################# [100%] Updating / installing... 1:sysstat-10.1.5-17.el7 ################################# [100%] [root@superman-vm01 ~]# # View the path of software installation; [root@superman-vm01 ~]# rpm -ql sysstat /etc/cron.d/sysstat /etc/sysconfig/sysstat /etc/sysconfig/sysstat.ioconf /usr/bin/cifsiostat /usr/bin/iostat /usr/bin/mpstat /usr/bin/nfsiostat-sysstat /usr/bin/pidstat /usr/bin/sadf /usr/bin/sar /usr/bin/tapestat .......... # View the version information of software installation; [root@superman-vm01 ~]# rpm -qi sysstat Name : sysstat Version : 10.1.5 Release : 17.el7 Architecture: x86_64 Install Date: Sat 10 Jul 2021 06:46:49 AM CST Group : Applications/System Size : 1172947 License : GPLv2+ Signature : RSA/SHA256, Mon 12 Nov 2018 10:47:27 PM CST, Key ID 24c6a8a7f4a80eb5 Source RPM : sysstat-10.1.5-17.el7.src.rpm Build Date : Wed 31 Oct 2018 04:04:26 AM CST Build Host : x86-01.bsys.centos.org Relocations : (not relocatable) Packager : CentOS BuildSystem <http://bugs.centos.org> Vendor : CentOS URL : http://sebastien.godard.pagesperso-orange.fr/ Summary : Collection of performance monitoring tools for Linux Description : The sysstat package contains sar, sadf, mpstat, iostat, pidstat, nfsiostat-sysstat, tapestat, cifsiostat and sa tools for Linux. .......... # Uninstall sysstat software; [root@superman-vm01 ~]# rpm -qa|grep sysstat sysstat-10.1.5-17.el7.x86_64 [root@superman-vm01 ~]# [root@superman-vm01 ~]# rpm -e sysstat-10.1.5-17.el7.x86_64 [root@superman-vm01 ~]# # Upgrade sysstat software; [root@superman-vm01 ~]# rpm -Uvh sysstat-10.1.5-17.el7.x86_64.rpm Preparing... ################################# [100%] Updating / installing... 1:sysstat-10.1.5-17.el7 ################################# [100%] [root@superman-vm01 ~]# # Check whether the software package related to sysstat is installed; [root@superman-vm01 ~]# rpm -qa|grep sysstat sysstat-10.1.5-17.el7.x86_64 [root@superman-vm01 ~]# # Forced uninstall of sysstat; [root@superman-vm01 ~]# rpm -e --nodeps sysstat [root@superman-vm01 ~]# # Independent of other software packages; [root@superman-vm01 ~]# rpm -ivh --nodeps sysstat-10.1.5-17.el7.x86_64.rpm Preparing... ################################# [100%] Updating / installing... 1:sysstat-10.1.5-17.el7 ################################# [100%] [root@superman-vm01 ~]#
2 Tar package management
In addition to using RPM management tools to manage software packages, Linux operating system can also manage source packages through tools such as tar, zip and jar.
2.1 detailed explanation of tar command parameters
-A, --catenate, --concatenate Merge archive with existing archive -c, --create Create a new archive -d, --diff, --compare Compare the differences between the archive and the current file --delete Remove from archive -r, --append Attach to end of Archive -t, --list Lists the directories of files in the archive -u, --update Attach only newer files to the archive -x, --extract, --get Unzip file -j, --bzip2, --bunzip2 have bz2 Attribute software package; -z, --gzip, --ungzip have gz Attribute software package; -b, --block-size N Specifies that the block size is Nx512 Bytes (default) N=20); -B, --read-full-blocks Reorganize the block when reading; -C, --directory DIR Specify a new directory; --checkpoint Display the directory name when reading the archive; -f, --file [HOSTNAME:]F Specify archiving or equipment, followed by file name; --force-local Force the use of local archives, even if clones exist; -G, --incremental Build old GNU Format backup; -g, --listed-incremental Establish new GNU Format backup; -h, --dereference Do not dump the dynamic link, dump the file pointed to by the dynamic link; -i, --ignore-zeros Ignore the 0-byte block in the archive (usually means the end of the file); --ignore-failed-read Mark 0 in the unreadable file before exiting; -k, --keep-old-files Save existing documents; Do not overwrite when expanding from archive; -K, --starting-file F From archive F Start; -l, --one-file-system Create an archive in the local file system; -L, --tape-length N In write N*1024 Pause after bytes and wait for disk replacement; -m, --modification-time When restoring files from a file, the new time tag is not used; -M, --multi-volume Create a multi volume Archive,For storage in several disks; -O, --to-stdout Expand the file to standard output; -P, --absolute-paths Do not remove from the file name'/'; -v, --verbose Detailed display of processed documents; --version display tar Version number of the program; --exclude FILE Do not include the specified documents; -X, --exclude-from FILE Reads a list of files you do not want to include from the specified file.
2.2.1 actual combat of tar command
# View kept-2.2.2 tar. Contents in GZ package; [root@superman-vm01 ~]# tar -tf keepalived-2.2.2.tar.gz keepalived-2.2.2/ keepalived-2.2.2/tools/ keepalived-2.2.2/tools/timed_reload keepalived-2.2.2/Makefile.in keepalived-2.2.2/build-aux/ keepalived-2.2.2/build-aux/install-sh keepalived-2.2.2/build-aux/missing keepalived-2.2.2/build-aux/compile keepalived-2.2.2/build-aux/depcomp keepalived-2.2.2/build-aux/ar-lib keepalived-2.2.2/bin_install/ keepalived-2.2.2/bin_install/Makefile.in keepalived-2.2.2/bin_install/Makefile.am keepalived-2.2.2/keepalived.spec.in .......... # Unzip keepalived-2.2.2 tar. GZ package; [root@superman-vm01 ~]# tar -xvf keepalived-2.2.2.tar.gz keepalived-2.2.2/ keepalived-2.2.2/tools/ keepalived-2.2.2/tools/timed_reload keepalived-2.2.2/Makefile.in keepalived-2.2.2/build-aux/ keepalived-2.2.2/build-aux/install-sh keepalived-2.2.2/build-aux/missing keepalived-2.2.2/build-aux/compile keepalived-2.2.2/build-aux/depcomp keepalived-2.2.2/build-aux/ar-lib keepalived-2.2.2/bin_install/ keepalived-2.2.2/bin_install/Makefile.in keepalived-2.2.2/bin_install/Makefile.am keepalived-2.2.2/keepalived.spec.in keepalived-2.2.2/snap/ keepalived-2.2.2/snap/snapcraft.yaml keepalived-2.2.2/snap/hooks/ keepalived-2.2.2/snap/hooks/post-refresh keepalived-2.2.2/snap/hooks/install keepalived-2.2.2/INSTALL keepalived-2.2.2/doc/ keepalived-2.2.2/doc/Makefile.in keepalived-2.2.2/doc/man/ keepalived-2.2.2/doc/man/man8/ ........ # Package the keepalived file or directory. After packaging, the name is keepalived-2.2.2 tar; [root@superman-vm01 ~]# tar -cvf keepalived-2.2.2.tar keepalived-2.2.2 keepalived-2.2.2/ keepalived-2.2.2/tools/ keepalived-2.2.2/tools/timed_reload keepalived-2.2.2/Makefile.in keepalived-2.2.2/build-aux/ keepalived-2.2.2/build-aux/install-sh keepalived-2.2.2/build-aux/missing keepalived-2.2.2/build-aux/compile keepalived-2.2.2/build-aux/depcomp keepalived-2.2.2/build-aux/ar-lib keepalived-2.2.2/bin_install/ keepalived-2.2.2/bin_install/Makefile.in keepalived-2.2.2/bin_install/Makefile.am keepalived-2.2.2/keepalived.spec.in keepalived-2.2.2/snap/ keepalived-2.2.2/snap/snapcraft.yaml keepalived-2.2.2/snap/hooks/ keepalived-2.2.2/snap/hooks/post-refresh keepalived-2.2.2/snap/hooks/install keepalived-2.2.2/INSTALL keepalived-2.2.2/doc/ keepalived-2.2.2/doc/Makefile.in keepalived-2.2.2/doc/man/ keepalived-2.2.2/doc/man/man8/ ........ # Append the a.txt file to kept-2.2.2 In tar; [root@superman-vm01 ~]# tar -rf keepalived-2.2.2.tar abc.txt [root@superman-vm01 ~]# [root@superman-vm01 ~]# tar tf keepalived-2.2.2.tar | grep abc.txt abc.txt [root@superman-vm01 ~]# # Package and compress the kept-2.2.2 directory in gzip format; [root@superman-vm01 ~]# tar -czvf keepalived-2.2.2.tar.gz keepalived-2.2.2 keepalived-2.2.2/ keepalived-2.2.2/tools/ keepalived-2.2.2/tools/timed_reload keepalived-2.2.2/Makefile.in keepalived-2.2.2/build-aux/ keepalived-2.2.2/build-aux/install-sh keepalived-2.2.2/build-aux/missing keepalived-2.2.2/build-aux/compile keepalived-2.2.2/build-aux/depcomp keepalived-2.2.2/build-aux/ar-lib keepalived-2.2.2/bin_install/ keepalived-2.2.2/bin_install/Makefile.in keepalived-2.2.2/bin_install/Makefile.am keepalived-2.2.2/keepalived.spec.in keepalived-2.2.2/snap/ keepalived-2.2.2/snap/snapcraft.yaml keepalived-2.2.2/snap/hooks/ keepalived-2.2.2/snap/hooks/post-refresh keepalived-2.2.2/snap/hooks/install ......... # Package and compress the superman directory in bzip2 format; [root@superman-vm01 ~]# tar -cjvf keepalived-2.2.2.tar.bz2 keepalived-2.2.2 keepalived-2.2.2/ keepalived-2.2.2/tools/ keepalived-2.2.2/tools/timed_reload keepalived-2.2.2/Makefile.in keepalived-2.2.2/build-aux/ keepalived-2.2.2/build-aux/install-sh keepalived-2.2.2/build-aux/missing keepalived-2.2.2/build-aux/compile keepalived-2.2.2/build-aux/depcomp keepalived-2.2.2/build-aux/ar-lib keepalived-2.2.2/bin_install/ keepalived-2.2.2/bin_install/Makefile.in keepalived-2.2.2/bin_install/Makefile.am keepalived-2.2.2/keepalived.spec.in keepalived-2.2.2/snap/ keepalived-2.2.2/snap/snapcraft.yaml keepalived-2.2.2/snap/hooks/ keepalived-2.2.2/snap/hooks/post-refresh keepalived-2.2.2/snap/hooks/install .......... # Package and compress all files in the current directory in gzip format, excluding ABC Txt; [root@superman-vm01 ceshi]# ls abc.txt keepalived-2.2.2 [root@superman-vm01 ceshi]# [root@superman-vm01 ceshi]# tar -czf keepalived-2.2.2.tar.gz * -X abc.txt [root@superman-vm01 ceshi]# [root@superman-vm01 ceshi]# tar tf keepalived-2.2.2.tar.gz | grep abc.txt abc.txt [root@superman-vm01 ceshi]# # Package and press all files and directories in the current directory in gzip format, excluding ABC txt. [root@superman-vm01 ceshi]# ls abc.txt keepalived-2.2.2 [root@superman-vm01 ceshi]# [root@superman-vm01 ceshi]# tar -czf keepalived-2.2.2.tar.gz * --exclude=abc.txt [root@superman-vm01 ceshi]# [root@superman-vm01 ceshi]# tar tf keepalived-2.2.2.tar.gz | grep abc.txt [root@superman-vm01 ceshi]#
3 source package software installation
rpm tools are usually used for management rpm terminated binary package, while standard The source code package at the end of zip and tar cannot be installed, uninstalled and upgraded using rpm tools. There are three steps to install the source code package, as follows:
./configure Precompiling is mainly used to detect whether the system benchmark environment library meets the requirements and generate MakeFile Documents; make Compilation, based on the generated in the first step makefile File to compile the source code; make install Install. After compiling, install the relevant runnable files into the system; use make At compile time, Linux The operating system must have GCC Compiler for compiling source code.
Source package installation usually requires/ There are three steps: configure, make and make install. Some special source code can only have one or two of the three steps.
3.1 source code installation practice
Based on the CentOS 7 Linux system, install the Nginx source code package on it. The detailed steps of source code installation in the enterprise are as follows:
1,nginx.org Download from the official website nginx-1.19.9.tar.gz package [root@superman-vm01 ~]# wget http://nginx.org/download/nginx-1.19.9.tar.gz --2021-07-10 07:43:34-- http://nginx.org/download/nginx-1.19.9.tar.gz Resolving nginx.org (nginx.org)... 52.58.199.22, 3.125.197.172, 2a05:d014:edb:5702::6, ... Connecting to nginx.org (nginx.org)|52.58.199.22|:80... connected. HTTP request sent, awaiting response... Read error (Connection reset by peer) in headers. Retrying. --2021-07-10 07:43:35-- (try: 2) http://nginx.org/download/nginx-1.19.9.tar.gz Connecting to nginx.org (nginx.org)|52.58.199.22|:80... connected. HTTP request sent, awaiting response... 200 OK Length: 887908 (867K) [application/octet-stream] Saving to: 'nginx-1.19.9.tar.gz' 57% [=====================> ] 507,913 --.-K/s in 16m 50s 2021-07-10 08:00:26 (503 B/s) - Read error at byte 507913/887908 (Connection timed out). Retrying. --2021-07-10 08:00:28-- (try: 3) http://nginx.org/download/nginx-1.19.9.tar.gz Connecting to nginx.org (nginx.org)|52.58.199.22|:80... connected. HTTP request sent, awaiting response... 206 Partial Content Length: 887908 (867K), 379995 (371K) remaining [application/octet-stream] Saving to: 'nginx-1.19.9.tar.gz' 100%[++++++++++++++++++++++================>] 887,908 6.46KB/s in 52s 2021-07-10 08:01:20 (7.11 KB/s) - 'nginx-1.19.9.tar.gz' saved [887908/887908] [root@superman-vm01 ~]# 2,Nginx Source package decompression [root@superman-vm01 ~]# tar -xvf nginx-1.19.9.tar.gz nginx-1.19.9/ nginx-1.19.9/auto/ nginx-1.19.9/conf/ nginx-1.19.9/contrib/ nginx-1.19.9/src/ nginx-1.19.9/configure nginx-1.19.9/LICENSE nginx-1.19.9/README nginx-1.19.9/html/ nginx-1.19.9/man/ nginx-1.19.9/CHANGES.ru nginx-1.19.9/CHANGES nginx-1.19.9/man/nginx.8 nginx-1.19.9/html/50x.html nginx-1.19.9/html/index.html nginx-1.19.9/src/core/ .......... 3,Source code Configure For precompiling, you need to enter the decompressed directory for execution./configure Instruction, semicolon ";" Indicates connecting multiple commands. [root@superman-vm01 ~]# cd nginx-1.19.9/;./configure checking for OS + Linux 3.10.0-957.el7.x86_64 x86_64 checking for C compiler ... found + using GNU C compiler + gcc version: 4.8.5 20150623 (Red Hat 4.8.5-44) (GCC) checking for gcc -pipe switch ... found checking for gcc builtin atomic operations ... found checking for C99 variadic macros ... found checking for gcc variadic macros ... found checking for unistd.h ... found checking for inttypes.h ... found checking for limits.h ... found checking for sys/filio.h ... not found checking for sys/param.h ... found checking for sys/mount.h ... found checking for sys/statvfs.h ... found checking for crypt.h ... found checking for Linux specific features checking for epoll ... found checking for EPOLLRDHUP ... found ........... 5,make install install [root@superman-vm01 nginx-1.19.9]# make install make -f objs/Makefile install make[1]: Entering directory `/root/nginx-1.19.9' test -d '/usr/local/nginx' || mkdir -p '/usr/local/nginx' test -d '/usr/local/nginx/sbin' || mkdir -p '/usr/local/nginx/sbin' test ! -f '/usr/local/nginx/sbin/nginx' || mv '/usr/local/nginx/sbin/nginx' '/usr/local/nginx/sbin/nginx.old' cp objs/nginx '/usr/local/nginx/sbin/nginx' test -d '/usr/local/nginx/conf' || mkdir -p '/usr/local/nginx/conf' cp conf/koi-win '/usr/local/nginx/conf' cp conf/koi-utf '/usr/local/nginx/conf' cp conf/win-utf '/usr/local/nginx/conf' test -f '/usr/local/nginx/conf/mime.types' || cp conf/mime.types '/usr/local/nginx/conf' cp conf/mime.types '/usr/local/nginx/conf/mime.types.default' test -f '/usr/local/nginx/conf/fastcgi_params' || cp conf/fastcgi_params '/usr/local/nginx/conf' cp conf/fastcgi_params '/usr/local/nginx/conf/fastcgi_params.default' test -f '/usr/local/nginx/conf/fastcgi.conf' || cp conf/fastcgi.conf '/usr/local/nginx/conf' cp conf/fastcgi.conf '/usr/local/nginx/conf/fastcgi.conf.default' test -f '/usr/local/nginx/conf/uwsgi_params' || cp conf/uwsgi_params '/usr/local/nginx/conf' cp conf/uwsgi_params '/usr/local/nginx/conf/uwsgi_params.default' test -f '/usr/local/nginx/conf/scgi_params' || cp conf/scgi_params '/usr/local/nginx/conf' cp conf/scgi_params '/usr/local/nginx/conf/scgi_params.default' test -f '/usr/local/nginx/conf/nginx.conf' || cp conf/nginx.conf '/usr/local/nginx/conf/nginx.conf' cp conf/nginx.conf '/usr/local/nginx/conf/nginx.conf.default' test -d '/usr/local/nginx/logs' || mkdir -p '/usr/local/nginx/logs' test -d '/usr/local/nginx/logs' || mkdir -p '/usr/local/nginx/logs' test -d '/usr/local/nginx/html' || cp -R html '/usr/local/nginx' test -d '/usr/local/nginx/logs' || mkdir -p '/usr/local/nginx/logs' make[1]: Leaving directory `/root/nginx-1.19.9' [root@superman-vm01 nginx-1.19.9]#
Through the above five steps, the source package software is successfully installed. The source package may encounter various errors during compilation and installation. You need to solve the errors before proceeding to the next installation. The following chapters will focus on case exercises for the software used by enterprises.
4 YUM package management
The front-end software package manager (Yellow Updater Modified, YUM) is applicable to the Shell command lines in CentOS, Fedora, RedHat and SUSE. It is mainly used to manage RPM packages. The scope of use of the RPM tool is similar. The YUM tool can automatically download and install RPM packages from the specified server, and can also automatically handle dependencies.
When using RPM tool to manage and install software, you will find that RPM packages are dependent and need to be downloaded and installed manually one by one. The greatest convenience of YUM tool is that it can automatically install all dependent software packages, so as to improve efficiency and save time.
4.1 YUM working principle
To learn YUM, you must understand the working principle of YUM. The normal operation of YUM depends on two parts: the source end of YUM and the client end of YUM, that is, the user end.
All RPM packages installed on the YUM client are from the YUM server, and the YUM source is published through HTTP or FTP server. The YUM client can download the dependent RPM package from the YUM source because the benchmark information of the RPM package is generated at the YUM source, including RPM package version number, configuration file, binary information, dependency, etc.
YUM client needs to install software or search for software. You will find / etc / YUM repos. D below Repo end file, CentOS Linux default The repo file name is CentOS base Repo, the image address of the YUM source side is configured in this file, so the YUM client will find it every time the RPM package is installed and upgraded Repo file.
If the YUM client is configured with CentOS official repo source, the client operating system must be able to connect to the Internet and meet the network conditions before downloading and installing the software. If there is no network, you can also build a CD source or an internal YUM source. When the YUM client installs the software, the YUM client stores the YUM source address, Header information, software package, database information and Cache file in / var/cache/yum by default. Each time you use the YUM tool, YUM first finds the relevant software package through the Cache, which does not exist in the Cache, and then accesses the external network YUM source.
4.2 detailed explanation of Yum parameters
Because the YUM tool is easy, fast and efficient to use, it is widely used in enterprises and favored by many IT operation and maintenance and program personnel. To be able to skillfully use the YUM tool, you need to master the use of YUM command line parameters. The following is a detailed explanation of the parameters and practical steps of the YUM command tool:
YUM Command tool guide, YUM The format is: YUM [command] [package] -y|-q Among them[options]Is optional.-y An error occurred during installation or uninstallation YES Automatic confirmation when yes;-q The installation process is not displayed. yum install sysstat install sysstat Software package; yum reinstall sysstat Reinstall sysstat software package yum search sysstat YUM Search software package; yum list sysstat Displays the installation of the specified package sysstat; yum list Display all installed and installable software packages; yum remove sysstat Delete package sysstat; yum erase sysstat Delete package sysstat; yum update Kernel upgrade or software update; yum update sysstat to update sysstat Software; yum check-update Check updatable procedures; yum info sysstat Display installation package information sysstat; yum provides List the documents provided by the software package; yum provides "*/rz" list rz Which software package provides the command; yum grouplist Inquiry can be used groupinstall Name of the installed group; yum groupinstall "Chinese Support" Install Chinese support; yum groupremove "Chinese Support" remove groups Chinese Support; yum deplist sysstat View program sysstat Dependence; yum clean packages Clear the software package in the cache directory; yum clean headers Clear the cache directory headers; yum clean all Clear the software package and old in the cache directory headers. yum repolist {all|enabled|disabled} List all/Enabled/Disabled yum source yum list {all|installed|avaliable} List all/already installed/Installable packages
4.2.1 YUM installation practice
1. Based on CentOS 7 Linux, execute the command yum install sysstat -y to install the sysstat service
[root@superman-vm01 ~]# yum install sysstat -y Loaded plugins: fastestmirror, langpacks Loading mirror speeds from cached hostfile * base: mirrors.aliyun.com * extras: mirrors.cn99.com * updates: mirrors.cn99.com Resolving Dependencies --> Running transaction check ---> Package sysstat.x86_64 0:10.1.5-17.el7 will be updated ---> Package sysstat.x86_64 0:10.1.5-19.el7 will be an update --> Finished Dependency Resolution Dependencies Resolved ================================================================================ Package Arch Version Repository Size ================================================================================ Updating: sysstat x86_64 10.1.5-19.el7 base 315 k Transaction Summary ================================================================================ Upgrade 1 Package Total size: 315 k Downloading packages: Running transaction check Running transaction test Transaction test succeeded Running transaction Warning: RPMDB altered outside of yum. Updating : sysstat-10.1.5-19.el7.x86_64 1/2 Cleanup : sysstat-10.1.5-17.el7.x86_64 2/2 Verifying : sysstat-10.1.5-19.el7.x86_64 1/2 Verifying : sysstat-10.1.5-17.el7.x86_64 2/2 Updated: sysstat.x86_64 0:10.1.5-19.el7 Complete! [root@superman-vm01 ~]#
2. Execute the command yum grouplist to check the software group name of groupinstall
[root@superman-vm01 ~]# yum grouplist Loaded plugins: fastestmirror, langpacks There is no installed groups file. Maybe run: yum groups mark convert (see man yum) Loading mirror speeds from cached hostfile * base: mirrors.bfsu.edu.cn * extras: mirrors.bfsu.edu.cn * updates: mirrors.bfsu.edu.cn Available Environment Groups: Minimal Install Compute Node Infrastructure Server File and Print Server Basic Web Server Virtualization Host Server with GUI GNOME Desktop KDE Plasma Workspaces Development and Creative Workstation Available Groups: Compatibility Libraries Console Internet Tools Development Tools Graphical Administration Tools Legacy UNIX Compatibility Scientific Support Security Tools Smart Card Support System Administration Tools System Management Done [root@superman-vm01 ~]#
3. Execute the command yum groupinstall "GNOME Desktop" -y to install the Linux image interface
[root@superman-vm01 ~]# yum groupinstall "GNOME Desktop" -y Loaded plugins: fastestmirror, langpacks There is no installed groups file. Maybe run: yum groups mark convert (see man yum) Loading mirror speeds from cached hostfile * base: mirrors.aliyun.com * extras: mirrors.aliyun.com * updates: mirrors.bfsu.edu.cn Warning: Group core does not have any packages to install. Warning: Group gnome-desktop does not have any packages to install. Warning: Group guest-agents does not have any packages to install. Package gtk2-immodule-xim-2.24.31-1.el7.x86_64 already installed and latest version Warning: Group guest-desktop-agents does not have any packages to install. Warning: Group fonts does not have any packages to install. Warning: Group print-client does not have any packages to install. Warning: Group desktop-debugging does not have any packages to install. Warning: Group dial-up does not have any packages to install. Package gstreamer1-plugins-bad-free-1.10.4-3.el7.x86_64 already installed and latest version Package gstreamer1-plugins-good-1.10.4-2.el7.x86_64 already installed and latest version Package gstreamer1-plugins-ugly-free-1.10.4-3.el7.x86_64 already installed and latest version Warning: Group multimedia does not have any packages to install. Warning: Group base does not have any packages to install. Group base does have 1 conditional packages, which may get installed. Warning: Group internet-browser does not have any packages to install. Warning: Group x11 does not have any packages to install. Resolving Dependencies --> Running transaction check ---> Package NetworkManager-bluetooth.x86_64 1:1.18.8-2.el7_9 will be installed .........
4. Execute the command Yum install sysstat PHP devel PHP MySQL MariaDB MariaDB server - y to install the LAMP architecture environment for small and medium-sized enterprises
[root@superman-vm01 ~]# yum install sysstat php php-devel php-mysql mariadb mariadb-server -y Loaded plugins: fastestmirror, langpacks Loading mirror speeds from cached hostfile * base: mirrors.aliyun.com * extras: mirrors.cn99.com * updates: mirrors.cn99.com Package sysstat-10.1.5-19.el7.x86_64 already installed and latest version Resolving Dependencies --> Running transaction check ---> Package mariadb.x86_64 1:5.5.68-1.el7 will be installed --> Processing Dependency: mariadb-libs(x86-64) = 1:5.5.68-1.el7 for package: 1:mariadb-5.5.68-1.el7.x86_64 ---> Package mariadb-server.x86_64 1:5.5.68-1.el7 will be installed --> Processing Dependency: perl-DBD-MySQL for package: 1:mariadb-server-5.5.68-1.el7.x86_64 ---> Package php.x86_64 0:5.4.16-48.el7 will be installed --> Processing Dependency: php-common(x86-64) = 5.4.16-48.el7 for package: php-5.4.16-48.el7.x86_64 ..........
5. Execute the command yum remove ntpdate -y to uninstall ntpdate package
[root@superman-vm01 ~]# yum remove ntpdate -yLoaded plugins: fastestmirror, langpacksResolving Dependencies--> Running transaction check---> Package ntpdate.x86_64 0:4.2.6p5-29.el7.centos.2 will be erased--> Processing Dependency: ntpdate = 4.2.6p5-29.el7.centos.2 for package: ntp-4.2.6p5-29.el7.centos.2.x86_64--> Running transaction check---> Package ntp.x86_64 0:4.2.6p5-29.el7.centos.2 will be erased--> Processing Dependency: ntp for package: ipa-client-4.6.8-5.el7.centos.6.x86_64--> Running transaction check---> Package ipa-client.x86_64 0:4.6.8-5.el7.centos.6 will be erased--> Finished Dependency ResolutionDependencies Resolved================================================================================ Package Arch Version Repository Size================================================================================Removing: ntpdate x86_64 4.2.6p5-29.el7.centos.2 @base 121 kRemoving for dependencies: ipa-client x86_64 4.6.8-5.el7.centos.6 @updates 255 k ntp x86_64 4.2.6p5-29.el7.centos.2 @base 1.4 MTransaction Summary================================================================================Remove 1 Package (+2 Dependent packages)Installed size: 1.7 MDownloading packages:Running transaction checkRunning transaction testTransaction test succeededRunning transaction Erasing : ipa-client-4.6.8-5.el7.centos.6.x86_64 1/3 Erasing : ntp-4.2.6p5-29.el7.centos.2.x86_64 2/3 Erasing : ntpdate-4.2.6p5-29.el7.centos.2.x86_64 3/3 Verifying : ntp-4.2.6p5-29.el7.centos.2.x86_64 1/3 Verifying : ntpdate-4.2.6p5-29.el7.centos.2.x86_64 2/3 Verifying : ipa-client-4.6.8-5.el7.centos.6.x86_64 3/3 Removed: ntpdate.x86_64 0:4.2.6p5-29.el7.centos.2 Dependency Removed: ipa-client.x86_64 0:4.6.8-5.el7.centos.6 ntp.x86_64 0:4.2.6p5-29.el7.centos.2Complete![root@superman-vm01 ~]#
6. Execute the command yum provides rz or yum provides "*/rz" to find the provider of the rz command
[root@superman-vm01 ~]# yum provides rzLoaded plugins: fastestmirror, langpacksLoading mirror speeds from cached hostfile * base: mirrors.bfsu.edu.cn * extras: mirrors.bfsu.edu.cn * updates: mirrors.bfsu.edu.cnextras/7/x86_64/filelists_db | 235 kB 00:00 updates/7/x86_64/filelists_db | 5.1 MB 00:04 lrzsz-0.12.20-36.el7.x86_64 : The lrz and lsz modem communications programsRepo : baseMatched from:Filename : /usr/bin/rzlrzsz-0.12.20-36.el7.x86_64 : The lrz and lsz modem communications programsRepo : @anacondaMatched from:Filename : /usr/bin/rz[root@superman-vm01 ~]# [root@superman-vm01 ~]# yum provides "*/rz"Loaded plugins: fastestmirror, langpacksLoading mirror speeds from cached hostfile * base: mirrors.huaweicloud.com * extras: mirrors.huaweicloud.com * updates: mirrors.huaweicloud.comlrzsz-0.12.20-36.el7.x86_64 : The lrz and lsz modem communications programsRepo : baseMatched from:Filename : /usr/bin/rzlrzsz-0.12.20-36.el7.x86_64 : The lrz and lsz modem communications programsRepo : @anacondaMatched from:Filename : /usr/bin/rz[root@superman-vm01 ~]#
7. Execute the command yum update -y to upgrade all updatable Linux packages or Linux kernel
[root@superman-vm01 ~]# yum update -y Loaded plugins: fastestmirror, langpacks Loading mirror speeds from cached hostfile * base: mirrors.aliyun.com * extras: mirrors.aliyun.com * updates: mirrors.huaweicloud.com Resolving Dependencies --> Running transaction check ---> Package GeoIP.x86_64 0:1.5.0-13.el7 will be updated ---> Package GeoIP.x86_64 0:1.5.0-14.el7 will be an update --> Processing Dependency: geoipupdate for package: GeoIP-1.5.0-14.el7.x86_64 ---> Package ModemManager.x86_64 0:1.6.10-1.el7 will be updated ---> Package ModemManager.x86_64 0:1.6.10-4.el7 will be an update ---> Package ModemManager-glib.x86_64 0:1.6.10-1.el7 will be updated ---> Package ModemManager-glib.x86_64 0:1.6.10-4.el7 will be an update ---> Package PackageKit.x86_64 0:1.1.10-1.el7.centos will be updated ---> Package PackageKit.x86_64 0:1.1.10-2.el7.centos will be an update ...........
4.3 configuring network sources
# yum source for installing 163: [root@superman-vm01 ~]# wget -O /etc/yum.repos.d/CentOS7-Base-163.repo http://mirrors.163.com/.help/CentOS7-Base-163.repo --2021-07-10 17:07:57-- http://mirrors.163.com/.help/CentOS7-Base-163.repo Resolving mirrors.163.com (mirrors.163.com)... 1.193.221.38, 124.116.156.215, 124.116.156.214, ... Connecting to mirrors.163.com (mirrors.163.com)|1.193.221.38|:80... connected. HTTP request sent, awaiting response... 200 OK Length: 1572 (1.5K) [application/octet-stream] Saving to: '/etc/yum.repos.d/CentOS7-Base-163.repo' 100%[======================================>] 1,572 --.-K/s in 0s 2021-07-10 17:07:57 (76.7 MB/s) - '/etc/yum.repos.d/CentOS7-Base-163.repo' saved [1572/1572] [root@superman-vm01 ~]# # Install Alibaba cloud's yum source: [root@superman-vm01 ~]# wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo --2021-07-10 17:08:52-- http://mirrors.aliyun.com/repo/Centos-7.repo Resolving mirrors.aliyun.com (mirrors.aliyun.com)... 1.180.14.242, 1.180.14.241, 1.180.14.248, ... Connecting to mirrors.aliyun.com (mirrors.aliyun.com)|1.180.14.242|:80... connected. HTTP request sent, awaiting response... 200 OK Length: 2523 (2.5K) [application/octet-stream] Saving to: '/etc/yum.repos.d/CentOS-Base.repo' 100%[======================================>] 2,523 --.-K/s in 0s 2021-07-10 17:08:52 (384 MB/s) - '/etc/yum.repos.d/CentOS-Base.repo' saved [2523/2523] [root@superman-vm01 ~]#
# Sohu does not have a ready-made yum source file to download. You need to configure it yourself: [root@superman-vm01 ~]# echo "[sohu] name=Centos-$releasever-sohu baseurl=http://mirrors.sohu.com/centos/$releasever/os/$basearch gpgcheck=1 gpgkey=http://mirrors.sohu.com/centos/$releasever/os/$basearch/RPM-GPG-KEY-CentOS-$releasever" > /etc/yum.repos.d/CentOS-souhu.repo [root@superman-vm01 ~]# [root@superman-vm01 ~]# [root@superman-vm01 ~]# [root@superman-vm01 ~]# yum makecache Loaded plugins: fastestmirror, langpacks Repository base is listed more than once in the configuration Repository updates is listed more than once in the configuration Repository extras is listed more than once in the configuration Repository centosplus is listed more than once in the configuration Loading mirror speeds from cached hostfile
4.4 configuring local sources
[root@superman-vm01 ~]# mkdir /mnt/cdrom [root@superman-vm01 ~]# mount /dev/cdrom /mnt/cdrom echo "[local] name=centos-$releasever-local baseurl=file:///mnt/cdrom gpgcheck=1 gpgkey=file:///mnt/cdrom/RPM-GPG-KEY-CentOS-7" > /etc/yum.repos.d/centos-7-local.repomount: /dev/sr0 is write-protected, mounting read-only [root@superman-vm01 ~]# echo "[local] name=centos-$releasever-local baseurl=file:///mnt/cdrom gpgcheck=1 gpgkey=file:///mnt/cdrom/RPM-GPG-KEY-CentOS-7" > /etc/yum.repos.d/centos-7-local.repo [root@superman-vm01 ~]#
4.5 automatic warehouse configuration
# Install yum's expansion pack: [root@superman-vm01 ~]# yum install yum-utils -y Loaded plugins: fastestmirror, langpacks Repository base is listed more than once in the configuration Repository updates is listed more than once in the configuration Repository extras is listed more than once in the configuration Repository centosplus is listed more than once in the configuration Loading mirror speeds from cached hostfile * base: mirrors.aliyun.com * extras: mirrors.aliyun.com * updates: mirrors.aliyun.com base | 3.6 kB 00:00 extras | 2.9 kB 00:00 local | 3.6 kB 00:00 updates | 2.9 kB 00:00 # Automatic configuration of domestic epel warehouse: [root@superman-vm01 ~]# yum-config-manager --add-repo=https://mirrors.tuna.tsinghua.edu.cn/epel/7/x86_64/ Loaded plugins: fastestmirror, langpacks Repository base is listed more than once in the configuration Repository updates is listed more than once in the configuration Repository extras is listed more than once in the configuration Repository centosplus is listed more than once in the configuration adding repo from: https://mirrors.tuna.tsinghua.edu.cn/epel/7/x86_64/ [mirrors.tuna.tsinghua.edu.cn_epel_7_x86_64_] name=added from: https://mirrors.tuna.tsinghua.edu.cn/epel/7/x86_64/ baseurl=https://mirrors.tuna.tsinghua.edu.cn/epel/7/x86_64/ enabled=1 [root@superman-vm01 ~]#
4.6 disable / enable warehouse
# epel is the ID of the warehouse [epel] [root@superman-vm01 ~]# yum-config-manager --disable epel Loaded plugins: fastestmirror, langpacks Repository base is listed more than once in the configuration Repository updates is listed more than once in the configuration Repository extras is listed more than once in the configuration Repository centosplus is listed more than once in the configuration [root@superman-vm01 ~]# [root@superman-vm01 ~]# yum-config-manager --enable epel Loaded plugins: fastestmirror, langpacks Repository base is listed more than once in the configuration Repository updates is listed more than once in the configuration Repository extras is listed more than once in the configuration Repository centosplus is listed more than once in the configuration [root@superman-vm01 ~]# # View warehouse status: [root@superman-vm01 ~]# yum repolist all Loaded plugins: fastestmirror, langpacks Repository 'sohu' is missing name in configuration, using id Repository base is listed more than once in the configuration Repository updates is listed more than once in the configuration Repository extras is listed more than once in the configuration Repository centosplus is listed more than once in the configuration Loading mirror speeds from cached hostfile Loading mirror speeds from cached hostfile Loading mirror speeds from cached hostfile Loading mirror speeds from cached hostfile Loading mirror speeds from cached hostfile repo id repo name status C7.0.1406-base/x86_64 CentOS-7.0.1406 - Base disabled C7.0.1406-centosplus/x86_64 CentOS-7.0.1406 - CentOSPlus disabled C7.0.1406-extras/x86_64 CentOS-7.0.1406 - Extras disabled C7.0.1406-fasttrack/x86_64 CentOS-7.0.1406 - Fasttrack disabled C7.0.1406-updates/x86_64 CentOS-7.0.1406 - Updates disabled C7.1.1503-base/x86_64 CentOS-7.1.1503 - Base disabled C7.1.1503-centosplus/x86_64 CentOS-7.1.1503 - CentOSPlus disabled C7.1.1503-extras/x86_64 CentOS-7.1.1503 - Extras disabled C7.1.1503-fasttrack/x86_64 CentOS-7.1.1503 - Fasttrack disabled C7.1.1503-updates/x86_64 CentOS-7.1.1503 - Updates disabled C7.2.1511-base/x86_64 CentOS-7.2.1511 - Base disabled C7.2.1511-centosplus/x86_64 CentOS-7.2.1511 - CentOSPlus disabled C7.2.1511-extras/x86_64 CentOS-7.2.1511 - Extras disabled C7.2.1511-fasttrack/x86_64 CentOS-7.2.1511 - Fasttrack disabled C7.2.1511-updates/x86_64 CentOS-7.2.1511 - Updates disabled C7.3.1611-base/x86_64 CentOS-7.3.1611 - Base disabled C7.3.1611-centosplus/x86_64 CentOS-7.3.1611 - CentOSPlus disabled C7.3.1611-extras/x86_64 CentOS-7.3.1611 - Extras disabled C7.3.1611-fasttrack/x86_64 CentOS-7.3.1611 - Fasttrack disabled C7.3.1611-updates/x86_64 CentOS-7.3.1611 - Updates disabled C7.4.1708-base/x86_64 CentOS-7.4.1708 - Base disabled C7.4.1708-centosplus/x86_64 CentOS-7.4.1708 - CentOSPlus disabled C7.4.1708-extras/x86_64 CentOS-7.4.1708 - Extras disabled C7.4.1708-fasttrack/x86_64 CentOS-7.4.1708 - Fasttrack disabled C7.4.1708-updates/x86_64 CentOS-7.4.1708 - Updates disabled C7.5.1804-base/x86_64 CentOS-7.5.1804 - Base disabled C7.5.1804-centosplus/x86_64 CentOS-7.5.1804 - CentOSPlus disabled C7.5.1804-extras/x86_64 CentOS-7.5.1804 - Extras disabled C7.5.1804-fasttrack/x86_64 CentOS-7.5.1804 - Fasttrack disabled C7.5.1804-updates/x86_64 CentOS-7.5.1804 - Updates disabled C7.6.1810-base/x86_64 CentOS-7.6.1810 - Base disabled C7.6.1810-centosplus/x86_64 CentOS-7.6.1810 - CentOSPlus disabled C7.6.1810-extras/x86_64 CentOS-7.6.1810 - Extras disabled C7.6.1810-fasttrack/x86_64 CentOS-7.6.1810 - Fasttrack disabled C7.6.1810-updates/x86_64 CentOS-7.6.1810 - Updates disabled C7.7.1908-base/x86_64 CentOS-7.7.1908 - Base disabled C7.7.1908-centosplus/x86_64 CentOS-7.7.1908 - CentOSPlus disabled C7.7.1908-extras/x86_64 CentOS-7.7.1908 - Extras disabled C7.7.1908-fasttrack/x86_64 CentOS-7.7.1908 - Fasttrack disabled C7.7.1908-updates/x86_64 CentOS-7.7.1908 - Updates disabled C7.8.2003-base/x86_64 CentOS-7.8.2003 - Base disabled C7.8.2003-centosplus/x86_64 CentOS-7.8.2003 - CentOSPlus disabled C7.8.2003-extras/x86_64 CentOS-7.8.2003 - Extras disabled C7.8.2003-fasttrack/x86_64 CentOS-7.8.2003 - Fasttrack disabled C7.8.2003-updates/x86_64 CentOS-7.8.2003 - Updates disabled base/7/x86_64 CentOS-7 - Base - mirrors.aliyun. enabled: 0 base-debuginfo/x86_64 CentOS-7 - Debuginfo disabled base-source/7 CentOS-7 - Base Sources disabled c7-media CentOS-7 - Media disabled centos-kernel/7/x86_64 CentOS LTS Kernels for x86_64 disabled centos-kernel-experimental/7/x86_64 CentOS Experimental Kernels for x disabled centosplus/7/x86_64 CentOS-7 - Plus - mirrors.aliyun. disabled centosplus-source/7 CentOS-7 - Plus Sources disabled contrib/7/x86_64 CentOS-7 - Contrib - mirrors.aliy disabled cr/7/x86_64 CentOS-7 - cr disabled extras/7/x86_64 CentOS-7 - Extras - mirrors.aliyu enabled: 0 extras-source/7 CentOS-7 - Extras Sources disabled fasttrack/7/x86_64 CentOS-7 - fasttrack disabled sohu sohu enabled: 0 updates/7/x86_64 CentOS-7 - Updates - mirrors.aliy enabled: 0 updates-source/7 CentOS-7 - Updates Sources disabled repolist: 0 [root@superman-vm01 ~]#
5. Synchronize external network sources
In the actual application scenario of an enterprise, only the RPM software package in the CD cannot meet the needs. We can synchronize all the software packages in the YUM source of the external network to the local, which can improve the number and integrity of the software packages of the local YUM source.
5.1 installing the reposync tool
[root@superman-vm01 ~]# yum install yum-utils createrepo -y Loaded plugins: fastestmirror, langpacks Repository base is listed more than once in the configuration Repository updates is listed more than once in the configuration Repository extras is listed more than once in the configuration Repository centosplus is listed more than once in the configuration Loading mirror speeds from cached hostfile * base: mirrors.aliyun.com * extras: mirrors.aliyun.com * updates: mirrors.aliyun.com mirrors.tuna.tsinghua.edu.cn_epel_7_x86_64_ | 4.7 kB 00:00 (1/3): mirrors.tuna.tsinghua.edu.cn_epel_7_x86_64_/group_g | 96 kB 00:00 (2/3): mirrors.tuna.tsinghua.edu.cn_epel_7_x86_64_/updatei | 1.0 MB 00:04 (3/3): mirrors.tuna.tsinghua.edu.cn_epel_7_x86_64_/primary | 6.9 MB 00:07
5.2 synchronization source
# Create local directory: [root@superman-vm01 ~]# mkdir /data/{centos,epel} [root@superman-vm01 ~]# # Sync yum source: [root@superman-vm01 ~]# reposync -r base -r updates -p /data/centos/ Repository base is listed more than once in the configuration Repository updates is listed more than once in the configuration Repository extras is listed more than once in the configuration Repository centosplus is listed more than once in the configuration No Presto metadata available for base 389-ds-base-1.3.10.2-6.el7.x86 FAILED 389-ds-base-devel-1.3.10.2-6.e FAILED (1/10072): 389-ds-base-snmp-1.3.10.2-6.el7.x86_64.rpm | 178 kB 00:00 (2/10072): ElectricFence-2.2.2-39.el7.i686.rpm | 35 kB 00:00 (3/10072): ElectricFence-2.2.2-39.el7.x86_64.rpm | 35 kB 00:00 (4/10072): GConf2-3.2.6-8.el7.i686.rpm | 1.0 MB 00:01 (5/10072): Cython-0.19-5.el7.x86_64.rpm | 1.9 MB 00:03 (6/10072): GConf2-3.2.6-8.el7.x86_64.rpm | 1.0 MB 00:01 (7/10072): GConf2-devel-3.2.6-8.el7.i686.rpm | 110 kB 00:00 (8/10072): GConf2-devel-3.2.6-8.el7.x86_64.rpm | 110 kB 00:00 ......... # Generate metadata: [root@superman-vm01 ~]# createrepo /data/centos [root@superman-vm01 ~]# # Make a local source in combination with the previous learning. If you want other servers to use the source, you can publish it in combination with nginx later.
Welcome to official account brother WeChat, IT, for more technical dry cargo!
Tell me what Tucao or feedback you make complaints about! I will solve your problems and serve you better!