yum command format:
yum install softwarename install
yum repolist lists information about setting yum sources
yum remove softwarename uninstall
yum list softwarename to check whether this software exists in the software source
yum list all lists all software names
yum list installd List installed software names
yum list available lists the software names that can be installed with yum
yum clean all clears the yum cache
yum search softwarename Search software name according to software information
yum whatprovides filename finds packages in yum sources that contain filename
yum update update software
yum history View system software change history
yum reinstall softwarename reinstall
yum info softwarename View software information
yum groups list View software group information
yum groups info softwaregroup View the software included in the software group
yum groups install softwaregroup install components
Solution for dhcp installation not working:
mkdir /iso creates a directory
mv /home/kiosk/Desktop/*.iso /iso to prevent accidental deletion
mkdir /source7.0 /source7.2 mount point
mount /iso/rhel-server-7.0-x86_64-dvd.iso /source7.0 mount separately
mount /iso/rhel-server-7.2-x86_64-dvd.iso /source7.2
The 7.0 and 7.2 here are the versions of our real machine and virtual machine. For example, after I reinstall the system, the version is 7.1, so the mirror has to be mounted correspondingly.
cd /etc/yum.repos.d/ switch path
mkdir /repobackup build directory
mv * /repobackup backup
vim yum.repo
[source7.2]
name=source7.2
baseurl = file: ///source7.2
gpgcheck=0
yum clean all
Detailed operation:
[root@foundation21 ~]# mkdir /iso
[root@foundation21 ~]# mv /home/kiosk/Desktop/*.iso /iso
[root@foundation21 ~]# mkdir /source7.0 /source7.2
[root@foundation21 ~]# mount /iso/rhel-server-7.0-x86_64-dvd.iso /source7.0
mount: /dev/loop0 is write-protected, mounting read-only
[root@foundation21 ~]# mount /iso/rhel-server-7.2-x86_64-dvd.iso /source7.2
mount: /dev/loop1 is write-protected, mounting read-only
[root@foundation21 ~]# cd /etc/yum.repos.d/
[root@foundation21 yum.repos.d]# mkdir /repobackup
[root@foundation21 yum.repos.d]# mv * /repobackup
[root@foundation21 yum.repos.d]# vim yum.repo
[root@foundation21 yum.repos.d]# yum clean all
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.
Cleaning repos: source7.2
Cleaning up everything
[root@foundation21 yum.repos.d]# cd
[root@foundation21 ~]# yum install dhcp 安装dhcp
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.
source7.2 | 4.1 kB 00:00
(1/2): source7.2/group_gz | 136 kB 00:00
(2/2): source7.2/primary_db | 3.6 MB 00:00
Resolving Dependencies
--> Running transaction check
---> Package dhcp.x86_64 12:4.2.5-42.el7 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
================================================================================
Package Arch Version Repository Size
================================================================================
Installing:
dhcp x86_64 12:4.2.5-42.el7 source7.2 511 k
Transaction Summary
================================================================================
Install 1 Package
Total download size: 511 k
Installed size: 1.4 M
Is this ok [y/d/N]: y
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : 12:dhcp-4.2.5-42.el7.x86_64 1/1
source7.2/productid | 1.6 kB 00:00
Verifying : 12:dhcp-4.2.5-42.el7.x86_64 1/1
Installed:
dhcp.x86_64 12:4.2.5-42.el7
Complete!
共享yum源:
1,上个实验在本地yum源配置完成之后安装apache点击打开链接,链接里面有阿帕奇的详细解释:
yum install httpd
systemctl start httpd
systemctl enable httpd
systemctl stop firewalld
systemctl disable firewalld
mkdir /var/www/html/source7.0 /var/www/html/source7.2
2,挂载镜像有两种方式:
临时挂载:
执行完如下命令后会挂载成功,但是在系统重启之后就需要重新挂载!
mount /iso/rhel-server-7.0-x86_64-dvd.iso /var/www/html/source7.0
mount /iso/rhel-server-7.2-x86_64-dvd.iso /var/www/html/source7.2
永久性挂载:
编辑如下文件可以实现开机永久性挂载。
vim /etc/rc.d/rc.local
写入:
mount /iso/rhel-server-7.0-x86_64-dvd.iso /var/www/html/source7.0
mount /iso/rhel-server-7.2-x86_64-dvd.iso /var/www/html/source7.2
:wq退出保存
chmod +x /etc/rc.d/rc.local 赋予执行权限
3,访问测试(在虚拟机)
在浏览器中输入地址,依次测试连接
http://ip/source7.0
http://172.25.254.78/source7.0,78为主机IP。
http://172.25.254.78/source7.2
***在虚拟机里面输入不需要输入http直接172.25.254.78即可测试。
4,配置虚拟机yum
rm -fr /etc/yum.repos.d/*
vim /etc/yum.repos.d/yum.repo
[source7.0]
name=source7.0
baseurl=http://172.25.254.78/source7.0
gpgcheck=0
配置文件完成后可以在虚拟机输入yum install dhcp进行下载
[root@foundation21 ~]# df 重启之后可以看到已经挂载完成
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/sda3 307974224 17399728 290574496 6% /
devtmpfs 1868044 0 1868044 0% /dev
tmpfs 1881152 88 1881064 1% /dev/shm
tmpfs 1881152 8868 1872284 1% /run
tmpfs 1881152 0 1881152 0% /sys/fs/cgroup
/dev/sda1 505580 149472 356108 30% /boot
/dev/loop0 3654720 3654720 0 100% /var/www/html/source7.0
/dev/loop1 3947824 3947824 0 100% /var/www/html/source7.2
tmpfs 376232 12 376220 1% /run/user/1000
yum命令仅仅是对软件进行管理,rpm命令才是真正安装软件的,yum的好处是可以解决软件依赖性。