How to install Miniconda on Ubuntu 24.04

How to Install Miniconda on Ubuntu 24.04

Spread the love

Anaconda is a package, dependency function, and environment management. As environment management for programming languages, especially Python, Conda allows users to install packages online using the Conda server, for example, the NumPy module for linear algebra, scikit-learn for machine learning, and others. Miniconda is a mini version of Anaconda, which consists of the Python programming language, conda, and a smaller number of packages, so if you have problems with storage space, then you are recommended to install Miniconda compared to Anaconda. Furthermore, it also incorporates a limited assortment of valuable packages such as Requests, PIPs, and numerous others. This tutorial will show you how to install Miniconda on Ubuntu 24.04.

Prerequisites

  • A VPS with OS Ubuntu 24.04
  • SSH root access or a regular system user with sudo privileges

Conventions

# – given commands should be executed with root privileges either directly as a root user or by use of sudo command
$ – given commands should be executed as a regular user

Step 1. Log in via SSH

Let’s log in to your Ubuntu 24.04 VPS through SSH as a root user or regular user with sudo privileges.

ssh root@IP_Address -p Port_number

If you cannot log in as root, remember to replace “root” with a user with sudo privileges. Replace “IP_Address” and “Port_Number” with your server’s IP address and SSH port.

You can check whether you have the correct Ubuntu version installed on your server with the following command:

# lsb_release -a

You should get this output:

No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 24.04.1 LTS
Release: 24.04
Codename: noble

Let’s update the package index on our Ubuntu 24.04 system.

# apt update

Step 2. Download Miniconda Installer

According to their documentation page, it is best to install Miniconda for the local user, which does not require administrator permissions and is the most robust type of installation. However, if you need to, you can install Miniconda system-wide, which does require administrator permissions.

In this step, we will install Miniconda using the installer script provided by the developer. We must download the installer script and execute it to install Miniconda. Miniconda is not available in the default Ubuntu repository so you should download the latest version directly from their website.

# wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O /opt/miniconda-installer.sh

The Miniconda installer script has been downloaded and saved as /opt/miniconda-installer.sh

Let’s give the correct permission

# chmod +x /opt/miniconda-installer.sh

Step 3. Install Miniconda

In the previous step, we downloaded the installer script and made it executable. Now, we can invoke the command below to install Miniconda.

# /opt/miniconda-installer.sh

Follow the instructions shown on the screen. Press ENTER to review the license agreement. Keep pressing ENTER or SPACE to continue, and finally finish it. You will be prompted to accept the license terms at the end of the agreement. Type ‘yes’ to accept and continue.

Next, you will be shown this option below.

Miniconda3 will now be installed into this location:
/root/miniconda3

- Press ENTER to confirm the location
- Press CTRL-C to abort the installation
- Or specify a different location below

Just press ENTER and continue.

Once the installation is finished, you will be prompted to start Miniconda.

Do you wish the installer to initialize Miniconda3
by running conda init? [yes|no]
[no] >>>

Type ‘yes’, then hit ENTER. You should see this as an output.

Downloading and Extracting Packages:

Preparing transaction: done
Executing transaction: done
installation finished.
Do you wish to update your shell profile to automatically initialize conda?
This will activate conda on startup and change the command prompt when activated.
If you'd prefer that conda's base environment not be activated on startup,
run the following command when conda is activated:

conda config --set auto_activate_base false

You can undo this by running `conda init --reverse $SHELL`? [yes|no]

type yes and hit ENTER and then you will see this message:

no change /root/miniconda3/condabin/conda
no change /root/miniconda3/bin/conda
no change /root/miniconda3/bin/conda-env
no change /root/miniconda3/bin/activate
no change /root/miniconda3/bin/deactivate
no change /root/miniconda3/etc/profile.d/conda.sh
no change /root/miniconda3/etc/fish/conf.d/conda.fish
no change /root/miniconda3/shell/condabin/Conda.psm1
no change /root/miniconda3/shell/condabin/conda-hook.ps1
no change /root/miniconda3/lib/python3.12/site-packages/xontrib/conda.xsh
no change /root/miniconda3/etc/profile.d/conda.csh
modified /root/.bashrc

==> For changes to take effect, close and re-open your current shell. <==

Thank you for installing Miniconda3!

That’s it! Miniconda has been installed.

Step 4. Configure Miniconda

After the Miniconda installation, we need to apply the changes made to ~/.bashrc file. The file was modified by the Miniconda installer. Let’s execute the command.

# source miniconda3/bin/activate

To initialize conda on all available shells, run the following command:

# conda init --all

Now, at this point, you can run this command to check your Miniconda information

# conda info

You will see this output:

(base) root@rh:~# conda info

active environment : base
active env location : /root/miniconda3
shell level : 1
user config file : /root/.condarc
populated config files :
conda version : 24.7.1
conda-build version : not installed
python version : 3.12.4.final.0
solver : libmamba (default)
virtual packages : __archspec=1=westmere
__conda=24.7.1=0
__glibc=2.39=0
__linux=6.8.0=0
__unix=0=0
base environment : /root/miniconda3 (writable)
conda av data dir : /root/miniconda3/etc/conda
conda av metadata url : None
channel URLs : https://repo.anaconda.com/pkgs/main/linux-64
https://repo.anaconda.com/pkgs/main/noarch
https://repo.anaconda.com/pkgs/r/linux-64
https://repo.anaconda.com/pkgs/r/noarch
package cache : /root/miniconda3/pkgs
/root/.conda/pkgs
envs directories : /root/miniconda3/envs
/root/.conda/envs
platform : linux-64
user-agent : conda/24.7.1 requests/2.32.3 CPython/3.12.4 Linux/6.8.0-47-generic ubuntu/24.04.1 glibc/2.39 solver/libmamba conda-libmamba-solver/24.7.0 libmambapy/1.5.8 aau/0.4.4 c/. s/. e/.
UID:GID : 0:0
netrc file : None
offline mode : False

Next, if you want to update Miniconda, you can run this command:

# conda update --all

If updates are available, it will show you a list of packages to be updated, and you need to answer yes to proceed with the update.

(base) root@rh:~# conda update --all
Channels:
- defaults
Platform: linux-64
Collecting package metadata (repodata.json): done
Solving environment: done

## Package Plan ##

environment location: /root/miniconda3


The following packages will be downloaded:

package | build
---------------------------|-----------------
ca-certificates-2024.9.24 | h06a4308_0 130 KB
certifi-2024.8.30 | py312h06a4308_0 163 KB
cffi-1.17.1 | py312h1fdaa30_0 308 KB
conda-24.9.1 | py312h06a4308_0 1.1 MB
conda-libmamba-solver-24.9.0| pyhd3eb1b0_0 40 KB
cryptography-43.0.0 | py312hdda0065_0 2.2 MB
expat-2.6.3 | h6a678d5_0 176 KB
ld_impl_linux-64-2.40 | h12ee557_0 710 KB
libarchive-3.7.4 | hfab0078_0 920 KB
libcurl-8.9.1 | h251f7ec_0 439 KB
libmamba-1.5.8 | hfe524e5_3 1.8 MB
libmambapy-1.5.8 | py312h2dafd23_3 333 KB
openssl-3.0.15 | h5eee18b_0 5.2 MB
ruamel.yaml-0.18.6 | py312h5eee18b_0 271 KB
ruamel.yaml.clib-0.2.8 | py312h5eee18b_0 156 KB
setuptools-75.1.0 | py312h06a4308_0 2.2 MB
tqdm-4.66.5 | py312he106c6f_0 159 KB
tzdata-2024b | h04d1e81_0 115 KB
urllib3-2.2.3 | py312h06a4308_0 228 KB
wheel-0.44.0 | py312h06a4308_0 141 KB
zstandard-0.23.0 | py312h2c38b39_0 443 KB
zstd-1.5.6 | hc292b87_0 664 KB
------------------------------------------------------------
Total: 17.8 MB

The following NEW packages will be INSTALLED:

ruamel.yaml.clib pkgs/main/linux-64::ruamel.yaml.clib-0.2.8-py312h5eee18b_0

The following packages will be UPDATED:

ca-certificates 2024.7.2-h06a4308_0 --> 2024.9.24-h06a4308_0
certifi 2024.7.4-py312h06a4308_0 --> 2024.8.30-py312h06a4308_0
cffi 1.16.0-py312h5eee18b_1 --> 1.17.1-py312h1fdaa30_0
conda 24.7.1-py312h06a4308_0 --> 24.9.1-py312h06a4308_0
conda-libmamba-so~ 24.7.0-pyhd3eb1b0_0 --> 24.9.0-pyhd3eb1b0_0
cryptography 42.0.5-py312hdda0065_1 --> 43.0.0-py312hdda0065_0
expat 2.6.2-h6a678d5_0 --> 2.6.3-h6a678d5_0
ld_impl_linux-64 2.38-h1181459_1 --> 2.40-h12ee557_0
libarchive 3.6.2-hfab0078_4 --> 3.7.4-hfab0078_0
libcurl 8.7.1-h251f7ec_0 --> 8.9.1-h251f7ec_0
libmamba 1.5.8-hfe524e5_2 --> 1.5.8-hfe524e5_3
libmambapy 1.5.8-py312h2dafd23_2 --> 1.5.8-py312h2dafd23_3
openssl 3.0.14-h5eee18b_0 --> 3.0.15-h5eee18b_0
ruamel.yaml 0.17.21-py312h5eee18b_0 --> 0.18.6-py312h5eee18b_0
setuptools 72.1.0-py312h06a4308_0 --> 75.1.0-py312h06a4308_0
tqdm 4.66.4-py312he106c6f_0 --> 4.66.5-py312he106c6f_0
tzdata 2024a-h04d1e81_0 --> 2024b-h04d1e81_0
urllib3 2.2.2-py312h06a4308_0 --> 2.2.3-py312h06a4308_0
wheel 0.43.0-py312h06a4308_0 --> 0.44.0-py312h06a4308_0
zstandard 0.22.0-py312h2c38b39_0 --> 0.23.0-py312h2c38b39_0
zstd 1.5.5-hc292b87_2 --> 1.5.6-hc292b87_0


Proceed ([y]/n)?

press Y then ENTER, everything should be up to date now. You will see this message once you are done.

Downloading and Extracting Packages:

Preparing transaction: done
Verifying transaction: done
Executing transaction: done

To install a Python package, this is the command syntax to invoke:

conda install package-name

For example, if you want to install pandas, you can run:

# conda install pandas
(base) root@rh:~# conda install pandas                                                                                                                                                             
/root/miniconda3/lib/python3.12/site-packages/conda/base/context.py:982: FutureWarning: Adding 'defaults' to the channel list implicitly is deprecated and will be removed in 25.3.

To remove this warning, please choose a default channel explicitly via 'conda config --add channels <name>', e.g. 'conda config --add channels defaults'.
deprecated.topic(
Channels:
- defaults
Platform: linux-64
Collecting package metadata (repodata.json): done
Solving environment: done

## Package Plan ##

environment location: /root/miniconda3

added / updated specs:
- pandas


The following packages will be downloaded:

package | build
---------------------------|-----------------
blas-1.0 | mkl 6 KB
bottleneck-1.3.7 | py312ha883a20_0 140 KB
intel-openmp-2023.1.0 | hdb19cb5_46306 17.2 MB
mkl-2023.1.0 | h213fc3f_46344 171.5 MB
mkl-service-2.4.0 | py312h5eee18b_1 66 KB
mkl_fft-1.3.10 | py312h5eee18b_0 223 KB
mkl_random-1.2.7 | py312h526ad5a_0 355 KB
numexpr-2.8.7 | py312hf827012_0 149 KB
numpy-1.26.4 | py312hc5e2394_0 11 KB
numpy-base-1.26.4 | py312h0da6c21_0 7.7 MB
pandas-2.2.2 | py312h526ad5a_0 15.4 MB
python-dateutil-2.9.0post0 | py312h06a4308_2 318 KB
python-tzdata-2023.3 | pyhd3eb1b0_0 140 KB
pytz-2024.1 | py312h06a4308_0 220 KB
six-1.16.0 | pyhd3eb1b0_1 18 KB
tbb-2021.8.0 | hdb19cb5_0 1.6 MB
------------------------------------------------------------
Total: 215.0 MB

The following NEW packages will be INSTALLED:

blas pkgs/main/linux-64::blas-1.0-mkl
bottleneck pkgs/main/linux-64::bottleneck-1.3.7-py312ha883a20_0
intel-openmp pkgs/main/linux-64::intel-openmp-2023.1.0-hdb19cb5_46306
mkl pkgs/main/linux-64::mkl-2023.1.0-h213fc3f_46344
mkl-service pkgs/main/linux-64::mkl-service-2.4.0-py312h5eee18b_1
mkl_fft pkgs/main/linux-64::mkl_fft-1.3.10-py312h5eee18b_0
mkl_random pkgs/main/linux-64::mkl_random-1.2.7-py312h526ad5a_0
numexpr pkgs/main/linux-64::numexpr-2.8.7-py312hf827012_0
numpy pkgs/main/linux-64::numpy-1.26.4-py312hc5e2394_0
numpy-base pkgs/main/linux-64::numpy-base-1.26.4-py312h0da6c21_0
pandas pkgs/main/linux-64::pandas-2.2.2-py312h526ad5a_0
python-dateutil pkgs/main/linux-64::python-dateutil-2.9.0post0-py312h06a4308_2
python-tzdata pkgs/main/noarch::python-tzdata-2023.3-pyhd3eb1b0_0
pytz pkgs/main/linux-64::pytz-2024.1-py312h06a4308_0
six pkgs/main/noarch::six-1.16.0-pyhd3eb1b0_1
tbb pkgs/main/linux-64::tbb-2021.8.0-hdb19cb5_0


Proceed ([y]/n)?

Press ‘y’ to proceed with the installation. The system will print this message when finished.

Downloading and Extracting Packages:

Preparing transaction: done
Verifying transaction: done
Executing transaction: done

Next, we can execute the following command to exit from the Conda environment.

# conda deactivate

That is all! You have successfully installed Miniconda on Ubuntu 24.04

Of course, you don’t have to set up Miniconda on Ubuntu 24.04 if you have an active server management plan with us. You can log in to the client area and then submit a ticket requesting our admins install Miniconda on Ubuntu 24.04. Our experienced administrators are available 24×7 and will take care of your request immediately.

Leave a Reply

Your email address will not be published. Required fields are marked *