JNevens
JNevens

Reputation: 12002

Install Anaconda on Ubuntu (or Linux) via command line

I would like to install Anaconda on a remote server running Ubuntu 12.04.

I only have access to this server via SSH.

How can I install Anaconda via the command line?

Upvotes: 44

Views: 87462

Answers (8)

Franck Dernoncourt
Franck Dernoncourt

Reputation: 83387

Here are the commands I use to install conda on Ubuntu 20.04.5 LTS (Focal Fossa) and bash:

wget https://repo.anaconda.com/archive/Anaconda3-2023.03-1-Linux-x86_64.sh 
bash Anaconda3-2023.03-1-Linux-x86_64.sh -b
if ! [[ $PATH =~ "$HOME/anaconda3/bin" ]]; then PATH="$HOME/anaconda3/bin:$PATH" fi
conda init bash
source ~/.bashrc 
conda update conda

The -b installs conda without any user input.

To test:

conda list
conda create -y -n mpt39 python=3.9
conda activate mpt39

To remove anaconda3, see https://stackoverflow.com/a/42182997/395857.

Upvotes: 5

kmario23
kmario23

Reputation: 61445

Please take a look at the Anaconda repo archive page and select an appropriate version that you'd like to install by copying the URL.

After that, just do:

 # replace this `Anaconda3-version.num-Linux-x86_64.sh` with your choice
~$ wget -c https://repo.continuum.io/archive/Anaconda3-vers.num-Linux-x86_64.sh
~$ bash Anaconda3-version.num-Linux-x86_64.sh

Concrete Example:

As of this writing, Anaconda3-2020.07 is the latest version. So,

~$ wget -c https://repo.anaconda.com/archive/Anaconda3-2020.07-Linux-x86_64.sh
~$ bash Anaconda3-2020.07-Linux-x86_64.sh

P.S. Based on comments, this should also work on CentOS systems.

Upvotes: 32

Greg Lever
Greg Lever

Reputation: 963

Something along the lines of:

wget https://repo.anaconda.com/archive/Anaconda3-2020.07-Linux-x86_64.sh

to get the installer for 64 bit linux followed by:

bash Anaconda3-2020.07-Linux-x86_64.sh

You can get the latest release from here

Upvotes: 49

shivaraj karki
shivaraj karki

Reputation: 159

Download Anaconda for linux, place in your ubuntu system through WinScp, then $ sudo bash Anaconda2-4.3.0-Linux-x86_64.sh

after this logout of your ssh session and then login, you will get base environment.

Upvotes: 3

Pablo Ruiz Ruiz
Pablo Ruiz Ruiz

Reputation: 636

1 - Go to Anaconda Repository, find the installation for your OS and copy the address

2 - wget {paste}. Ex: https://repo.continuum.io/archive/Anaconda3-5.2.0-Linux-x86_64.sh

3 - Execute with: bash. Ex: bash Anaconda3-5.2.0-Linux-x86_64.sh

Run!

Upvotes: 1

You can do as Prashant said or you can use bash scripts to automate the installation. Just simply copy and paste depending on the version of Python you want

If you are trying to it entirely in command line you use a bash script python 2 anaconda install bash script:

# Go to home directory
cd ~

# You can change what anaconda version you want at 
# https://repo.continuum.io/archive/
wget https://repo.continuum.io/archive/Anaconda2-4.2.0-Linux-x86_64.sh
bash Anaconda2-4.2.0-Linux-x86_64.sh -b -p ~/anaconda
rm Anaconda2-4.2.0-Linux-x86_64.sh
echo 'export PATH="~/anaconda/bin:$PATH"' >> ~/.bashrc 

# Refresh basically
source .bashrc

conda update conda

python 3 anaconda install bash script

# Go to home directory
cd ~

# You can change what anaconda version you want at 
# https://repo.continuum.io/archive/
wget https://repo.continuum.io/archive/Anaconda3-4.2.0-Linux-x86_64.sh
bash Anaconda3-4.2.0-Linux-x86_64.sh -b -p ~/anaconda
rm Anaconda3-4.2.0-Linux-x86_64.sh
echo 'export PATH="~/anaconda/bin:$PATH"' >> ~/.bashrc 

# Refresh basically
source .bashrc

conda update conda

Source: https://medium.com/@GalarnykMichael/install-python-on-ubuntu-anaconda-65623042cb5a

Upvotes: 17

Prashant Kumar
Prashant Kumar

Reputation: 2092

Just download the anaconda installer and execute it as it is a shell script. Follow the steps :

  1. In the terminal type "wget https://repo.continuum.io/archive/Anaconda-2.3.0-Linux-x86_64.sh"

  2. The file will be downloaded in current directory. Now execute the downloaded file by "bash ./Anaconda-2.3.0-Linux-x86_64.sh"

  3. Restart the terminal. This is very important for python version provided by anaconda to be set to default for that user.

Note- Try using environment for using different version of python. Changing the default python version for root might result in non functioning of some functionalities like yum.

Upvotes: 0

Raj Saha
Raj Saha

Reputation: 79

$ sudo bash Anaconda2-4.3.0-Linux-x86_64.sh

Video tutorial:: https://youtu.be/JP60kTsVJ8E

Upvotes: 0

Related Questions