42

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?

3
  • Have you tried reading the "Getting started" document linked in your link?
    – MrGumble
    Mar 4, 2015 at 11:07
  • 22
    The Getting started document requires the download of a setup program through the browser. Please avoid unnecessary and unwarranted sarcasm.
    – Tom Slee
    Aug 12, 2016 at 17:03
  • Isn't Anaconda the installer for Redhat?
    – user324747
    Apr 21, 2020 at 18:45

8 Answers 8

45

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

9
  • 1
    After I run the second line, nothing happens. Is this a common bug? Jan 19, 2019 at 2: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, 2019 at 9:28
  • I get no output. The command just finishes and nothing happens Jan 23, 2019 at 6:58
  • I used the most recent version. Jan 23, 2019 at 7:06
  • Silly question, you're definitely running this in bash, right ?
    – Greg Lever
    Jan 23, 2019 at 11:59
30

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.

1
  • 1
    This also worked fine for my CentOS Linux 7. Thanks!
    – knia
    Sep 5, 2017 at 12:45
15

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

1
  • What is Bash -b -p I couldn't find those in search?
    – Ali
    Jun 21, 2021 at 20:19
4

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.

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.

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!

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

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

1
  • 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 5, 2017 at 4: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.

2
  • How do I execute it as a shell script? Nov 5, 2020 at 4:34
  • You want to run the shell script in the above steps ? Or any script of your own @kirtipurohit ? Nov 5, 2020 at 6:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.