Skip to content

Instantly share code, notes, and snippets.

@rishiip
Forked from mislav/arch.md
Last active August 29, 2015 14:23
Show Gist options
  • Save rishiip/a05666eb62c00f76cb9c to your computer and use it in GitHub Desktop.
Save rishiip/a05666eb62c00f76cb9c to your computer and use it in GitHub Desktop.

Create the partition:

sgdisk --zap-all /dev/sda
cgdisk /dev/sda
mkfs.ext4 /dev/sda1
mount /dev/sda1 /mnt

Edit the mirror list to bring the preferred mirror to the top:

vi /etc/pacman.d/mirrorlist

Install the base system

pacstrap /mnt base base-devel

Generate an fstab

genfstab -U -p /mnt >> /mnt/etc/fstab
vi /mnt/etc/fstab

Chroot into the new system

arch-chroot /mnt /bin/bash

Set hostname

echo arch > /etc/hostname

Set root password to "vagrant"

passwd

Set up DHCP

systemctl enable dhcpcd@enp0s3.service

Create "vagrant" user

useradd -G wheel -m vagrant
passwd vagrant

Setup bootloader

pacman -S gptfdisk syslinux
syslinux-install_update -iam

Edit boot configuration in /boot/syslinux/syslinux.cfg:

LABEL arch
    ...
    APPEND root=/dev/sda1 rw

Setup ssh:

pacman -S openssh rsync
systemctl enable sshd.service

Edit /etc/ssh/sshd_config

UseDNS no

Clean package cache

pacman -Sc

exit chroot environment and reboot.

Set hostname:

hostname centos65

Edit /etc/sysconfig/network-scripts/ifcfg-eth0

ONBOOT=yes
NM_CONTROLLED=no
BOOTPROTO=dhcp

Edit /etc/ssh/sshd_config

UseDNS no

Add "vagrant" user:

useradd -G wheel vagrant

Enable passwordless sudo using visudo

%wheel  ALL=(ALL)  ALL
%wheel  ALL=(ALL)  NOPASSWD: ALL

# Defaults  requiretty

Restart the VM:

shutdown -r now

Install Vagrant's SSH key:

su - vagrant
mkdir -p .ssh
curl -kL https://raw.github.com/mitchellh/vagrant/master/keys/vagrant.pub > .ssh/authorized_keys
chmod -R go-rwx .ssh
exit

Install basic provisioning tools, rsync & scp:

yum install rsync openssh-clients
yum clean all

Halt the VM:

shutdown -h now

Build base box:

vagrant package --output centos65.box --base "CentOS 6.5"

To boot Fedora into text-only mode:

  1. Press "e" at the boot menu,
  2. Arrow down to the line that starts with "linux",
  3. Replace last two words with text 3.
  4. Ctrl+X.

Edit /etc/ssh/sshd_config

UseDNS no

Enable passwordless sudo using visudo

%wheel  ALL=(ALL)  ALL
%wheel  ALL=(ALL)  NOPASSWD: ALL

# Defaults  requiretty

Install rsync:

yum install -y rsync
yum clean all

Edit /etc/ssh/sshd_config

UseDNS no

Install essential packages:

pkg install -y sudo bash rsync curl

Enable passwordless sudo using visudo

%wheel  ALL=(ALL)  ALL
%wheel  ALL=(ALL)  NOPASSWD: ALL

Add "vagrant" user:

adduser -G wheel
chsh -s bash vagrant

Install Vagrant's SSH key:

su - vagrant
mkdir -p .ssh
curl -kL https://raw.github.com/mitchellh/vagrant/master/keys/vagrant.pub >> .ssh/authorized_keys
chmod -R go-rwx .ssh
exit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment