Ubuntu上安装TensorFlow脚本备忘

在 2016-10-06 发布于 人工智能 下以来已有1,055人读过本文 | 0条评论 发表评论

#!/bin/bash

# uninstall amazon
# uninstall libreOffice

sudo apt-get update

sudo add-apt-repository ppa:hzwhuang/ss-qt5
sudo apt-get update
sudo apt-get install shadowsocks-qt5


# install fonts
# Fira Code: https://github.com/tonsky/FiraCode
# fonts is stored in ~/Downloads/
# cd /usr/share/fonts
# sudo mkdir -p winFonts
# sudo cp ~/Downloads/*.ttf winFonts
# cd winFonts
# sudo chmod 644 *.ttf
# sudo mkfontscale
# sudo mkfontdir
# sudo fc-cache -fv

# sudo cp -r your_Chrome_config_path/.config/google-chrome ~/.config/google-chrome
# Firefox install addons --> autoProxy
# setup the proxy to download Chrome and install it
# run from terminal using google-chrome --proxy-server=socks5://127.0.0.1:1080
# to start chrome and login your google account to Synchronize your settings
# uninstall Firefox

# sudo cp sudo cp -r your_easystroke_configuration_path/.easystroke ~/
sudo apt-get install easystroke

# setting resolution
cvt 1440 900
sudo xrandr --newmode "1440x900_60.00" 106.50 1440 1528 1672 1904 900 903 909 934 -hsync +vsync
sudo xrandr --addmode VGA-0 1440x900_60.00
# add to system
# sudo gedit ~/.profile and add:
sudo echo "cvt 1440 900" >> ~/.profile
sudo echo 'sudo xrandr --newmode "1440x900_60.00" 106.50 1440 1528 1672 1904 900 903 909 934 -hsync +vsync' >> ~/.profile
sudo echo "sudo xrandr --addmode VGA-0 1440x900_60.00" >> ~/.profile

# sudo cp -r your_vscode_configuration_path/.vscode ~/
# sudo cp -r your_vscode_config_path/.config/Code ~/.config/Code
# download VScode deb package and install it

sudo apt-get install nautilus-open-terminal
sudo apt-get install htop

sudo add-apt-repository ppa:shutter/ppa
sudo apt-get update && sudo apt-get install shutter

# ref: http://blog.csdn.net/songrotek/article/details/50770154
# ref: https://github.com/saiprashanths/dl-setup
# sudo edit /etc/modprobe.d/blacklist-nouveau.conf
sudo echo "blacklist nouveau" >> /etc/modprobe.d/blacklist-nouveau.conf
sudo echo "blacklist lbm-nouveau" >> /etc/modprobe.d/blacklist-nouveau.conf
sudo echo "options nouveau modeset=0" >> /etc/modprobe.d/blacklist-nouveau.conf
sudo echo "alias nouveau off" >> /etc/modprobe.d/blacklist-nouveau.conf
sudo echo "alias lbm-nouveau off" >> /etc/modprobe.d/blacklist-nouveau.conf
echo options nouveau modeset=0 | sudo tee -a /etc/modprobe.d/nouveau-kms.conf
sudo update-initramfs -u
sudo reboot

sudo apt-get update
sudo apt-get upgrade
sudo apt-get install build-essential cmake g++ gfortran git pkg-config python-dev software-properties-common wget
sudo apt-get autoremove
sudo rm -rf /var/lib/apt/lists/*
# Ctrl+Alt+F1 to tty1
sudo service lightdm stop
sudo sh cuda*.run --no-opengl-libs
sudo service lightdm start

# sudo gedit ~/.bashrc to add Path
sudo echo "export CUDA_HOME=/usr/local/cuda" >> ~/.bashrc
sudo echo "export PATH=$PATH:/usr/local/cuda/bin" >> ~/.bashrc
sudo echo "export LD_LIBRARY_PATH=:/usr/local/cuda/lib64" >> ~/.bashrc
# then source
source ~/.bashrc
# validate the installation
cd /usr/local/cuda/samples/1_Utilities/deviceQuery
sudo make
sudo ./deviceQuery
# or using
nvcc -V
nvidia-smi
# install cudnn
# cudnn-7.5-linux-x64-v5.1
tar -zxf cudnn*.tgz
cd cuda
sudo cp lib64/* /usr/local/cuda/lib64/
sudo cp include/cudnn.h /usr/local/cuda/include/
sudo chmod a+r /usr/local/cuda/lib64/libcudnn*
# may need to run: sudo ldconfig /usr/local/cuda/lib64
# update your system
sudo apt-get update && sudo apt-get upgrade
sudo apt-get install linux-source
sudo apt-get install linux-headers-`uname -r`
# prepare to install deep learning libraries
sudo apt-get update && sudo apt-get install -y python-numpy python-scipy python-nose python-h5py python-skimage python-matplotlib python-pandas python-sklearn python-sympy
sudo apt-get install python-pip python-dev
sudo apt-get clean && sudo apt-get autoremove
rm -rf /var/lib/apt/lists/*
# install TensorFlow
# restore /.pip/pip.conf to the original state
export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow-0.10.0-cp27-none-linux_x86_64.whl
sudo pip install --upgrade $TF_BINARY_URL
# if having errors running TensorFlow, copy links manually using libcudnn.so.5.0.5
# to make links of libcudnn.so and libcudnn.so.5.0
# after install TensorFlow, modify /.pip/pip.conf to use the mirror in China
# [global]
# index-url = https://pypi.tuna.tsinghua.edu.cn/simple/
# install SimpleITK
sudo pip install https://sourceforge.net/projects/simpleitk/files/SimpleITK/0.9.1/Python/SimpleITK-0.9.1-cp27-none-linux_x86_64.whl#md5=1cd1bc22eb8072ab7fc63212a56c47c7
# install iPython (using it: ipython notebook ipynb_file_path)
sudo apt-get update
sudo pip install IPython
sudo pip install jupyter
sudo apt-get install python-vigra
sudo apt-get install python-opencv
## install oh-my-zsh (!don't use it, or it will cause cudnn error)
# sudo rm -r .oh-my-zsh/
# sudo apt-get install zsh
# wget https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh -O - | sh
# chsh -s /bin/zsh
# sudo gedit .zshrc #change theme to 'ys'
# install autopep8
sudo pip install --upgrade autopep8
# install pinyin-input
sudo apt-get remove ibus
sudo apt-get autoremove
sudo apt-get update
sudo dpkg -i sogou*.deb
# Terminal run 'im-config' to select fcitx
# Terminal run 'fcitx-config-gtk3' to add 'sogou' (need unselect 'Only Show Current Language')
# ref: http://www.voidcn.com/blog/Lmerissa/article/p-5016128.html
# if control center not completed using
# sudo apt-get remove unity-control-center
# sudo apt-get install unity-control-center
sudo pip install pprocess

发表评论

您的昵称 *

您的邮箱 *

您的网站