Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

190 lines (136 sloc) 6.055 kb
mkdir /tmp/archlinux
cd /tmp/archlinux
alias wget='wget --trust-server-names'
for f in *.tar.xz ; do unxz -v $f ; done
for f in *.tar ; do tar xvf $f ; done
for f in *.tar.gz ; do tar xzvf $f ; done
export PATH=/tmp/archlinux/usr/bin:$PATH
export LD_LIBRARY_PATH=/tmp/archlinux/usr/lib:/tmp/archlinux/lib:$LD_LIBRARY_PATH
alias pacman="pacman --config /tmp/archlinux/etc/pacman.conf"
cd /
for f in /tmp/archlinux/pacman-*pkg.tar.gz ; do
tar xzf $f
#enable a mirror
#Partition the disk
#This assumes a predefined layout - customize to your own liking
sfdisk --force /dev/sda <<EOF
# partition table of /dev/sda
unit: sectors
/dev/sda1 : start= 2048, size= 18874368, Id=83
/dev/sda2 : start= 18876416, size= 2095104, Id=82
/dev/sda3 : start= 0, size= 0, Id= 0
/dev/sda4 : start= 0, size= 0, Id= 0
sleep 2
#Format the first disk
mkfs.ext3 /dev/sda1
#Format the swap and use it
mkswap /dev/sda2
swapon /dev/sda2
mkdir /newarch
mount /dev/sda1 /newarch
mkdir -p /newarch/var/lib/pacman
#setting pacman - mirror - Belgium
#Customize to your own liking
sed -i 's/^#\(.*kangaroot.*\)/\1/' /etc/pacman.d/mirrorlist
# pacman -S reflector
# export LC_ALL=C
# reflector -c Belgium -l 8 -r -o /etc/pacman.d/mirrorlist
pacman -Sy -r /newarch
#pacman: error while loading shared libraries: cannot open shared object file: No such file or directory
#require bzip2
pacman --noconfirm --cachedir /newarch/var/cache/pacman/pkg -S base -r /newarch
#Create the devices
cd /newarch/dev
rm -f console ; mknod -m 600 console c 5 1
rm -f null ; mknod -m 666 null c 1 3
rm -f zero ; mknod -m 666 zero c 1 5
#Copy the dns information (cp is aliased so we use the binary)
/bin/cp -f /etc/resolv.conf /newarch/etc/
#Mount the process architecture
mount -t proc proc /newarch/proc
mount -t sysfs sys /newarch/sys
mount -o bind /dev /newarch/dev
chroot /newarch pacman --noconfirm -S kernel26
#set the mirror list within the machine
chroot /newarch sed -i 's/^#\(.*kangaroot.*\)/\1/' /etc/pacman.d/mirrorlist
#We need a partition!
echo "echo '/dev/sda1 / ext4 defaults,noatime 0 0' >> /etc/fstab"|chroot /newarch sh -
echo "echo '/dev/sda2 swap swap defaults 0 0'>> /etc/fstab"|chroot /newarch sh -
chroot /newarch sed -i 's/^HOSTNAME=\(.*\)/HOSTNAME=vagrant-arch/' /etc/rc.conf
echo "grep -v rootfs /proc/mounts > /etc/mtab" |chroot /newarch sh -
chroot /newarch grub-install /dev/sda
echo "cp -a /usr/lib/grub/i386-pc/* /boot/grub" | chroot /newarch sh -
echo "sed -i 's:^kernel\(.*\)$:kernel /boot/vmlinuz26 root=/dev/sda1 ro:' /boot/grub/menu.lst" | chroot /newarch sh -
echo "sed -i 's:^initrd\(.*\)$:initrd /boot/kernel26.img:' /boot/grub/menu.lst" | chroot /newarch sh -
#Configure ssh
chroot /newarch pacman --noconfirm -S openssh
#Still errors
echo "sed -i 's:^DAEMONS\(.*\))$:DAEMONS\1 sshd):' /etc/rc.conf" | chroot /newarch sh -
echo "echo 'sshd:ALL' > /etc/hosts.allow" | chroot /newarch sh -
echo "echo 'ALL:ALL' > /etc/hosts.deny" | chroot /newarch sh -
#Configure Sudo
chroot /newarch pacman --noconfirm -S sudo
echo "echo 'vagrant ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers" | chroot /newarch sh -
#create vagrant user / password vagrant
chroot /newarch useradd -m -r vagrant -p '$1$MPmczGP9$1SeNO4bw5YgiEJuo/ZkWq1'
#get some ruby running
chroot /newarch pacman --noconfirm -S git curl gcc make
echo "bash < <( curl -L )"| chroot /newarch /bin/bash -
echo "/usr/local/bin/rvm install ruby-1.8.7 "| chroot /newarch sh -
echo "/usr/local/bin/rvm use ruby-1.8.7 --default "| chroot /newarch sh -
#Installing chef & Puppet
echo ". /usr/local/lib/rvm ; gem install chef --no-ri --no-rdoc"| chroot /newarch sh -
echo ". /usr/local/lib/rvm ; gem install puppet --no-ri --no-rdoc"| chroot /newarch sh -
#Installing vagrant keys
echo "creating vagrant ssh keys"
chroot /newarch mkdir /home/vagrant/.ssh
chroot /newarch chmod 700 /home/vagrant/.ssh
chroot /newarch cd /home/vagrant/.ssh
chroot /newarch wget --no-check-certificate '' -O /home/vagrant/.ssh/authorized_keys
chroot /newarch chmod 600 /home/vagrant/.ssh/authorized_keys
chroot /newarch chown -R vagrant /home/vagrant/.ssh
echo "adding rvm to global bash rc"
echo "echo '. /usr/local/lib/rvm' >> /etc/bash/bash.rc" | chroot /newarch sh -
#kernel pacman -S kernel26-headers
chroot /newarch pacman --noconfirm -S kernel26-headers
/bin/cp -f /root/.vbox_version /newarch/home/vagrant/.vbox_version
VBOX_VERSION=$(cat /root/.vbox_version)
##INstalling the virtualbox guest additions
cat <<EOF | chroot /newarch /bin/bash -
cd /tmp
mount -o loop VBoxGuestAdditions_$VBOX_VERSION.iso /mnt
sh /mnt/
umount /mnt
rm VBoxGuestAdditions_$VBOX_VERSION.iso
echo "sed -i 's:^DAEMONS\(.*\))$:DAEMONS\1 rc.vboxadd):' /etc/rc.conf" | chroot /newarch sh -
cd /
umount /newarch/{proc,sys,dev}
umount /newarch
Jump to Line
Something went wrong with that request. Please try again.