yum源
查看现有的yum仓库镜像
[root@localhost ~]# ls -l /etc/yum.repos.d/
总用量 4
-rw-r--r--. 1 root root 43 7月 8 11:04 hh.repo
打包保存 做成一个tar.gz
yum repolist all
tar -zcvf /etc/yum.repos.d/bak.tar.gz /etc/yum.repos.d/*
rm -rf /etc/yum.repos.d/*.repo 删除所有
ls -l /etc/yum.repos.d/ 进行查看
yum clean 清空缓存
yum makecache 查看源列表
挂载
rm -rf /mnt/* 删除mnt目录下的所有文件
ls /mnt
lsblk 未挂载
mount -o ro /dev/sr0 /mnt/ 进行挂载
查看mnt目录
将光盘数据挂载到/mnt目录中,就可以在该目录中读取光盘的数据
开机启动
[root@localhost ~]# vim /etc/rc.local
追加也可以
[root@localhost ~]# echo "mount -o -ro /dev/sr0 /mnt" >> /etc/rc.local
编写一个本地repo文件
yum仓库格式:
[root@localhost ~]# vim /etc/yum.repos.d/hh.repo
测试:
下载软件,安装成功
yum -y install httpd
[root@localhost ~]# man 5 yum.conf 查看文件配置
阿里云镜像配置
54 wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo
55 ls /etc/yum.repos.d/
56 yum clean
57 yum clean all
58 yum makecache
59 yum list
60 yum list | grep python3
腾讯云镜像配置
[root@localhost ~]# wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.cloud.tencent.com/repo/centos7_base.repo
[root@localhost ~]# yum clean all
[root@localhost ~]# yum makecache
下载epel
cp /etc/yum.repos.d/x x.repo
yum makecache
yum -y install epel-release
yum -y install sl
sl
nginx已经在epel中加装
安装nginx
77 yum -y install nginx.x86_64
79 curl http://localhost 启动nginx
80 nginx -s stop 停用nginx
另一种方式:
vim /etc/yum.repos.d/nginx.repo
93 yum clean all
94 yum makecache
99 yum -y install nginx.x86_64
下载后自动安装在指定路径
vim /etc/yum.cong
keepcache=1
测试 yum -y install tree
/var/cache/yum/x86_32/base/packages...
102 cp /etc/yum.repos.d/CentOS-Base.repo.bak /etc/yum.repos.d/CentOS-Base.repo
103 yum clean all
104 yum makecache
105 vim /etc/yum.repos.d/CentOS-Base.repo
106 vim /etc/yum.conf
107 yum remove tree -y
108 yum -y install tree
109 cd /var/cache/yum/
只下载不安装
[root@localhost ~]# yum install --downloadonly --downloaddir=./soft/ samba
安装createrepo制作仓库的软件
[root@localhost ~]# yum -y install createrepo
把soft文件夹做成本地的一个仓库软件
[root@localhost ~]# createrepo soft/
在/etc/yum.repos.d/下创建/soft.repo
[root@localhost ~]# vim /etc/yum.repos.d/soft.repo
131 yum clean all
132 yum makecache
133 yum -y install samba