This post will guide you how to download and install Anaconda Python Distribution an ubuntu 16.04/18.04 Linux server through the following steps.
- Downloading Anaconda
- Verify the Data Integrity of the Anaconda Bash Script
- Run the Anaconda Installation Script
- Activate the Installation of Anaconda
- Test the Installation of Anaconda
- Setup Anaconda Environments
Anaconda is a free and open-source distribution of the Python and R programming languages for scientific computing, that aims to simplify package management and deployment. Package versions are managed by the package management system conda. The open source Anaconda Distribution is the fastest and easiest way to do Python and R data science and machine learning on Linux, Windows, and Mac OS X. It’s the industry standard for developing, testing, and training on a single machine.
Install Anaconda on Ubuntu 16.04/17.04/18.04
#1 Get the Latest Version of Anaconda
You can try to get the latest version of anaconda from the Anaconda Downloads page . And the latest version of anaconda is version 5.2.0. You can use the wget tool to download the Anaconda Installation script. Type the following command:
# wget https://repo.anaconda.com/archive/Anaconda3-5.2.0-Linux-x86_64.sh . --no-check-certificate
Outputs:
root@devops-osetc:/home/devops# wget https://repo.anaconda.com/archive/Anaconda3-5.2.0-Linux-x86_64.sh . --no-check-certificate --2018-12-25 11:46:56-- https://repo.anaconda.com/archive/Anaconda3-5.2.0-Linux-x86_64.sh Resolving www-proxy.us.osetc.com (www-proxy.us.osetc.com)... 148.87.19.20 Connecting to www-proxy.us.osetc.com (www-proxy.us.osetc.com)|148.87.19.20|:80... connected. WARNING: cannot verify repo.anaconda.com's certificate, issued by ‘CN=COMODO ECC Domain Validation Secure Server CA 2,O=COMODO CA Limited,L=Salford,ST=Greater Manchester,C=GB’: Issued certificate not yet valid. Proxy request sent, awaiting response... 200 OK Length: 651745206 (622M) [application/x-sh] Saving to: ‘Anaconda3-5.2.0-Linux-x86_64.sh’ Anaconda3-5.2.0-Linux-x86_64.sh 100%[==========================================================================>] 621.55M 346KB/s in 30m 52s 2018-12-25 12:17:50 (344 KB/s) - ‘Anaconda3-5.2.0-Linux-x86_64.sh’ saved [651745206/651745206] --2018-12-25 12:17:50-- http://./ Connecting to www-proxy.us.osetc.com (www-proxy.us.osetc.com)|148.87.19.20|:80... connected. Proxy request sent, awaiting response... 400 badrequest 2018-12-25 12:17:50 ERROR 400: badrequest. FINISHED --2018-12-25 12:17:50-- Total wall clock time: 30m 54s Downloaded: 1 files, 622M in 30m 52s (344 KB/s)
The anaconda bash script has been downloaded to your local disk.
#2 Verify the Data Integrity of the Anaconda Bash Script
After downloaded the Anaconda Bash script to your local disk, you still need to check the data integrity of installer file with MD5 or SHA-256 checksum. Type the following command:
$ md5sum Anaconda3-5.2.0-Linux-x86_64.sh
Or
$ sha256sum Anaconda3-5.2.0-Linux-x86_64.sh
Outputs:
root@devops-osetc:/home/devops# md5sum Anaconda3-5.2.0-Linux-x86_64.sh 3e58f494ab9fbe12db4460dc152377b5 Anaconda3-5.2.0-Linux-x86_64.sh root@devops-osetc:/home/devops# sha256sum Anaconda3-5.2.0-Linux-x86_64.sh 09f53738b0cd3bb96f5b1bac488e5528df9906be2480fe61df40e0e0d19e3d48 Anaconda3-5.2.0-Linux-x86_64.sh
Note: you can verify results against the proper hash page to make sure the hashes match.
#3 Run the Anaconda Installation Script
You can run the Anaconda installation script to install Anaconda for python 3.7 in your Ubuntu 16.04/18.01 Linux server. type:
$ bash Anaconda3-5.2.0-Linux-x86_64.sh
Outputs:
root@devops-osetc:/home/devops# sha256sum Anaconda3-5.2.0-Linux-x86_64.sh 09f53738b0cd3bb96f5b1bac488e5528df9906be2480fe61df40e0e0d19e3d48 Anaconda3-5.2.0-Linux-x86_64.sh root@devops-osetc:/home/devops# bash Anaconda3-5.2.0-Linux-x86_64.sh Welcome to Anaconda3 5.2.0 In order to continue the installation process, please review the license agreement. Please, press ENTER to continue >>>
You should press Enter key on you keyboard to review the license agreement so that to continue the installation process. And you need to press Space key to get the end of the license. Then you need to be asked to approve the license terms.
Outputs:
kerberos (krb5, non-Windows platforms) A network authentication protocol designed to provide strong authentication for client/server applications by using secret-key cryptography. cryptography A Python library which exposes cryptographic recipes and primitives. Do you accept the license terms? [yes|no] [no] >>>
You need to type yes to accept the license terms to continue the installation process. Then you need to confirm the default location or specify a different location of installation. at this example, you can press ENTER key to accept the default location. And the installation will proceed.
Outputs:
Anaconda3 will now be installed into this location: /root/anaconda3 - Press ENTER to confirm the location - Press CTRL-C to abort the installation - Or specify a different location below [/root/anaconda3] >>>
Then the installation will take some time to be completed. And you will see the following installation finished output.
Outputs:
[/root/anaconda3] >>> PREFIX=/root/anaconda3 installing: python-3.6.5-hc3d631a_2 ... Python 3.6.5 :: Anaconda, Inc. installing: blas-1.0-mkl ... installing: ca-certificates-2018.03.07-0 ... installing: conda-env-2.6.0-h36134e3_1 ... installing: intel-openmp-2018.0.0-8 ... installing: libgcc-ng-7.2.0-hdf63c60_3 ... installing: libgfortran-ng-7.2.0-hdf63c60_3 ...... installing: statsmodels-0.9.0-py36h3010b51_0 ... installing: blaze-0.11.3-py36h4e06776_0 ... installing: seaborn-0.8.1-py36hfad7ec4_0 ... installing: anaconda-5.2.0-py36_3 ... installation finished.
Once the installation is complete, you will get the following output to make sure if you want the installer to prepend the Anaconda3 install location to PATH environment variable. You can type yes to use the conda command.
Outputs:
Do you wish the installer to prepend the Anaconda3 install location to PATH in your /root/.bashrc ? [yes|no] [no] >>> yes Appending source /root/anaconda3/bin/activate to /root/.bashrc A backup will be made to: /root/.bashrc-anaconda3.bak For this change to become active, you have to open a new terminal. Thank you for installing Anaconda3! ===========================================================================
Then the installer will ask you if you want to install VSCode, you can type yes to install it and type no to decline.
Outputs:
Anaconda is partnered with Microsoft! Microsoft VSCode is a streamlined code editor with support for development operations like debugging, task running and version control. To install Visual Studio Code, you will need: - Administrator Privileges - Internet connectivity Visual Studio Code License: https://code.visualstudio.com/license Do you wish to proceed with the installation of Microsoft VSCode? [yes|no] >>> no
So far, the installation of Anaconda3 has been completed.
#4 Activate the Installation of Anaconda3
you need to run the following command to activate the installation of Anaconda3, and it has been added into the .bashrc file in your current user directory, type:
$ source ~/.bashrc
#5 Test the Installation of Anaconda3
After installed Anaconda3 in your Ubuntu Linux server, you can use the following conda command to test installation and activation, type:
# conda list
Or
# conda info
Outputs:
root@devops-osetc:/home/devops# conda list # packages in environment at /root/anaconda3: # # Name Version Build Channel _ipyw_jlab_nb_ext_conf 0.1.0 py36he11e457_0 alabaster 0.7.10 py36h306e16b_0 anaconda 5.2.0 py36_3 anaconda-client 1.6.14 py36_0 anaconda-navigator 1.8.7 py36_0 anaconda-project 0.8.2 py36h44fb852_0 asn1crypto 0.24.0 py36_0 astroid 1.6.3 py36_0 astropy 3.0.2 py36h3010b51_1 attrs 18.1.0 py36_0 babel 2.5.3 py36_0 backcall 0.1.0 py36_0 backports 1.0 py36hfa02d7e_1 backports.shutil_get_terminal_size 1.0.0 py36hfea85ff_2 beautifulsoup4 4.6.0 py36h49b8c8c_1 bitarray 0.8.1 py36h14c3975_1 ...... root@devops-osetc:/home/devops# conda info active environment : None user config file : /root/.condarc populated config files : conda version : 4.5.4 conda-build version : 3.10.5 python version : 3.6.5.final.0 base environment : /root/anaconda3 (writable) channel URLs : https://repo.anaconda.com/pkgs/main/linux-64 https://repo.anaconda.com/pkgs/main/noarch https://repo.anaconda.com/pkgs/free/linux-64 https://repo.anaconda.com/pkgs/free/noarch https://repo.anaconda.com/pkgs/r/linux-64 https://repo.anaconda.com/pkgs/r/noarch https://repo.anaconda.com/pkgs/pro/linux-64 https://repo.anaconda.com/pkgs/pro/noarch package cache : /root/anaconda3/pkgs /root/.conda/pkgs envs directories : /root/anaconda3/envs /root/.conda/envs platform : linux-64 user-agent : conda/4.5.4 requests/2.18.4 CPython/3.6.5 Linux/4.15.0-43-generic ubuntu/18.04 glibc/2.27 UID:GID : 0:0 netrc file : None offline mode : False
#6 Setup Anaconda Environments
You can try to create Anaconda environments with the conda create command. For example, you can crate a python 3 environment called mypy3Env with the following command:
# conda create --name mypy3Env python=3 # source activate mypy3Env
Now You have installed Anaconda on your Ubuntu 16.04/18.04 Linux server.