centos8のvagrant boxを入れてから、opencvをインストールします。git cloneするため、gitのインストールも必要です。
$ vagrant box add generic/centos8
$ vagrant init generic/centos8
$ vagrant up
$ vagrant ssh
$ sudo yum update
$ git –version
-bash: git: command not found
$ sudo yum -y install gcc curl-devel expat-devel gettext-devel openssl-devel zlib-devel perl-ExtUtils-MakeMaker autoconf
$ cd /usr/local/src/
// gitを入れる 省略
$ sudo su
$ dnf install epel-release make git gcc gcc-c++ cmake3 qt5-qtbase-devel python3 python3-devel python3-pip cmake python3-devel python3-numpy gtk2-devel libpng-devel libwebp-devel libjpeg-turbo-devel libtiff-devel tbb-devel freeglut-devel mesa-libGL mesa-libGL-devel boost boost-thread boost-devel gstreamer1-plugins-base -y
$ mkdir -p ~/opencv_build
$ cd ~/opencv_build
$ git clone https://github.com/opencv/opencv.git
$ git clone https://github.com/opencv/opencv_contrib.git
$ cd opencv
$ mkdir build
$ cd build
$ cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D INSTALL_C_EXAMPLES=ON -D INSTALL_PYTHON_EXAMPLES=ON -D OPENCV_GENERATE_PKGCONFIG=ON -D OPENCV_EXTRA_MODULES_PATH=~/opencv_build/opencv_contrib/modules -D BUILD_EXAMPLES=ON ..
$ make -j4
// 凄い時間がかかる
$ make install
$ ln -s /usr/local/lib64/pkgconfig/opencv4.pc /usr/share/pkgconfig/
$ ldconfig
$ pkg-config –modversion opencv4
4.5.0
$ python3 -c “import cv2; print(cv2.__version__)”
4.5.0-dev
ぎゃあああああああああああああああああああああ
いい週末になった