Link a Developer Hub org to a namespace org to use the Salesforce Developer Experience to develop a second-generation package.
Create an Org with Dev Hub Features Enabled
Use this Dev Hub org to manage scratch orgs and build managed packages for distribution.
Create a Developer Edition org.
Turn on Dev Hub features. From Setup, enter Dev Hub in the Quick Find box and select Dev Hub. Then, click Enable. After you enable Dev Hub, you can’t disable it.
Select Unlocked Packages and Second-Generation Managed Packages.
Create a Namespace Org
Create a separate org just to manage the namespace. If you’re creating a managed package for distribution, a namespace is required.