Tutorials | Module Safari https://modulesafari.com development simplified Sat, 30 Nov 2019 21:15:58 +0000 en-US hourly 1 https://wordpress.org/?v=5.5.3 https://modulesafari.com/wp-content/uploads/2019/11/favivon.ico Tutorials | Module Safari https://modulesafari.com 32 32 How to install the Boost C++ libraries https://modulesafari.com/how-to-install-the-boost-c-libraries/ https://modulesafari.com/how-to-install-the-boost-c-libraries/#respond Sat, 30 Nov 2019 21:14:29 +0000 https://modulesafari.com/?p=590 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 […]

The post How to install the Boost C++ libraries appeared first on Module Safari.

]]>
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

The post How to install the Boost C++ libraries appeared first on Module Safari.

]]>
https://modulesafari.com/how-to-install-the-boost-c-libraries/feed/ 0
Learn how to set ulimit on Linux https://modulesafari.com/linux-ulimits/ https://modulesafari.com/linux-ulimits/#respond Sat, 30 Nov 2019 19:27:17 +0000 https://modulesafari.com/?p=565 Often times you will need to increase the maximum number of file descriptors in order to achieve proper functionality of your application. Perhaps you have a database or have run into the “Too many open files” error. In this tutorial, we will go over increasing this value and other ulimits. But first, what is a […]

The post Learn how to set ulimit on Linux appeared first on Module Safari.

]]>
Often times you will need to increase the maximum number of file descriptors in order to achieve proper functionality of your application. Perhaps you have a database or have run into the “Too many open files” error. In this tutorial, we will go over increasing this value and other ulimits. But first, what is a Linux ulimit?

What is a Linux ulimit?

A ulimit or user limit in Linux is a restriction placed on a user’s access to certain resources. You can use the command ulimit -a to view them, this will give you a list of the ulimit values you can set, as well as their value. It is important to note that there are two types of limits, soft and hard.

Hard Limits

A hard limit is the maximum allowed to the user. It is set by the root user and acts as the hard ceiling for that value. The user will be unable to have a limit higher than this unless it is changed by the root user. There are a few ways to update this value, but the most common way is by updating the /etc/security/limits.conf file. In most situations, it is best to not update this value.

Soft Limits

A soft limit is the current maximum for the user. The user is able to change this at any time, either through setrlimit(2) or the ulimit command. Often times, you will only need to set this value, as very few situations call for resources above the hard limit.

Permanently Updating Limits

The best method for permanently updating soft limits and hard limits is via the /etc/security/limits.conf file. In this file, you can include the new soft limit defaults for a user, or update the hard limits. The format in which you insert your updates into this file is simple, it is just <domain> <type> <item> <value>. So, if you wanted to update the default file limit for the user apache, it would look like this.

apache soft nofile 5000

Now, all you would have to do is reboot the system, and the user apache’s file descriptor limit would default to 5000.

Temporarily Updating Limits

The easiest way to temporarily update a soft limit is with the ulimit command. If you wanted to set your file descriptor limit to 5000 for the duration of your shell session, you can use this command.

ulimit -S -n 5000

The -S flag signals that you are temporarily updating the soft limit value, and the -n flag states you wish to change the value for file-descriptors. You can also update hard limits using this method, just swap out the -S with -H. However, you can only set a lower value.

The post Learn how to set ulimit on Linux appeared first on Module Safari.

]]>
https://modulesafari.com/linux-ulimits/feed/ 0