Created
November 8, 2016 02:53
-
-
Save elyssonmr/a2c27be99c19d05a6a99cbc70c825563 to your computer and use it in GitHub Desktop.
My Vagrant's provision script to run Python3 on Ubuntu images
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
#!/usr/bin/env bash | |
# System Update | |
apt-get update | |
# Pre requisites Packages | |
apt-get install -y build-essential | |
apt-get install -y git | |
# Development Packages | |
apt-get install -y python3 | |
apt-get install -y python3-dev | |
apt-get install -y python3-pip | |
apt-get install -y python-setuptools | |
# Python virtual environment | |
easy_install virtualenv | |
easy_install pip | |
easy_install virtualenvwrapper | |
source /usr/local/bin/virtualenvwrapper.sh | |
export WORKON_HOME="/home/vagrant/.virtualenvs" | |
if ! grep -Fxq "source /usr/local/bin/virtualenvwrapper.sh" .bashrc | |
then | |
echo "Add VirtualEnv Wrapper in .bashrc" | |
echo "source /usr/local/bin/virtualenvwrapper.sh" >> /home/vagrant/.bashrc | |
fi | |
lsvirtualenv | grep 'env' &> /dev/null | |
if [ $? == 1 ]; then | |
echo "Creating Virtualenv" | |
mkvirtualenv --python=/usr/bin/python3 env | |
chown -R vagrant.vagrant .virtualenvs | |
fi | |
workon env | |
if [[ -f "/vagrant/requirements.txt" ]]; then | |
echo "Installing Requirements" | |
pip install -r /vagrant/requirements.txt | |
fi | |
# git config | |
git config --global user.name "User Name" | |
git config --global user.email [email protected] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment