How to create a Drupal 8 distribution
What you need is to create an installation profile.

Follow the instructions on drupal.

How to write a D8 profile

Move the files from the config/sync folder to config/install folder. Be sure to delete core.extension.yml and remove all UUIDs.

Optionally, you can try this project:project config_installer