一.创建yum源
1.User/passwd:root/nyztesoft$123
2.上传镜像存放目录:/soft/os_iso/centos
/soft/os_iso/redhat
3.镜像挂载目录:/var/www/html/centos/6.0
/var/www/html/centos/6.1
挂载镜像mount -o loop /soft/os_iso/centos/CentOS_6.5_x86_64-bin-DVD.iso /var/www/html/centos/6.5
设置为开机自动挂载
vi /etc/fstab
添加
/soft/os_iso/centos/ CentOS_6.5_x86_64-bin-DVD.iso /var/www/html/centos/6.5/ iso9600 loop,default 0 0
注:针对于centos6版本的镜像,处理方式是把两个DVD1.iso和DVD2.iso包相同文件用文本编辑器合并成一个文件,把两个iso压缩包package放到一起,再压缩成一个镜像DVD.iso,可使用软件UltraISO
4.如需要挂载ntfs格式移动硬盘可以参照https://www.tuxera.com/community/open-source-ntfs-3g/
下载软件包ntfs-3g_ntfsprogs-2017.3.23.tgz
tar -zxvf ntfs-3g_ntfsprogs-2017.3.23.tgz
cd ntfs-3g_ntfsprogs-2017.3.23
./configure
make
make install
如需要在其他环境上下载镜像可使用scp命令
从本地复制到远程scp local_file remote_username@remote_ip:remote_folder
从远程复制到本地scp remote_username@remote_ip:remote_file local_folder
5.先做一个本地的yum源,安装http服务
上传镜像,挂载
在yum源主机中
cd /etc/yum.repos.d
vi file.repo
[centos7.1]
name=centos7.1
baseurl=file:///var/www/html/centos/7.1/
enabled=1
gpgcheck=0
创建成功后清理缓存:yum clean all
升级刷新yum:yum update
检查:yum list
6.创建yum源需要安装http服务,并设为开机自启
yum install -y httpd
systemctl start httpd
systemctl enable httpd
8.登陆查看http://10.45.10.222/centos/7.1/
二.使用yum源
1.本地
cd /etc/yum.repos.d
vi file.repo
[centos7.1]
name=centos7.1
baseurl=http://10.45.10.222/centos/7.1
enabled=1
gpgcheck=0
2.创建成功后清理缓存:yum clean all清理缓存
3.升级刷新yum:yum update
4.检查:yum list