Arch Linux: use cmd template.
← Older revision | Revision as of 16:34, 15 August 2023 | ||
(4 intermediate revisions by the same user not shown) | |||
Line 2: | Line 2: | ||
Because there are different use cases, this is just a slight overview about what's possible and what's sensible.<br> | Because there are different use cases, this is just a slight overview about what's possible and what's sensible.<br> | ||
= Your options = | = Your options = | ||
Line 8: | Line 7: | ||
== gcompat == | == gcompat == | ||
gcompat is the go-to compatibility layer for Alpine users. | |||
{{cmd|apk add gcompat}} | {{cmd|apk add {{pkg|gcompat}}}} | ||
After that you run your binaries as normal. | After that you run your binaries as normal. | ||
Line 19: | Line 18: | ||
Firstly install it. | Firstly install it. | ||
{{cmd|apk add flatpak}} | {{cmd|apk add {{pkg|flatpak}}}} | ||
Then you can run any Flatpak application: | Then you can run any Flatpak application: | ||
Line 88: | Line 87: | ||
Either use '''pacstrap''' (included with the arch-install-scripts package) or an Arch bootstrap image: | Either use '''pacstrap''' (included with the arch-install-scripts package) or an Arch bootstrap image: | ||
{{cmd|sudo apk add arch-install-scripts | |||
mkdir ~/chroot && cd ~/chroot | |||
sudo tar xzf archlinux-bootstrap-x86_64.tar.gz && rm archlinux-bootstrap-x86_64.tar.gz | |||
sudo sed -i '/evowise/s/^#//' root.x86_64/etc/pacman.d/mirrorlist | |||
sudo sed -i '/CheckSpace/s/^/#/' root.x86_64/etc/pacman.conf | |||
sudo arch-chroot root.x86_64 | |||
[chroot]# pacman-key --init | |||
[chroot]# pacman-key --populate archlinux}} | |||
Once that is done, update the system and install the desired package(s) (denoted by ''"foo"'' in this example): | Once that is done, update the system and install the desired package(s) (denoted by ''"foo"'' in this example): | ||
{{cmd|[chroot]# pacman -Syu ''foo''}} | |||
=== Debian === | === Debian === | ||
{{todo|gresec referencs need to be cleanly removed from this section.}} | |||
Use the provided debootstrap package to create the Debian chroot. <code>--arch</code> is optional, depending of your needs. | Use the provided debootstrap package to create the Debian chroot. <code>--arch</code> is optional, depending of your needs. | ||
Line 121: | Line 120: | ||
It's also possible to use Docker or Podman containers with a helper like Distrobox. This allows using graphical programs easily and doesn't require root privileges once set up. | It's also possible to use Docker or Podman containers with a helper like Distrobox. This allows using graphical programs easily and doesn't require root privileges once set up. | ||
{{cmd|# apk add {{pkg|distrobox}}}} | |||
=== Distrobox + Podman === | === Distrobox + Podman === | ||
{{cmd|# apk add {{pkg|podman}}}} | |||
Then set up rootless Podman, following [ | Then set up rootless Podman, following [[Podman|these steps]]. | ||
You'll need to mount your root as shared for Distrobox to function. | You'll need to mount your root as shared for Distrobox to function. | ||
Fill in | Fill in {{path|/etc/local.d/mount-rshared.start}} like so: | ||
{{cmd|#!/bin/sh | |||
mount --make-rshared /}} | |||
Mark it as executable. | Mark it as executable. | ||
{{cmd|# chmod +x /etc/local.d/mount-rshared.start}} | |||
Then autostart its service. | Then autostart its service. | ||
{{cmd|# rc-update add local default | |||
# rc-service local start}} | |||
Finally you can create a container using your chosen image. | Finally you can create a container using your chosen image. | ||
{{cmd|$ distrobox create --image debian --name debian | |||
$ distrobox enter debian}} | |||
It may also be necessary to allow X authorization for GUI programs to work. | It may also be necessary to allow X authorization for GUI programs to work. | ||
{{cmd|$ xhost +si:localuser:$USER}} | |||
== Chroot + Bubblewrap == | == Chroot + Bubblewrap == | ||
Line 157: | Line 156: | ||
It's also possible to use a Debian system chroot with Bubblewrap. This allows running programs without root. | It's also possible to use a Debian system chroot with Bubblewrap. This allows running programs without root. | ||
{{cmd|# apk add bubblewrap debootstrap | |||
# mkdir -p /var/chroots/debian | |||
# debootstrap --arch amd64 stable /var/chroots/debian/ https://deb.debian.org/debian}} | |||
Finally we can make an alias for bwrap. | Finally we can make an alias for bwrap. | ||
{{cmd|$ alias glibc{{=}}"LANG{{=}}en_US.UTF-8 bwrap --bind /var/chroots/debian / --dev-bind /dev /dev --proc /proc --bind /sys /sys --bind /run /run --bind /home /home --ro-bind /etc/resolv.conf /etc/resolv.conf --ro-bind /etc/passwd /etc/passwd --ro-bind /etc/group /etc/group"}} | |||
Now we can invoke glibc-built binaries like so: | Now we can invoke glibc-built binaries like so: | ||
{{cmd|$ glibc ./binary}} | |||
For updating the Chroot or installing dependencies we can mount it and then login as root: | For updating the Chroot or installing dependencies we can mount it and then login as root: | ||
{{cmd|# mount --bind /dev /var/chroots/debian/dev | |||
# mount --bind /proc /var/chroots/debian/proc | |||
# chroot /var/chroots/debian /bin/bash | |||
# apt update && apt upgrade}} | |||
[[Category:Development]] | [[Category:Development]] | ||
[[Category:Installation]] | [[Category:Installation]] |
Distro