大家好我是渣渣辉今天我教大家怎么用Yum命令在Linux上安装一个软件包
首先我们向把 光盘挂载到一个空的文件夹
mount /dev/sr0 /mnt
mount: /mnt: WARNING: device write-protected, mounted read-only.
然后我们创立一个yum的仓库然后我们在仓库里面设置2个软件源让yum能去find那些附属软件因为在安装一些软件时要安装一些附属软件有了这个就很快了一下就安完了
cd /etc/yum.repos.d
[root@wzs yum.repos.d]# ll
total 4
-rw-r--r--. 1 root root 358 Nov 9 21:59 redhat.repo
[root@wzs yum.repos.d]# touch httpd.repo
[root@wzs yum.repos.d]# ll
total 4
-rw-r--r--. 1 root root 0 Nov 25 20:35 httpd.repo
-rw-r--r--. 1 root root 358 Nov 9 21:59 redhat.repo
[root@wzs yum.repos.d]# vim httpd.repo
```bash
[APPStream]
name=appstream
baseurl=file:///mnt/AppStream
gpgcheck=0
[baseos]
name=baseos
baseurl=file:///mnt/BaseOS
gpgcheck=0
``
然后就可以安装了
[root@wzs yum.repos.d]# yum install httpd
Updating Subscription Management repositories.
Unable to read consumer identity
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
appstream 41 MB/s | 5.8 MB 00:00
baseos 62 MB/s | 2.3 MB 00:00
Last metadata expiration check: 0:00:01 ago on Fri 25 Nov 2022 08:55:48 PM CST.
Dependencies resolved.
================================================================================
Package Arch Version Repo Size
================================================================================
Installing:
httpd x86_64 2.4.37-21.module+el8.2.0+5008+cca404a3 APPStream 1.4 M
Installing dependencies:
apr x86_64 1.6.3-9.el8 APPStream 125 k
apr-util x86_64 1.6.1-6.el8 APPStream 105 k
httpd-filesystem noarch 2.4.37-21.module+el8.2.0+5008+cca404a3 APPStream 36 k
httpd-tools x86_64 2.4.37-21.module+el8.2.0+5008+cca404a3 APPStream 103 k
mod_http2 x86_64 1.11.3-3.module+el8.2.0+4377+dc421495 APPStream 158 k
redhat-logos-httpd
noarch 81.1-1.el8 baseos 26 k
Installing weak dependencies:
apr-util-bdb x86_64 1.6.1-6.el8 APPStream 25 k
apr-util-openssl x86_64 1.6.1-6.el8 APPStream 27 k
Enabling module streams:
httpd 2.4
Transaction Summary
================================================================================
Install 9 Packages
Total size: 2.0 M
Installed size: 5.5 M
Is this ok [y/N]: y
Downloading Packages:
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
Preparing : 1/1
Installing : apr-1.6.3-9.el8.x86_64 1/9
Running scriptlet: apr-1.6.3-9.el8.x86_64 1/9
Installing : apr-util-bdb-1.6.1-6.el8.x86_64 2/9
Installing : apr-util-openssl-1.6.1-6.el8.x86_64 3/9
Installing : apr-util-1.6.1-6.el8.x86_64 4/9
Running scriptlet: apr-util-1.6.1-6.el8.x86_64 4/9
Installing : httpd-tools-2.4.37-21.module+el8.2.0+5008+cca404a3.x 5/9
Installing : redhat-logos-httpd-81.1-1.el8.noarch 6/9
Running scriptlet: httpd-filesystem-2.4.37-21.module+el8.2.0+5008+cca40 7/9
Installing : httpd-filesystem-2.4.37-21.module+el8.2.0+5008+cca40 7/9
Installing : mod_http2-1.11.3-3.module+el8.2.0+4377+dc421495.x86_ 8/9
Installing : httpd-2.4.37-21.module+el8.2.0+5008+cca404a3.x86_64 9/9
Running scriptlet: httpd-2.4.37-21.module+el8.2.0+5008+cca404a3.x86_64 9/9
Verifying : apr-1.6.3-9.el8.x86_64 1/9
Verifying : apr-util-1.6.1-6.el8.x86_64 2/9
Verifying : apr-util-bdb-1.6.1-6.el8.x86_64 3/9
Verifying : apr-util-openssl-1.6.1-6.el8.x86_64 4/9
Verifying : httpd-2.4.37-21.module+el8.2.0+5008+cca404a3.x86_64 5/9
Verifying : httpd-filesystem-2.4.37-21.module+el8.2.0+5008+cca40 6/9
Verifying : httpd-tools-2.4.37-21.module+el8.2.0+5008+cca404a3.x 7/9
Verifying : mod_http2-1.11.3-3.module+el8.2.0+4377+dc421495.x86_ 8/9
Verifying : redhat-logos-httpd-81.1-1.el8.noarch 9/9
Installed products updated.
Installed:
apr-1.6.3-9.el8.x86_64
apr-util-1.6.1-6.el8.x86_64
apr-util-bdb-1.6.1-6.el8.x86_64
apr-util-openssl-1.6.1-6.el8.x86_64
httpd-2.4.37-21.module+el8.2.0+5008+cca404a3.x86_64
httpd-filesystem-2.4.37-21.module+el8.2.0+5008+cca404a3.noarch
httpd-tools-2.4.37-21.module+el8.2.0+5008+cca404a3.x86_64
mod_http2-1.11.3-3.module+el8.2.0+4377+dc421495.x86_64
redhat-logos-httpd-81.1-1.el8.noarch
Complete!
如果在 yum install httpd 后加-y 可以忽略 要确定的那步 刚才古天乐找我去沙城忘记打了