Deploy YUM warehouse and NFS service

Posted by cHinshaw on Fri, 08 Oct 2021 02:09:34 +0200

catalogue

1, YUM overview

2, YUM implementation process

3, YUM command

1. Inquiry

2. Install and upgrade using yum or up2date

3. Software uninstall

4, Build yum warehouse

1. Build local warehouse

2. Build Alibaba cloud warehouse

5, NFS share

1. Characteristics

2. Advantage

3. Construction process

6, Summary

 

1, YUM overview

yum is a software update mechanism based on RPM package (short for red hat package manager), which can automatically solve the dependencies between packages. It solves a lot of time for finding and installing dependent packages in daily work.

Yum is composed of warehouse and client, that is, the whole Yum is composed of two parts, so yum can be stored on two servers. It can also be stored on a server. Services can be provided by officials or by third parties, such as domestic Alibaba cloud, Sohu cloud, and some non-profit organizations such as schools. The official source is generally abroad, and the download speed must be limited. Manually changing to domestic cloud can greatly improve the download speed.

2, YUM implementation process

Create a yum repository (warehouse) on the yum server. Many rpm packages and related metadata files of the package are stored in the warehouse in advance (placed in the specific directory repodata). When the yum client installs the package using the yum/dnf tool, the metadata in repodata will be automatically downloaded to query whether there are related packages and dependencies in the remote data, Automatically find relevant packages from the warehouse, download and install them.

3, YUM command

1. Inquiry

1.yum list [software name] - displays the available installation packages

[root@localhost ~]# yum list gcc
 Plug in loaded: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: mirrors.ustc.edu.cn
 * extras: mirrors.cn99.com
 * updates: mirrors.cn99.com
 Installed packages
gcc.x86_64                            4.8.5-44.el7                            @base

2.yum info [software name] - displays installation package details

[root@localhost ~]# yum info gcc
 Plug in loaded: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: mirrors.ustc.edu.cn
 * extras: mirrors.cn99.com
 * updates: mirrors.cn99.com
 Installed packages
 name    :  gcc
 framework    : x86_64
 edition    : 4.8.5
 release    : 44.el7
 size    : 37 M
 source    : installed
 From source: base
 brief introduction    :  Various compilers (C, C++, Objective-C, Java, ...)
website    : http://gcc.gnu.org
 agreement    :  GPLv3+ and GPLv3+ with exceptions and GPLv2+ with exceptions and LGPLv2+
         : and BSD
 describe    :  The gcc package contains the GNU Compiler Collection version 4.8.
         : You'll need this package in order to compile C code.

3.yum search keyword --- find the software package according to the keyword

[root@localhost ~]# yum search ftp
 Plug in loaded: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: mirrors.ustc.edu.cn
 * extras: mirrors.cn99.com
 * updates: mirrors.cn99.com
================================ N/S matched: ftp =================================
ftp.x86_64 : The standard UNIX FTP (File Transfer Protocol) client
lftp-scripts.noarch : Scripts for lftp
syslinux-tftpboot.noarch : SYSLINUX modules in /var/lib/tftpboot, available for
                         : network booting
tftp.x86_64 : The client for the Trivial File Transfer Protocol (TFTP)
tftp-server.x86_64 : The server for the Trivial File Transfer Protocol (TFTP)
vsftpd.x86_64 : Very Secure Ftp Daemon
vsftpd-sysvinit.x86_64 : SysV initscript for vsftpd daemon
curl.x86_64 : A utility for getting files from remote servers (FTP, HTTP, and
            : others)
lftp.i686 : A sophisticated file transfer program
lftp.x86_64 : A sophisticated file transfer program
wget.x86_64 : A utility for retrieving files using the HTTP or FTP protocols

  Name and profile match only,Use“ search all"try.

4.yum whatprovides keyword --- know a command but don't know the specific package

[root@localhost ~]# yum whatprovides ftp
 Plug in loaded: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: mirrors.ustc.edu.cn
 * extras: mirrors.cn99.com
 * updates: mirrors.cn99.com
ftp-0.17-67.el7.x86_64 : The standard UNIX FTP (File Transfer Protocol) client
 source    : base


5.yum gruoplist

For the query of installation package group, all information is displayed without package group

[root@localhost ~]# yum grouplist
 Plug in loaded: fastestmirror, langpacks
 The group information file is not installed
Maybe run: yum groups mark convert (see man yum)
Loading mirror speeds from cached hostfile
 * base: mirrors.ustc.edu.cn
 * extras: mirrors.cn99.com
 * updates: mirrors.cn99.com
 Available environment groups:
   minimal installation
   Infrastructure server
   Calculation node
   File and print server
   Basic web server
   Virtualization host
   belt GUI Server
   GNOME desktop
   KDE Plasma Workspaces
   Development and generation workstation
 Available groups:
   tradition UNIX compatibility
   Compatibility Library
   Graphics management tools
   Security tools
   development tool
   Console Internet tools
   Smart card support
   Scientific notation support
   system management
   system management tool
 complete

6.yum groupinfo package description

Display all without package

[root@localhost ~]# yum groupinfo "GNOME Desktop"
Plug in loaded: fastestmirror, langpacks
 The group information file is not installed
Maybe run: yum groups mark convert (see man yum)
Loading mirror speeds from cached hostfile
 * base: mirrors.ustc.edu.cn
 * extras: mirrors.cn99.com
 * updates: mirrors.cn99.com

Environmental grouping: GNOME desktop
 environment ID: gnome-desktop-environment
 Description: GNOME Is a very intuitive and user-friendly desktop environment.
Prerequisite group:
   +base
   +core
   +desktop-debugging
   +dial-up
   +directory-client
   +fonts
   +gnome-desktop
   +guest-agents
   +guest-desktop-agents
   +input-methods
   +internet-browser
   +java-platform
   +multimedia
   +network-file-system-client
   +networkmanager-submodules
   +print-client
   +x11
 Optional groups:
   +backup-client
   +gnome-apps
   +internet-applications
   +legacy-x
   +office-suite
   +remote-desktop-clients
   +smart-card

2. Install and upgrade using yum or up2date

1.yum install

yum install [software name]

[root@localhost ~]# yum install gcc
 Plug in loaded: fastestmirror, langpacks
base                                                        | 3.6 kB  00:00:00     
extras                                                      | 2.9 kB  00:00:00     
updates                                                     | 2.9 kB  00:00:00     
(1/4): extras/7/x86_64/primary_db                           | 243 kB  00:00:00     
(2/4): base/7/x86_64/primary_db                             | 6.1 MB  00:00:01     
(3/4): base/7/x86_64/group_gz                               | 153 kB  00:00:02     
(4/4): updates/7/x86_64/primary_db                          |  11 MB  00:00:02     
Determining fastest mirrors
 * base: mirrors.ustc.edu.cn
 * extras: mirrors.dgut.edu.cn
 * updates: mirrors.ustc.edu.cn
 Resolving dependencies
--> Checking transactions
---> software package gcc.x86_64.0.4.8.5-16.el7 Will be upgraded
--> Processing dependencies gcc = 4.8.5-16.el7,It is a software package gcc-gfortran-4.8.5-16.el7.x86_64 need
--> Processing dependencies gcc = 4.8.5-16.el7,It is a software package gcc-c++-4.8.5-16.el7.x86_64 need
--> Processing dependencies gcc = 4.8.5-16.el7,It is a software package libquadmath-devel-4.8.5-16.el7.x86_64 need
---> software package gcc.x86_64.0.4.8.5-44.el7 Will be updated
--> Processing dependencies libgomp = 4.8.5-44.el7,It is a software package gcc-4.8.5-44.el7.x86_64 need
--> Processing dependencies cpp = 4.8.5-44.el7,It is a software package gcc-4.8.5-44.el7.x86_64 need
--> Processing dependencies libgcc >= 4.8.5-44.el7,It is a software package gcc-4.8.5-44.el7.x86_64 need
--> Checking transactions
---> software package cpp.x86_64.0.4.8.5-16.el7 Will be upgraded
---> software package cpp.x86_64.0.4.8.5-44.el7 Will be updated
---> software package gcc-c++.x86_64.0.4.8.5-16.el7 Will be upgraded
---> software package gcc-c++.x86_64.0.4.8.5-44.el7 Will be updated
--> Processing dependencies libstdc++-devel = 4.8.5-44.el7,It is a software package gcc-c++-4.8.5-44.el7.x86_64 need
--> Processing dependencies libstdc++ = 4.8.5-44.el7,It is a software package gcc-c++-4.8.5-44.el7.x86_64 need
---> software package gcc-gfortran.x86_64.0.4.8.5-16.el7 Will be upgraded
---> software package gcc-gfortran.x86_64.0.4.8.5-44.el7 Will be updated
--> Processing dependencies libquadmath = 4.8.5-44.el7,It is a software package gcc-gfortran-4.8.5-44.el7.x86_64 need
--> Processing dependencies libgfortran = 4.8.5-44.el7,It is a software package gcc-gfortran-4.8.5-44.el7.x86_64 need
---> software package libgcc.x86_64.0.4.8.5-16.el7 Will be upgraded
---> software package libgcc.x86_64.0.4.8.5-44.el7 Will be updated
---> software package libgomp.x86_64.0.4.8.5-16.el7 Will be upgraded
---> software package libgomp.x86_64.0.4.8.5-44.el7 Will be updated
---> software package libquadmath-devel.x86_64.0.4.8.5-16.el7 Will be upgraded
---> software package libquadmath-devel.x86_64.0.4.8.5-44.el7 Will be updated
--> Checking transactions
---> software package libgfortran.x86_64.0.4.8.5-16.el7 Will be upgraded
---> software package libgfortran.x86_64.0.4.8.5-44.el7 Will be updated
---> software package libquadmath.x86_64.0.4.8.5-16.el7 Will be upgraded
---> software package libquadmath.x86_64.0.4.8.5-44.el7 Will be updated
---> software package libstdc++.x86_64.0.4.8.5-16.el7 Will be upgraded
---> software package libstdc++.x86_64.0.4.8.5-44.el7 Will be updated
---> software package libstdc++-devel.x86_64.0.4.8.5-16.el7 Will be upgraded
---> software package libstdc++-devel.x86_64.0.4.8.5-44.el7 Will be updated
--> Resolve dependency complete

Dependency resolution

===================================================================================
 Package                   framework           edition                  source            size
===================================================================================
Updating:
 gcc                       x86_64         4.8.5-44.el7          base          16 M
 Update for dependency:
 cpp                       x86_64         4.8.5-44.el7          base         5.9 M
 gcc-c++                   x86_64         4.8.5-44.el7          base         7.2 M
 gcc-gfortran              x86_64         4.8.5-44.el7          base         6.7 M
 libgcc                    x86_64         4.8.5-44.el7          base         103 k
 libgfortran               x86_64         4.8.5-44.el7          base         301 k
 libgomp                   x86_64         4.8.5-44.el7          base         159 k
 libquadmath               x86_64         4.8.5-44.el7          base         190 k
 libquadmath-devel         x86_64         4.8.5-44.el7          base          54 k
 libstdc++                 x86_64         4.8.5-44.el7          base         306 k
 libstdc++-devel           x86_64         4.8.5-44.el7          base         1.5 M

Transaction summary
===================================================================================
Upgrade 1 package (+10 Dependent packages)

Total downloads: 39 M
Is this ok [y/d/N]: y
Downloading packages:
No Presto metadata available for base
 Warning:/var/cache/yum/x86_64/7/base/packages/gcc-4.8.5-44.el7.x86_64.rpm: head V3 RSA/SHA256 Signature, secret key ID f4a80eb5: NOKEY
gcc-4.8.5-44.el7.x86_64.rpm Your public key is not installed
(1/11): gcc-4.8.5-44.el7.x86_64.rpm                         |  16 MB  00:00:02     
(2/11): cpp-4.8.5-44.el7.x86_64.rpm                         | 5.9 MB  00:00:02     
(3/11): gcc-c++-4.8.5-44.el7.x86_64.rpm                     | 7.2 MB  00:00:00     
(4/11): libgcc-4.8.5-44.el7.x86_64.rpm                      | 103 kB  00:00:00     
(5/11): libgfortran-4.8.5-44.el7.x86_64.rpm                 | 301 kB  00:00:00     
(6/11): libgomp-4.8.5-44.el7.x86_64.rpm                     | 159 kB  00:00:00     
(7/11): libquadmath-4.8.5-44.el7.x86_64.rpm                 | 190 kB  00:00:00     
(8/11): libquadmath-devel-4.8.5-44.el7.x86_64.rpm           |  54 kB  00:00:00     
(9/11): libstdc++-4.8.5-44.el7.x86_64.rpm                   | 306 kB  00:00:00     
(10/11): libstdc++-devel-4.8.5-44.el7.x86_64.rpm            | 1.5 MB  00:00:00     
(11/11): gcc-gfortran-4.8.5-44.el7.x86_64.rpm               | 6.7 MB  00:00:01     
-----------------------------------------------------------------------------------
total                                                  9.6 MB/s |  39 MB  00:04     
from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7 retrieving keys
 Import GPG key 0xF4A80EB5:
 user ID     : "CentOS-7 Key (CentOS 7 Official Signing Key) <security@centos.org>"
 fingerprint       : 6341 ab27 53d7 8a78 a7c2 7bb1 24c6 a8a7 f4a8 0eb5
 software package     : centos-release-7-4.1708.el7.centos.x86_64 (@anaconda)
 come from       : /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
 Continue?[y/N]: y
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Updating    : libgcc-4.8.5-44.el7.x86_64                                    1/22 
  Updating    : libquadmath-4.8.5-44.el7.x86_64                               2/22 
  Updating    : libstdc++-4.8.5-44.el7.x86_64                                 3/22 
  Updating    : libstdc++-devel-4.8.5-44.el7.x86_64                           4/22 
  Updating    : libgfortran-4.8.5-44.el7.x86_64                               5/22 
  Updating    : libgomp-4.8.5-44.el7.x86_64                                   6/22 
  Updating    : cpp-4.8.5-44.el7.x86_64                                       7/22 
  Updating    : gcc-4.8.5-44.el7.x86_64                                       8/22 
  Updating    : libquadmath-devel-4.8.5-44.el7.x86_64                         9/22 
  Updating    : gcc-gfortran-4.8.5-44.el7.x86_64                             10/22 
  Updating    : gcc-c++-4.8.5-44.el7.x86_64                                  11/22 
  clear        : gcc-gfortran-4.8.5-16.el7.x86_64                             12/22 
  clear        : gcc-c++-4.8.5-16.el7.x86_64                                  13/22 
  clear        : libquadmath-devel-4.8.5-16.el7.x86_64                        14/22 
  clear        : gcc-4.8.5-16.el7.x86_64                                      15/22 
  clear        : libgfortran-4.8.5-16.el7.x86_64                              16/22 
  clear        : libstdc++-devel-4.8.5-16.el7.x86_64                          17/22 
  clear        : libstdc++-4.8.5-16.el7.x86_64                                18/22 
  clear        : libgcc-4.8.5-16.el7.x86_64                                   19/22 
  clear        : libquadmath-4.8.5-16.el7.x86_64                              20/22 
  clear        : cpp-4.8.5-16.el7.x86_64                                      21/22 
  clear        : libgomp-4.8.5-16.el7.x86_64                                  22/22 
  Verification in progress      : gcc-c++-4.8.5-44.el7.x86_64                                   1/22 
  Verification in progress      : gcc-gfortran-4.8.5-44.el7.x86_64                              2/22 
  Verification in progress      : libquadmath-devel-4.8.5-44.el7.x86_64                         3/22 
  Verification in progress      : libquadmath-4.8.5-44.el7.x86_64                               4/22 
  Verification in progress      : cpp-4.8.5-44.el7.x86_64                                       5/22 
  Verification in progress      : libgfortran-4.8.5-44.el7.x86_64                               6/22 
  Verification in progress      : gcc-4.8.5-44.el7.x86_64                                       7/22 
  Verification in progress      : libstdc++-4.8.5-44.el7.x86_64                                 8/22 
  Verification in progress      : libstdc++-devel-4.8.5-44.el7.x86_64                           9/22 
  Verification in progress      : libgcc-4.8.5-44.el7.x86_64                                   10/22 
  Verification in progress      : libgomp-4.8.5-44.el7.x86_64                                  11/22 
  Verification in progress      : libgfortran-4.8.5-16.el7.x86_64                              12/22 
  Verification in progress      : gcc-4.8.5-16.el7.x86_64                                      13/22 
  Verification in progress      : libgcc-4.8.5-16.el7.x86_64                                   14/22 
  Verification in progress      : libstdc++-devel-4.8.5-16.el7.x86_64                          15/22 
  Verification in progress      : libstdc++-4.8.5-16.el7.x86_64                                16/22 
  Verification in progress      : libgomp-4.8.5-16.el7.x86_64                                  17/22 
  Verification in progress      : gcc-gfortran-4.8.5-16.el7.x86_64                             18/22 
  Verification in progress      : gcc-c++-4.8.5-16.el7.x86_64                                  19/22 
  Verification in progress      : cpp-4.8.5-16.el7.x86_64                                      20/22 
  Verification in progress      : libquadmath-devel-4.8.5-16.el7.x86_64                        21/22 
  Verification in progress      : libquadmath-4.8.5-16.el7.x86_64                              22/22 

Update complete:
  gcc.x86_64 0:4.8.5-44.el7                                                        

Upgraded as a dependency:
  cpp.x86_64 0:4.8.5-44.el7             gcc-c++.x86_64 0:4.8.5-44.el7             
  gcc-gfortran.x86_64 0:4.8.5-44.el7    libgcc.x86_64 0:4.8.5-44.el7              
  libgfortran.x86_64 0:4.8.5-44.el7     libgomp.x86_64 0:4.8.5-44.el7             
  libquadmath.x86_64 0:4.8.5-44.el7     libquadmath-devel.x86_64 0:4.8.5-44.el7   
  libstdc++.x86_64 0:4.8.5-44.el7       libstdc++-devel.x86_64 0:4.8.5-44.el7     

complete!

2.yum groupinstall package description

[root@localhost ~]# yum groupinstall gnome desktop

3.yum update -- update charter

[root@localhost ~]# yum update gcc
 Plug in loaded: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: mirrors.ustc.edu.cn
 * extras: mirrors.dgut.edu.cn
 * updates: mirrors.ustc.edu.cn
No packages marked for update

4.yum groupupdate

Package updates and individual package updates

[root@localhost ~]# yum groupupdate
 Plug in loaded: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: mirrors.ustc.edu.cn
 * extras: mirrors.dgut.edu.cn
 * updates: mirrors.ustc.edu.cn
Maybe run: yum groups mark install (see man yum)
There are no packages to install or upgrade in the specified group

3. Software uninstall

1.yum remove software name

Uninstall installed software
 

[root@localhost ~]# yum remove gcc
 Plug in loaded: fastestmirror, langpacks
 Resolving dependencies
--> Checking transactions
---> software package gcc.x86_64.0.4.8.5-44.el7 Will be deleted
--> Processing dependencies gcc,It is a software package systemtap-devel-3.1-3.el7.x86_64 need
--> Processing dependencies gcc = 4.8.5-44.el7,It is a software package libquadmath-devel-4.8.5-44.el7.x86_64 need
--> Processing dependencies gcc = 4.8.5-44.el7,It is a software package gcc-c++-4.8.5-44.el7.x86_64 need
--> Processing dependencies gcc,It is a software package systemtap-devel-3.1-3.el7.x86_64 need
--> Processing dependencies gcc = 4.8.5,It is a software package libtool-2.4.2-22.el7_3.x86_64 need
--> Processing dependencies gcc = 4.8.5-44.el7,It is a software package gcc-gfortran-4.8.5-44.el7.x86_64 need
--> Checking transactions
---> software package gcc-c++.x86_64.0.4.8.5-44.el7 Will be deleted
---> software package gcc-gfortran.x86_64.0.4.8.5-44.el7 Will be deleted
---> software package libquadmath-devel.x86_64.0.4.8.5-44.el7 Will be deleted
---> software package libtool.x86_64.0.2.4.2-22.el7_3 Will be deleted
---> software package systemtap-devel.x86_64.0.3.1-3.el7 Will be deleted
--> Processing dependencies systemtap-devel = 3.1-3.el7,It is a software package systemtap-3.1-3.el7.x86_64 need
--> Checking transactions
---> software package systemtap.x86_64.0.3.1-3.el7 Will be deleted
--> Resolve dependency complete

Dependency resolution

===================================================================================
 Package                 framework         edition                   source               size
===================================================================================
Deleting:
 gcc                     x86_64       4.8.5-44.el7           @base            37 M
 Remove for dependency:
 gcc-c++                 x86_64       4.8.5-44.el7           @base            16 M
 gcc-gfortran            x86_64       4.8.5-44.el7           @base            16 M
 libquadmath-devel       x86_64       4.8.5-44.el7           @base            18 k
 libtool                 x86_64       2.4.2-22.el7_3         @anaconda       2.2 M
 systemtap               x86_64       3.1-3.el7              @anaconda       197 k
 systemtap-devel         x86_64       3.1-3.el7              @anaconda       7.2 M

Transaction summary
===================================================================================
Remove 1 package (+6 Dependent packages)

Installation size: 79 M
 Continue?[y/N]: y
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Deleting    : gcc-gfortran-4.8.5-44.el7.x86_64                               1/7 
  Deleting    : libquadmath-devel-4.8.5-44.el7.x86_64                          2/7 
  Deleting    : libtool-2.4.2-22.el7_3.x86_64                                  3/7 
  Deleting    : systemtap-3.1-3.el7.x86_64                                     4/7 
  Deleting    : systemtap-devel-3.1-3.el7.x86_64                               5/7 
  Deleting    : gcc-c++-4.8.5-44.el7.x86_64                                    6/7 
  Deleting    : gcc-4.8.5-44.el7.x86_64                                        7/7 
  Verification in progress      : gcc-c++-4.8.5-44.el7.x86_64                                    1/7 
  Verification in progress      : gcc-gfortran-4.8.5-44.el7.x86_64                               2/7 
  Verification in progress      : libquadmath-devel-4.8.5-44.el7.x86_64                          3/7 
  Verification in progress      : systemtap-devel-3.1-3.el7.x86_64                               4/7 
  Verification in progress      : gcc-4.8.5-44.el7.x86_64                                        5/7 
  Verification in progress      : systemtap-3.1-3.el7.x86_64                                     6/7 
  Verification in progress      : libtool-2.4.2-22.el7_3.x86_64                                  7/7 

delete:
  gcc.x86_64 0:4.8.5-44.el7                                                        

Deleted as dependency:
  gcc-c++.x86_64 0:4.8.5-44.el7              gcc-gfortran.x86_64 0:4.8.5-44.el7   
  libquadmath-devel.x86_64 0:4.8.5-44.el7    libtool.x86_64 0:2.4.2-22.el7_3      
  systemtap.x86_64 0:3.1-3.el7               systemtap-devel.x86_64 0:3.1-3.el7   

complete!

2.yum groupremove package group name

Uninstall package group

3.yum history

View usage history

[root@localhost ~]# yum history 
Plug in loaded: fastestmirror, langpacks
ID     | log on user                 | Date and time       | operation           | Number of changes 
-------------------------------------------------------------------------------
     5 | root <root>              | 2021-10-07 15:09 | Erase          |    7   
     4 | root <root>              | 2021-10-07 15:03 | I, U           |   14   
     3 | root <root>              | 2021-10-07 15:01 | Install        |    3   
     2 | root <root>              | 2021-10-07 15:00 | Update         |   11   
     1 | system <empty>                | 2021-10-07 16:03 | Install        | 1372   
history list

4, Build yum warehouse

1. Build local warehouse

1. Mount the image file in the optical drive

[root@localhost ~]# mount /dev/sr0 /mnt
mount: /dev/sr0 Write protected, will mount as read-only
[root@localhost ~]# df -hT    #View mount
 file system                type      Capacity used available used% Mount point
/dev/mapper/centos-root xfs        50G  3.6G   47G    8% /
devtmpfs                devtmpfs  1.9G     0  1.9G    0% /dev
tmpfs                   tmpfs     1.9G     0  1.9G    0% /dev/shm
tmpfs                   tmpfs     1.9G  9.1M  1.9G    1% /run
tmpfs                   tmpfs     1.9G     0  1.9G    0% /sys/fs/cgroup
/dev/mapper/centos-home xfs        46G   33M   46G    1% /home
/dev/sda1               xfs      1014M  179M  836M   18% /boot
tmpfs                   tmpfs     378M   44K  378M    1% /run/user/0
/dev/sr0                iso9660   4.3G  4.3G     0  100% /mnt
[root@localhost ~]# 

2. Switch to the yum.repo.d directory, create a new folder, and move the built-in repo files to the folder. Multiple open warehouse files may cause conflicts and cannot be used

root@localhost ~]# cd /etc/yum.repos.d/
[root@localhost yum.repos.d]# ls
CentOS-Base.repo  CentOS-Debuginfo.repo  CentOS-Media.repo    CentOS-Vault.repo
CentOS-CR.repo    CentOS-fasttrack.repo  CentOS-Sources.repo
[root@localhost yum.repos.d]# mkdir qwe
[root@localhost yum.repos.d]# mv *.repo qwe
[root@localhost yum.repos.d]# ls
qwe
[root@localhost yum.repos.d]# 

3. Create a new local warehouse

[root@localhost yum.repos.d]# vim asd.repo
[qwe]
name=asd
baseurl=file:///mnt
enabled=1
gpgcheck=0
:wq

4.yum list

Check the warehouse and use it normally without error

[root@localhost yum.repos.d]# yum list 

5.yum installation

yum install software name

[root@localhost yum.repos.d]# yum install httpd
 Plug in loaded: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 Resolving dependencies
--> Checking transactions
---> software package httpd.x86_64.0.2.4.6-67.el7.centos Will be installed
--> Processing dependencies httpd-tools = 2.4.6-67.el7.centos,It is a software package httpd-2.4.6-67.el7.centos.x86_64 need
--> Processing dependencies /etc/mime.types,It is a software package httpd-2.4.6-67.el7.centos.x86_64 need
--> Checking transactions
---> software package httpd-tools.x86_64.0.2.4.6-67.el7.centos Will be installed
---> software package mailcap.noarch.0.2.1.41-2.el7 Will be installed
--> Resolve dependency complete

Dependency resolution

===================================================================================
 Package             framework           edition                         source           size
===================================================================================
Installing:
 httpd               x86_64         2.4.6-67.el7.centos          qwe         2.7 M
 Install for dependency:
 httpd-tools         x86_64         2.4.6-67.el7.centos          qwe          87 k
 mailcap             noarch         2.1.41-2.el7                 qwe          31 k

Transaction summary
===================================================================================
Install 1 package (+2 Dependent packages)

Total downloads: 2.8 M
 Installation size: 9.6 M
Is this ok [y/d/N]: y
Downloading packages:
-----------------------------------------------------------------------------------
total                                                  one hundred and forty-four MB/s | 2.8 MB  00:00     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing    : httpd-tools-2.4.6-67.el7.centos.x86_64                         1/3 
  Installing    : mailcap-2.1.41-2.el7.noarch                                    2/3 
  Installing    : httpd-2.4.6-67.el7.centos.x86_64                               3/3 
  Verification in progress      : httpd-2.4.6-67.el7.centos.x86_64                               1/3 
  Verification in progress      : mailcap-2.1.41-2.el7.noarch                                    2/3 
  Verification in progress      : httpd-tools-2.4.6-67.el7.centos.x86_64                         3/3 

already installed:
  httpd.x86_64 0:2.4.6-67.el7.centos                                               

Installed as a dependency:
  httpd-tools.x86_64 0:2.4.6-67.el7.centos      mailcap.noarch 0:2.1.41-2.el7     

complete!

2. Build Alibaba cloud warehouse

1. Switch to the yum.repo.d directory and remove the built-in repo

[root@localhost ~]# cd /etc/yum.repos.d/
[root@localhost yum.repos.d]# ls
CentOS-Base.repo  CentOS-Debuginfo.repo  CentOS-Media.repo    CentOS-Vault.repo
CentOS-CR.repo    CentOS-fasttrack.repo  CentOS-Sources.repo
[root@localhost yum.repos.d]# mkdir ding
[root@localhost yum.repos.d]# mv *.repo ding
[root@localhost yum.repos.d]# ls
ding
[root@localhost yum.repos.d]# 

yum source for centos system

yum source for CentOS system
#Alibaba cloud
https://mirrors.aliyun.com/centos/$releasever/ 
#Tencent cloud
https://mirrors.cloud.tencent.com/centos/$releasever/ 
#Hua Weiyun
https://repo.huaweicloud.com/centos/$releasever/ 
#Tsinghua University
https://mirrors.tuna.tsinghua.edu.cn/centos/$releasever/


yum source for EPEL
#Alibaba cloud
https://mirrors.aliyun.com/epel/$releasever/x86_64
#Tencent cloud
https://mirrors.cloud.tencent.com/epel/$releasever/x86_64
#Hua Weiyun
https://mirrors.huaweicloud.com/epel/$releasever/x86_64
#Tsinghua University
https://mirrors.tuna.tsinghua.edu.cn/epel/$releasever/x86_64

#Update source
http://mirrors.aliyun.com/centos/$releasever/updates/$basearch/ http://mirrors.aliyuncs.com/centos/$releasever/updates/$basearch/ http://mirrors.cloud.aliyuncs.com/centos/$releasever/updates/$basearch/

2. Create a new aliyun warehouse

[root@localhost yum.repos.d]# vim aliyun.repo

[ali]
name=aliyun
baseurl=https://mirrors.aliyun.com/centos/7/os/x86_64/
aseurl=https://mirrors.aliyun.com/centos/$releasever/os/$basearch/
gpgcheck=0

5, NFS share

NFS (Network File System network file service) NFS is a Network File System protocol based on TCP/IP transmission, which was originally developed by Sun company. By using the NFS protocol, clients can access the shared resources in the remote server like accessing the local directory. NFS is also a protocol inevitably supported by NAS storage devices

1. Characteristics

Use TCP/IP to transmit network files

Low safety

Easy to operate

Suitable for LAN environment

2. Advantage

Advantages of NFS: save local storage space, store common data such as: / home directory on NFS server and access through network, which will reduce the utilization of local disk

3. Construction process

Add a hard disk for sharing

[root@localhost ~]# yum install nfs-utils.x86_64 rpcbind -y   #Install package
[root@localhost ~]# mkdir /share
[root@localhost ~]# cd /share/
[root@localhost share]# chmod -R 777 /share/
[root@localhost share]# vim /etc/exports
/share *
[root@localhost ~]# systemctl start rpcbind 
[root@localhost ~]# systemctl start nfs 
[root@localhost ~]#exports -vr
[r[root@localhost ~]# netstat -anpt | grep rpc
[root@localhost ~]# showmount -e 
#Client
[root@localhost ~]# mount 192.168.7.250:/opt/wwwroot /var/www/html
[root@localhost ~]# vi /etc/fstab 
192.168.7.250:/opt/wwwroot /var/www/html nfs defaults,_netdev 0 0
showmount -e Host name (view remote host) nfs (shared)

6, Summary

The YUM software warehouse is mainly published through HTTP or FTP and requires data, including the header of all rpm files

When querying a package using the yum command, the available sub commands include list, info and search, which are used to query the package list, the description of the package and the specified package respectively

When installing, upgrading and uninstalling a package using the yum command, the corresponding subcommands are install, update and remove

The implementation of acting as NFS client and NFNFS service depends on RPC mechanism and the intermediary of RPCS server. In CentOS 6 system, NFS utils rpcbind package needs to be installed to provide NFS sharing service. The former is used for NFS sharing publishing and access, and the latter is used for NFS sharing
J is supported by RPC.

The mount command is used to mount the access to nfs shares, and the corresponding file system type is nfs. You can mount manually or add fstab configuration file to realize automatic mount after startup.

Topics: Linux Operation & Maintenance CentOS