Kunpeng 920 openEuler operating system deployment and installation of Anaconda3 and Jupyter Notebook

I wrote an article on Kunpeng 920 CentOS7 deployment and installation of Archiconda3 and Jupyter notebook.
Some friends also said, why is there no Anaconda3? At that time, the official aarch64 version (for Kunpeng 920) was not released.
Recently, I suddenly discovered that the official release of Anaconda3 aarch64 version
So, This article will take you for a walk and play

Seriously, this article makes a lot of sense

  • Through this article, you can directly open the road of Python learning, without any IDE development tools, you can use the browser to program immediately

  • Through this article, you can start the road of data analysis (pandas/numpy/…), data mining (Data Mining)

  • You can also use this article to start the road of AI (Deep Learning Deep Learning, Machine Learning Machine Learning, Neural Network TensorFlow)


First post the article I wrote before
Kunpeng 920 CentOS7 deployment and installation of Archiconda3 and Jupyter notebook



0. Environmental Description

The specific environment used in this article: (Kunpeng 920, openEuler operating system)

[root@oe-20-09 ~]# uname -sr
Linux 4.19.140-2009.4.0.0048.oe1.aarch64
[root@oe-20-09 ~]#
[root@oe-20-09 ~]# cat /etc/system-release
openEuler release 20.09
[root@oe-20-09 ~]#

1. Create a user

Operate directly under the root user

useradd ai1024

add password

  • Way 1:
echo "password" | passwd --stdin ai1024
  • Way 2:
echo "ai1024:password" | chpasswd
  • Way 3:
passwd ai1024

2. Download the Anaconda3 aarch64 one-click deployment script

  • Create data directory
mkdir -p /datafs/ai1024
  • Download the script to the data directory
wget https://mirrors.tuna.tsinghua.edu.cn/anaconda/archive/Anaconda3-2021.11-Linux-aarch64.sh -P /datafs/ai1024
  • Authorize the script (normal user rights)
chown -R ai1024:ai1024 /datafs/ai1024

3. One-click deployment of Anaconda3

  • Switch to normal user first
su - ai1024
  • Execute one-click deployment scripts
sh /datafs/ai1024/Anaconda3-2021.11-Linux-aarch64.sh

After execution, press Enter

1

Then, yes to accept the license

Then customize the installation directory (the lazy person is also wide by default, but by default it will be installed in the user's home directory)

2
Then, yes initialize conda

3

Note: this command

conda config --set auto_activate_base false

Automatic activation can be deactivated (base)

I will demonstrate it later, and re-enter the terminal. The default is the activated pseudo terminal, which will have (base) in front of [ai1024@oe-20-09 ~]

4

Then we close the terminal and re-enter the terminal, we will find a pseudo terminal (base)

5

Then we can set to cancel the automatic activation of the pseudo terminal (base)

conda config --set auto_activate_base false

6

Then we exited the terminal, reopened the terminal, and found that the pseudo terminal (base) no longer appeared in the default terminal.

7

Then, at this time, if I want to enter the pseudo terminal (base) again,
use this command

conda activate

8

Then, at this time, if I want to exit the pseudo terminal (base) again,
use this command

conda deactivate

9

Then let's take a look at the hidden files generated by the current user's home directory

ls -la

10

Then, let's take effect of the environment variables

source .bashrc

11

Then we enter the pseudo terminal, because the pseudo terminal has an Anaconda3 environment

[ai1024@oe-20-09 ~]$ conda activate
(base) [ai1024@oe-20-09 ~]$

Check conda version

(base) [ai1024@oe-20-09 ~]$ conda -V
conda 4.10.3
(base) [ai1024@oe-20-09 ~]$

check python version

(base) [ai1024@oe-20-09 ~]$ python -V
Python 3.9.7
(base) [ai1024@oe-20-09 ~]$

Check pip version

(base) [ai1024@oe-20-09 ~]$ pip -V
pip 21.2.4 from /datafs/ai1024/anaconda3/lib/python3.9/site-packages/pip (python 3.9)
(base) [ai1024@oe-20-09 ~]$

View the number of conda lists

(base) [ai1024@oe-20-09 ~]$ conda list|wc -l
402
(base) [ai1024@oe-20-09 ~]$

Check the jupyter version (this installation comes with dependencies, you don't need to install jupyter separately)

(base) [ai1024@oe-20-09 ~]$ jupyter --version
Selected Jupyter core packages...
IPython          : 7.29.0
ipykernel        : 6.4.1
ipywidgets       : 7.6.5
jupyter_client   : 6.1.12
jupyter_core     : 4.8.1
jupyter_server   : 1.4.1
jupyterlab       : 3.2.1
nbclient         : 0.5.3
nbconvert        : 6.1.0
nbformat         : 5.1.3
notebook         : 6.4.5
qtconsole        : 5.1.1
traitlets        : 5.1.0
(base) [ai1024@oe-20-09 ~]$

4. Configure Jupyter Notebook

Generate jupyter notebook default configuration file (default is none)

(base) [ai1024@oe-20-09 ~]$ jupyter notebook --generate-config
Writing default config to: /home/ai1024/.jupyter/jupyter_notebook_config.py
(base) [ai1024@oe-20-09 ~]$

Then configure the jupyter notebook default configuration file

vim /home/ai1024/.jupyter/jupyter_notebook_config.py

c.NotebookApp.allow_root = False
c.NotebookApp.ip = '0.0.0.0'
c.NotebookApp.open_browser = False
c.NotebookApp.port = 8888

Involving security issues (the browser panel can enter the linux terminal), we only use ordinary users, so disable the root user

ip is set to 0.0.0.0 This is to ensure that both the local and the outside world can access

port is set to 8888 is a custom port

Regarding the port, let me say a little more. In order to ensure external access, either turn off the firewall (firewalld).
If the firewall is open, then the port needs to be released.

[root@oe-20-09 ~]# firewall-cmd --zone=public --add-port=8888/tcp --permanent
success
[root@oe-20-09 ~]# firewall-cmd --reload
success
[root@oe-20-09 ~]#
[root@oe-20-09 ~]# firewall-cmd --list-ports
8888/tcp
[root@oe-20-09 ~]#

Then configure the jupyter notebook password

(base) [ai1024@oe-20-09 .jupyter]$ jupyter notebook password
Enter password:
Verify password:
[NotebookPasswordApp] Wrote hashed password to /home/ai1024/.jupyter/jupyter_notebook_config.json
(base) [ai1024@oe-20-09 .jupyter]$

5. Start and use Jupyter Notebook

Before starting, create a storage directory for later use

mkdir -p /datafs/ai1024/notebook

Then make sure you are in pseudo terminal (base) mode of Anaconda3

(base) [ai1024@oe-20-09 notebook]$

Then run the background to start jupyter notebook

(base) [ai1024@oe-20-09 notebook]$ nohup jupyter notebook >/tmp/ai1024-jupyter-notebook-20220226.log 2>&1 &
[1] 26022
(base) [ai1024@oe-20-09 notebook]$ 

Then exit the pseudo terminal (base) mode of Anaconda3

(base) [ai1024@oe-20-09 notebook]$ conda deactivate
[ai1024@oe-20-09 notebook]$

View jupyter process

[ai1024@oe-20-09 notebook]$ ps -ef|grep jupyter|grep -v grep
ai1024     26022       1  0 Feb26 ?        00:00:56 /datafs/ai1024/anaconda3/bin/python /datafs/ai1024/anaconda3/bin/jupyter-notebook
ai1024     30077   26022  0 Feb26 ?        00:00:15 /datafs/ai1024/anaconda3/bin/python -m ipykernel_launcher -f /home/ai1024/.local/share/jupyter/runtime/kernel-83982529-e755-4d41-973f-5ed355feea06.json
[ai1024@oe-20-09 notebook]$

View port 8888

[ai1024@oe-20-09 notebook]$ netstat -antp|grep 8888
(Not all processes could be identified, non-owned process info
 will not be shown, you would have to be root to see it all.)
tcp        0      0 0.0.0.0:8888            0.0.0.0:*               LISTEN      26022/python
[ai1024@oe-20-09 notebook]$

View log files

[ai1024@oe-20-09 notebook]$ ls -l /tmp/ai1024-jupyter-notebook-20220226.log
-rw-rw-r--. 1 ai1024 ai1024 14832 Mar  2 21:22 /tmp/ai1024-jupyter-notebook-20220226.log
[ai1024@oe-20-09 notebook]$

Then, use your web browser to access Anaconda3's Jupyter Notebook panel
, enter the password you set, and you're in!

12

After logging in, you can open a new world

111

222

333


More exciting! Please continue to follow this blogger!

Liver text is not easy. If you feel it is okay, please give a like and support , okay?


Friends, have you lost your studies?
See you next time, bye!

Guess you like

Origin blog.csdn.net/frdevolcqzyxynjds/article/details/123283242