piston/lxc/notes.txt

34 lines
1021 B
Plaintext

# install
yum install lxc lxc-templates debootstrap libvirt
# create container
lxc-create -t download -n piston
select ubuntu, bionic, amd64
# start container
lxc-start -n piston -d
# shell in and install stuff
lxc-attach -n piston
export PATH=/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin
sed -i 's/http:\/\/archive.ubuntu.com\/ubuntu/http:\/\/mirror.math.princeton.edu\/pub\/ubuntu/' /etc/apt/sources.list
apt-get update
apt-get -y install tzdata nano dpkg-dev build-essential python python3 ruby nodejs golang php7.2 r-base mono-complete nasm openjdk-8-jdk
# create users and apply limits
for i in {1..150}; do
#userdel runner$i
useradd -M runner$i
usermod -d /tmp runner$i
echo "runner$i soft nproc 64" >> /etc/security/limits.conf
echo "runner$i hard nproc 64" >> /etc/security/limits.conf
echo "runner$i soft nofile 2048" >> /etc/security/limits.conf
echo "runner$i hard nofile 2048" >> /etc/security/limits.conf
done
# remove home dir
rm -rf /home/ubuntu
# set tmp
chmod 755 /tmp