Created
September 4, 2013 19:44
-
-
Save jedvardsson/6441886 to your computer and use it in GitHub Desktop.
vm: debian setup
This file contains 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 | |
echo "This script installs the necessary details for this host to become a vagrant box." | |
echo -n "Press enter to continue..." | |
read | |
echo "Setting up grub timeout..." | |
sed -i 's/^GRUB_TIMEOUT=.*/GRUB_TIMEOUT=1/' /etc/default/grub | |
update-grub | |
echo "Setting up /etc/sudoers..." | |
apt-get install -y sudo | |
add | |
sed -i 's/%sudo ALL=(ALL) ALL/%sudo ALL=NOPASSWD: ALL/' /etc/sudoers | |
grep -q 'Defaults *env_keep+=SSH_AUTH_SOCK' /etc/sudoers || echo 'Defaults env_keep+=SSH_AUTH_SOCK' >> /etc/sudoers | |
echo "Setting up ssh..." | |
mkdir /home/vagrant/.ssh | |
wget --no-check-certificate "https://raw.github.com/mitchellh/vagrant/master/keys/vagrant.pub" -O - > /home/vagrant/.ssh/authorized_keys | |
echo "Setting up .bashrc" | |
sed -i "s/#alias ll='ls -l'/alias ll='ls -laFh'/" /home/vagrant/.bashrc | |
echo "Installing packages..." | |
apt-get install -y less | |
apt-get install -y vim | |
update-alternatives --set editor /usr/bin/vim.basic | |
apt-get install -y puppet | |
apt-get install -y zerofree | |
apt-get install -y lsof | |
apt-get install -y linux-headers-$(uname -r) build-essential | |
echo | |
echo "Insert the Virtualbox Guest Addtion CD (HOST+D in console) and press enter..." | |
read | |
mount /dev/cdrom /media/cdrom | |
/media/cdrom/VBoxLinuxAdditions.run | |
apt-get clean | |
cat <<EOF | |
Done. | |
Manual steps left: | |
Remove bash history | |
------------------- | |
Make sure to remove .bash_history from /root and /home/vagrant. | |
Log in as vagrant user and execute: | |
sudo rm /root/.bash_history | |
export HISTFILE= | |
rm /home/vagrant/.bash_history | |
exit | |
EOF | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment