搭建内网yum源服务器

fengmian

需求分析:

有时候我们的内网linux服务器是不允许上网的,但是又需要经常yum安装软件,这种情况下就可以在内网部署一台yum服务器,用于内网所有服务器的yum源。

首先介绍下安装基础(baseyum

base源一般在ISO镜像Packages文件内存放,会携带一些常用的基础的软件包;

步骤1.首先在yum服务器上安装ftp功能,这里我使用的是vsftp服务,并且开通匿名账户登陆功能

1),正常安装一台vsftp服务器

2),改配置文件

vi /etc/vsftpd/vsftpd.conf

anonymous_enable=YES

anon_root=/home/ftp/mirror

anon_upload_enable=YES

anon_mkdir_write_enable=NO

anon_other_write_enable=NO

anon_umask=022

3),mkdir /home/ftp/mirror/upload

4),chmod 777 /home/ftp/mirror/upload

5),重启vsftpd服务

6),将rhel7 OS镜像文件读取后上传至FTP的这个目录下(rpm包在Packages这个目录下)

步骤2:客户端服务器修改yum repo配置

[root@rd11 ~]# vi /etc/yum.repos.d/local.repo

[base]

name=ftp10.0.102.161.repo

baseurl=ftp://10.0.102.161/upload/rhel7.8

gpgcheck=0

enable=1

[root@rd11 ~]#yum clean all

[root@rd11 ~]#yum repolist

Loaded plugins: langpacks, product-id, search-disabled-repos, subscription-manager

This system is not registered with an entitlement server. You can use subscription-manager to register.

repo id                                                  repo name                                                              status

Server                                                   ftp10.0.102.161.repo                                                   5,231

repolist: 5,231

这样就可以正常使用了基本yum

扩展yumepel如何离线安装?

阿里官方epel镜像站:

http://mirrors.aliyun.com/epel/7/

步骤1、在yum服务器上配置添加epel的源

更新方法:

https://developer.aliyun.com/mirror/epel

vi /etc/yum.repos.d/local.repo

[base]

name=base.repo

baseurl=ftp://10.0.102.161/upload/rhel7.8

gpgcheck=0

enable=1

[epel]

name=Extra Packages for Enterprise Linux 7 – $basearch

baseurl=https://mirrors.aliyun.com/epel/7/$basearch

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 – $basearch – Debug

baseurl=https://mirrors.aliyun.com/epel/7/$basearch/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 – $basearch – Source

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

failovermethod=priority

enabled=0

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

gpgcheck=0

yum clean all

yum repolist

步骤2、下载安装制作工具包

 yum install yum-utils createrepo xorriso

步骤3、把epel源中的rpm包下载到本地(目前有13609个rpm包),这个时间会比较久

 reposync -r epel -p /data/epel/

步骤4、制作本地仓库

 createrepo -v /data/epel

/data/epel cpftp路径下

步骤5、客户端配置:

[root@rd11 ~]# vi /etc/yum.repos.d/local.repo

[base]

name=base.repo

baseurl=ftp://10.0.102.161/upload/rhel7.8

gpgcheck=0

enable=1

[epel]

name=epel.repo

baseurl=ftp://10.0.102.161/upload/epel

gpgcheck=0

enable=1

yum clean all

yum repolist

这样epel源就可以用了

搭建内网yum源服务器

发表回复

滚动到顶部