Linux --- Configure the local yum source and realize automatic mounting at boot

Mount the ISO image file:

Create a yum directory under the / directory, and then mount the CD path /dev/sr0 to the /yum directory

Check whether the local yum is successfully built, and clear the yum cache:

Display a list of software repositories:

This is a one-time mount, and the yum source will become invalid after the system restarts! So the following will introduce the automatic mounting every time you boot.

Execute the vim command to configure the file to be automatically run at startup (similar to the "startup" folder under the windows system)

Add executable permissions to the /etc/rc.d/rc.local file:

verification:

Build a network yum source on a virtual machine to experiment:

[root@localhost Desktop]# yum install httpd -y
Loaded plugins: langpacks, product-id, search-disabled-repos, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register .
we are addressing dependencies
-> checking affairs
---> httpd.x86_64.0.2.4.6-40.el7 package will be installed
-> processing dependency httpd-tools = 2.4.6-40.el7, It is required by the package httpd-2.4.6-40.el7.x86_64
--> is processing dependencies /etc/mime.types, it is required by the package httpd-2.4.6-40.el7.x86_64
--> is in progress Check transaction
---> Package httpd-tools.x86_64.0.2.4.6-40.el7 will be installed
---> Package mailcap.noarch.0.2.1.41-2.el7 will be installed
--> Resolve dependencies carry out

Dependency resolution

================================================== ===============================
 Package Architecture Version Source Size
=============== ================================================== ==============
Installing:
 httpd x86_64 2.4.6-40.el7 yum 1.2 M
for dependency installation:
 httpd-tools x86_64 2.4.6-40.el7 yum 82 k
 mailcap noarch 2.1.41-2.el7 yum 31 k

Transaction summary
==================================================================================================================================================================================================================== =================================
install 1 package (+2 dependent packages)

Total downloads: 1.3 M
Installation size: 3.9 M
Downloading packages:
------------------------------------ --------------------------------------------
Total 8.6 MB/s | 1.3 MB 00:00     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
warning: The RPM database has been modified by a non-yum program.
  Installing: httpd-tools-2.4.6-40.el7.x86_64 1/3 
  is installing: mailcap-2.1.41-2.el7.noarch 2/3 
  is installing: httpd-2.4.6-40.el7.x86_64 3/3 
yum/productid | 1.6 kB 00:00     
  Verifying: mailcap-2.1.41-2.el7.noarch 1/3 
  Verifying: httpd-tools-2.4.6-40.el7.x86_64 2/3 
  Verifying: httpd-2.4.6-40.el7.x86_64 3/3 

Installed:
  httpd.x86_64 0:2.4.6-40.el7                                                   

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

complete!

Switch to the /var/www/html file, create a chuid shared directory, and then mount the /dev/sr0 CD-ROM file to the /chuid directory, and set it to automatically mount at startup:

verification:

Enter 192.168.203.176/chuid in the browser to view the mounted image file in the shared directory and download it

Guess you like

Origin blog.csdn.net/C_huid/article/details/105659820