Conda is an open-source package manager used in data science, machine learning, and scientific computing, supporting Python, R, and other languages.

This guide covers installing Miniconda (a minimal Conda distribution) and Anaconda (the full package) on Ubuntu 24.04, plus update and removal steps.

Quick Answer

Download the Miniconda installer from the Conda website, assign executable permissions with chmod +x, and run the .sh file to install Conda.

How to Install Miniconda on Ubuntu 24.04

Step 1: Download the Conda Installer

Open the Miniconda installer page at docs.conda.io in Firefox. Scroll to the Linux installer section and click the link to start the download.

Firefox showing the Miniconda installer download page at docs.conda.io

Step 2: Navigate to Downloads Directory

After downloading the Miniconda installer, navigate to the Downloads directory in Terminal before proceeding with the next steps.

cd ~/Downloads
Terminal showing the cd Downloads command to navigate to the Downloads directory

Step 3: Verify the Downloaded File

Run ls -lrt to verify the Miniconda installer file is present in the Downloads directory. The .sh filename confirms a successful download.

ls -lrt
Terminal showing ls -lrt output with the Miniconda installer .sh file in the Downloads directory

Step 4: Assign Executable Permissions

Grant executable permission to the Miniconda installer using chmod +x. The file must be executable before the installation script can run.

chmod +x Miniconda3-latest-Linux-x86_64.sh
Terminal running chmod +x to assign executable permissions to the Miniconda installer file

Step 5: Run the Installer

Run the installer script to begin Miniconda installation. Press Enter when prompted to accept the license, confirm the directory, and initialize.

./Miniconda3-latest-Linux-x86_64.sh
Terminal running the Miniconda installer script with ./Miniconda3-latest-Linux-x86_64.sh

Enter yes to accept the license agreement. Continue pressing Enter to accept the default installation directory unless you prefer a different one.

Terminal showing the Miniconda license agreement prompt with yes entered to accept
Terminal showing the Miniconda installation directory confirmation prompt

Enter yes at the final prompt to initialize Miniconda and configure the shell to activate the base environment automatically on login.

Terminal showing the Miniconda installer prompt asking whether to initialize conda on login

When installation completes, the terminal displays a success message and instructions to close and reopen the shell to activate the base environment.

Terminal showing the Miniconda installation success message and shell reload instructions

Step 6: Verify Conda Installation

Open a new Terminal to activate the base environment. The (base) prefix confirms Miniconda is active. Run conda –version to see the installed version.

conda --version
Terminal showing conda --version output confirming Miniconda is installed on Ubuntu 24.04

How to Update Miniconda on Ubuntu 24.04

Run conda update conda in Terminal to update Miniconda to the latest version. Press y when prompted to confirm the upgrade of any outdated packages.

conda update conda
Terminal showing conda update conda command running and listing packages to upgrade

How to Deactivate Miniconda on Ubuntu 24.04

Run conda deactivate in Terminal to deactivate the base environment. The (base) prefix disappears from the prompt once deactivation completes.

conda deactivate

How to Uninstall Miniconda on Ubuntu 24.04

Follow these steps to remove Miniconda and all its associated files and configuration directories from Ubuntu 24.04 completely.

Step 1: Remove the Conda Directory

Remove the conda directory from the home folder. This removes the Conda binary and installed packages but leaves configuration files intact.

sudo rm -rf ~/conda
Terminal running sudo rm -rf to remove the conda directory from the home folder

Step 2: Remove Hidden Conda Files

Remove hidden Conda configuration files and directories from the home folder. These files store environment settings and cached package metadata.

sudo rm -rf ~/.condarc ~/.conda ~/.continuum
Terminal removing hidden Conda configuration files including .condarc and .conda from the home directory

Step 3: Remove the Miniconda3 Directory

Remove the miniconda3 installation directory. This deletes the full Miniconda installation, including all environments created in that directory.

sudo rm -rf ~/miniconda3

Step 4: Verify Removal

Run conda –version after removing all files. A command not found error confirms Miniconda has been fully removed from the system.

conda --version
Terminal showing command not found error for conda --version confirming Miniconda removal

How to Install Anaconda on Ubuntu 24.04

Step 1: Navigate to Downloads Directory

Switch to the Downloads directory in Terminal before running the curl command that downloads the Anaconda installer file to the system.

cd ~/Downloads
Terminal showing cd Downloads command before downloading the Anaconda installer

Step 2: Install Curl

Install the curl utility from the Ubuntu repository. Enter yes when prompted to confirm. Curl downloads files from URLs directly in Terminal.

sudo apt-get install curl
Terminal installing curl on Ubuntu 24.04 using sudo apt-get install curl

Step 3: Download Anaconda

Download the Anaconda installer with curl using the URL below. The -O flag saves the file with the original filename to the current directory.

curl -O https://repo.anaconda.com/archive/Anaconda3-2024.02-1-Linux-x86_64.sh
Terminal showing curl -O command downloading the Anaconda installer file from the Anaconda repository

Step 4: Verify the SHA256 Checksum

Verify the download by running sha256sum on the installer file. Check the output against the SHA256 value on the Anaconda download page to confirm.

sha256sum Anaconda3-2024.02-1-Linux-x86_64.sh
Terminal showing sha256sum output for verifying the Anaconda installer download integrity

Step 5: Run the Anaconda Installer

Run the Anaconda installer with bash. Press Enter at the welcome prompt to begin reading the license agreement, then enter yes to accept it.

bash Anaconda3-2024.02-1-Linux-x86_64.sh
Terminal running the Anaconda installer with bash and showing the initial installation prompt

Enter yes to accept the license and continue. Press Enter to confirm the installation location, then enter yes to initialize the conda environment.

Terminal showing the Anaconda installation prompts for license acceptance and directory confirmation

Step 6: Verify Anaconda Installation

Open a new Terminal after installation. Run conda –version to confirm Anaconda is installed. The command displays the installed conda version.

conda --version

Run conda info to display details about the installed Anaconda environment, including the active environment, conda version, and platform.

conda info
Terminal showing conda info output displaying Anaconda environment details and platform information

How to Deactivate Anaconda on Ubuntu 24.04

Run conda deactivate in Terminal to exit the Anaconda base environment. The (base) prefix is removed from the prompt after successful deactivation.

conda deactivate
Terminal showing conda deactivate command removing the base prefix from the shell prompt

How to Update Anaconda on Ubuntu 24.04

Step 1: Update Conda

Run conda update conda to update the Anaconda package manager. Enter y when prompted. All outdated packages in the current environment are upgraded.

conda update conda

Step 2: Verify the Conda Version

After the update finishes, run conda –version to confirm the updated version. The output shows the new version number installed on the system.

conda --version
Terminal showing conda --version output confirming the updated Anaconda version number

How to Uninstall Anaconda on Ubuntu 24.04

Follow these steps to fully remove Anaconda and its environment configuration from Ubuntu 24.04. The process uses the anaconda-clean tool.

Step 1: Install anaconda-clean

Install the anaconda-clean package using conda install. The tool removes Anaconda files in an organized way, prompting before each deletion.

conda install anaconda-clean

Step 2: Run anaconda-clean

Run anaconda-clean to remove Anaconda configuration files. Enter y or a at each prompt to confirm the deletions. Press Enter to accept the defaults.

anaconda-clean

Step 3: Remove the Anaconda3 Directory

Remove the Anaconda installation directory. This deletes the full Anaconda directory and all environments and packages installed within it.

sudo rm -rf ~/anaconda3
Terminal running sudo rm -rf to remove the anaconda3 installation directory from Ubuntu 24.04

Step 4: Edit .bashrc

Open the .bashrc file in nano to remove the Anaconda initialization block. The block was added by the installer and must be deleted manually.

sudo nano ~/.bashrc
Terminal running sudo nano to open the .bashrc file for editing the Conda initialization block

Step 5: Remove the Conda Initialization Block

Locate the Conda initialization block between the conda initialize markers and delete the entire block. Save and close the file when done.

Step 6: Verify Removal

Open a new Terminal and run conda –version. A command not found error confirms Anaconda has been fully removed from the system.

conda --version
Terminal showing the Miniconda installer script command in the shell

When Conda Is the Right Tool

Conda is the right tool when working on Python data science or machine learning projects that require managing multiple package environments at once.

Use Miniconda when disk space is limited or you only need a base Conda install. Use Anaconda when you want a full pre-built data science environment.

Related Guides