How did I install TensorRT 5.1.2 for CUDA 10.0 to Ubuntu 18.04?

Step 1

I have downloaded TensorRT 5.1.2 from developer.nvidia.com/nvidia-tensorrt-5x-download

Please note that I downloaded not the latest TensorRT version but the version compatible with CUDA 10.0:

01

Step 2

dpkg -i nv-tensorrt-repo-ubuntu1804-cuda10.0-trt5.1.2.2-rc-20190227_1-1_amd64.deb
apt-key add /var/nv-tensorrt-repo-cuda10.0-trt5.1.2.2-rc-20190227/7fa2af80.pub
apt-get update
apt-get install libnvinfer5=5.1.2-1+cuda10.0
apt-get install libnvinfer-dev=5.1.2-1+cuda10.0
apt-mark hold libnvinfer5 libnvinfer-dev

docs.nvidia.com/deeplearning/sdk/tensorrt-install-guide/index.html

The documentation says:

If you want to upgrade to the latest version of TensorRT or the latest version of CUDA, then you can unhold the libnvinfer5 package using the following command:

apt-mark unhold libnvinfer5 libnvinfer-dev

docs.nvidia.com/deeplearning/sdk/tensorrt-install-guide/index.html#maclearn-net-repo-install