Snippets

Dénes Türei Building an Arch Linux system in a custom directory as user in order to provide an up to date environment for running tasks on an outdated cluster

Created by Dénes Türei last modified
#!/usr/bin/bash

# compiling fakechroot as this is most likely not available on the cluster
mkdir fakechroot
curl -L -o fakechroot.tar.gz https://github.com/dex4er/fakechroot/archive/master.tar.gz
tar -xvzf fakechroot.tar.gz
rm fakechroot.tar.gz
cd fakechroot-master
./autogen.sh
./configure --prefix=`readlink -f ../fakechroot`
make
make install
cd ..

# bootstraping arch linux system into the target directory
curl -LO https://github.com/tokland/arch-bootstrap/raw/master/arch-bootstrap.sh
chmod +x ./arch-bootstrap.sh
mkdir root
fakechroot fakeroot ./arch-bootstrap.sh root

# chrooting into the new system
./fakechroot/bin/fakechroot fakeroot chroot root
# installing basic tools (likely you will need them later)
pacman -S base-devel
# installing python and r
pacman -S python r
# creating a user
adduser myuser
mkdir -p /home/myuser
chown -R myuser:myuser /home/myuser
echo 'myuser:password' | chpasswd
exit

# logging in to the system
./fakechroot/bin/fakechroot chroot root
cd /home/myuser
# running something with the fresh python from the new system
echo 'print('"'"'hello'"'"')' > ./hello.py
python hello.py

Comments (0)

HTTPS SSH

You can clone a snippet to your computer for local editing. Learn more.