As we know, PowerShell is a cross-platform task automation and configuration management framework from Microsoft built on top of the .NET Common Language Runtime; it accepts and returns .NET objects. It consists of a command line shell and an associated scripted language. Powershell enables management of both local and remote linux machines
INSTALLING POWERSHELL ON CENTOS.
-Since the PowerShell package is not included in the official CentOS repository, first thing to do in the installation process is to add the repository with the following command;
curl https://packages.microsoft.com/config/rhel/7/prod.repo | sudo tee /etc/yum.repos.d/microsoft.repo
After adding the repo, use the yum makecache to update the repository cache
Now install the powershell with yum install powershell
Along the line, the installation guide may ask you to accept the gpg key. Type y to continue the installation.
Here are a few commands you can run to check if the installation is well set up;
this will tell you the version of powershell you have just installed.
This will take you to the powershell terminal and you will be ready to run powershell commands
Similarly, you can run Linux commands from the powershell terminal.
MAKING YOUR LOGIN POWERSHELL
– Run the whoami command to find the path of the pwsh shell program. Use that result of the command to set the default login shell to that of the powershell with the following command;
usermod –s /usr/bin/pwsh $(whoami)
Now reboot your machine and that is all that is needed to have PowerShell up and running.
I hope you found this blog post helpful. If you have any questions, please let me know in the comment session. I welcome you to follow me on Twitter and Facebook.