服务端
1.安装createrepo
yum install createrepo
2.安装nginx
yum install nginx
3.配置
- 创建repo包存放目录
mkdir -p /opt/yum/centos/7/os/x86_64
- 修改nginx目录
server {
listen 80 default_server;
listen [::]:80 default_server;
server_name _;
root /opt/yum; ##这里
# Load configuration files for the default server block.
include /etc/nginx/default.d/*.conf;
location / {
##这里
autoindex on;
autoindex_exact_size off;
autoindex_localtime on;
index index.html;
}
error_page 404 /404.html;
location = /40x.html {
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
}
}
- 下载需要的包入repo目录
yum install –downloadonly –downloaddir=/opt/yum/centos/7/os/x86_64/ tcpdump
- 创建源
createrepo /opt/yum/centos/7/os/x86_64/
注:加入新包后需要重新生成源
- 创建客户端使用的k8s.repo文件
[k8s-base]
name=k8s-$releasever
baseurl=http://192.168.82.200/centos/ releasever/os/ basearch/
gpgcheck=0
gpgkey=
客户端
wget -O /etc/yum.repos.d/k8s.repo http://192.168.82.200/k8s.repo