当前位置:   article > 正文

银河麒麟高级服务器v10 sp1 搭建局域网yum源(同步阿里yum源centos7.9)_麒麟v10 sp1 阿里源

麒麟v10 sp1 阿里源

系统环境:

[root@localhost ~]# nkvers

############## Kylin Linux Version #################

Release:

Kylin Linux Advanced Server release V10 (Tercel

Kernel:

4.19.90-23.8.v2101.ky10.x86_64

Build:

Kylin Linux Advanced Server

release V10 (SP1) /(Tercel)-x86_64-Build20/20210518

#################################################

[root@localhost ~]# echo $LANG  

zh_CN.UTF-8 

实验环境:

Yum源仓库服务器IP地址        192.168.1.66       

Yum源测试客户端IP地址        192.168.1.15        CentOS 7.9

 

说明:

搭建内部yum源仓库有许多种类,例如file、ftp、http、https,本教程以http进行搭建内部yum源仓库

一、添加阿里云yum源并检查

mv /etc/yum.repos.d/ /tmp/yum/    

curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo

curl -o /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo

yum makecache

yum repolist

修改repo文件

[root@localhost yum.repos.d]# cat CentOS-Base.repo 

# CentOS-Base.repo

#

# The mirror system uses the connecting IP address of the client and the

# update status of each mirror to pick mirrors that are updated to and

# geographically close to the client.  You should use this for CentOS updates

# unless you are manually picking other mirrors.

#

# If the mirrorlist= does not work for you, as a fall back you can try the 

# remarked out baseurl= line instead.

#

#

 

[base]

name=CentOS-7.9.2009 - Base - mirrors.aliyun.com

failovermethod=priority

baseurl=http://mirrors.aliyun.com/centos/7.9.2009/os/x86_64/

        http://mirrors.aliyuncs.com/centos/7.9.2009/os/x86_64/

        http://mirrors.cloud.aliyuncs.com/centos/7.9.2009/os/x86_64/

gpgcheck=1

gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7

 

#released updates 

[updates]

name=CentOS-7.9.2009 - Updates - mirrors.aliyun.com

failovermethod=priority

baseurl=http://mirrors.aliyun.com/centos/7.9.2009/updates/x86_64/

        http://mirrors.aliyuncs.com/centos/7.9.2009/updates/x86_64/

        http://mirrors.cloud.aliyuncs.com/centos/7.9.2009/updates/x86_64/

gpgcheck=1

gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7

 

#additional packages that may be useful

[extras]

name=CentOS-7.9.2009 - Extras - mirrors.aliyun.com

failovermethod=priority

baseurl=http://mirrors.aliyun.com/centos/7.9.2009/extras/x86_64/

        http://mirrors.aliyuncs.com/centos/7.9.2009/extras/x86_64/

        http://mirrors.cloud.aliyuncs.com/centos/7.9.2009/extras/x86_64/

gpgcheck=1

gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7

 

#additional packages that extend functionality of existing packages

[centosplus]

name=CentOS-7.9.2009 - Plus - mirrors.aliyun.com

failovermethod=priority

baseurl=http://mirrors.aliyun.com/centos/7.9.2009/centosplus/x86_64/

        http://mirrors.aliyuncs.com/centos/7.9.2009/centosplus/x86_64/

        http://mirrors.cloud.aliyuncs.com/centos/7.9.2009/centosplus/x86_64/

gpgcheck=1

enabled=0

gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7

 

#contrib - packages by Centos Users

[contrib]

name=CentOS-7.9.2009 - Contrib - mirrors.aliyun.com

failovermethod=priority

baseurl=http://mirrors.aliyun.com/centos/7.9.2009/contrib/x86_64/

        http://mirrors.aliyuncs.com/centos/7.9.2009/contrib/x86_64/

        http://mirrors.cloud.aliyuncs.com/centos/7.9.2009/contrib/x86_64/

gpgcheck=1

enabled=0

gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7

[root@localhost yum.repos.d]# cat epel.repo 

[epel]

name=Extra Packages for Enterprise Linux 7 - x86_64

baseurl=http://mirrors.aliyun.com/epel/7/x86_64

failovermethod=priority

enabled=1

gpgcheck=0

gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7

 

[epel-debuginfo]

name=Extra Packages for Enterprise Linux 7 - x86_64 - Debug

baseurl=http://mirrors.aliyun.com/epel/7/x86_64/debug

failovermethod=priority

enabled=0

gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7

gpgcheck=0

 

[epel-source]

name=Extra Packages for Enterprise Linux 7 - x86_64 - Source

baseurl=http://mirrors.aliyun.com/epel/7/SRPMS

failovermethod=priority

enabled=0

gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7

gpgcheck=0

二、安装相关软件

yum install -y wget make cmake gcc gcc-c++ pcre-devel zlib-devel openssl openssl-devel httpd yum-utils createrepo

标注:

yum-utils:reposync同步工具

createrepo:编辑yum库工具

httpd:通过Apache软件提供web服务,也可以使用nginx

三、同步阿里云yum源软件包到本地服务器指定目录/mirror(自定义目录)

mkdir /repo

chown -R apache:apache /repo

chmod -R 755 /repo

###参数-n指下载最新软件包,-p指定目录,指定本地的源--repoid(如果不指定就同步本地服务器所有的源),下载过程比较久

reposync -n --repoid=extras --repoid=updates --repoid=base --repoid=epel -p /repo

[root@localhost /]# du -sh /repo/*

9.0G    /repo/base

17G     /repo/epel

321M    /repo/extras

3.3G    /repo/updates

四、创建仓库索引

createrepo -po /repo/base/ /repo/base/

createrepo -po /repo/extras/ /repo/extras/

createrepo -po /repo/updates/ /repo/updates/

createrepo -po /repo/epel/ /repo/epel/

五、更新数据源

createrepo --update /repo/base/

createrepo --update /repo/extras/

createrepo --update /repo/updates/

createrepo --update /repo/epel/

六、启动并配置Apache服务

systemctl start httpd

systemctl enable httpd

systemctl status httpd

[root@yumserver ~]# vim /etc/httpd/conf/httpd.conf

DocumentRoot "/repo/"

<Directory "/repo/">

    Options Indexes FollowSymLinks

    AllowOverride  None

    Order allow,deny

    Allow from all

    Require all granted

</Directory>

###修改Apache默认首页index.html,直接复制粘贴执行

cat << EOF > /usr/share/httpd/noindex/index.html

<!DOCTYPE html>

<html>

<head>

<meta charset="utf-8">

<title>CentOS 7 镜像</title>

<script>document.createElement("myHero")</script>

<style>

myHero {

        display: block;

        background-color: #ddd;

        padding: 10px;

        font-size: 20px;

</style> 

</head>

<body>

    <h1>简介</h1>

    <hr>

<p>银河麒麟V10作为国内安全等级最高的操作系统,是首款实现具有内生安全体系的操作系统,成功打破了相关技术封锁与垄断,完全有能力作为承载国家基础软件的安全基石;在生态方面,20多年的不断发展使银河麒麟V10的通用和专用应用,都已经构建了丰>富的生态系统.</p>

    <hr>

    <br>

    <br>

        <h1>CentOS 7 配置内部YUM源</h1>

    <br>

        <h2>1、备份</h2>

        <myHero>mv /etc/yum.repos.d/* /opt/yum/</myHero>

    <br>

        <h2>2、下载新的 CentOS-Base.repo 到 /etc/yum.repos.d/ </h2>

        <myHero>curl -o /etc/yum.repos.d/CentOS-Base.repo http://192.168.1.66/repo/CentOS-Base.repo</myHero>

    <br>

        <h2>3、运行 yum makecache 生成缓存</h2>

    <br>

        <h2>4、运行 yum repolist   查看已经生成缓存</h2>

    <br>

    <br>

</body>

</html>

EOF

 

七、编写yum源客户端配置文件

[root@yumserver ~]# mkdir -p /repo/repo/
###直接复制粘贴执行

cat << EOF > /repo/repo/CentOS-Base.repo

[base]

name=CentOS-$releasever - Base - 192.168.1.66

failovermethod=priority

baseurl=http://192.168.1.66/base/

enable=1

gpgcheck=0

#released updates 

[updates]

name=CentOS-$releasever - Updates - 192.168.1.66

failovermethod=priority

baseurl=http://192.168.1.66/updates/

enable=1

gpgcheck=0

 

#additional packages that may be useful

[extras]

name=CentOS-$releasever - Extras - 192.168.1.66

failovermethod=priority

baseurl=http://192.168.1.66/extras/

enable=1

gpgcheck=0

 

#additional packages that may be useful

[epel]

name=CentOS-$releasever - Epel - 192.168.1.66

failovermethod=priority

baseurl=http://192.168.1.66/epel/

enable=1

gpgcheck=0

EOF

八、客户端配置Yum源      ===>>>希望对你所帮助,博主很穷,当前页面右边点开打赏,你的支持是我无限的动力~!

curl -o /etc/yum.repos.d/CentOS-Base.repo http://192.168.1.66/repo/CentOS-Base.repo

yum makecache

客户端浏览网页http://192.168.1.66首页提示如何配置

 

本文内容由网友自发贡献,转载请注明出处:【wpsshop博客】
推荐阅读
相关标签
  

闽ICP备14008679号