Your power for portable builds!
Surviving on CentOS 7 in 2025.
The first thing you will encounter when installing a standard CentOS 7 image with a minimal setup:
# yum update
Loaded plugins: fastestmirror
Determining fastest mirrors
Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=os&infra=stock error was
14: curl#6 - "Could not resolve host: mirrorlist.centos.org; Unknown error"
One of the configured repositories failed (Unknown),
and yum doesn't have enough cached data to continue. At this point the only
safe thing yum can do is fail. There are a few ways to work "fix" this:
1. Contact the upstream for the repository and get them to fix the problem.
2. Reconfigure the baseurl/etc. for the repository, to point to a working
upstream. This is most often useful if you are using a newer
distribution release than is supported by the repository (and the
packages for the previous distribution release still work).
3. Run the command with the repository temporarily disabled
yum --disablerepo=`repoid` ...
4. Disable the repository permanently, so yum won't use it by default. Yum
will then just ignore the repository until you permanently enable it
again or use --enablerepo for temporary usage:
yum-config-manager --disable `repoid`
or
subscription-manager repos --disable=`repoid`
5. Configure the failing repository to be skipped, if it is unavailable.
Note that yum will try to contact the repo. when it runs most commands,
so will have to try and fail each time (and thus. yum will be be much
slower). If it is a very temporary problem though, this is often a nice
compromise:
yum-config-manager --save --setopt=`repoid`.skip_if_unavailable=true
Cannot find a valid baseurl for repo: base/7/x86_64
- first of all, download the full distribution
https://vault.centos.org/7.9.2009/isos/x86_64/CentOS-7-x86_64-Everything-2207-02.iso
- we perform a standard installation using this image
- we check our IP using the command:
hostname -I
- logging in via SSH
- we connect our image:
mkdir -p /mnt/disc
mount /dev/sr0 /mnt/disc
or if a local image:
mount -o loop RHEL7.9.iso /mnt/disc
- adding the image as a repository:
cp /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/centosdvd.repo
then edit /etc/yum.repos.d/centosdvd.repo:
[LocalRepo]
name=LocalRepository
baseurl=file:///mnt/disc
enabled=1
gpgcheck=0
- we are disabling the repository from the setup /etc/yum.repos.d/CentOS-Base.repo, set enabled=0 everywhere
then:
yum update
- we check, for example, install nano with:
yum install nano
- we install epel-release and ius-release (
https://ius.io/)
yum install https://dl.fedoraproject.org/pub/archive/epel/7/x86_64/Packages/e/epel-release-7-14.noarch.rpm
yum install -y yum-utils
yum-config-manager --add-repo https://vault.ius.io/el7/x86_64/
then:
yum update
there should be something like:
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
epel/x86_64/metalink | 5.1 kB 00:00:00
* epel: d2lzkl7pfhq30w.cloudfront.net
epel | 4.3 kB 00:00:00
ius | 1.3 kB 00:00:00
(1/4): epel/x86_64/group | 399 kB 00:00:00
(2/4): ius/x86_64/primary | 40 kB 00:00:00
(3/4): epel/x86_64/updateinfo | 1.0 MB 00:00:00
(4/4): epel/x86_64/primary_db | 8.7 MB 00:00:02
ius 159/159
No packages marked for update
Now you can build software for most distributions!