python 模块 SimpleHTTPServer 搭建本地yum源

测试环境Centos7.6

安装python2

创建服务,如果没有
[root@test ~]# python2 -m SimpleHTTPServer 8000
-bash: python2: command not found
#如果没有python2,可以用yum
[root@test bk]# yum install python2 -y
#启动成功
[root@test ~]# python2 -m SimpleHTTPServer 8000
Serving HTTP on 0.0.0.0 port 8000 ...

挂载ISO

C:\>scp Working\Software\ISO\CentOS-7-x86_64-Minimal-1810.iso root@10.253.52.219:/root/
root@10.253.52.219's password:
CentOS-7-x86_64-Minimal-1810.iso      

anaconda-ks.cfg  CentOS-7-x86_64-Minimal-1810.iso
[root@test ~]# mkdir /mnt/iso
[root@test ~]# mount CentOS-7-x86_64-Minimal-1810.iso /mnt/iso/
mount: /mnt/iso: WARNING: device write-protected, mounted read-only.
#到/mnt下面执行 python2 命令
[root@test ~]# cd /mnt/
[root@test mnt]# python2 -m SimpleHTTPServer 8010
Serving HTTP on 0.0.0.0 port 8010 ...

 web页面显示

 设置yum源

#本地yum源设置
[root@test ~]# cd /etc/yum.repos.d/
[root@test yum.repos.d]# cat iso.repo
[iso]
name=iso
baseurl=http://10.253.52.219:8010/iso
enabled=1
gpgcheck=0
[root@test yum.repos.d]# yum repolist
repo id                                                                                                     repo name
iso                                                                                                         iso
[root@test yum.repos.d]# yum list

后台运行

#后台运行
nohup python -m SimpleHTTPServer 8010 &> /dev/null &   

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

石兴稳

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值