Table of Contents
1 CentOS 7との違い
CentOS Streamより前の変更について記載する。
1.1 パッケージ管理ツールがyumからdnfへ
dnfはFedora 22から導入されている。yumと引数等で互換性がある。yumはdnfへのシンボリックリンクになっており、yumのままでもCentOS 7と同様に使うことができる。
- yum-builddepはdnf builddepに置き換わった。dnf builddepはプラグインとして dnf-plugins-coreパッケージにて提供される。
- debuginfo-installはdnf debuginfo-installに置き換わった。 dnf debuginfo-installはプラグインとしてdnf-plugins-coreパッケージにて提供される。
1.2 複数バージョン・複数アーキテクチャのdebuginfoと/usr/bin/.build-id
/path/to/binaryというバイナリのBuild IDがxxyyである場合、CentOS 7では以下の通りであった。GDBはBuild IDからバイナリのdebuginfoの場所を導き出す。
- /usr/lib/debug/.build-id/xx/yy.debugは/usr/lib/debug/path/to/binary.debug へのシンボリックリンク。
- /usr/lib/debug/.build-id/xx/yyは/path/to/binaryへのシンボリックリンク。 /usr/lib/.debugは存在しない。
CentOS 8では以下の通りになる(FedoraのParallelInstallableDebuginfoを参照)。
- /usr/lib/debug/.build-id/xx/yy.debugは /usr/lib/debug/path/to/binary-version.arch.debugへのシンボリックリンク(例えば/usr/lib/debug/usr/bin/bash-4.4.20-1.el8_4.x86_64.debug)。これにより、複数のバージョン、複数のアーキテクチャのdebuginfoを同時にインストールできる。
- /usr/lib/debug/.build-id/xx/yyは/usr/lib/.build-id/xx/yyへのシンボリックリンク。/usr/lib/.debug/xx/yyは/path/to/binaryへのシンボリックリンク。例えば、複数のマシンで共有される/usr/lib/debugをNFSマウントしているとして、 /path/to/binaryの名前を変更したい場合、これまでは/usr/lib/debug/.build-id のシンボリックリンクを変更する必要があったが、/usr/lib/debugはそのままで、 /usr/lib/.build-idのシンボリックリンクを変更すれば良くなった。
-
rpmに/usr/lib/.build-idを含めたくない場合はSPECファイルに以下を記述する(あるいはrpmbuildeの–defineオプションで指定する)。
%define _build_id_links none
1.3 リポジトリの変更
EPELとRPM Fusionは従来通り。
$ sudo dnf install -y epel-release$ sudo dnf install -y rpmfusion-free-release
CentOS 7のリポジトリは以下の通りであった。
$ ls /etc/yum.repos.d # CentOS 7CentOS-Base.repo CentOS-SCLo-scl-rh.repo entOS-fasttrack.repoCentOS-CR.repo CentOS-SCLo-scl.repo epel-testing.repoCentOS-Debuginfo.repo CentOS-Sources.repo epel.repoCentOS-Media.repo CentOS-Vault.repo
CentOS 8では以下の通りである。RHEL 8でパッケージのマニフェストが大きく変更されたようだ。
$ ls /etc/yum.repos.d # CentOS 8CentOS-Linux-AppStream.repo CentOS-Linux-Plus.repoCentOS-Linux-BaseOS.repo CentOS-Linux-PowerTools.repoCentOS-Linux-ContinuousRelease.repo CentOS-Linux-Sources.repoCentOS-Linux-Debuginfo.repo epel-modular.repoCentOS-Linux-Devel.repo epel-playground.repoCentOS-Linux-Extras.repo epel-testing-modular.repoCentOS-Linux-FastTrack.repo epel-testing.repoCentOS-Linux-HighAvailability.repo epel.repoCentOS-Linux-Media.repo
PowerToolsリポジトリを有効にする場合は以下を実行する(あるいは /etc/yum.repos.d/CentOS-Linux-PowerTools.repoにてenabledを1にする)。
$ sudo dnf config-manager –set-enabled powertools
リポジトリの一覧は以下で確認できる。
$ dnf repolist # –enabled$ dnf repolist –disabled$ dnf repolist –all
1.4 いくつかのxxx-develパッケージがない
xxx-develパッケージの多くはPowerToolsリポジトリにある。xxx-develパッケージにはCの場合はincludeファイルが含まれる。
問題はPow
erToolsリポジトリにもないパッケージがあること。xxx-develパッケージはxxxパッケージ作成時に生成されているが、リポジトリに格納されていない。
つまり、xxx-develパッケージパッケージが提供するincludeファイルを利用するアプリケーションはビルドできない。また、dnf builddepがxxx-develパッケージを見つけられず、src.rpmのビルド環境を整えることができない。
$ for repo in cr devel fasttrack ha plus powertools; do sudo dnf config-manager –set-enabled “$repo”;done$ sudo dnf builddep emacsenabling appstream-source repositoryenabling baseos-source repositoryenabling extras-source repositoryenabling plus-source repositoryenabling epel-modular-source repositoryenabling epel-source repositoryLast metadata expiration check: 0:00:10 ago on Tue 22 Jun 2021 07:15:07 PM JST.Package desktop-file-utils-0.23-8.el8.x86_64 is already installed.Package bzip2-1.0.6-26.el8.x86_64 is already installed.Package gzip-1.9-12.el8.x86_64 is already installed.Package glibc-devel-2.28-151.el8.x86_64 is already installed.Package cairo-1.15.12-3.el8.x86_64 is already installed.Package libjpeg-turbo-1.5.3-10.el8.x86_64 is already installed.No matching package to install: ‘libotf-devel’No matching package to install: ‘m17n-lib-devel’Not all dependencies satisfiedError: Some packages could not be found.
いまのところxxxパッケージをrpmbuildでビルドして、xxx-develパッケージをインストールするしかない。
#!/bin/sh -esudo dnf install -y dnf-plugins-core rpmdevtools makesudo dnf config-manager –set-enabled powertoolsfor build_requires in libotf m17n-db m17n-lib; do dnf download –source ${build_requires} sudo dnf builddep -y ./${build_requires}* rpmbuild –rebuild –define “debug_package %{nil}” ./${build_requires}* sudo dnf localinstall -y $(find rpmbuild/RPMS/ -name “*.rpm”) rm -rf ~/rpmbuilddonednf download –source emacssudo dnf builddep -y emacs*rpmbuild –rebuild –define “debug_package %{nil}” emacs*
1.5 EOLが2029年末から2021年に変更され、ローリングリリースのCentOS Streamへ
CentOS 7のEOLは2024年。CentOS 8の方が先にEOLを迎える。
CentOSはローリングリリースとなるCentOS Streamへ変更される。RedHatに対してアップストリームとなる立ち位置になる。ローリングリリースと固定リリースのバージョンがあるOpenSUSEと同様になる。
2 CentOS Stream
CentOS Stream 8のEOLは2024年5月31日。いくつかのxxx-develがないのはCentOS 8と同様。
2021年6月22日現在、dnf repolistにsrc.rpm用とdebuginfo用のリポジトリがない。 dnf builddepとdnf debuginfo-installが使えない。
src.rpmとdebuginfoはこちらにあるので、src.rpmとdebuginfoは取得できるが、手間が掛かる。dnf repolistに加えて欲しい。
- [CentOS-devel] Questions regarding CS8
- 0017951: Missing source code for CentOS 8-stream
src.rpmのgitリポジトリがあるのはとても良い。これはdnfと同様にCentOS 7と比べて良くなった点のひとつ。
src.rpmのリポジトリがない現在、emacsをビルドしようとすると以下のようになる。
#!/bin/sh -esudo dnf install -y dnf-plugins-core rpmdevtools makesudo dnf config-manager –set-enabled powertoolsmkdir -p ~/src/git.centos.orgcd ~/src/git.centos.orgfor build_requires in libotf m17n-db m17n-lib; do rm -rf ~/rpmbuild/ mkdir ~/rpmbuild git clone {build_requires} cp -a ${build_requires}/* ~/rpmbuild/ sudo dnf builddep -y ~/rpmbuild/SPECS/*.spec mkdir -p ~/rpmbuild/SOURCES/ spectool -g -R ~/rpmbuild/SPECS/*.spec rpmbuild -ba –define “debug_package %{nil}” ~/rpmbuild/SPECS/*.spec sudo dnf localinstall -y $(find ~/rpmbuild/RPMS/ -name “*.rpm”)donerm -rf ~/rpmbuild/mkdir ~/rpmbuildgit clone -a emacs/* ~/rpmbuild/sudo dnf builddep -y ~/rpmbuild/SPECS/*.specmkdir -p ~/rpmbuild/SOURCES/spectool -g -R ~/rpmbuild/SPECS/*.specrpmbuild -ba –define “debug_package %{nil}” ~/rpmbuild/SPECS/*.specsudo dnf localinstall -y $(find ~/rpmbuild/RPMS/ -name “*.rpm”)
3 CentOS 8の代替えディストリビューション
2021年6月22日現在だとAlma Linuxが良さげ。CentOS 8とほぼ同じになっている(2021年3月30日にリリース)。
Alma Linuxに比べてRocky Linuxは開発が遅れているようで、src.rpm用のリポジトリにつながらない(2021年6月22日にリリース)。
サーバを数台持っているだけならRedHat 8の開発者用サブスクリプションを利用するのもありかもしれない。
]]> tagPlaceholderカテゴリ: ja, centos-8, 202107