Dénes TüreiBuilding 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
#!/usr/bin/bash# compiling fakechroot as this is most likely not available on the clustermkdir 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 directorycurl -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 rpacman -S python r
# creating a useradduser 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 systemecho'print('"'"'hello'"'"')' > ./hello.py
python hello.py
Comments (0)
HTTPSSSH
You can clone a snippet to your computer for local editing.
Learn more.