It depends on the service you want to use, but in general the set up is the same. Go to the app of your choosing (Google Photos, Dropbox, OneDrive, etc.), open the Settings and set up Camera Upload. That way everything in your camera folder will get backed up. Some apps, like Photos, will also give you the option to backup other folders.
I prefer Photos because as long as you are OK with it storing up to 16MP pictures and re-scaling larger ones to that (most phones don't have over 16MP anyway, and in my case I always shoot at lower resolutions than the maximum as I'm not in any hurry to print billboard ads
), storage is free and unlimited, whereas in services like Dropbox or OneDrive, those files will count against your storage quota. Amazon's service, if you have Prime, also gives you unlimited, full-res storage, but the moment you stop paying for Prime, the storage becomes blocked.