So, first of all, although it didn't work for me, I highly recommend to try the packaged solution that comes with rpmfusion repos. Only if that doesn't work, then switch to the manual installation. Below you will find a summary of both methods with a link to the two resources that I found more helpful to understand how this can be setup.
Method 1: rpmfusion
You need to enable the rpmfusion repos in FC31, update the kernel and packages and only then install the drivers.
With a root shell (or prepend with sudo every command):
# dnf update
# dnf install https://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm # dnf install https://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-$(rpm -E %fedora).noarch.rpm
# dnf install akmod-nvidia
# reboot
so you say yes to everything and will install all the software. If all goes well, you'll simply start with the Nvidia drivers already working and you don't need to do anything else.
For further details on this method, you can check this blog entry:
https://linuxconfig.org/how-to-install-the-nvidia-drivers-on-fedora-31
Method 2: manual installation
This method, although covered in the link provided above, it just didn't work as it's explained there for me. To me, the resource below is more clear and simply by executing the instructions it worked for me, with just one workaround that I had to do.
https://www.if-not-true-then-false.com/2015/fedora-nvidia-guide/
The summary is:
1. Disable secure boot in BIOS (F2 at boot) or either you will have to sign the kernel module and
install the PK in the kernel.
2. Download the software and pre-reqs:
# lspci |grep -E VGA
01:00.0 VGA compatible controller: NVIDIA Corporation TU116M [GeForce GTX 1660 Ti Mobile] (rev a1)
==> Download the software compatible with your card at https://www.nvidia.com/Download/Find.aspx?lang=en-us
# dnf update
# dnf install kernel-devel kernel-headers gcc make dkms acpid libglvnd-glx libglvnd-opengl libglvnd-devel pkgconfig
# reboot
3. With root, install:
# echo "blacklist nouveau" >> /etc/modprobe.d/blacklist.conf
# vi /etc/default/grub
<>
GRUB_CMDLINE_LINUX="your-grub-options nomodeset rd.driver.blacklist=nouveau "
# grub2-mkconfig -o /boot/efi/EFI/fedora/grub.cfg
# dnf remove xorg-x11-drv-nouveau
# systemctl set-default multi-user.target
# reboot
<>
# cd /path/to/NVIDIA_INSTALLER
# chmod +x NVIDIA-Linux-*.run
#
./NVIDIA-Linux-*.run
<>
# systemctl set-default graphical.target
# reboot
<< Here you got back to graphical mode and restarted without nouveau and with nvidia driver >>
** Optional **
# dnf install vdpauinfo libva-vdpau-driver libva-utils
Something to note is that I added nomodeset in the kernel load line. This isn't in neither resource but I broke my teeth for a fair amount of time because when I installed the drivers the few first times I always was getting a blank or pixelated screen during startup. Nomodeset helps by loading BIOS driver during startup until Xserver is started. So, in mode 3 (text) I could at least login to the machine and run the installation script. Without it I couldn't even do that.
I'm actually keeping nomodeset after nvidia is properly installed. As far as I could read, it only affects startup and it's just to make it prettier... I actually don't care about that, so I'll let it start with raw matrix-like startup and load nvidia only after X is running. If X crashes I can go back to text mode.
Hope this helps.