openSUSE:Expert Installation

Jump to: navigation, search
This wiki article is based on the following blogpost.

This page explains one way of installing openSUSE without using YaST. It is similar to the default installation methods of Arch or Gentoo.

Preparation

First we will get the current Tumbleweed live ISO:

wget https://download.opensuse.org/tumbleweed/iso/openSUSE-Tumbleweed-GNOME-Live-x86_64-Current.iso

You could also choose the rescue ISO (The rescue OS from the NET install iso for Tumbleweed does not contain zypper - release from 2023-03-23). Basically any ISO that provides zypper will work. Burn this to a disk, put it on a thumb drive (e.g. dd if=$ISO of=/dev/sdX bs=1M) or feed it to your virtual machine manager (e.g. qemu-img create vm.img 10G && qemu-kvm -cdrom $ISO -drive file=vm.img,format=raw,if=virtio -m 1500 ) .

Preparing the disks

First, you need to locate the disk you want to install to. In the examples below, we will assume a VM with virtio and legacy BIOS that uses /dev/vda, but on a physical machine, you would have /dev/sda or /dev/nvme0n1 instead for the first SATA or NVMe disk. If you use UEFI instead of legacy BIOS, you need a /boot/efi partition formatted as vfat with mkdosfs and use grub2-efi later.

We will use a simple setup as an example, consisting of 3 partitions.

If you would like to use the default btrfs layout of openSUSE including subvolumes you might want to take a look at this blogpost.

Let’s start: fdisk /dev/vda

Creating a disk label

Type p <Enter> to print the current layout. In your example we will assume it’s an empty disk. You might want to use d to remove existing partitions.

Create a new disklabel by typing o.

The boot partition

Press n <Enter> p <Enter> 1 <Enter> <Enter> +256M <Enter> to create a new 256MB boot partition.

Swap

If you do not plan to use hibernate (aka suspend-to-disk), you can use as little as 200MB swap

Press n <Enter> p <Enter> 2 <Enter> <Enter> +4GB <Enter> t <Enter> 2 <Enter> 82 <Enter> to create a new 4GB swap partition and set it to the correct type.

Root

Press n <Enter> p <Enter> 3 <Enter> <Enter> <Enter> to create the root partition that will use the remaining disk space.

Press p <Enter> to check the result:

 Command (m for help): p Disk /dev/vda: 30 GiB, 32212254720 bytes, 62914560 sectors
 Units: sectors of 1 * 512 = 512 bytes
 Sector size (logical/physical): 512 bytes / 512 bytes
 I/O size (minimum/optimal): 512 bytes / 512 bytes
 Disklabel type: dos Disk identifier: 0x7363fb58
 Device Boot Start End Sectors Size Id Type
 /dev/vda1 2048 8390655 8388608 4G 83 Linux
 /dev/vda2 8390656 16779263 8388608 4G 82 Linux swap / Solaris
 /dev/vda3 16779264 62914559 46135296 22G 83 Linux

If everything looks fine use w to apply the changes.

Formatting

To learn more about partitions and formatting them, check out the dedicated wiki page.

We will use ext4 as our filesystems for the /boot and / partition:

 mkfs.ext4 -L boot /dev/vda1
 mkfs.ext4 -L root /dev/vda3
 mkswap -L swap /dev/vda2
 swapon /dev/vda2

Mounting the partitions

The --make-rslave operations are only needed for systemd.
mkdir -p /mnt/os
mount /dev/vda3 /mnt/os
mkdir /mnt/os/boot
mount /dev/vda1 /mnt/os/boot/

mkdir /mnt/os/{proc,sys,dev,run}

mount --types proc /proc /mnt/os/proc
mount --rbind /sys /mnt/os/sys
mount --make-rslave /mnt/os/sys
mount --rbind /dev /mnt/os/dev
mount --make-rslave /mnt/os/dev
mount --bind /run /mnt/os/run
mount --make-slave /mnt/os/run

Installing a base system

I’ll install some packages that I’ll need. You might not want vim or man.

zypper --root /mnt/os ar --refresh https://download.opensuse.org/tumbleweed/repo/oss/ oss
zypper --root /mnt/os in kernel-default grub2 zypper bash man vim shadow util-linux
zypper --root /mnt/os in --no-recommends NetworkManager

Chrooting

Now we will chroot to work in the new environment.

chroot /mnt/os /bin/bash
source /etc/profile
export PS1="(chroot) ${PS1}"

Editing fstab

Let’s use vim to edit /etc/fstab with our disks:

LABEL=boot   /boot        ext4    defaults,noatime     0 2
LABEL=swap   none         swap    sw                   0 0
LABEL=root   /            ext4    noatime              0 1

Install grub

dracut -f
localhost:/ # grub2-install /dev/vda
Installation finished. No error reported.

grub2-mkconfig > /boot/grub2/grub.cfg
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-5.17.3-1-default
Warning: os-prober will not be executed to detect other bootable partitions.
Systems on them will not be added to the GRUB boot configuration.
Check GRUB_DISABLE_OS_PROBER documentation entry.
done

passwd

Booting into the installation

Now we are ready to restart and boot into our new installation:

exit
umount -l /mnt/os/dev{/shm,/pts,}
umount -R /mnt/os
reboot

Final steps

Let’s enable NetworkManager so we can access the internet: systemctl enable --now NetworkManager. It might be that you need to edit /etc/resolv.conf for name resolution.

If you want to keep your system minimal edit /etc/zypp/zypp.conf and change the solver line to: solver.onlyRequires = true.

To make your life easier I would suggest to install some minimal pattern and not install really from scratch. To decide which one look what you have available using: zypper se -t pattern.

basic_desktop, gnome_basic, minimal_base or sway might all be good choices depending on what you like.

Now let’s add a user and be done:

useradd -m geeko
usermod -aG users geeko
passwd geeko