Today I was reading about influxDB and Grafana as I am planning to deploy it in my lab to monitor my vSphere infrastructure and while going through the installation/configuration steps, I stumbled on one step where we needed to have powercli installed on the box where grafana is installed.
Since I am planning to deploy the influxdb/grafana on my centos 7 box, I started looking for how to configure PowerCLI on top of unix variants. Read few articles and finally deployed it my lab.
PowerShell Core v6.0 was released few days ago by Microsoft with support for Windows, Linux, and MacOS. Around same time, VMware released PowerCLI 10.0 which is VMware’s “PowerShell-like” utility. PowerShell version for linux can be downloaded from here
In this post I will be demonstrating installation of both PowerShell and PowerCli Core on RHEL 7 system. If you’re interested in installing this on other variants of linux then please consult this article. PowerCli core can also be installed via docker
All right enough of theory. Lets jump into action and do the deployment. Here are the steps:
1: Add the PowerShell Core repository in YUM Server
[root@mgmt-grafana ~]# curl https://packages.microsoft.com/config/rhel/7/prod.repo | sudo tee /etc/yum.repos.d/microsoft.repo
2: Install PowerShell
[root@mgmt-grafana ~]# yum install powershell -y
3: Launch PowerShell session
[root@mgmt-grafana ~]# pwsh
Copyright (c) Microsoft Corporation. All rights reserved.
Type 'help' to get help.
4: Verify PowerShell Version
PS /root> $PSVersionTable.PSVersion
Major Minor Patch PreReleas BuildLabel
----- ----- ----- --------- ----------
6 0 2
5: Create trust for PSGallery
Since VMware PowerCLI has moved from being its own native installer to the PSGallery, the PSGallery needs to be “Trusted” before anything from it can be installed. To trust the PSGallery, entering the following command in the PowerShell session.
PS /root> Set-PSRepository -Name "PSGallery" -InstallationPolicy "Trusted"