TL;DR I tried to reproduce the steps when the remote server (Cent OS 6.8) was made a dedicated server for Jupyter Notebook. It is convenient because it can be used as a dedicated analysis server for teams.
Install Pyenv so that you can easily switch between multiple Python versions.
curl -L https://raw.githubusercontent.com/yyuu/pyenv-installer/master/bin/pyenv-installer | bash
pyenv -v
When the version is displayed with, ok
pyenv 20160509-74-ge93ae00
Anaconda is a distribution with a lot of data analysis analysis libraries. Jupyter is also in this.
pyenv update
pyenv install -l //Check the latest version of anaconda
pyenv install anaconda3-4.1.0 //Latest version installation
pyenv global anaconda3-4.1.0 //Default Python switches to anaconda
It takes some time to install, but it's OK if the version is displayed with `jupyter --version`
4.1.0
Consider using one IP for multiple services, and use Nginx.
First, register repo so that you can get the latest Nginx
/etc/yum.repos.d/nginx.repo
[nginx]
name=nginx repo
baseurl=http://nginx.org/packages/centos/6/$basearch/
gpgcheck=0
enabled=1
Update yum and install Nginx
sudo yum update
sudo yum install nginx
nginx -v
When the version is displayed with, ok
nginx version: nginx/1.10.1
Include Nginx's Jupyter-specific configuration file jupyter.conf before creating it
/etc/nginx/nginx.conf
http {
include /etc/nginx/conf.d/jupyter.conf;
}
Create jupyter.conf. Listen to 9999.
/etc/nginx/conf.d/jupyter.conf
location / {
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Origin "";
proxy_pass http://127.0.0.1:9999;
}
Start Nginx
sudo service nginx start
Create a Jupyter config file
jupyter notebook --generate-config
jupyter notebook
The command launches the browser by default.
Set the default port used by Notebook to 9999 while preventing it from booting.
.jupyter/jupyter_notebook_config.py
c.NotebookApp.open_browser = False
c.NotebookApp.port = 9999
That's all you have to enter!
jupyter notebook
Access the IP of the server, and when the screen below appears, startup is complete. The files and directories of the directory where the command was entered are displayed.
Immediately press "New" to create a new file
As the name of Notebook suggests, you can write code as a trial writing, and you can execute it line by line, like one line = one set of code. In my case, I imported all the required libraries in the first line so that autocomplete works.
After setting the server port and user, it is troublesome to enter a long ssh command on the client side to connect to the remote, so make it possible to connect with `ssh jupyter`
.
~/.ssh/config
Host jupyter
HostName IP_ADDRESS
Port SSH_PORT
IdentityFile SECRET_KEY
User USERNAME