You have to unclock the bootloader first to make any nasty changes in the device. If you have an unlocked bootloader & custom recovery installed then you don't need a pc for that purpose. But if your phone is in factory condtion, then you must need a pc. That's the general method most of us use.
It's too easy and you can do this in 15 minutes if you have the unlock code, drivers & fastboot installed on pc and twrp image file ready.
Refer this link for help:
forum.xda-developers. com/moto-g4-plus/development/wip-modified-boot-img-root-t3387113
remove the space in url