建立本地yum源
将如下4个文件按顺序安装,yum -y install ~
或者rpm -ivh ~
1、使用命令查看是否安装成功,出现版本号即为成功
createrepo --version
2、创建iso文件夹及cdron文件夹:
mkdir /mnt/iso
mkdir /mnt/cdron
3、用Xftp上传CentOS-7-x86_64-DVD-1908.iso文件到/mnt/iso上:
4、将/mnt/iso/CentOS-7-x86_64-DVD-1908.iso挂载到/mnt/cdron/下,并用df -h命令查 看:
mount -o loop /mnt/iso/CentOS-7-x86_64-DVD-1908.iso /mnt/cdron
[root@localhost ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda3 38G 9.0G 29G 24% /
devtmpfs 482M 0 482M 0% /dev
tmpfs 490M 92K 490M 1% /dev/shm
tmpfs 490M 7.1M 483M 2% /run
tmpfs 490M 0 490M 0% /sys/fs/cgroup
/dev/sda1 297M 106M 192M 36% /boot
/dev/loop0 4.4G 4.4G 0 100% /mnt/cdron
5、将/mnt/cdron/目录下的所用文件复制到/opt/下(即将yum源仓库放在/opt目录下):
cp -rv /mnt/cdron/* /opt/
6、切