Categories: C++Tutorials

How to install the Boost C++ libraries

The Boost C++ libraries are a set of free peer-reviewed C++ libraries. They are intended to be useful for a wide variety of applications and portable. Boost just makes life easier, here is how to install it on Linux.

Installing Boost using a package manager

The easiest way to install Boost is with your built-in package manager. It takes care of the installation of all of the dependencies and is more likely to be using a very stable version of the library. Also, there is the added benefit of it being easy to remove if you no longer want it.

Apt (Debian, Ubuntu, Pop OS, etc)

On most Debian based systems, you can install all of the Boost libraries with a single command.

apt-get install libboost-all-dev

DNF (Fedora, etc)

The newer versions of Fedora now use Dandified Yum, instead of just regular yum.

dnf install boost-devel

Yum (Centos, older versions of Fedora, etc)

yum install boost-devel

Manual Installation

If you require a different version of it than the one that is provided by your package manager, you can easily compile and install it manually.

Dependencies

Boost has very few dependencies. You mainly need just a C++ compiler and make.

  • C++ compiler (g++, clang++, etc)
  • make

Installation

With that out of the way, let’s get to the installation, do keep in mind that you will need to set the change the first few environment variables to what you would like them to be.

export MAJOR_VERSION=1
export MINOR_VERSION=70
export PATCH_VERSION=0
wget https://dl.bintray.com/boostorg/release/${MAJOR_VERSION}.${MINOR_VERSION}.${PATCH_VERSION}/source/boost_${MAJOR_VERSION}_${MINOR_VERSION}_${PATCH_VERSION}.tar.gz
tar -xzf boost_${MAJOR_VERSION}_${MINOR_VERSION}_${PATCH_VERSION}.tar.gz
cd boost_${MAJOR_VERSION}_${MINOR_VERSION}_${PATCH_VERSION}
./bootstrap.sh
./b2 install -j$(nproc)

You should now have successfully installed Boost on your machine. For more details, I suggest taking a look at the official boost documentation

Nathaniel Blakely

Share
Published by
Nathaniel Blakely

Recent Posts

Mockery; Mock Everything In Go.

Mockery is an awesome tool that offers the ability to generate mocks from Go interfaces.…

1 year ago

Testify; Test Your Go Code

Testify is a testing library that makes writing tests for your Go code easy. It…

1 year ago

Certmagic; Automagic HTTPS for Golang

Certmagic is a Golang library which allows to user to easily and automatically setup HTTPS…

1 year ago

Learn how to set ulimit on Linux

Often times you will need to increase the maximum number of file descriptors in order…

1 year ago

Served; Build RESTful C++ servers

Served is a C++ library for easy creation of highly performant web servers. It presents…

1 year ago

This website uses cookies.