Docker container installation and configuration Anaconda environment
If you do not need to create a docker container, you can directly skip the step of creating a container.
Create container
docker run -d -p 80:80 nginx
Create a new container and run a command
Syntax docker run [OPTIONS] IMAGE [COMMAND] [ARG…]
-d returns the container ID for the background running container
-p specifies port mapping host port: container port
You docker run -d -p 81:80 nginx
can create a new external port mapped to the same container port and open the same page
Start SSH service
After starting the SSH service, you can open the docker container without using the host. For specific methods, see: Start the SSH service
Configure Anaconda (python) environment
Using Anaconda
1. Download Anaconda
I downloaded it directly to the local windows computer. Go directly to the official website https://www.anaconda.com/products/individual#linux to download the Python3 version.
2. Upload to linux server
I use WinSCP software to send files through SFTP protocol.
If you are using a container, then the host name here is the IP of the host, and the port number is the port number of the host (this port number is mapped to port 22 of the container). If you use the host itself, use the IP address of the host directly. You can query it through the ifconfig command, port number 22
If the connection fails to be established, check whether the ssh service is turned on. For specific installation and detection methods, see Starting the SSH Service.
After the connection is successful, drag Anaconda3-2021.05-Linux-x86_64
the file directly to the linux directory
3.Anaconda installation
-
cd to the directory where the Anaconda installation package is placed in Linux
-
enter
bash Anaconda3-2021.05-Linux-x86_64.sh
-
When the interface shown below appears, press ENTER and keep ENTER
-
until it appears
Enter yes and wait for the installation to complete
-
When prompted whether you want the installer
conda init
to initialize by running
Official recommendation: yes
1. Select yes:
If you select yes, the following content will be added to the bashrc file, so that the conda activate root command will be automatically executed when the terminal is opened, so that when python is entered in the terminal, the default is python3 (CentOS7 and below are installed by default. python2).
Entering the shell interface in this way, the front of the command will become (base), the default is python3, and the previous one was (root). The method to change back to root isconda activate root
2. Select no:
If you choose no, you need to manually add environment variables after installing anaconda.
6. 安装完成!
Exit the Anaconda environment
conda deactivate
# 若要重新进入用 conda activate xxx
View python interpreter path
Type in the terminal python
to enter the python command line
enter
import sys
sys.executable
The bash interface will display the python interpreter path