ftp方式和http方式搭建云仓库

1.搭建阿里云仓库

国外云仓库比较慢,可以使用阿里云仓库代替

1.服务端和客户端切换到 yum.repo.d 目录 将自带的仓库移走

bash 复制代码
[root@localhost ~] cd /etc/yum.repos.d/
[root@localhost yum.repos.d] mkdir bak
[root@localhost yum.repos.d] mv *.repo bak/
[root@localhost yum.repos.d] ls
bak
vim ali.repo

2.新建aliyun仓库

bash 复制代码
[ali]
name=aliyun
#baseurl=https://mirrors.aliyun.com/centos/7/os/x86_64/                  //开启哪个都可以正常使用,这边主要解释变量的作用
baseurl=https://mirrors.aliyun.com/centos/$releasever/os/$basearch/    //变量参见主配置文件2.1小节
gpgcheck=0

[epel]                                                                //epel源仓库
name=epel
baseurl=https://mirrors.aliyun.com/centos/7/extras/x86_64/
gpgcheck=0

[update]                                                             //更新包仓库
name=update
baseurl=https://mirrors.aliyun.com/centos/7/updates/x86_64/
gpgcheck=0


#小火车
[root@centos7 ~]#yum -y install epel-release
[root@centos7 ~]#yum -y install sl
[root@centos7 ~]#sl -a


#牛
[root@localhost ~]#yum install -y install cowsay
[root@localhost ~]#cowsay hello

2.ftp方式搭建云仓库

1.服务端安装vsftp服务

bash 复制代码
systemctl stop firewalld
setenforce 0
yum install vsftpd.x86_64 -y
systemctl start vsftpd

2.服务端切换到 ftp目录下新建一个centos7目录,将光驱挂载到该目录下

bash 复制代码
cd /var/ftp/
mkdir centos7 
mount /dev/sr0 /var/ftp/centos7

3.客户端安装ftp 服务并启动关闭防火墙和selinux

bash 复制代码
 yum install ftp -y
 systemctl stop firewalld.service
 setenforce 0
 systemctl start ftp
 ftp 192.168.91.100
 #测试ftp服务是否正常

4编写yum仓库文件

bash 复制代码
vim centos7.repo
 
[centos7]
name=centos7
baseurl=ftp://192.168.91.100/centos7
gpgcheck=0

yum clean all
yum makecache

3.http方式搭建云仓库

1.服务端安装httpd服务,将光驱挂载到httpd服务文件夹下

bash 复制代码
systemctl stop firewalld
setenforce 0
yum install httpd -y
systemctl start httpd
mkdir /var/www/html/centos7
mount /dev/sr0 /var/www/html/centos7

3.客户端安装httpd服务关闭防火墙并且建立yum仓库

bash 复制代码
systemctl stop firewalld
setenforce 0
yum install httpd -y
systemctl start httpd

cd /etc/yum.repos.d
mkdir bak
mv *.repo bak
vim http.repo

[http]
name=http
baseurl=http://192.168.91.100/centos7
gpgcheck=0

yum clean all
yum makecache
相关推荐
huangyuchi.17 分钟前
【Linux】LInux下第一个程序:进度条
linux·运维·服务器·笔记·进度条·c/c++
帽儿山的枪手36 分钟前
程序员必掌握的iptables五表五链
linux·网络协议
西阳未落1 小时前
Linux(14)——库的制作与原理
linux
444A4E1 小时前
深入Linux进程优先级:Nice值与O(1)调度器原理
linux·操作系统
Jooolin1 小时前
【编程史】Git是如何诞生的?这可并非计划之中...
linux·git·ai编程
云边有个稻草人1 小时前
【Linux系统】第八节—进程概念(上)—冯诺依曼体系结构+操作系统+进程及进程状态+僵尸进程—详解!
linux·进程·冯诺依曼体系结构·pcb·僵尸进程·进程的状态·task_ struct
xian0gang2 小时前
rk3588 区分两个相同的usb相机
linux
这儿有一堆花2 小时前
安全访问家中 Linux 服务器的远程方案 —— 专为单用户场景设计
linux·服务器·安全
RussellFans2 小时前
Linux 文本三剑客(grep, awk, sed)
linux·运维·服务器
Chuncheng's blog2 小时前
CentOS 7如何编译安装升级gcc至7.5版本?
linux·运维·c++·centos