centos7配置yum本地仓库源

在安装之前要确保你是使用的iso镜像文件,配置yum本地仓库源是以iso镜像为基础创建的

本地安装

[ root@localhost ~] # mkdir /iosguo                       ####创建文件夹,便于下一步挂载镜像
[ root@localhost ~] # mount /dev/cdrom /iosguo            ####挂载磁盘镜像
mount: /dev/sr0 写保护,将以只读方式挂载
[root@localhost ~] # cd /etc/yum.repos.d/
[root@ocalhost yum.repos.d] # 1s
Centos- Base.repo
CentoS.Debuginfo.repo Centos-Media.repo
CentoS-vault.repo
Cent0S-CR.repo
CentoS.fasttrack.repo Cent0S-Sources.repo
Centos-x86_64-kernel.repo
[root@localhost yum.repos.d] # cp Cent0S- Sources. repo guo.repo      ####复制使用其模板
[root@localhost yum.repos.d] # vim guo.repo
[root@localhost yum.repos.d] # vim guo.repo
[root@localhost yum.repos.d] # cat guo.repo
[centos]
nane= centos
baseurl=file:///iosguo/    ###file:///表示根目录文件
gpgcheck=0
enabled=1
[root@localhost yum.repos.d] # yum repolist            ####验证没有出错
已加载插件:fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: mirror.lzu.edu.cn
 * extras: mirrors.aliyun.com
 * updates: mirrors.tuna.tsinghua.edu.cn
源标识                              源名称                                状态
!base/7/x86_64                      CentOS-7 - Base                       10,072
!centos                             centos                                 4,070
!extras/7/x86_64                    CentOS-7 - Extras                        500
!updates/7/x86_64                   CentOS-7 - Updates                     2,751
repolist: 17,393
[root@localhost ~]# 


 

网络安装

[root@localhost ~]# yum -y install vsftpd
已加载插件:fastestmirror, langpacks  。。。。。                                                                                                                                       完毕!     ###安装过程省略
[root@localhost ~]# systemctl start vsftpd    ###开启ftp服务
[root@localhost ~]# systemctl enable vsftpd    ###设置为开机自启动
Created symlink from /etc/systemd/system/multi-user.target.wants/vsftpd.service to /usr/lib/systemd/system/vsftpd.service.
[root@localhost ~]# systemctl status vsftpd    ###查看ftp服务状态
● vsftpd.service - Vsftpd ftp daemon
   Loaded: loaded (/usr/lib/systemd/system/vsftpd.service; enabled; vendor preset: disabled)
   Active: active (running) since 一 2021-09-27 23:59:17 CST; 23s ago
 Main PID: 3489 (vsftpd)
   CGroup: /system.slice/vsftpd.service
           └─3489 /usr/sbin/vsftpd /etc/vsftpd/vsftpd.conf

9月 27 23:59:17 localhost systemd[1]: Starting Vsftpd ftp daemon...
9月 27 23:59:17 localhost systemd[1]: Started Vsftpd ftp daemon.
[root@localhost ~]# cd /var/ftp/
[root@localhost ftp]# ls
pub
[root@localhost ftp]# mkdir -pv guoios/centos    ###递归创建文件夹,便于一会上传
mkdir: 已创建目录 "guoios"
mkdir: 已创建目录 "guoios/centos"
[root@localhost ftp]# cp -rf /iosguo ./guoios/centos/ &     ###递归复制文件至文件夹下
###########自己可以去网站输入ftp://127.0.0.1下查看上传文件内容######
[root@localhost ~] # cd /etc/yum.repos.d/
[root@localhost yum.repos.d] # vim guo.repo
[root@localhost yum.repos.d] # cat guo.repo
[centos]
nane= centos
baseurl=ftp://127.0.0.1/guoios/centos/iosguo     ###是上传ftp文件夹的路径,直接复制网址也可
gpgcheck=0
enabled=1
[root@localhost yum.repos.d] # yum repolist            ####验证没有出错
已加载插件:fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: mirror.lzu.edu.cn
 * extras: mirrors.aliyun.com
 * updates: mirrors.tuna.tsinghua.edu.cn
源标识                              源名称                                状态
!base/7/x86_64                      CentOS-7 - Base                       10,072
!centos                             centos                                 4,070
!extras/7/x86_64                    CentOS-7 - Extras                        500
!updates/7/x86_64                   CentOS-7 - Updates                     2,751
repolist: 17,393
[root@localhost ~]# 

大体步骤是这个样子,有什么问题下面留言,会及时回复

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 3
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值