centos7下自建yum源同步阿里源仓库-搭建篇1
内容导读
互联网集市收集整理的这篇技术教程文章主要介绍了centos7下自建yum源同步阿里源仓库-搭建篇1,小编现在分享给大家,供广大互联网技能从业者学习和参考。文章包含1796字,纯文字阅读大概需要3分钟。
内容图文
![centos7下自建yum源同步阿里源仓库-搭建篇1](/upload/InfoBanner/zyjiaocheng/936/e4e7a92b37314b90ba044f48c01d93a3.jpg)
yum源服务端配置工作
一、安装必要的软件
yum install -y wget make cmake gcc gcc-c++ &&yum install -y pcre-devel lib zlib-devel openssl openssl-devel createrepo yum-util
安装nginx ,一会需要对外提供http服务。
yum -y install nginx
二、创建索引
下一步将nginx的根目录配置为索引根目录/opt/yum/centos/7/os/。
mkdir /opt/yum/centos/7/os/x86_64/
createrepo /opt/yum/centos/7/os/x86_64/
三、 nginx配置如下:
cat /etc/nginx/conf.d/yum.conf
server {
listen 9000 default_server;
server_name _;
root /opt/yum/centos/7/os/; ##这里
# 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 {
}
}
四、设置阿里云镜像为本地yum源
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
#yum repolist查看yum仓库标识
五、同步base源到自建的yum仓库地址
reposync -r base -p /opt/yum/centos/7/os/
同理,可以同步epel源到自建仓库目录
reposync -r epel -p /opt/yum/centos/7/os/
六、上述同步完成以后,更新仓库索引
createrepo --update /opt/yum/centos/7/os/base/
createrepo --update /opt/yum/centos/7/os/epel/
此时yum源仓库配置完成。
客户端机器测试自建yum源
1.客户端服务器配置/etc/yum.repos.d目录的repo仓库
cp -rp /etc/yum.repos.d /etc/yum.repos.d.bak
rm -rf /etc/yum.repos.d/*
#新建编辑base和epel的仓库文件
#cat smcaiot-base.repo
[smcaiot-base]
name=centos-base
baseurl=http://192.168.101.21:9000/base/
enabled=1
gpgcheck=0
#cat smcaiot-epel.repo
[smcaiot-epel]
name=smcaiot-epel
baseurl=http://192.168.101.21:9000/epel/
enabled=1
gpgcheck=0
2.清理缓存
yum clean all && yum makecache
3.测试yum安装,比如 yum -y install htop 发现安装速度还是比较快的。
内容总结
以上是互联网集市为您收集整理的centos7下自建yum源同步阿里源仓库-搭建篇1全部内容,希望文章能够帮你解决centos7下自建yum源同步阿里源仓库-搭建篇1所遇到的程序开发问题。 如果觉得互联网集市技术教程内容还不错,欢迎将互联网集市网站推荐给程序员好友。
内容备注
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 gblab@vip.qq.com 举报,一经查实,本站将立刻删除。
内容手机端
扫描二维码推送至手机访问。