Running CLI Tools Locally

Installing the CLI tools locally


Is it possible to install the cli tools locally so I don’t have to give my server admins ssh access to the nodes?

Hi Matt!

yes, it’s possible to install OpenNebula cli tools on any host. For example, for AlmaLinux 9 (and RHEL9 derivatives) the steps should be as below:

  1. Enable required repositories:
repo=$(dnf repolist --disabled | grep -i -e powertools -e crb | awk '{print $1}' | head -1)
dnf config-manager --set-enabled $repo && dnf makecache
  1. Enable OpenNebula repository:
    For Enterprise edition:
cat << "EOT" > /etc/yum.repos.d/opennebula.repo
[opennebula]
name=OpenNebula Enterprise Edition
baseurl=https://<token>@enterprise.opennebula.io/repo/7.0/RedHat/$releasever/$basearch
enabled=1
gpgkey=https://downloads.opennebula.io/repo/repo2.key
gpgcheck=1
repo_gpgcheck=1
EOT

(replace <token> with your OpenNebula token)

For Community Edition:

# cat << "EOT" > /etc/yum.repos.d/opennebula.repo
[opennebula]
name=OpenNebula Community Edition
baseurl=https://downloads.opennebula.io/repo/7.0/RedHat/$releasever/$basearch
enabled=1
gpgkey=https://downloads.opennebula.io/repo/repo2.key
gpgcheck=1
repo_gpgcheck=1
EOT

Make cache:

dnf makecache

Install opennebula-tools package:

dnf in opennebula-tools

While it’s possible to specify OpenNebula username, password and endpoint in each command via corresponding arguments, e.g.

onedatastore list --user <user> --password <password> --endpoint http://<remote-opennebula-host>:2633/RPC2

it is more convenient and secure to define user’s credentials in a file and the OpenNebula XMLRPC URL via environmental variable as described in our docs:

su - <user>

mkdir ~/.one

chmod 700 ~/.one/

cat ~/.one/one_auth
oneuser:password

chmod 600 ~/.one/one_auth

Define ONE_XMLRPC env variable:

echo "export ONE_XMLRPC=http://<opennebula-remote-host>:2633/RPC2" >> ~/.bashrc

where <opennebula-remote-host> needs to be replaced with the OpenNebula front-end host IP address or hostname.

source ~/.bashrc

One can try to execute the command:

onedatastore list

You may find also useful to use our API.

Thanks! I’ll give this a try now.