install php7.4 on ubuntu 16.04 - Dockerfile - docker

I am trying to install php7.4 and related packages with below commands
FROM ubuntu:16.04
RUN apt update \
&& apt install -y software-properties-common\
&& add-apt-repository ppa:ondrej/php \
&& apt-get update \
&& apt-get install -y php7.4
I get the below message
Reading package lists...
Building dependency tree...
Reading state information...
E: Unable to locate package php7.4
E: Couldn't find any package by glob 'php7.4'
E: Couldn't find any package by regex 'php7.4'
on searching with
apt-cache search php7
I see that only 7.0 related packages are available
php7.0 - server-side, HTML-embedded scripting language (metapackage)
php7.0-cgi - server-side, HTML-embedded scripting language (CGI binary)
php7.0-cli - command-line interpreter for the PHP scripting language
php7.0-common - documentation, examples and common module for PHP
php7.0-curl - CURL module for PHP
I am confused why I am not getting the newer versions as 7.3, 7,4 and 8 should be the only ones available today. How can I get php7.4 packages?

TL;DR: Since Ubuntu 16.04 reached "End of Standard Support", packages for it were removed from the PPA.
You might want to read this: https://github.com/oerdnj/deb.sury.org/issues/1567
In April 2021, Ubuntu 16.04 Xenial will reach End of Standard Support and will be available only as a paid option through Ubuntu Extended Security Maintenance.
What does it mean for DEB.SURY.ORG PPAs?
The packages for Ubuntu 16.04 will be deleted shortly after the EoL/EoSS is announced, usually at the same time as the next PHP release is published because it's not possible to build the packages any more.
The packages for Ubuntu 16.04 will be available via PHP LTS by Freexian paid program. This is cheaper option than previously announced Private dedicated repositories.

FROM ubuntu:20.04
RUN apt-get update
RUN apt-get install -y wget tar make
RUN wget https://www.php.net/distributions/php-7.4.33.tar.gz --no-check-certificate
RUN tar xzf php-7.4.33.tar.gz
RUN cd php-7.4.33
RUN apt-get update
RUN apt-get --assume-yes install gcc
RUN apt-get -y install expect
RUN apt-get -y install pkg-config
RUN apt-get --assume-yes install -y libsqlite3-dev
RUN apt-get --assume-yes install -y libxml2-dev
RUN ./php-7.4.33/configure
RUN make
RUN make install
CMD ["/bin/bash"]

Install PHP 7.4 on Ubuntu 20.04
NOTE: Ubuntu 20.04 ships with PHP 7.4 in its upstream repositories. Just install it and the extensions you with the apt package manager.
sudo apt update
sudo apt install php php-cli php-fpm php-json php-common php-mysql php-zip php-gd php-mbstring php-curl php-xml php-pear php-bcmath
Confirm PHP version:
$ php --version
PHP 7.4.3 (cli) (built: Mar 26 2020 20:24:23) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
with Zend OPcache v7.4.3, Copyright (c), by Zend Technologies
Install PHP 7.4 on Ubuntu 18.04/16.04
Step 1: Add PHP PPA Repository
We’ll add ppa:ondrej/php PPA repository which has the latest build packages of PHP.
sudo apt-get update
sudo apt -y install software-properties-common
sudo add-apt-repository ppa:ondrej/php
sudo apt-get update
Step 2: Install PHP 7.4 on Ubuntu 18.04/19.04/16.04
Install PHP 7.4 on Ubuntu 18.04/19.04/16.04 using the command:
sudo apt -y install php7.4
Check version installed:
$ php -v
PHP 7.4.0beta4 (cli) (built: Aug 28 2019 11:41:49) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0-dev, Copyright (c) Zend Technologies
with Zend OPcache v7.4.0beta4, Copyright (c), by Zend Technologies
Use the next command to install additional packages:
sudo apt-get install php7.4-xxx
Example:
sudo apt-get install -y php7.4-{bcmath,bz2,intl,gd,mbstring,mysql,zip,common}
PHP configurations related to Apache is stored in /etc/php/7.4/apache2/php.ini
I hope my experience help you guys

Related

ERR: "Biopython requires Python 3.6 or later. Python 2.7 detected". Even though I'm running python version 3.10.6

I'm trying to build a docker image from the docker file:
FROM ubuntu:18.04
# Install tzdata
RUN apt-get update &&\
DEBIAN_FRONTEND=noninteractive TZ=Etc/UTC apt-get -y install tzdata
# Install Python, Bowtie2 and Java
RUN apt-get install -y python3.10 python3-pip \
openjdk-8-jdk \
bowtie2 \
wget
RUN apt-get install --yes --no-install-recommends \
zlib1g-dev \
libbz2-dev \
liblzma-dev
# Install RSeQC
RUN apt-get install -y python-pip &&\
pip install RSeQC
# Install biopython=1.80
RUN pip install biopython
# Install Atria
RUN wget https://github.com/cihga39871/Atria/releases/download/v3.1.2/atria-3.1.2-linux.tar.gz && \
tar -zxf atria-3.1.2-linux.tar.gz && \
mv atria-3.1.2/bin/atria /usr/local/bin/atria && \
chmod +x /usr/local/bin/atria
#Atria dependencies
RUN apt-get install pigz pbzip2
# Install findtail
RUN wget https://storage.googleapis.com/google-code-archive-downloads/v2/code.google.com/findtail/findtail_v1.01 && \
mv findtail_v1.01 /usr/local/bin/findtail_v1.01 && \
chmod +x /usr/local/bin/findtail_v1.01
# Cleanup
RUN apt clean
But while on Step 6/10 : RUN pip install biopython it gives the error :
---> Running in 062f9c27cc15
Collecting biopython
Downloading https://files.pythonhosted.org/packages/3d/2f/d9df24de05d651c5e686ee8fea3afe3985c03ef9ca02f4cc1e7ea10aa31e/biopython-1.77.tar.gz (16.8MB)
Complete output from command python setup.py egg_info:
Biopython requires Python 3.6 or later. Python 2.7 detected.
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-mgUybW/biopython/
The command '/bin/sh -c pip install biopython' returned a non-zero code: 1
I've check the python version on my pc. I'm running python version 3.10.6 on my OS and in the dockerfile I'm trying to incorporate python 3.10 version. Where is this error coming from?
The default Python version in Ubuntu 18.04 is 3.6. However, on line 19, you are installing the python-pip package, i.e. the Python 2 version of the pip package manager, which in turn depends on the Python 2.7 package and thus will install Python 2.7.
Which means from this point on, you have two Python versions installed on the system, with two Python VM executables, python and python3, and two pip executables, pip and pip3.
It is not clear why you install Python 2.7 and python-pip on line 19 when you have already installed Python 3.10 and python3-pip on line 8. Nor is it clear why you install BioPython using pip, i.e. the Python 2 version instead of pip3, i.e. the Python 3 version.
I would not install Python 2 at all, since it has not been maintained or supported for several years. I would also not use Ubuntu 18.04, which will be out of standard support in 4 months, unless you are paying for the Extended Security Maintenance. The latest Long-Term Support version of Ubuntu is 22.04.1 which has standard support until April 2027 and extended support until April 2032.

install Erlang 17.3 on Ubuntu 18

I was trying many ways in order to install Erlang 17.3 on Ubuntu 18. So far I came up with this solution you can read below:
For installation Erlang 17.3 on Ubuntu 18 you should do the following things:
Enter in the console next command:
Download the tar file:
wget http://erlang.org/download/otp_src_17.3.tar.gz
Extract the tar file in directory where you download the otp_src_17.3.tar.gz:
cd '/home/yaroslav/otp_src_17.3'
tar -zxf otp_src_17.3.tar.gz
set export ERL_TOP your 'pwd' path:
export ERL_TOP=pwd
Basic dependencies:
sudo apt-get install autoconf libncurses-dev build-essential
Other applications dependencies
sudo apt-get install m4
sudo apt-get install unixodbc-dev
sudo apt-get install libssl-dev
sudo apt-get -y install libssh-dev
sudo apt-get install libwxgtk3.0-dev libglu-dev
sudo apt-get install fop xsltproc
sudo apt-get install g++
sudo apt-get install default-jdk
sudo apt-get install xsltproc fop
Or all dependencies in one line:
apt-get -y install build-essential autoconf m4 libncurses5-dev libwxgtk3.0-dev libgl1-mesa-
dev libglu1-mesa-dev libpng-dev libssh-dev unixodbc-dev xsltproc fop g++ default-jdk
install openssl version 1.0.2 for Ubuntu 18 (different version SSL is not compatible):
curl https://www.openssl.org/source/openssl-1.0.2l.tar.gz | tar xz && cd openssl-1.0.2l &&
sudo ./config && sudo make && sudo make install
Configure and build:
./configure --with-ssl='/home/yaroslav/otp_src_17.3/openssl-1.0.2l'
sudo make
sudo make install
For installing older versions of Erlang and working with several at the same time I would recommend using kerl
If you need more fancy features you could also head for asdf which has a Erlang plugin (which runs kerl under the hood)

Install specific version of python in Dockerfile on ubuntu

I have this in a Dockerfile:
RUN apt install -y python3-pip
how do I install a specific version of python though? Something like this:
RUN apt install -y python3-pip#python===3.6.7
I am looking for:
Python 3.6.7
If you want to install latest version just use RUN apt-get install python3 but if you want to install specific version of python you should do it manually for example were going to install python3.5.1:
sudo apt-get install libssl-dev openssl
wget https://www.python.org/ftp/python/3.5.1/Python-3.5.1.tgz
tar xzvf Python-3.5.1.tgz
cd Python-3.5.1
./configure
make
sudo make install
After installation completed set installed python as default one.
If you just want to install a specific version of Python over a simple Ubuntu, then why don't you directly use the official Python image corresponding to your needs ?
You can find all the supported images here : https://hub.docker.com/_/python

adding .net core to docker container with Jenkins

I'm trying to create a dockerfile that will build an image with .net core 2.0 and Jenkins. I'm kind of new to Docker but want to include .net core 2.0 in my container with Jenkins so I don't have to worry about .net core being installed on the target machine and can build .net core apps with Jenkins in my container. Am I missing something here?
it builds fine up until it runs the apt-get update command and I get the following error:
E: Malformed entry 1 in list file /etc/apt/sources.list.d/dotnetdev.list (component)
E: The list of sources could not be read.
I'm using the steps to install on ubuntu at this link:
https://learn.microsoft.com/en-us/dotnet/core/linux-prerequisites?tabs=netcore2x
My Dockerfile looks like this:
FROM jenkins
# Install .NET Core SDK
USER root
RUN mkdir -p /jenkins
WORKDIR /jenkins
ENV DOTNET_CORE_SDK_VERSION 2.0
RUN curl https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor >/jenkins/microsoft.gpg
RUN mv microsoft.gpg /etc/apt/trusted.gpg.d/microsoft.gpg
RUN sh -c 'echo "deb [arch=amd64] https://packages.microsoft.com/repos/microsoft-ubuntu-xenial-prod xenial main" > /etc/apt/sources.list.d/dotnetdev.list'
RUN apt-get update
RUN apt-get install dotnet-sdk-2.0.0
As of this response you can use the following Dockerfile to get .NetCore 2 installed into the Jenkins container. You can obviously take this further and install the needed plugins and additional software as needed. I hope this helps you out!
FROM jenkins/jenkins:lts
# Switch to root to install .NET Core SDK
USER root
# Just for my sanity... Show me this distro information!
RUN uname -a && cat /etc/*release
# Based on instructiions at https://learn.microsoft.com/en-us/dotnet/core/linux-prerequisites?tabs=netcore2x
# Install depency for dotnet core 2.
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
curl libunwind8 gettext apt-transport-https && \
curl https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > microsoft.gpg && \
mv microsoft.gpg /etc/apt/trusted.gpg.d/microsoft.gpg && \
sh -c 'echo "deb [arch=amd64] https://packages.microsoft.com/repos/microsoft-debian-stretch-prod stretch main" > /etc/apt/sources.list.d/dotnetdev.list' && \
apt-get update
# Install the .Net Core framework, set the path, and show the version of core installed.
RUN apt-get install -y dotnet-sdk-2.0.0 && \
export PATH=$PATH:$HOME/dotnet && \
dotnet --version
# Good idea to switch back to the jenkins user.
USER jenkins
You can run these commands inside the Docker container in order to install .NET Core. They can also be stored in a Dockerfile (as per #Zooly57)
Install the latest .NET Core 2.0:
sudo apt install libunwind8 gettext apt-transport-https
curl -sSL https://dot.net/v1/dotnet-install.sh | bash /dev/stdin --channel 2.0
Or LTS version of .NET Core
sudo apt install libunwind8 gettext apt-transport-https
curl -sSL https://dot.net/v1/dotnet-install.sh | bash /dev/stdin --channel LTS
Contents of the script here:
https://github.com/dotnet/cli/blob/master/scripts/obtain/dotnet-install.sh
Fantastic answer by Dennis, it's exactly what I ended up doing. It was a nice introduction to Docker as well :-)
Here's my Dockerfile for Jenkins 2.249.2 (LTS at the time of writing) on Debian 9 (stretch):
# Extend Jenkins 2.249.2 on Debian 9 (stretch)
FROM jenkins/jenkins:2.249.2-lts
# Switch to root user to install .NET SDK
USER root
# Print kernel and distro info
RUN echo "Distro info:" && uname -a && cat /etc/*release
# Install needed tools and upgrade installed packages
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
curl apt-transport-https software-properties-common \
&& apt-get upgrade -y
# Add Microsoft repository for .NET SDK
RUN curl -sSL https://packages.microsoft.com/keys/microsoft.asc | apt-key add -
RUN apt-add-repository https://packages.microsoft.com/debian/9/prod/
# Install .NET SDK
RUN apt-get update \
&& apt-get install -y dotnet-sdk-3.1
# Switch back to jenkins user
USER jenkins
The dotnet command worked without setting any paths.
I guess when a newer version of Jenkins is released that uses Debian 10, I'll just update the FROM line then the Microsoft repository URL.
I believe you should follow below approach instead:
Develop your asp.net core app and check in to Git(Any source control)
Have a build server which has Jenkins, .Net Core, Docker installed
Configure Jenkins to communicate with Git (webhook/polling - to see if there is a check in)
And configure a Jenkins job which will do the following
Pull the latest from Git,
Restore,
Build,
Publish the asp.net core application,
Create a docker image which has a capability to run the asp.net core app in it
Upload the docker image just created to your Docker Hub
You may not want to do it exactly as mentioned above especially the source control part. But this approach works well.
I have followed this link while I made the above setup.
Hope it helps. Thanks!
For anyone who is struggling with this topic recently, this is what I added to the bottom of my Dockerfile to install the .NET SDK;
USER root
# Install dependencies
RUN apt-get install wget
RUN wget https://packages.microsoft.com/config/ubuntu/18.04/packages-microsoft-prod.deb -O packages-microsoft-prod.deb
RUN dpkg -i packages-microsoft-prod.deb
RUN rm packages-microsoft-prod.deb
# Install .NET SDK 6.0
RUN apt-get update;
RUN apt-get install -y apt-transport-https
RUN apt-get update
RUN apt-get install -y dotnet-sdk-6.0
RUN dotnet --version
This is based on installing the SDK on Ubuntu 18.04 as this is the version that AKS uses which was perfect for my scenario
https://learn.microsoft.com/en-us/dotnet/core/install/linux-ubuntu#dependencies

Installing OpenCV in Tinker Board

I have downloaded 20170817-tinker-board-linaro-stretch-alip-v2.0.1.img for Tinker Board. I am trying to install OpenCV 3.0.0. I have followed the instructions given here : http://www.pyimagesearch.com/2015/06/22/install-opencv-3-0-and-python-2-7-on-ubuntu/.
I was not able to install libjasper-dev. Hence, instead of libpng12-dev, I have installed libpng.
I am trying to compile OpenCV on Tinker Board since yesterday morning. But have been getting following errors during building process:
/usr/include/c++/6/cmath:106:11: error: ::acos has not been declared
Followed by all the math formula triggers similar errors.
Which Debian version is stable for OpenCV? Should I install a lower version of OpenCV? Can someone help?
I successfully managed to install OpenCV on a TinkerBoard. The following were the steps:
Format a 16 GB memory card to FAT32
Download debian image 20170817-tinker-board-linaro-stretch-alip-v2.0.1.img for tinker board from here.
Copy the img file on to the memory card
sudo dd if=/path/to/your/imgfile of=/path/to/your/memorycard bs=4M
a lot of help on this is already available in SO.
Before powering on ensure that you connect your tinker board to the internet through a lan cable.
Once powered on reset the system time with sudo dpkg-reconfigure tzdata. Debian image for tinker board already has ntp installed. Wait a couple of minutes for the tinker board to adjust the board time from the network.
To install opencv and its dependant library, I have taken the instructions given here ....though I had to make some custom library installations but it was very helpful. Please note, my purpose of using Opencv on Tinker Board is to process live video's and hence my focus was more towards installing appropriate video codecs.
The following were the steps:
sudo apt-get -y update
sudo apt-get -y upgrade
sudo apt-get -y dist-upgrade
sudo apt-get -y autoremove
You may face the following warning messages during installation of perl applications:
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
LANGUAGE = (unset),
LC_ALL = (unset),
LANG = "en_US.utf8"
are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
Though this doesn't impact your installation of OpenCV, after spending 3 days in trying to compile Opencv on tinker board I do not want to leave anything for a chance.
Use the following to suppress these warning messages:
export LANGUAGE=en_US.UTF-8
export LANG=en_US.UTF-8
export LC_ALL=en_US.UTF-8
dpkg-reconfigure locales
Thanks to this post.
# INSTALL THE DEPENDENCIES
# Build tools:
sudo apt-get install -y build-essential cmake
# GUI (if you want to use GTK instead of Qt, replace 'qt5-default' with 'libgtkglext1-dev' and remove '-DWITH_QT=ON' option in CMake): I just went with qt5 itself.
sudo apt-get install -y qt5-default libvtk6-dev
# Media I/O:
sudo apt-get install -y zlib1g-dev libjpeg-dev libwebp-dev libpng-dev libtiff5-dev libopenexr-dev libgdal-dev
Pls note libjasper-dev is unavailable for this version of Debian and hence I have removed from the above Media I/O list.
# Video I/O:
sudo apt-get install -y libdc1394-22-dev libavcodec-dev libavformat-dev libswscale-dev libtheora-dev libvorbis-dev libxvidcore-dev libx264-dev yasm libopencore-amrnb-dev libopencore-amrwb-dev libv4l-dev libxine2-dev
sudo apt-get install -y gstreamer1.0-plugins-*
sudo apt-get install libxine-dev
# Parallelism and linear algebra libraries:
sudo apt-get install -y libtbb-dev libeigen3-dev
# Python:
sudo apt-get install -y python-dev python-tk python-numpy python3-dev python3-tk python3-numpy
sudo apt-get install python-pip
# Java:
sudo apt-get install -y ant default-jdk
# Documentation:
sudo apt-get install -y doxygen
Get OpenCV. I decided to go with version 3.0.0 as my development was in this version. You may choose a different version.
sudo apt-get install -y unzip wget
wget https://github.com/opencv/opencv/archive/3.0.0.zip
unzip 3.0.0.zip
rm 3.0.0.zip
Build OpenCV.
mv opencv-3.0.0 OpenCV
cd OpenCV
mkdir build
cd build
cmake -DWITH_QT=ON -DWITH_OPENGL=ON -DFORCE_VTK=ON -DWITH_TBB=ON -DWITH_GDAL=ON -DWITH_FFMPEG=0 -DWITH_XINE=ON -DBUILD_EXAMPLES=ON -DENABLE_PRECOMPILED_HEADERS=OFF ..
A change here from the original script - is the addition of -DWITH_FFMPEG=0, as FFMPEG library was missing and I was not in a frame of mind to install the same. You may want to do so.
make
Though TinkerBoard supports make -j4 i chose to go slow with make. The compile with make took almost 2.5 hours with lot of seemingly indentation errors in c++ codes but finally the compile gets over.
sudo make install
sudo ldconfig
$ python
>>> import cv2
>>> cv2.__version__
'3.0.0'
After few days finally I got good setup. My post improves the previous answer.
Steps is similar like it was before me, but I changed few strings, because I had different errors.
In my case for new Asus Tinker Board I installed:
20170928-tinker-board-linaro-stretch-alip-v2.0.3
opencv-3.3.0 with opencv_contrib-3.3.0.
First start of tinker board.
sudo apt-get -y update
sudo apt-get -y upgrade
sudo apt-get -y dist-upgrade
It necessary to remove default (old) OpenCV:
sudo apt-get remove libopencv*
sudo apt-get -y autoremove
# INSTALL THE DEPENDENCIES
# Build tools:
sudo apt-get install -y build-essential cmake
# GUI (I had errors with Qt, so I did next)
sudo apt-get install -y libgtkglext1-dev libvtk6-dev
# Media I/O:
sudo apt-get install -y zlib1g-dev libjpeg-dev libwebp-dev libpng-dev libtiff5-dev libopenexr-dev libgdal-dev
# Video I/O:
sudo apt-get install -y libdc1394-22-dev libavcodec-dev libavformat-dev libswscale-dev libtheora-dev libvorbis-dev libxvidcore-dev libx264-dev yasm libopencore-amrnb-dev libopencore-amrwb-dev libv4l-dev libxine2-dev libxine-dev
sudo apt-get install -y gstreamer1.0-plugins-*
# Parallelism and linear algebra libraries:
sudo apt-get install -y libtbb-dev libeigen3-dev
# Python:
sudo apt-get install -y python-dev python-tk python-numpy python3-dev python3-tk python3-numpy
sudo apt-get install python-pip
# Java:
sudo apt-get install -y ant default-jdk
# Documentation:
sudo apt-get install -y doxygen
Get OpenCV.
cd ~
wget -O opencv.zip https://github.com/opencv/opencv/archive/3.3.0.zip
unzip opencv.zip
wget -O opencv_contrib.zip https://github.com/opencv/opencv_contrib/archive/3.3.0.zip
unzip opencv_contrib.zip
Compile and Install OpenCV
cd ~/opencv-3.3.0/
mkdir build
cd build
cmake -DWITH_OPENGL=ON -DFORCE_VTK=ON -DWITH_TBB=ON -DWITH_GDAL=ON -DWITH_FFMPEG=0 -DWITH_XINE=ON -DBUILD_EXAMPLES=ON -DOPENCV_EXTRA_MODULES_PATH=~/opencv_contrib-3.3.0/modules -DENABLE_PRECOMPILED_HEADERS=OFF ..
CMake should start to build your configuration, after a couple of minutes you should see:
-- Configuring done
-- Generating done
-- Build files have been written to: ./opencv-3.3.0/build
If you can't see Generating done then some issues have been occurred. Read error messages and the error log file to investigate.
I did without examples, but you can try. Qt I deleted.
make
Better without -j4.
sudo make install
sudo ldconfig
Test the installation
linaro#tinkerboard:~$ python3
Python 3.5.3 (default, Jan 19 2017, 14:11:04)
[GCC 6.3.0 20170118] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import cv2
>>> cv2.__version__
'3.3.0'
installing ffmpeg ( the previous answers skiped this )
sudo apt update && sudo apt install ffmpeg libav-tools x264 x265
I also recommend installing the additional packages and enabling neon and vfpv3 when compiling the opncv files. This should give significant improvement in performance:
https://www.pyimagesearch.com/2017/10/09/optimizing-opencv-on-the-raspberry-pi/
I came to this question late. I am adding this answer for the future reference of the people. Here is the official documentation of Tinkerboard.
https://tinkerboarding.co.uk/wiki/index.php/CSI-camera
I just changed the version to the latest version at this time (3.4.1):
#!/bin/bash
#Install
sudo apt-get update
sudo apt-get upgrade
#Install a few developer tools
sudo apt-get install -y build-essential git cmake pkg-config
#Install image I/O packages which allow us to load image file formats such as JPEG, PNG, TIFF, etc.
sudo apt-get install -y libjpeg-dev libtiff5-dev libpng-dev
#Install video I/O packages
sudo apt-get install -y libavcodec-dev libavformat-dev libswscale-dev libv4l-dev libxvidcore-dev libx264-dev libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev
#Install the GTK development library
sudo apt-get install -y libgtk2.0-dev
#Various operations inside of OpenCV (such as matrix operations) can be optimized using added dependencies
sudo apt-get install -y libatlas-base-dev gfortran
#Install the Python 2.7 and Python 3 header files
sudo apt-get install -y python2.7-dev python3-dev python-opencv
wget https://github.com/opencv/opencv/archive/3.4.1.zip
unzip 3.4.1.zip
cd opencv-3.4.1
mkdir build
cd build
cmake -D CMAKE_BUILD_TYPE=Release -D WITH_LIBV4L=ON -D CMAKE_INSTALL_PREFIX=/usr/local ..
sudo make install
It took around 90 minutes to compile.

Resources