centos7下自建yum源同步阿里源仓库-搭建篇1
2020-09-29 15:37
1011 查看
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 发现安装速度还是比较快的。
相关文章推荐
- centos/debian配置gitlab 7.1x来搭建自建的git仓库.
- centos7下,搭建多仓库的svn服务器
- CentOS7下使用SonatypeNexus3搭建Docker私有仓库
- CentOS 7下YUM 本地仓库的搭建详细步骤
- CentOS7下搭建yum仓库
- CentOS 7下 YUM 本地仓库的搭建
- 新兵实战搭建CentOS7下docker+springboot项目+nginx反向代理 (三)
- CentOS 7下Mongodb副本集搭建
- CentOS 7下搭建LAMP平台环境
- CentOS7下LAMP环境的搭建
- CentOS 7下Redis的搭建
- Centos7下使用ELK(Elasticsearch + Logstash + Kibana)搭建日志集中分析平台
- Centos7下Etcd集群搭建
- CentOS7下搭建多节点Elasticsearch集群
- Linux_CentOS7下redis搭建过程记录
- CDH5.7.2-Hadoop集群CentOS7下的搭建(离线安装)
- CentOS7下Hbase分布式环境搭建
- CentOS 7 搭建docker仓库
- centos7下docker部署搭建drools-workbench7.5的几点收获
- centos 7下搭建wiki系统