Update Installation instructions authored by Nikolai.Hartmann's avatar Nikolai.Hartmann
# Install packages on debian host system # Install packages on debian host system
```bash ```bash
apt install acl dnf rpm git systemd-container python3-venv apt install acl dnf rpm git systemd-container python3-venv rsync
``` ```
# Clone git and checkout config files # Clone git and checkout config files
...@@ -38,11 +38,21 @@ python3 -m pip install git+https://github.com/systemd/mkosi.git ...@@ -38,11 +38,21 @@ python3 -m pip install git+https://github.com/systemd/mkosi.git
mkosi -i -t directory -o /var/lib/machines/xcache-$(date +%Y-%m-%d-%H%M) mkosi -i -t directory -o /var/lib/machines/xcache-$(date +%Y-%m-%d-%H%M)
``` ```
# Build image (manual `dnf --installroot`)
```bash
img_name=xcache-$(date +%Y-%m-%d-%H%M)
dnf -y --installroot /var/lib/machines/$img_name --releasever=7 install system-release bash yum
rsync -av /var/local/mkosi/mkosi.extra/ /var/lib/machines/$img_name
cp /var/local/mkosi/mkosi.postinst /var/lib/machines/$img_name/
systemd-nspawn -D /var/lib/machines/$img_name /bin/bash
systemd-nspawn -D /var/lib/machines/$img_name bash /mkosi.postinst
```
# Create xrootd user in host system # Create xrootd user in host system
We will map the xrootd user id inside the container (typically 999) to one shifted by 65536 * 10 on the host system. This is an arbitrary choice and one should check this range of user ids is not used by anything else. We will map the xrootd user id inside the container (typically 999) to one shifted by 65536 * 10 on the host system. This is an arbitrary choice and one should check this range of user ids is not used by anything else.
```bash ```bash
# for some reason that command might add a carriage return (therefore the sed) ... # for some reason that command might add a carriage return (therefore the sed) ...
XRD_UID_INSIDE=$(systemd-nspawn -D /var/lib/machines/<img-name> id -u xrootd | sed 's/\r//') XRD_UID_INSIDE=$(systemd-nspawn -D /var/lib/machines/$img_name id -u xrootd | sed 's/\r//')
let "XRD_UID_HOST = $XRD_UID_INSIDE + 65536 * 10" let "XRD_UID_HOST = $XRD_UID_INSIDE + 65536 * 10"
useradd --no-create-home --system -u $XRD_UID_HOST xrootd useradd --no-create-home --system -u $XRD_UID_HOST xrootd
``` ```
...@@ -62,7 +72,7 @@ setfacl -m "u:xrootd:r" /etc/grid-security/hostkey.pem ...@@ -62,7 +72,7 @@ setfacl -m "u:xrootd:r" /etc/grid-security/hostkey.pem
# Start and enable xcache service running in container # Start and enable xcache service running in container
The running image has to be linked to `/var/lib/machines/xcache` in order to pick up the configuration in `/etc/systemd/nspawn/xcache.nspawn`. The running image has to be linked to `/var/lib/machines/xcache` in order to pick up the configuration in `/etc/systemd/nspawn/xcache.nspawn`.
``` ```
ln -s /var/lib/machines/{<img-name>,xcache} ln -s /var/lib/machines/{$img_name,xcache}
machinectl start xcache machinectl start xcache
machinectl enable xcache machinectl enable xcache
``` ```
\ No newline at end of file