Created
April 12, 2017 18:34
-
-
Save wirewc/03733589d4ab28e64cd1a8853429fed1 to your computer and use it in GitHub Desktop.
Builds a chroot from scratch from other CentOS/RHEL 7 boxes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Name of Container as the argument to the script. | |
CNAME=$1 | |
mkdir -p /srv/nspawns/$CNAME/var/lib/rpm; rpm --rebuilddb --root=/srv/nspawns/$CNAME | |
mkdir /srv/nspawns/isos; cd /srv/nspawns/isos; | |
wget http://mirror.centos.org/centos-7/7/os/x86_64/Packages/centos-release-7-3.1611.el7.centos.x86_64.rpm | |
rpm -i --root=/srv/nspawns/$CNAME --nodeps /srv/nspawns/isos/centos-release-7-3.1611.el7.centos.x86_64.rpm | |
yum --installroot=/srv/nspawns/$CNAME install -y rpm-build yum net-tools openssh-server vim systemd-networkd iproute hostname screen iputils dhclient passwd | |
echo $CNAME > /srv/nspawns/$CNAME/etc/hostname |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment