AFAIK Ola Hallengren's script is still one of the best ways to achieve this. Here is an install guide from Garth Jones
https://www.recastsoftware.com/resources/installation-guide-to-ola-hallengrens-sql-server-maintenance-solution/
I would backup the database prior.