In order to install FiveM it is necessary to have a legal copy of GTA V, no matter the kind.
The copy of the game can be both physical and digital and can be purchased from any authorized store such as Steam, Epic Games or Rockstar Launcher.
Now it's time to download FiveM, first you will have to go to the official website to be able to download the executable.
Now click on the button on the right "DOWNLOAD CLIENT", at which point the terms of service will appear, then click on "SURE, I AGREE!".
Once downloaded, you just have to start Fivem.exe, which will then download about 200MB of files and ask you to select the folder containing GTA V.
If the installer does not let you choose the folder, it means that the path has been detected automatically and FiveM will be installed immediately.
You have successfully installed FiveM.