Toss a half-day, in order to be able to learn tensorflow, engaged in the remote Jupyter, convenient to use it locally, today filled a lot of pits.
After loading:
Here are some steps:
Check Python Environment
Python 2.7 is integrated by default in CentOS 7.2, and the Python version can be checked by the following command:
Python--version
Install PIP
Pip is a Python package management tool, and we use the Yum command to install the tool:
Yum-y Install Python-pip
Use the following command to upgrade the PIP to the latest version:
Pip Install--upgrade pip
Installation related dependencies
Additional dependencies are required during the installation of Jupyter, and we install them using the following command:
Yum-y Groupinstall "Development Tools"
Yum-y Install Python-devel
Configuring the Virtual Environment
Installing Virtualenv
We will create a separate virtual environment for Jupyter and isolate it from the Python that comes with the system. To do this, first install the VIRTUALENV library:
Pip Install Virtualenv
Create a virtual environment
Create a dedicated virtual environment and activate it directly into the environment:
Virtualenv venv
SOURCE Venv/bin/activate
Installing Jupyter with PIP
We use the PIP command to install Jupyter:
Pip Install Jupyter
Configuring Jupyter Notebook
Create a project directory
We first prepare a directory for Jupyter related files:
Mkdir/data/jupyter
Cd/data/jupyter
Set up a directory as the root directory for the Jupyter run:
Mkdir/data/jupyter/root
Prepare password redaction
Since we will start Jupyter in a mode that requires password authentication, we need to pre-generate the cipher corresponding to the cipher.
Generate ciphertext
Use the following command to create a password for the ciphertext:
Python-c "Import Ipython;print IPython.lib.passwd ()"
After execution you need to enter and confirm the password, then the program will return a ' SHA1: ... ' Ciphertext, we'll use it next.
Modify Configuration
Build configuration file
We use the--generate-config parameter to generate the default configuration file:
Jupyter Notebook--generate-config--allow-root
The generated configuration file is in the/root/.jupyter/directory and can be edited in this configuration.
Modify Configuration
Then, at the bottom of the configuration file, add the following configuration:
C.notebookapp.ip = ' * '
C.notebookapp.allow_root = True
C.notebookapp.open_browser = False
C.notebookapp.port = 8888
C.notebookapp.password = U ' just generated ciphertext (sha: ...) '
C.contentsmanager.root_dir = '/data/jupyter/root '
which
C.notebookapp.password please fill in the ciphertext in the previous step, including the SHA: section.
You can also directly configure or use Nginx to proxy the service to 80 or 443 ports.
Start Jupyter Notebook
Direct start
Start Jupyter Notebook with the following command:
Jupyter Notebook
At this point, access to http://115.159.157.37:8888 can enter the Jupyter home page.
Create Notebook
Running in the background
The way to start jupyter directly with the Jupyter Notebook command will be interrupted when the connection is disconnected, so we need to have the Jupyter service in the background.
First press Ctrl + C and enter Y to stop the Jupyter service, and then execute the following command:
Nohup Jupyter Notebook >/data/jupyter/jupyter.log 2>&1 &
This command will cause Jupyter to run in the background and write the log in the/data/jupyter/jupyter.log file.
Installation to the end I thought everything was ready, but finally opened in the browser but always response time-out, finally found a half-day reason is a firewall problem. Add the 8888 port to the firewall file, and then restart the firewall to open normally.
Jupyter Notebook Introduction Jupyter Notebook is an open source Web application that can be used to create and share documents that contain dynamic code, equations, visualizations, and explanatory text. It is applied to include: Data collation and transformation, numerical simulation, statistical modeling, machine learning and so on. For more information, please visit our website. Check python environment The Python 2.7 is integrated by default in CentOS 7.2, and you can check the Python version with the following command: Python--version installation pippip is a Python package management tool, we use the Yum command to install the tool : yum-y Install PYTHON-PIP Use the following command to upgrade the PIP to the latest version: Pip install--upgrade PIP installation related dependent installation The Jupyter process also requires some other dependencies, we use the following command to install them: yum-y gr Oupinstall "Development Tools" Yum-y Install python-devel Configure Virtual Environment installation Virtualenv
We will create a separate virtual environment for Jupyter and isolate it from the Python that comes with the system. To do this, first install the VIRTUALENV Library: Pip install virtualenv Create a virtual environment
Create a dedicated virtual environment and activate it directly into the environment: virtualenv venvsource venv/bin/activate use pip to install Jupyter we use the PIP command to install JUPYTER:PIP installation Jupyter Configuring Jupyter Notebook setting up a project directory we'll first prepare a directory for the Jupyter related files: Mkdir/data/jupytercd/data/jupyter to build a directory as Jupyter Run root directory: Mkdir/data/jupyter/root prepare cipher cipher Since we will start Jupyter in a mode that requires password authentication, we need to pre-generate the ciphertext for the required password. Generate ciphertext
Use the following command to create a ciphertext password: python-c "import ipython;print IPython.lib.passwd ()" will need to enter and confirm the password after execution, then the program will return a ' SHA1: ... ' Ciphertext, we'll use it next. Modify the configuration build configuration file
We use the--generate-config parameter to generate the default profile: Jupyter notebook--generate-config--allow-root The generated configuration file in the/root/.jupyter/directory, You can click this to edit the configuration. Modify Configuration
Then, at the bottom of the configuration file, add the following configuration: C. Notebookapp.ip = ' * ' c.notebookapp.allow_root = Truec.NotebookApp.open_browser = Falsec.NotebookApp.port = 8888c. Notebookapp.password = U ' just generated ciphertext (sha: ...) ' C.contentsmanager.root_dir = '/data/jupyter/root ' Where: C. Notebookapp.password please fill in the ciphertext in the previous step, including the SHA: section. You can also directly configure or use Nginx to proxy the service to 80 or 443 ports. Start Jupyter Notebook Direct start using the following command to start Jupyter Notebook:jupyter Notebook at this time, access to http://115.159.157.37:8888 to enter the Jupyter home. Creating a notebook background run directly with the Jupyter Notebook command to start Jupyter will break when the connection is broken, so we need to have the Jupyter service in the background. First press Ctrl + C and enter Y to stop the Jupyter service, and then execute the following command: Nohup Jupyter notebook >/data/jupyter/jupyter.log 2>&1 & This command will make the Ju The pyter runs in the background and writes the logs in the/data/jupyter/jupyter.log file.
Installing remote Jupyter in the Conda environment and Python2.7 in CentOS 7