Last active
September 6, 2016 07:26
-
-
Save askeing/f1569a23518c5f329e82a52adc9bc42d to your computer and use it in GitHub Desktop.
Create Ubunt 14.04 LTS VM on Linux
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 | |
# Author: askeing | |
# Version: 0.0.1 | |
func_log () { | |
echo "$@" | tee -a bootstrap-linux.log | |
} | |
################ | |
# Prerequisite # | |
################ | |
RET_SUCCESS="0" | |
func_log "[START] `date +%Y-%m-%d:%H:%M:%S`" | |
# OS Platform | |
PLATFORM=`uname` | |
if [[ ${PLATFORM} == 'Linux' ]]; then | |
func_log "[INFO] Your platform is Linux." | |
elif [[ ${PLATFORM} == 'Darwin' ]]; then | |
func_log "[FAIL] Your platform is Mac OS X, not Linux." | |
exit 1 | |
else | |
func_log "[FAIL] Your platform is $PLATFORM not Linux." | |
exit 1 | |
fi | |
func_log "[INFO] Install Requiremants ..." | |
# tools | |
sudo apt-get install -y --force-yes unzip wget git | |
# python | |
sudo apt-get install -y --force-yes python-dev python-virtualenv python-pip | |
# build toolchains | |
sudo apt-get install -y build-essential cmake libffi-dev libssl-dev | |
# req of numpy, scipy | |
sudo apt-get install -y --force-yes libblas-dev liblapack-dev libatlas-base-dev gfortran | |
# opencv | |
sudo apt-get install -y --force-yes libopencv-dev python-opencv | |
func_log "[INFO] Install Requiremants finished." | |
################ | |
# Installation # | |
################ | |
func_log "[INFO] Creating virtualenv ..." | |
virtualenv .env-python | |
source .env-python/bin/activate | |
func_log "[INFO] Upgrading pip itself ..." | |
pip install -U pip | |
pip install -U setuptools | |
func_log "[INFO] Install numpy and scipy ..." | |
pip install numpy scipy | |
func_log "[INFO] Linking opencv's cv2.so to virtualenv ..." | |
CV2_SO_PATH=`find /usr/ -name "cv2.so"` | |
ln -s ${CV2_SO_PATH} .env-python/lib/python2.7/site-packages/cv2.so | |
func_log "[INFO] Python Setup Install ..." | |
pip install -r requirements.txt | |
python setup.py install | |
func_log "[INFO] Checking Python CV2 Module ..." | |
PYTHON_CV2_CHECK_RESULT=`./scripts/cv2_checker.py` | |
func_log ${PYTHON_CV2_CHECK_RESULT} | |
BOOTSTRAP_RET=$? | |
func_log "[INFO] Done." | |
func_log "[END] `date +%Y-%m-%d:%H:%M:%S`" | |
func_log "" | |
if [[ ${RET_SUCCESS} == ${BOOTSTRAP_RET} ]]; then | |
echo "### Hasal ##############" | |
echo "# Welcome to Hasal! :) #" | |
echo "########################" | |
else | |
echo "### Hasal ########################" | |
echo "# It seems like something wrong! #" | |
echo "# Please check bootstrap log. #" | |
echo "##################################" | |
fi | |
# Return cv2_checker's return code as bootstrap return code. | |
exit ${BOOTSTRAP_RET} |
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
#!/usr/bin/bash | |
# install virtualbox | |
sudo apt-get install virtualbox virtualbox-dkms | |
# create vm folder | |
mkdir ubuntu-14.04 | |
# go into working folder | |
pushd ubuntu-14.04 | |
# install vagrant | |
mkdir tmp | |
pushd tmp | |
wget https://releases.hashicorp.com/vagrant/1.8.5/vagrant_1.8.5_x86_64.deb | |
sudo dpkg -i vagrant_1.8.5_x86_64.deb | |
popd | |
rm -rf tmp | |
# init the ubunto 14.04 LTS | |
#vagrant init ubuntu/trusty64; vagrant up --provider virtualbox | |
# Desktop version | |
vagrant init box-cutter/ubuntu1404-desktop; vagrant up --provider virtualbox | |
# Guest VM have to install following packages: | |
# - virtualbox-guest-dkms | |
# - virtualbox-guest-utils | |
# - virtualbox-guest-x11 | |
popd |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment