Last active
October 29, 2017 12:27
-
-
Save threecourse/72dd58a7e011b8b7b6a68ed2af9bd80e to your computer and use it in GitHub Desktop.
ubuntu environment setting
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 | |
# utils | |
cd ~/ | |
mkdir proj lib | |
sudo apt-get update | |
sudo apt-get install -y git build-essential libatlas-base-dev | |
sudo apt-get install -y python3-dev | |
git config --global credential.helper 'cache --timeout=3600' | |
git config --global user.email "xxxx@xxxx.com" | |
git config --global user.name "xxxxxxx" | |
# anaconda | |
# http://stuarteberg.github.io/conda-docs/help/silent.html | |
wget --quiet https://repo.continuum.io/archive/Anaconda3-5.0.0-Linux-x86_64.sh -O lib/anaconda.sh | |
/bin/bash lib/anaconda.sh -b | |
echo export PATH=~/anaconda3/bin:$PATH >> ~/.bashrc | |
source ~/.bashrc | |
pip install xgboost | |
pip install lightgbm | |
pip install tensorflow | |
pip install keras | |
pip install hyperopt | |
# set backend for matplotlib to Agg | |
matplotlibrc_path=$(python -c "import site, os, fileinput; packages_dir = site.getsitepackages()[0]; print(os.path.join(packages_dir, 'matplotlib', 'mpl-data', 'matplotlibrc'))") && \ | |
sed -i 's/^backend : qt5agg/backend : agg/' $matplotlibrc_path | |
# install gensim(word2vec is slow?) | |
pip install gensim |
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
# install CUDA Toolkit 8.0, cuDNN v6. | |
# https://developer.nvidia.com/cuda-80-ga2-download-archive | |
wget http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1604/x86_64/7fa2af80.pub | |
cat 7fa2af80.pub | sudo apt-key add - | |
wget http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1604/x86_64/cuda-repo-ubuntu1604_8.0.61-1_amd64.deb | |
sudo dpkg -i cuda-repo-ubuntu1604_8.0.61-1_amd64.deb | |
sudo apt update | |
sudo apt install -y linux-generic | |
sudo apt install -y cuda-8-0 # (no need cuda-drivers?) | |
sudo reboot | |
# after reboot ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
sudo apt remove linux-virtual | |
sudo apt autoremove | |
# rm 7fa2af80.pub cuda-repo-ubuntu1604_8.0.61-1_amd64.deb | |
source ~/.bashrc | |
echo export PATH="/usr/local/cuda-8.0/bin:$PATH" >> ~/.bashrc | |
echo export LD_LIBRARY_PATH="/usr/local/cuda/lib64:$LD_LIBRARY_PATH" >> ~/.bashrc | |
### run command in local ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
# copy cudnn from local to server (require downloading in advance) | |
export address=xx.xx.xx.xx | |
export usrname=ubuntu | |
export keypath=xxxx.pem | |
scp -i $keypath ~/xxxx/cudnn-8.0-linux-x64-v6.0.tgz $usrname@$address:~/ | |
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
# install cudnn | |
tar xzf cudnn-8.0-linux-x64-v6.0.tgz | |
sudo cp -a cuda/lib64/* /usr/local/lib/ | |
sudo cp -a cuda/include/* /usr/local/include/ | |
sudo ldconfig | |
# tensorflow | |
pip uninstall -y tensorflow | |
pip install tensorflow-gpu |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
某コンペの為に仕込んだ環境設定スクリプトです。(結局init_gpu.shは使わなかった…)
ubuntuの知識はかなり怪しいので、間違っているところがあるかもしれません。
この辺を参考にしています