LoginSignup
0
0

RPMリポジトリサーバ構築

Last updated at Posted at 2024-01-08

今回のただのパクり
https://www.server-world.info/query?os=CentOS_8&p=localrepo

あとから気づいたがこんな記事もある
https://shimmydays.com/1340/

今回のrpm全量を自分のPC側に置くのでディスクサイズが結構いきました。
100GB程度消費しました。

[root@parent ~]# du -sh /var/www/repos/
104G    /var/www/repos/
[root@parent ~]#

リポジトリサーバ(自分のPCのリポジトリサーバparent)にはhttpdサーバの設定を有効(当然FirewalldとSelinuxは無効)

[root@parent ~]# cat /etc/httpd/conf.d/repos.conf
Alias /repos /var/www/repos
<directory /var/www/repos>
    Options +Indexes
    Require all granted
</directory>
[root@parent ~]#

リポジトリサーバ側からtcpdumpを実行してみると
Content-Typeが 「application/x-rpm」になっていました。

   HTTP/1.1 200 OK
        Date: Mon, 08 Jan 2024 05:46:52 GMT
        Server: Apache/2.4.37 (CentOS Stream)
        Last-Modified: Sat, 30 Dec 2023 12:58:49 GMT
        ETag: "26b87-60db9b5c2a63b"
        Accept-Ranges: bytes
        Content-Length: 158599
        Content-Type: application/x-rpm

クライアント側の設定は以下の3つになります。

[root@child ~]# cat /etc/yum.repos.d/CentOS-Stream-BaseOS.repo
# CentOS-Stream-BaseOS.repo
#
# The mirrorlist system uses the connecting IP address of the client and the
# update status of each mirror to pick current mirrors that are 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, you can try the commented out
# baseurl line instead.

[baseos]
name=CentOS Stream $releasever - BaseOS
#mirrorlist=http://mirrorlist.centos.org/?release=$stream&arch=$basearch&repo=BaseOS&infra=$infra
#baseurl=http://mirror.centos.org/$contentdir/$stream/BaseOS/$basearch/os/
baseurl=http://192.168.2.130/repos/centos/$releasever/$basearch/os/baseos/
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
[root@child ~]#
[root@child ~]# cat /etc/yum
yum/         yum.conf     yum.repos.d/
[root@child ~]# cat /etc/yum.repos.d/CentOS-Stream-AppStream.repo
# CentOS-Stream-AppStream.repo
#
# The mirrorlist system uses the connecting IP address of the client and the
# update status of each mirror to pick current mirrors that are 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, you can try the commented out
# baseurl line instead.

[appstream]
name=CentOS Stream $releasever - AppStream
#mirrorlist=http://mirrorlist.centos.org/?release=$stream&arch=$basearch&repo=AppStream&infra=$infra
#baseurl=http://mirror.centos.org/$contentdir/$stream/AppStream/$basearch/os/
baseurl=http://192.168.2.130/repos/centos/$releasever/$basearch/os/appstream/
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
[root@child ~]#
[root@child ~]# cat /etc/yum.repos.d/CentOS-Stream-
CentOS-Stream-AppStream.repo         CentOS-Stream-Debuginfo.repo         CentOS-Stream-HighAvailability.repo  CentOS-Stream-PowerTools.repo
CentOS-Stream-BaseOS.repo            CentOS-Stream-Extras.repo            CentOS-Stream-Media.repo             CentOS-Stream-RealTime.repo
[root@child ~]# cat /etc/yum.repos.d/CentOS-Stream-Extras.repo
# CentOS-Stream-Extras.repo
#
# The mirrorlist system uses the connecting IP address of the client and the
# update status of each mirror to pick current mirrors that are 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, you can try the commented out
# baseurl line instead.

[extras]
name=CentOS Stream $releasever - Extras
#mirrorlist=http://mirrorlist.centos.org/?release=$stream&arch=$basearch&repo=extras&infra=$infra
#baseurl=http://mirror.centos.org/$contentdir/$stream/extras/$basearch/os/
baseurl=http://192.168.2.130/repos/centos/$releasever/$basearch/os/extras/
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
[root@child ~]#
[root@child ~]#
[root@child ~]#
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0