39

I would like to install Anaconda on a remote server.

The server is running Ubuntu 12.04.

I only have access to this server via SSH.

How can I install Anaconda via the command line?

kmario23
  • 57,311
  • 13
  • 161
  • 150
JNevens
  • 11,202
  • 9
  • 46
  • 72

8 Answers8

41

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

Kuldeep Singh Sidhu
  • 3,748
  • 2
  • 12
  • 22
Greg Lever
  • 863
  • 12
  • 21
  • 1
    After I run the second line, nothing happens. Is this a common bug? – Lubed Up Slug Jan 19 '19 at 02:26
  • @LubedUpSlug what output do you get ? I'm not sure if that version in the command is supported any longer. – Greg Lever Jan 22 '19 at 09:28
  • I get no output. The command just finishes and nothing happens – Lubed Up Slug Jan 23 '19 at 06:58
  • I used the most recent version. – Lubed Up Slug Jan 23 '19 at 07:06
  • Silly question, you're definitely running this in bash, right ? – Greg Lever Jan 23 '19 at 11:59
  • What would be a way to test that? This is a new (to me) machine so that could be it. I made a hello world bash script and that worked, but I'm not very proficient in bash. – Lubed Up Slug Jan 23 '19 at 21:34
  • `echo $SHELL` will return `/bin/bash` if you're running bash. Also https://stackoverflow.com/questions/9910966/how-to-tell-if-its-using-zsh-or-bash – Greg Lever Jan 24 '19 at 10:16
  • yep it's running bash. If this isn't a common problem (doesn't seem to be) then I doubt it can be debugged over SO comments. I'll work on this myself for now and write back here if I find a clean fix. Thanks for your help – Lubed Up Slug Jan 25 '19 at 19:59
  • If you must suggest to download a script and run it, at least be from a trusted source. The current URL refers to a CDN host which cannot be verified points to the right origin. – spider Jul 24 '20 at 17:32
28

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

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 in CentOS systems.

kmario23
  • 57,311
  • 13
  • 161
  • 150
14

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

3

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
Franck Dernoncourt
  • 77,520
  • 72
  • 342
  • 501
2

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.

shivaraj karki
  • 139
  • 1
  • 8
1

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!

Pablo Ruiz Ruiz
  • 605
  • 1
  • 6
  • 23
0
$ sudo bash Anaconda2-4.3.0-Linux-x86_64.sh

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

Petter Friberg
  • 21,252
  • 9
  • 60
  • 109
rjrajsaha
  • 79
  • 1
  • 5
  • 1
    This presumes that you already have access to the file, which first you need to loate. The video tutorial requires downloading the file through their browser which defeats the purpose unless the user was going to use X11, which presumably they would prefer to avoid (see @TomSlee's comment in response to another comment at the question level). – mpacer Mar 05 '17 at 04:05
0

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.

Prashant Kumar
  • 2,057
  • 2
  • 9
  • 22