Option 1
If all what you want is to test your apps in a local environment, you just need to create a Developer Site (it is just a site collection created using the developer site template). Then you can deploy your Apps directly from Visual Studio. This works for local environment and online.
SharePoint Apps development with Developer Site
Option 2
Also, in theory you can force a non-developer site collection to be able to host apps as a developer site, this is for test purpose only, I haven't tested this so I can't recommend this action but the information is here in case you want to try it.
The developer site is the intended place for app development to take
place in SharePoint—it is designed specifically for app developers to
install and test apps before they are released to the store. There are
certain site collection templates, such as Search and Project, which
are not compatible with the dev site template. This means that
developers cannot test apps designed for use with those templates with
the developer site alone. The sideloading feature enables development
against site collections that use a different template without
affecting the UI. By enabling sideloading, an admin opens the door for
anyone with app install permissions to install apps that are not
sourced from the app catalog or app store.
Enable app SideLoading in your non-developer site collection
Option 3
Lets say that you want to setup a production-ready environment to deploy apps locally, maybe because you want to allow test users to choose apps from your App Catalog so they can have a full experience of installing and configuring apps.
To setup a local App Catalog you need to perform some specific configurations in your server and DNS.
Here are some good resourses about this topic:
Prepare your SharePoint 2013 farm for App development and debugging
Configure an environment for apps for SharePoint 2013
Setting up your App domain for SharePoint 2013