2

A standard install with a kickstart file on fedora or centos just installs the packages from the install repository, which are usually outdated after some days after the release of a new fedora/centos version. So installing a fedora/centos always requires a %post section in the kickstart file where you would call a dnf/yum update -y in order to upgrade the old and outdated packages. This is a waste of time and bandwidth and the dnf/yum installer can use multiple repositories at the same time and pick the latest version.

How can I tell anaconda during a fresh install to include the "updates" repository for installation, so that a yum/dnf update -y afterwards is not required, as the updates woud already be installed?

0xSheepdog
  • 2,742
  • 1
  • 20
  • 31
Mandragor
  • 1,050
  • 3
  • 13
  • 22
  • Did you try the `repo` option of [kickstart](https://www.centos.org/docs/5/html/Installation_Guide-en-US/s1-kickstart2-options.html)? – Thomas Sep 17 '17 at 09:59
  • oh my, not sure why i did overlook this option - will try this. Thanks – Mandragor Sep 17 '17 at 11:00

2 Answers2

2

In any recent version of Fedora, Anaconda comes with built-in configuration for the updates repo. So you should be able to enable updates in a Fedora install just by adding the line:

repo --name=updates

to your kickstart. From the kickstart documentation of the repo command:

By default, anaconda has a configured set of repos taken from /etc/anaconda.repos.d plus a special Installation Repo in the case of a media install. The exact set of repos in this directory changes from release to release and cannot be listed here. There will likely always be a repo named “updates”.

Note: If you want to enable one of the repos in /etc/anaconda.repos.d that is disabled by default (like “updates”), you should use –name= but none of the other options. anaconda will look for a repo by this name automatically. Providing a baseurl or mirrorlist URL will result in anaconda attempting to add another repo by the same name, which will cause a conflicting repo error.

That shortcut should work fine in CentOS 7 (thanks to @maxschlepzig in the comments for checking!). If you have to deal with something older you should still be able to add the updates repo manually with a more complete repo command:

repo --name=centos-updates --mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates

That would enable the CentOS updates repo (with full mirror support!) during the install.

wwoods
  • 1,226
  • 10
  • 10
  • 1
    would be wonderful for completion sake to know which one actually worked.. – Alex R Nov 30 '18 at 14:30
  • @AlexR, I've just tested `repo --name=updates` with `CentOS-7-x86_64-NetInstall-1810.iso` and it *does work*. That means the `ks.cfg` is accepted and a `yum update` after first reboot doesn't want to update anything. – maxschlepzig Jan 18 '19 at 16:06
0

For those coming to this question hoping for a solution that works with CentOS 8.x, I found adding these lines will do the trick:

repo --name=centos-updates --mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=BaseOS --cost=1000
repo --name=appstream-updates --mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=AppStream --cost=1000
repo --name=extras-updates --mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=Extras --cost=1000

The same should work with RHEL 8, with appropriate modifications and system registration, etc...

kronenpj
  • 314
  • 1
  • 4