I am trying to install openstack using devstack on ubuntu 16.04. I followed the following link.
https://docs.openstack.org/developer/devstack/guides/singl
Take rocky version of OpenStack Keystone as an example. https://docs.openstack.org/keystone/rocky/install/keystone-openrc-rdo.html#using-the-scripts
You can create an admin-openrc.sh (If you are installing OpenStack Keystone for the first time.) and put environment params. And source this file before you run any "openstack" command. This resolves the issue.
I put the admin-openrc.sh in directory /usr/share/keystone/admin-openrc.sh for a recommend.
Make sure you are logged into horizon and download the rc file (right corner). After that do source admin-openrc.sh
Note that you have to download the rc file of the project you are working on
always run admin-openrc
file before running any openstack command
eg.
$source admin-openrc
then run whatever openstack command you want to run
eg.
$openstack --debug server list
This should do. keystonerc_admin
file is generated at the end of openstack packstack installation
source keystonerc_admin