Install Anaconda in AWS EC2 (centos) and run Jupyter Notebook

Maurya Allimuthu
3 min readJun 21, 2020

This article helps to install the Aanconda in AWS (EC2) and use it. We have setup the same in “centos 7” linux instance.

Authors: Maurya Allimuthu, Gopa Kumar

Prerequisites

  1. The User should have an EC2 machine with sudo/relevant access.
  2. The EC2 instance should have access to internet.

Please follow the below steps to setup the same.

Step 1

Login into the EC2 instance. Download the package using “wget” command. Refer the repository https://repo.anaconda.com/archive/

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

Step 2

Verify the downloaded package by checking the checksum.

sha256sum /tmp/Anaconda3–2020.02-Linux-x86_64.sh

Step 3

Install the Anaconda sh/bash file.

sh /tmp/Anaconda3–2020.02-Linux-x86_64.sh

Keep entering, Once you get yes/no prompt, please proceed with “yes”

It will show the default path where the Anaconda/Anaconda3 would be installed (say /home/centos/anaconda3/ ) and also asks for the path where the anaconda needs to be installed. Based on your need please use the existing path or provide path of your choice.

Once Installed files will be created in the above provided path.

Step 4

Run the below two commands

4.1) To download and extract the conda files and place in apt directories.

conda update conda

provide ‘y’

4.2) To download the necessary applications and python packages used in Anaconda. They are like jupyter, spider, scipy, numpy..etc,

conda update anaconda

proceed with ‘y’

Step 5

To setup bashrc file,

Please copy paste the below snippet in the ~/.bashrc and change the path accordingly. change “/data/anaconda3/” to your installed path.

Run the ~/.bashrc using source command.

Step 6

Configure jupyter environment and password
6.1) Run the below command to create jupyter environment.

jupyter notebook — generate-config

The below command will create “.jupyter” folder in the home folder.

(base) [******@******** anaconda3]$ ls /home/centos/.jupyter/
jupyter_notebook_config.py migrated Untitled.ipynb

6.2) create a sha1 password using the below method

run “ipython” then

from notebook.auth import passwd; passwd()

6.3) Edit the file vim ~/.jupyter/jupyter_notebook_config.py

Step 7

Note: Open the port 8888 in AWS

Start jupyter using “jupyter notebook”

Enter the apt password and play with notebook.

--

--