0

I have CentOS 7 and would like to install a chroot environment of OpenSUSE Leap for testing.

How do I do that?

2 Answers 2

1
yum install mock
mock -r opensuse-leap-15.3-x86_64 shell

or if you want to build package for Leap

mock -r opensuse-leap-15.3-x86_64 your_package.src.rpm

List of configs you can use as chroot is in /etc/mock/

0

First create a repo file in CentOS:

===> cat /etc/yum.repos.d/opensuse-leap-15.3.repo 
[opensuse-leap-15.3]
name=OpenSUSE Leap 15.3
baseurl=https://download.opensuse.org/distribution/leap/15.3/repo/oss/
enabled=0
gpgcheck=0
#gpgkey=

Make the chroot and RPM directory

mkdir /mnt/opensuse-leap-15.3
mkdir /mnt/opensuse-leap-15.3/var/lib/rpm -p

Mount /dev, proc, and sysfs

for i in proc sys dev; do
  mkdir -p /mnt/opensuse-leap-15.3/$i
  mount --bind /$i /mnt/opensuse-leap-15.3/$i
done

Initialize the RPM database

rpm --root /mnt/opensuse-leap-15.3 --initdb

Deploy!

yum --disablerepo=\* --enablerepo=opensuse-leap-15.3 --installroot=/mnt/opensuse-leap-15.3 install aaa_base rpm-repos-openSUSE-Leap bash zypper util-linux

Get inside the chroot:

chroot /mnt/opensuse-leap-15.3 /bin/su -
el7-dev:~ # 

The rest of these commands are inside the chroot:

Setup DNS:

echo nameserver 1.1.1.1 > /etc/resolv.conf

Add the zypper repos:

rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-openSUSE

zypper ar -r /etc/yum.repos.d/opensuse-leap-oss.repo

Here are a few other nice-to-have packages:

zypper install vim openssl ca-certificates wget curl

You may wish to import the RPM signing keys:

rpm --import https://download.opensuse.org/distribution/leap/15.3/repo/oss/gpg-pubkey-3dbdc284-53674dd4.asc
rpm --import https://download.opensuse.org/distribution/leap/15.3/repo/oss/gpg-pubkey-39db7c82-5847eb1f.asc
rpm --import https://download.opensuse.org/distribution/leap/15.3/repo/oss/gpg-pubkey-307e3d54-5aaa90a5.asc
rpm --import https://download.opensuse.org/distribution/leap/15.3/repo/oss/gpg-pubkey-65176565-59787af5.asc

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .