See the following: Designate a System Photo Library in Photos - Apple Support
Also note that this applies to "Photos" and not "iPhoto."
iPhoto was discontinued .
Also note that iCloud Photos is not quite like a "backup." It is a syncing service.
iCloud Photos is a syncing service. Any photo you delete from a device where iCloud Photos is turned on will also be deleted from iCloud and from any other device connected to iCloud Photos. You can potentially reduce the storage space required on a device by turning on Optimize Storage. See the following Apple article for more information: Set up and use iCloud Photos - Apple Support
Apple does not currently offer cloud-only storage for photos. If that is what you want or need, you may want to explore 3rd party options such as Google Photos or Dropbox.