カスタムkickstart .isoでシステムファイルを変更できますか?

カスタムkickstart .isoでシステムファイルを変更できますか?

CentOS 7のKickstart .isoインストールを設定しましたが、正しくインストールされました(.isoは内部のks.cfgファイルでコンパイルされました)。

まだ理解していないのは、isoインストールでシステムファイルを編集して、プロキシ設定を含む/etc/profile.d/proxy.shファイルを作成し、後で次のことができるかどうかです。自分で更新するようにいくつかのyumコマンドを渡します(このフォーラムで読んだものですが、yumはプロキシ設定なしでは何もできません)。

ks.cfgファイルの%postセクションのコマンドを端末に入力したかのように単純に渡そうとしましたが、何もしないので、どのように機能するのかわかりません。

これは可能ですか?それともこのためにAnsibleを自動化する必要がありますか?

次の%post部分を試しました。

%post
touch /etc/profile.d/proxy.sh
echo 'Proxy info' >> /etc/profile.d/proxy.sh
yum install whatever
%end

しかし、技術的にはシステム自体ではなくインストールメディアにあるので、このようなコマンドを実行できないと思います。

ベストアンサー1

私にとってうまくいきます。

私は次の起動設定を使用しました。

text
url --url=http://mirror.facebook.net/centos/8-stream/BaseOS/x86_64/os/

keyboard --vckeymap=us --xlayouts='us'
lang en-US.UTF-8
network --bootproto=dhcp --ipv6=auto --activate
firewall --enabled --service=ssh
timezone US/Eastern --isUtc
selinux --enforcing
bootloader --location=mbr
clearpart --all --initlabel
autopart
reboot --eject

rootpw --plaintext secret

%packages
@Core
%end

%post
echo 'Proxy info' >> /etc/profile.d/proxy.sh
%end

次のようにテストしました。

$ virt-install --name centos8-stream -r 4096 \
  --disk pool=default,size=10 \
  --os-variant centos8 \
  --location http://mirror.facebook.net/centos/8-stream/BaseOS/x86_64/os/ \
  -w network=default \
  --graphics=none \
  --console pty,target_type=serial \
  --initrd-inject ks.cfg \
  --extra-args='inst.ks=file:/ks.cfg console=ttyS0,115200n8'

システムが起動すると、ファイルは期待どおりに存在します。

CentOS Stream 8
Kernel 4.18.0-373.el8.x86_64 on an x86_64

localhost login: root
Password:
Last login: Thu Apr 14 22:46:23 on ttyS0
-bash: Proxy: command not found
[root@localhost ~]# cat /etc/profile.d/proxy.sh
Proxy info

他の動作が見られる場合は、その動作を再現する例を投稿していただければ詳しく見てみましょう。

おすすめ記事