Last active
December 25, 2015 19:19
-
-
Save oliveiraev/7027013 to your computer and use it in GitHub Desktop.
Set up any debian/redhat-based distro ready for vagrant.
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
test "$(command -v su)" || (echo "su is required but not found" && exit 1) | |
RUN="su" | |
test "$(command -v sudo)" && RUN="sudo su" | |
$RUN -c' | |
INSTALLER="apt-get" | |
test "$(command -v yum)" && INSTALLER="yum" | |
$INSTALLER install -y openssh-server | |
printf "\n#Vagrant additions\n" >> /etc/sudoers | |
useradd -s$SHELL vagrant | |
sed -ri "s/^vagrant:[^:]/vagrant:\!/" /etc/shadow | |
echo "vagrant ALL=(ALL:ALL) NOPASSWD: ALL" >> /etc/sudoers | |
echo "Defaults:vagrant !requiretty" >> /etc/sudoers | |
SSHDIR=$(grep vagrant /etc/passwd | awk -F":" "{print \$(NF-1)}")/.ssh | |
mkdir -p -m700 $SSHDIR | |
wget -qO$SSHDIR/authorized_keys --no-check-certificate https://raw.github.com/mitchellh/vagrant/master/keys/vagrant.pub | |
chown -R vagrant: $SSHDIR/..' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Usage:
curl -sL https://gist.github.com/oliveiraev/7027013/raw/linux-to-vagrant.sh | bash
Wget option:
wget -qO - https://gist.github.com/oliveiraev/7027013/raw/linux-to-vagrant.sh | bash
You can use any smart shell:
curl -sL https://gist.github.com/oliveiraev/7027013/raw/linux-to-vagrant.sh | zsh