Skip to content

TechDirectArchive

Hands-on IT, Cloud, Security, Veeam & DevOps

  • Home
  • About
  • Advertise With US
  • Reviews
  • Contact
  • Toggle search form

How to setup PowerShell on a Linux server

Posted on 24/11/202030/08/2026 Christian By Christian No Comments on How to setup PowerShell on a Linux server
  1. Home
  2. Scripts
  3. How to setup PowerShell on a Linux server
setup PowerShell

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. See the following guide for “how to rename a Printer in Windows 10“.. Also, see reasons to deploy AAD, how to set up Azure AD Tenant, and how to add or delete users, and set permissions

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
Linux server

After adding the repo, use the yum makecache to update the repository cache

PowerShell installation

Now install the powershell with yum install powershell

PowerShell installation
Linux PowerShell

Along the line, the installation guide may ask you to accept the gpg key. Type y to continue the installation.

setup PowerShell

Here are a few commands you can run to check if the installation is well set up;

pwsh –v

this will tell you the version of powershell  you have just installed.

Linux server
pwsh

This will take you to the powershell terminal and you will be ready to run powershell commands

Command line interface displaying PowerShell prompt with user details and copyright information.

Similarly, you can run Linux commands from the powershell terminal.

Terminal screenshot showing the command prompt with the 'pwd' command output displaying the current path as '/home/techdirect'.
Terminal screenshot showing a user executing the command 'sudo yum install httpd' and confirming that the package is already installed.

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)
Terminal output displaying the location of the pwsh executable and a command using sudo to change the default shell to pwsh for the current user.

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.

Thank you for reading this post. Kindly share it with others.

  • Share on X (Opens in new window) X
  • Share on Reddit (Opens in new window) Reddit
  • Share on LinkedIn (Opens in new window) LinkedIn
  • Share on Facebook (Opens in new window) Facebook
  • Share on Pinterest (Opens in new window) Pinterest
  • Share on Tumblr (Opens in new window) Tumblr
  • Share on Telegram (Opens in new window) Telegram
  • Share on WhatsApp (Opens in new window) WhatsApp
  • Share on Mastodon (Opens in new window) Mastodon
  • Share on Bluesky (Opens in new window) Bluesky
Scripts Tags:PowerShell, PowerShell version 7, Ubuntu

Post navigation

Previous Post: Restore AD Objects: How to restore deleted user accounts in Active Directory with Microsoft LDP and PowerShell
Next Post: How to delete obsolete drivers from the Driver Store in Windows

Related Posts

  • windows 10 hert
    Windows Management Instrumentation Commands Scripts
  • powershell commands lede 1024x276 1
    Enable WinRM on Windows Servers and Windows PCs Scripts
  • How to visualize MBAM Recovery Audit Report with Python
    Visualize MBAM Recovery Audit Report with Python Automation
  • powershell01 1
    Create a self-signed certificate and export it in PFX format via PowerShell [Part 1] Scripts
  • hero activedirectory
    Create and find Organisation Unit paths in AD Scripts
  • powershell logo
    Cannot find the computer: Fix the following error occurred while using Kerberos authentication Scripts

More Related Articles

maxresdefault 2 How to uninstall Applications with PowerShell Script Scripts
How to visualize MBAM Recovery Audit Report with Python Visualize MBAM Recovery Audit Report with Python Automation
Featured image 9 Create and Delete Registry Keys via PowerShell in Windows Scripts
Chocolatey Packages Create Chocolatey Package: Upgrade Software with Chocolatey Scripts
powershell commands lede 1024x276 1 Enable WinRM on Windows Servers and Windows PCs Scripts
powershell01 How to add servers to the Trusted Hosts list Scripts

Leave a Reply Cancel reply

You must be logged in to post a comment.

Microsoft MVP

vexpert-badge-stars-5

Virtual Background

VEEAMLEGEND

Categories

Top 30 Sysadmin blog

veeaam100

Veeam Vanguard

  • fress install windows server 2025 downgrade of Windows Server datacenter to standard edition
    Convert Windows Server Datacenter to Standard: Install Windows Server via iDRAC Virtual Media Windows Server
  • screenshot 2020 03 13 at 20.24.17
    How to view installed packages in Cygwin on Windows Windows
  • Add a second domain to your domain
    How to add a new Domain Controller to an Existing Domain Windows Server
  • ansible logo600 591x296 1 1
    Ansible error: Server unreachable, ssl: auth method ssl requires a password Configuration Management Tool
  • banner
    How to fix Git always asking for my Username and Password Version Control System
  • xxxxxx 1
    The different Windows Logon Types Windows
  • Delete AWS EBS Volume
    How to delete an Elastic Block Store Volume on AWS AWS/Azure/OpenShift
  • redirects3endpoint
    How to redirect requests for your bucket’s website endpoint to another bucket or domain AWS/Azure/OpenShift

Subscribe to Blog via Email

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

Join 1,746 other subscribers
  • RSS - Posts
  • RSS - Comments
  • About
  • Authors
  • Write for us
  • Contact
  • Advertise with us
  • General Terms and Conditions
  • Privacy policy
  • Feedly
  • Telegram
  • Youtube
  • Facebook
  • Instagram
  • LinkedIn
  • Tumblr
  • Pinterest
  • Twitter
  • mastodon
  • Bsky

Tags

Active Directory Azure Bitlocker Microsoft Windows PowerShell WDS Windows 10 Windows 11 Windows Deployment Services Windows Server 2016

Copyright © 2026 TechDirectArchive

Loading Comments...

You must be logged in to post a comment.