Experimental platform: CentOS7
Experimental analysis: The source rpm package in the Linux system is stored in the official yum warehouse, usually We can call the rpm package in the yum warehouse at will when we are connected to the Internet, but in the disconnected state, all of this is obviously impossible to achieve. If we need to install the rpm package, we can only build a temporary yum repository by ourselves, and this depends on the installation image of the Linux operating system. Obviously, there are a large number of rpm packages stored in the installation image, but compared to the yum warehouse in the network, the rpm package in the image cannot be upgraded at any time, updated version, etc.
Overview of the rpm package
The rpm package is one of the most widely used software packages in various Linux distributions. The rpm package is characterized by its powerful functions and Extensive compatibility is supported by most Linux distributions and supported by the majority of Linux users. The rpm package manager establishes a unified file database to record in detail the various rpm software packages installed, uninstalled, and upgraded in the Linux system, and can automatically analyze the dependencies between the software packages to keep the applications in a coordinated manner. , Run in an orderly overall environment.
Experimental process
First, disconnect the CentOS7 network, set the network card to host-only mode, click OK
The network card mode is only the host mode, we need to reconfigure Network card, add ip address, subnet mask, gateway, etc. In the Linux terminal, enter the command to enter the network card configuration
The original interface you entered for the first time
The interface after the change
After the configuration is complete, enter wq in the last line mode to save and exit. After the configuration file is changed here, the service must be restarted to take effect.
Enter the ifconfig command to see if the configuration is successful
This is an error when trying to load yum list. The reason is that the network is already disconnected and the client cannot access the official yum warehouse
The configuration is complete, we go to the next step , Relying on the system image file to create a yum warehouse to install the rpm package.
Use df -h command to see if the CD image has been mounted
Still in the CD-ROM, not mounted on it
We need to mount the CD-ROM drive, so that to use the files in the CD-ROM drive, just open the directory where the CD-ROM drive is mounted. Can. First find out an empty directory as the mount point. The /mnt directory is an empty directory, which can be viewed through ls. The mount command is mount
Use df -h to check whether the mounting is successful
After completion, we proceed to the next step. When the system is installed, the yum source is concentrated in one place. After the network is disconnected, these software packages cannot be used. We move the software package to an empty folder and use the software package in the CD
Create a private yum warehouse
After the configuration is complete, you can use the yum repository, here use yum to install the httpd service
Visit the website via ip address
< img alt="Install the rpm package when the network is off" src="/wp-content/uploads/images/os/linux/1626797219384.png" >
Access is successful