Anconda installation, Jupyter notebook deployment and remote access (to Ali cloud centos for example) in the 64-bit linux

Introduction

I used a few times Jupyter notebook, feeling very friendly for beginners. In some scientific data application scenarios, such interactive python interpreter, not simply better. Compared to Ipython, Jupyter advantage is its more powerful and feature-rich, and it can be accessed at the web end, which Jupyter notebook and more suitable for beginners I use. Of course, we will use the next Jupter Lab, but the first notebook to get started.
Jupyter notebook + Anconda seems to be a very good choice, anconda provides many common scientific data packets, such as mathematical modeling commonly used numpy, pandas, matplotlab, etc., and built a number of development tools, such as Jupyter notebook, the author now with Ali ECS example to explain the cloud server deployment and use.

Configuration

Service Provider: Ali cloud
CPU: Intel Xeon E5-2682 v4 2 nuclear
Memory: DDR4 4GB
of bandwidth: 1M
system disk: 40GB
OS: Centos 8.0 64 Wei

Anconda installation

Step One: Download the installation file

Now I know, you can get anconda installation package from two locations, recommended to choose the installation package Tsinghua tuna source, I found the official website of the package due in a foreign country, only a few hundred kb to seconds, while Tsinghua tuna source almost ran full speed
Tsinghua tuna source: https://mirrors.tuna.tsinghua.edu.cn/anaconda/archive/
official source: https://repo.continuum.io/archive/index.html
after opening, choose the newer version to get his download link, no accident, then, should be accompanied update next time, choose the newer
Here Insert Picture Description
of our choice here is used in the latest 64-bit linux version of anconda
point after the opening, there should be a common browser will pop up a download the link and the author here is https://mirrors.tuna.tsinghua.edu.cn/anaconda/archive/Anaconda3-5.3.1-Linux-x86_64.sh
remember this link, the next step is useful

Step 2: Install Anconda

Use the following few commands to start your installation

wget https://mirrors.tuna.tsinghua.edu.cn/anaconda/archive/Anaconda3-5.3.1-Linux-x86_64.sh

This function is a command to download the appropriate installation file, in the middle of that link should be a download link you find in the first step, by default, he will be saved to your current working directory

bash Anaconda3-5.3.1-Linux-x86_64.sh

This command opens the executable binary file, ready to begin the installation, followed by the name should be the name of the file you download the installation files anconda
The next step is an interactive installation process, usually the default, or according to their own choice options need
to note that the line will need to choose whether you choose to join an environment variable, the default is no, but be sure to choose yes! ! !
Here Insert Picture Description

The third step: changing the source and check the installation

Close the current terminal, restart a new terminal! ! !
Then execute the following two commands to change to a source Tsinghua tuna

conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
conda config --set show_channel_urls yes

Execute the following command, you can view the conda source of information, check whether the source is changed correctly

conda info

Under normal circumstances, the part should be underlined in the URLs of the front, with the highest priority
Here Insert Picture Description
to this anconda installed

Jupyter Notebook Configuration

Step 1: Install Jupyter Notebook

Use this command to install Jupyter Notebook

conda install jupyter notebook

Step Two: Get the key

First run IPython, open ipython directly in the terminal run this command

iPython

In the next operation, these two codes are sequentially performed

from notebook.auth import passwd
passwd()

Here Insert Picture Description
Press Options to enter a password, you will get a key interfaces, is part of the figure crossed out, remember him

Step three: Open the relevant interface, open Remote Access

Execute the following command, he will generate relevant configuration file in your home directory

jupyter notebook --generate-config

Under normal circumstances, he does not want to generate the configuration file as root, if error, you can use

jupyter notebook --generate-config --allow-root

Returns the correct operating position of the configuration file, the configuration file in a hidden directory (the beginning of the play.)
Open the configuration file with vim, and make the following changes, you can add the following lines at the end

c.NotebookApp.password = 'sha1:xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'#这里应该是你的密钥
c.NotebookApp.ip='*'#允许访问的ip,这里可以填写*,代表所有ip均可访问
c.NotebookApp.open_browser = False
c.NotebookApp.port =80 #浏览器端口,80就是普通的http服务接口,打开时就不用指定port

Finally, again run the service, successfully launched!

nohup jupyter notebook &

Nohup here for pending services to the ssh client still can use close
attention, after restarting the server, you may need to restart the notebook, recommended that this command is added to the scheduled task
is not recommended to use the root user to start, which could damage related file, you need to perform as root, do

nohup jupyter notebook --allow-root &

What if an error occurs during use, can be repaired under execution

bash Anaconda3-5.3.1-Linux-x86_64.sh -u
Published 37 original articles · won praise 6 · views 4768

Guess you like

Origin blog.csdn.net/STL_CC/article/details/105280867