I wrote a similar article before, but it was easier with pyenv, so I will reorganize the procedure. By the way, depending on the environment, some people may not be able to use pyenv or do not want to use it. In such a case, please refer to the following URL.
http://qiita.com/mix_dvd/items/7d2f11fa090cf39a5b31
Download the iso file from the following URL and install it because it does not matter whether it is a real machine or a virtual environment.
http://www.ubuntu.com/download/server
For the detailed procedure, please refer to the site that explained the details.
http://webkaru.net/linux/ubuntu-14-04-lts-install/
Log in as the initial user created during installation.
The following is the procedure for using the environment only with the logged-in user.
The following commands are not required to run Jupyter Notebook itself, but you may get an error when installing or running the library, so install them in advance.
$ sudo apt install -y build-essential
$ sudo apt install -y libsm6
$ sudo apt install -y libxrender1
When you run the first command, if you are prompted for a password, enter the password you use to log in.
https://github.com/yyuu/pyenv
pyenv is a tool for installing multiple versions of Python in one environment.
$ git clone https://github.com/yyuu/pyenv.git ~/.pyenv
$ echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bashrc
$ echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.bashrc
$ echo 'eval "$(pyenv init -)"' >> ~/.bashrc
$ source ~/.bashrc
By the way, to update pyenv, use the following command.
$ cd ~/.pyenv
$ git pull
https://www.continuum.io/why-anaconda
Check the version of Anaconda that can be installed.
$ pyenv install -l | grep anaconda
As of June 10, 2016, the latest version was 4.0.0. Since there are many differences between version 2.x and version 3.x of Python, please select one of the following according to your environment. Unless otherwise specified, I think you can choose the 3.x series.
$ pyenv install anaconda2-4.0.0
$ pyenv rehash
$ pyenv global anaconda2-4.0.0
$ echo 'export PATH="$PYENV_ROOT/versions/anaconda2-4.0.0/bin/:$PATH"' >> ~/.bashrc
$ source ~/.bashrc
$ pyenv install anaconda3-4.0.0
$ pyenv rehash
$ pyenv global anaconda3-4.0.0
$ echo 'export PATH="$PYENV_ROOT/versions/anaconda3-4.0.0/bin/:$PATH"' >> ~/.bashrc
$ source ~/.bashrc
By the way, it seems that the following message may appear depending on the environment.
$ pyenv install anaconda3-4.2.0
Downloading Anaconda3-4.2.0-Linux-x86.sh...
-> https://repo.continuum.io/archive/Anaconda3-4.2.0-Linux-x86.sh
error: failed to download Anaconda3-4.2.0-Linux-x86.sh
BUILD FAILED (Ubuntu 16.04 using python-build 1.0.7-1-g99d1670)
The solution is as follows.
$ sudo apt-get install ca-certificates
$ sudo mkdir -p /etc/pki/tls/certs
$ sudo cp /etc/ssl/certs/ca-certificates.crt /etc/pki/tls/certs/ca-bundle.crt
After executing the above, install Anaconda with pyenv.
Seaborn
Headquarters site https://web.stanford.edu/~mwaskom/software/seaborn/
$ pip install seaborn
XGBoost
Headquarters site https://xgboost.readthedocs.io/
Reference URL https://xgboost.readthedocs.io/en/latest/build.html#python-package-installation
$ git clone --recursive https://github.com/dmlc/xgboost
$ cd xgboost
$ make -j4
$ cd python-package
$ python setup.py install
I can install it with pip, but even if I could install it, an error sometimes occurred at runtime, so the procedure for installing by compiling from the source code is shown.
Reference URL https://www.tensorflow.org/versions/r0.9/get_started/os_setup.html#pip-installation
Python 2
Ubuntu/Linux 64-bit, CPU only, Python 2.7
$ export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-0.9.0rc0-cp27-none-linux_x86_64.whl
$ sudo pip install --upgrade $TF_BINARY_URL
Python 3
Ubuntu/Linux 64-bit, CPU only, Python 3.5
$ export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-0.9.0rc0-cp35-cp35m-linux_x86_64.whl
$ sudo pip3 install --upgrade $TF_BINARY_URL
Jupyter Notebook
Headquarters site http://jupyter.org
$ cd
$ jupyter notebook --generate-config
$ echo "c.NotebookApp.ip = '*'" >> ~/.jupyter/jupyter_notebook_config.py
$ echo "c.NotebookApp.open_browser = False" >> ~/.jupyter/jupyter_notebook_config.py
$ echo "c.NotebookApp.port = 8888" >> ~/.jupyter/jupyter_notebook_config.py
Execute the following command in the home directory of the initial user.
$ jupyter notebook
If it seems to work, start a web browser on another machine and access the following URL.
http://xxx.xxx.xxx.xxx:8888
Please replace "xxx.xxx.xxx.xxx" with the IP address of the Ubuntu machine.
When the Jupyter Notebook page is displayed, OK!
Japanese may not be displayed when drawing a graph with matplotlib, so please refer to the corresponding procedure as well.
http://qiita.com/mix_dvd/items/1c192bd8c852c4aaa413
There is a desire to easily retrieve the files saved in the home directory, so I will add the procedure to make it accessible from other PCs using Samba.
First, install Samba.
$ sudo apt install -y samba
$ sudo pdbedit -a [Login user name]
new password: [Any password]
retype new password: [Any password]
Next is editing the configuration file.
$ sudo vi /etc/samba/smb.conf
Search for the following parts and correct the parts that are commented out or have different contents.
smb.conf
[homes]
comment = %U's Home directory
browseable = Yes
read only = No
writable = Yes
Restart Samba.
$ sudo systemctl restart smbd nmbd
that's all.
Recommended Posts