Explaining Package Managers

The aim of this page📝 is to explain package management and the use of package managers in different contexts, based on the particular example of installing Homebrew in a Docker container which I need to do due to the fact that I am running Windows and need to run Homebrew at work. Wrapping my head around package managers just out of curiosity.

Pavol Kutaj
3 min readNov 7, 2023
  • Package managers are software tools that automate the process of installing, upgrading, configuring, and removing software packages in a consistent manner.
  • They keep track of every file installed by a package, making it easy to uninstall packages or upgrade them without leaving behind unused files.
  • Most operating systems and programming languages come with a dominant package manager.
  • For operating systems, examples of dominant package managers include apt for Debian-based distributions like Ubuntu, yum and dnf for RPM-based distributions like Fedora, and pacman for Arch Linux.
  • For macOS, Homebrew is a popular package manager.
  • For Windows, Chocolatey and Winget are commonly used.
  • For programming languages, examples of dominant package managers include Pip for Python, Npm for Node.js, RubyGems for Ruby, Cargo for Rust, and Maven and Gradle for Java.
  • Homebrew is a package manager that simplifies the installation of software on macOS and Linux.
  • It’s similar to apt or yum in the Linux world, or Chocolatey for Windows.
  • Homebrew allows you to easily install, update, and uninstall software packages on your local system.
  • Helm is considered the de facto package manager for Kubernetes.
  • Helm helps you manage Kubernetes applications — Helm Charts help you define, install, and upgrade even the most complex Kubernetes application.
  • Helm Charts are easy to create, version, share, and publish.
  • Conda is an open-source package management system and environment management system that runs on Windows, macOS, and Linux.
  • Conda quickly installs, runs, and updates packages and their dependencies.
  • It easily creates, saves, loads, and switches between environments on your local computer.
  • Conda was created for Python programs, but it can package and distribute software for any language.
  • If you need a package that requires a different version of Python, you do not need to switch to a different environment manager, because Conda is also an environment manager.
  • With just a few commands, you can set up a totally separate environment to run that different version of Python, while continuing to run your usual version of Python in your normal environment.
  • In its default configuration, Conda can install and manage the thousand packages at repo.anaconda.com that are built, reviewed, and maintained by Anaconda.
  • Packages that are not available using conda install can be obtained from Anaconda.org, a package management service for both public and private package repositories.

CODE

Here is a particular example I have experienced when trying to install Homebrew in a Docker container:

# Use an official Ubuntu runtime as a parent image
FROM ubuntu:latest

# Update and install dependencies
RUN apt-get update -y && apt-get install -y curl file git

# Install Homebrew (Linuxbrew)
RUN bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"

# Add Homebrew to PATH
ENV PATH="/root/.linuxbrew/bin:${PATH}"

# Now you can use Homebrew commands
# For example, to install wget:
RUN brew install wget

This Dockerfile starts with an Ubuntu image, updates it, installs the necessary dependencies, and then installs Homebrew. It then adds Homebrew to the PATH so that you can use brew commands. In this example, it installs wget using brew install wget.

--

--

Pavol Kutaj
Pavol Kutaj

Written by Pavol Kutaj

Today I Learnt | Infrastructure Support Engineer at snowplow.io with a passion for cloud infrastructure/terraform/python/docs. More at https://pavol.kutaj.com

No responses yet