Miniconda is a compact and complimentary installer for conda. It is an alternative to Anaconda, which comprises solely Python, Conda, and a handful of fundamental bundles.
Miniconda encompasses conda, Python, and a limited selection of packages that Python and conda rely on. Furthermore, it also incorporates a limited assortment of valuable packages such as Requests, PIPs, and numerous others. In this tutorial, we will show you how to install Miniconda on Ubuntu 22.04.
Table of Contents
Prerequisites
- An Ubuntu 22.04 VPS
- SSH root access or a regular system user with sudo privileges
Step 1. Log in via SSH
Let’s log in to your Ubuntu 22.04 VPS with SSH as a root user or as a 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 that has sudo privileges. Additionally, replace the “IP_Address” and “Port_Number” with your server’s respective 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 22.04.1 LTS
Release: 22.04
Codename: jammy
Let’s update the package index on our Ubuntu 22.04 system.
# apt update
Step 2. Download Miniconda Installer
The process is very simple; we need to download the installer script. We have to do this because Miniconda is not available in the default Ubuntu repository. So, let’s get it downloaded.
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
Step 3. Install Miniconda
The installation will be easy and straightforward. Simply execute the installer file.
# bash /opt/miniconda-installer.sh
Follow the instructions shown on the screen. We need to press ENTER to review the license agreement. Keep pressing ENTER or SPACE to finish it. , At the end of the agreement, you will be asked to accept the license terms or not. 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 or not.
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.
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.11/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. <== If you'd prefer that conda's base environment not be activated on startup, set the auto_activate_base parameter to false: conda config --set auto_activate_base false Thank you for installing Miniconda3!
That’s it! You have just installed Miniconda.
Step 4. Configure Miniconda
After the Miniconda installation, we need to apply the changes made to ~/.bashrc file. Miniconda installer modified the file during the installation. Let’s execute the command.
# source ~/.bashrc
Now, at this point, you can run this command to check your Miniconda information.
# conda info
You will see this output:
active environment : base
active env location : /root/miniconda3
shell level : 1
user config file : /root/.condarc
populated config files :
conda version : 23.5.2
conda-build version : not installed
python version : 3.11.4.final.0
virtual packages : __archspec=1=x86_64
__glibc=2.35=0
__linux=5.15.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/23.5.2 requests/2.29.0 CPython/3.11.4 Linux/5.15.0-76-generic ubuntu/22.04 glibc/2.35
UID:GID : 0:0
netrc file : None
offline mode : False
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 update, and you need to answer with yes to proceed with the update.
(base) root@ubuntu22:~# conda update --all Collecting package metadata (current_repodata.json): done Solving environment: done ## Package Plan ## environment location: /root/miniconda3 The following packages will be downloaded: package | build ---------------------------|----------------- certifi-2023.7.22 | py311h06a4308_0 154 KB conda-23.7.2 | py311h06a4308_0 1.3 MB conda-libmamba-solver-23.7.0| py311h06a4308_0 90 KB conda-package-handling-2.2.0| py311h06a4308_0 278 KB conda-package-streaming-0.9.0| py311h06a4308_0 33 KB libcurl-8.1.1 | h251f7ec_2 397 KB openssl-3.0.10 | h7f8727e_0 5.2 MB pip-23.2.1 | py311h06a4308_0 3.3 MB pyopenssl-23.2.0 | py311h06a4308_0 121 KB requests-2.31.0 | py311h06a4308_0 124 KB setuptools-68.0.0 | py311h06a4308_0 1.2 MB ------------------------------------------------------------ Total: 12.2 MB The following packages will be UPDATED: certifi 2023.5.7-py311h06a4308_0 --> 2023.7.22-py311h06a4308_0 conda 23.5.2-py311h06a4308_0 --> 23.7.2-py311h06a4308_0 conda-libmamba-so~ 23.5.0-py311h06a4308_0 --> 23.7.0-py311h06a4308_0 conda-package-han~ 2.1.0-py311h06a4308_0 --> 2.2.0-py311h06a4308_0 conda-package-str~ 0.8.0-py311h06a4308_0 --> 0.9.0-py311h06a4308_0 libcurl 8.1.1-h251f7ec_1 --> 8.1.1-h251f7ec_2 openssl 3.0.9-h7f8727e_0 --> 3.0.10-h7f8727e_0 pip 23.1.2-py311h06a4308_0 --> 23.2.1-py311h06a4308_0 pyopenssl 23.0.0-py311h06a4308_0 --> 23.2.0-py311h06a4308_0 requests 2.29.0-py311h06a4308_0 --> 2.31.0-py311h06a4308_0 setuptools 67.8.0-py311h06a4308_0 --> 68.0.0-py311h06a4308_0 Proceed ([y]/n)? y
Press y, then hit ENTER to proceed.
To install a Python package, this is the command syntax to invoke:
conda install package-name
So, if you want to install pandas, you can run:
# conta install pandas
(base) root@ubuntu22:~# conda install pandas Collecting package metadata (current_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.5 | py311hbed6279_0 133 KB intel-openmp-2023.1.0 | hdb19cb5_46305 17.1 MB mkl-2023.1.0 | h213fc3f_46343 171.6 MB mkl-service-2.4.0 | py311h5eee18b_1 54 KB mkl_fft-1.3.6 | py311ha02d727_1 217 KB mkl_random-1.2.2 | py311ha02d727_1 291 KB numexpr-2.8.4 | py311h65dcdc2_1 161 KB numpy-1.25.2 | py311h08b1b3b_0 12 KB numpy-base-1.25.2 | py311hf175353_0 8.2 MB pandas-1.5.3 | py311hba01205_0 12.9 MB python-dateutil-2.8.2 | pyhd3eb1b0_0 233 KB pytz-2022.7 | py311h06a4308_0 196 KB tbb-2021.8.0 | hdb19cb5_0 1.6 MB ------------------------------------------------------------ Total: 212.7 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.5-py311hbed6279_0 intel-openmp pkgs/main/linux-64::intel-openmp-2023.1.0-hdb19cb5_46305 mkl pkgs/main/linux-64::mkl-2023.1.0-h213fc3f_46343 mkl-service pkgs/main/linux-64::mkl-service-2.4.0-py311h5eee18b_1 mkl_fft pkgs/main/linux-64::mkl_fft-1.3.6-py311ha02d727_1 mkl_random pkgs/main/linux-64::mkl_random-1.2.2-py311ha02d727_1 numexpr pkgs/main/linux-64::numexpr-2.8.4-py311h65dcdc2_1 numpy pkgs/main/linux-64::numpy-1.25.2-py311h08b1b3b_0 numpy-base pkgs/main/linux-64::numpy-base-1.25.2-py311hf175353_0 pandas pkgs/main/linux-64::pandas-1.5.3-py311hba01205_0 python-dateutil pkgs/main/noarch::python-dateutil-2.8.2-pyhd3eb1b0_0 pytz pkgs/main/linux-64::pytz-2022.7-py311h06a4308_0 tbb pkgs/main/linux-64::tbb-2021.8.0-hdb19cb5_0 Proceed ([y]/n)?
Press ‘y’ to proceed with the installation.
Next, to exit from the conda environment, we can execute this command.
# conda deactivate
Congratulation! You have successfully installed Miniconda on Ubuntu 22.04
Of course, you don’t have to set up Miniconda on Ubuntu 20.04 if you use one of our Ubuntu VPS Hosting services, in which case you can simply ask our expert Linux admins to set up Miniconda on Ubuntu 20.04 VPS for you. They are available 24/7 and will take care of your request immediately.
PS. If you liked this post on how to set up Miniconda on Ubuntu 20.04, please share it with your friends on social networks or simply leave a reply in the comments section. Thanks.
This tutorial helped me to understand how conda works.
Thanks!