User:Moggers87/Installing Opensuse: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
| Line 54: | Line 54: | ||
===Copy in resolv.conf=== | ===Copy in resolv.conf=== | ||
# cp -v /etc/resolv.conf /target/etc/ | |||
<syntaxhighlight lang="text"> | |||
root@rescue:~# cp -v /etc/resolv.conf /target/etc/ | |||
</syntaxhighlight> | |||
===Set up Zypper repoes=== | ===Set up Zypper repoes=== | ||
<syntaxhighlight lang="text"> | |||
root@rescue:~# mkdir -p /target/etc/zypp/repos.d/ | |||
root@rescue:~# cat <<-EOF > /target/etc/zypp/repos.d/repo-oss.repo | |||
[repo-oss] | [repo-oss] | ||
name=Main Repository | name=Main Repository | ||
| Line 68: | Line 73: | ||
keeppackages=0 | keeppackages=0 | ||
EOF | EOF | ||
# | root@rescue:~# cat <<-EOF > /target/etc/zypp/repos.d/repo-update.repo | ||
[repo-update] | |||
name=Main Update Repository | |||
enabled=1 | |||
autorefresh=1 | |||
baseurl=http://download.opensuse.org/update/leap/\$releasever/oss | |||
path=/ | |||
type=rpm-md | |||
keeppackages=0 | |||
EOF | |||
</syntaxhighlight> | |||
===Install Zypper=== | ===Install Zypper=== | ||
# | <syntaxhighlight lang="text"> | ||
root@rescue:~# zypper --releasever=15.3 -R /target install zypper | |||
</syntaxhighlight> | |||
=== | You'll be prompted to trust various GPG keys and confirm that you want to install the zypper package and its dependencies. | ||
# | |||
===Enter chroot=== | |||
# | |||
Mount <code>/dev</code> and some other things needed by the chroot: | |||
# | <syntaxhighlight lang="text"> | ||
root@rescue:~# mount -v --bind /dev /target/dev | |||
# | root@rescue:~# mount -v --bind /dev /target/dev | ||
root@rescue:~# mount -v -t proc procfs /target/proc | |||
# | root@rescue:~# mount -v -t sysfs sysfs /target/sys | ||
</syntaxhighlight> | |||
# | |||
Enter the chroot: | |||
# | <syntaxhighlight lang="text"> | ||
root@rescue:~# chroot /target /bin/bash | |||
</syntaxhighlight> | |||
===Install base packages=== | |||
Install some base packages for first boot: | |||
<syntaxhighlight lang="text"> | |||
root@rescue:~# zypper --releasever=15.3 install openSUSE-release lsb grub2 dracut-tools wicked -t pattern enhanced_base | |||
</syntaxhighlight> | |||
===Configure GRUB and install kernel=== | |||
<syntaxhighlight lang="text"> | |||
root@rescue:~# cat > /etc/default/grub << EOF | |||
# If you change this file, run 'grub2-mkconfig -o /boot/grub2/grub.cfg' afterwarrds to update | |||
# /boot/grub2/grub.cfg. | |||
GRUB_DEFAULT=saved | |||
GRUB_HIDDEN_TIMEOUT=0 | |||
GRUB_HIDDEN_TIMEOUT_QUIET=true | |||
GRUB_TIMEOUT=10 | |||
GRUB_CMDLINE_LINUX_DEFAULT="" | |||
GRUB_CMDLINE_LINUX="splash=silent mitigations=auto quiet" | |||
GRUB_TERMINAL=console | |||
GRUB_DISABLE_RECOVERY="true" | |||
EOF | |||
root@rescue:~# zypper --releasever=15.3 install kernel-default | |||
root@rescue:~# grub2-mkconfig -o /boot/grub2/grub.cfg | |||
</syntaxhighlight> | |||
===Networking=== | |||
<syntaxhighlight lang="text"> | |||
root@rescue:~# cat > /etc/sysconfig/network/ifcfg-eth0 << EOF | |||
TYPE="Ethernet" | |||
PROXY_METHOD="none" | |||
BROWSER_ONLY="no" | |||
BOOTPROTO="none" | |||
DEFROUTE="yes" | |||
IPV4_FAILURE_FATAL="no" | |||
IPV6INIT="yes" | |||
IPV6_AUTOCONF="no" | |||
IPV6_DEFROUTE="yes" | |||
IPV6_FAILURE_FATAL="no" | |||
IPV6_ADDR_GEN_MODE="stable-privacy" | |||
NAME="eth0" | |||
DEVICE="eth0" | |||
ONBOOT="yes" | |||
IPADDR=85.119.82.225 | |||
PREFIX=21 | |||
GATEWAY=85.119.80.1 | |||
IPV6ADDR=2001:ba8:1f1:f1d7::2/64 | |||
IPV6_DEFAULTGW=2001:ba8:1f1:f1d7::1 | |||
DNS1=85.119.80.232 | |||
DNS2=85.119.80.233 | |||
EOF | |||
</syntaxhighlight> | |||
# fstab | # fstab | ||
cat > /etc/fstab << EOF | cat > /etc/fstab << EOF | ||
Revision as of 21:25, 21 January 2022
under construction.gif
Install OpenSUSE
Make sure you're in PVH mode
xen-shell> virtmode pvh
Boot rescue VM and log in
xen-shell> rescue
After a while you'll be presented with a login prompt. The password is auto-generated and should be printed a few lines above the prompt. Once you're logged in, become root:
user@rescue:~$ sudo -i
root@rescue:~#
Install required utilities into rescue VM
root@rescue:~# apt update
root@rescue:~# apt install rpm zypper curl btrfs-progs zstd parted
Set up partitions on disk
Wipe existing block devices:
root@rescue:~# for d in a b; do wipefs -a /dev/xvd${d}; done
Create partitions:
root@rescue:~# parted -s /dev/xvda mklabel gpt mkpart root btrfs 0% 100%
root@rescue:~# parted -s /dev/xvda set 1 boot on
root@rescue:~# parted -s /dev/xvdb mklabel gpt mkpart swap linux-swap 0% 100%
root@rescue:~# mkfs.btrfs /dev/xvda1
root@rescue:~# mkswap -L SWAP /dev/xvdb1
Finally, mount the partition:
root@rescue:~# mkdir -vp /target && mount -v /dev/xvda1 /target
Copy in resolv.conf
root@rescue:~# cp -v /etc/resolv.conf /target/etc/
Set up Zypper repoes
root@rescue:~# mkdir -p /target/etc/zypp/repos.d/
root@rescue:~# cat <<-EOF > /target/etc/zypp/repos.d/repo-oss.repo
[repo-oss]
name=Main Repository
enabled=1
autorefresh=1
baseurl=http://download.opensuse.org/distribution/leap/\$releasever/repo/oss/
path=/
type=rpm-md
keeppackages=0
EOF
root@rescue:~# cat <<-EOF > /target/etc/zypp/repos.d/repo-update.repo
[repo-update]
name=Main Update Repository
enabled=1
autorefresh=1
baseurl=http://download.opensuse.org/update/leap/\$releasever/oss
path=/
type=rpm-md
keeppackages=0
EOF
Install Zypper
root@rescue:~# zypper --releasever=15.3 -R /target install zypper
You'll be prompted to trust various GPG keys and confirm that you want to install the zypper package and its dependencies.
Enter chroot
Mount /dev and some other things needed by the chroot:
root@rescue:~# mount -v --bind /dev /target/dev
root@rescue:~# mount -v --bind /dev /target/dev
root@rescue:~# mount -v -t proc procfs /target/proc
root@rescue:~# mount -v -t sysfs sysfs /target/sys
Enter the chroot:
root@rescue:~# chroot /target /bin/bash
Install base packages
Install some base packages for first boot:
root@rescue:~# zypper --releasever=15.3 install openSUSE-release lsb grub2 dracut-tools wicked -t pattern enhanced_base
Configure GRUB and install kernel
root@rescue:~# cat > /etc/default/grub << EOF
# If you change this file, run 'grub2-mkconfig -o /boot/grub2/grub.cfg' afterwarrds to update
# /boot/grub2/grub.cfg.
GRUB_DEFAULT=saved
GRUB_HIDDEN_TIMEOUT=0
GRUB_HIDDEN_TIMEOUT_QUIET=true
GRUB_TIMEOUT=10
GRUB_CMDLINE_LINUX_DEFAULT=""
GRUB_CMDLINE_LINUX="splash=silent mitigations=auto quiet"
GRUB_TERMINAL=console
GRUB_DISABLE_RECOVERY="true"
EOF
root@rescue:~# zypper --releasever=15.3 install kernel-default
root@rescue:~# grub2-mkconfig -o /boot/grub2/grub.cfg
Networking
root@rescue:~# cat > /etc/sysconfig/network/ifcfg-eth0 << EOF
TYPE="Ethernet"
PROXY_METHOD="none"
BROWSER_ONLY="no"
BOOTPROTO="none"
DEFROUTE="yes"
IPV4_FAILURE_FATAL="no"
IPV6INIT="yes"
IPV6_AUTOCONF="no"
IPV6_DEFROUTE="yes"
IPV6_FAILURE_FATAL="no"
IPV6_ADDR_GEN_MODE="stable-privacy"
NAME="eth0"
DEVICE="eth0"
ONBOOT="yes"
IPADDR=85.119.82.225
PREFIX=21
GATEWAY=85.119.80.1
IPV6ADDR=2001:ba8:1f1:f1d7::2/64
IPV6_DEFAULTGW=2001:ba8:1f1:f1d7::1
DNS1=85.119.80.232
DNS2=85.119.80.233
EOF
- fstab
cat > /etc/fstab << EOF /dev/xvda1 / btrfs defaults,noatime 0 0 LABEL=SWAP swap swap defaults 0 0 EOF
- passwd root
- openSUSE doesn't currently have selinux enabled by default, but if that changes in future you'll need to ask for a relabel *and* disable it for the first boot
- exit chroot and dismount
exit umount /target/sys umount /target/proc umount /target/dev umount /target
- halt