$ sudo apt update && sudo apt install -y cmake g++ wget unzip
$ wget -O opencv.zip https://github.com/opencv/opencv/archive/4.x.zip
$ unzip opencv.zip
$ mkdir -p build && cd build
$ cmake ../opencv-4.x
$ cmake --build .
$ nproc
$ make -j8 2>&1 | tee build_messages.txt
$ sudo make install
$ sudo ldconfig
$ pkg-config --modversion opencv