openSUSE

How To Install PowerShell on openSUSE

Install PowerShell on openSUSE

In this tutorial, we will show you how to install PowerShell on openSUSE. PowerShell, a powerful scripting language and automation tool, has gained immense popularity in recent years. Initially developed by Microsoft for Windows, PowerShell is now a cross-platform solution available on various operating systems, including Linux distributions like openSUSE.

This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root account, if not you may need to add ‘sudo‘ to the commands to get root privileges. I will show you the step-by-step installation of the PowerShell on openSUSE.

Prerequisites

  • A server running one of the following operating systems: openSUSE (Leap or Tumbleweed)
  • It’s recommended that you use a fresh OS install to prevent any potential issues.
  • You will need access to the terminal to execute commands. openSUSE provides the Terminal application for this purpose. It can be found in your Applications menu.
  • You’ll need an active internet connection.
  • You’ll need administrative (root) access or a user account with sudo privileges.

Install PowerShell on openSUSE

Step 1. Update System Packages.

To ensure a smooth installation process, it’s essential to update your openSUSE system packages to their latest versions. Open a terminal and run the following commands:

sudo zypper refresh
sudo zypper update

The zypper refresh command refreshes the repository cache, while zypper update upgrades all installed packages to their latest available versions. This process may take a few minutes, depending on the number of updates available and your internet connection speed.

Step 2. Installing PowerShell on openSUSE.

  • Method 1: Install PowerShell from RPM

The easiest way to install PowerShell on openSUSE is by using the RPM package manager. Follow these steps to get started:

First, import the Microsoft Signature Key. Open a terminal and run the following command:

sudo rpm --import https://packages.microsoft.com/keys/microsoft.asc

This command adds the Microsoft Signature Key to your system’s trusted key ring, allowing you to install packages signed by Microsoft.

Next, you need to add the Microsoft repository to your system’s package sources. You can do this using the YaST (Yet another Setup Tool) utility. Open YaST and navigate to the “Software Repositories” section. Click on “Add” and enter the following information:

Save the changes and close YaST. You may encounter a warning about an unsigned repository. Proceed with the installation by confirming the warning.

With the Microsoft repository added, you can now install the PowerShell package using the zypper package manager. Open a terminal and run the following command:

sudo zypper install powershell

This command will download and install the PowerShell package from the Microsoft repository. During the installation process, you may encounter a libcurl dependency error. To resolve this, you need to install the libcurl4 package.

PowerShell requires the OpenSSL library to function properly. You can install the necessary dependencies using YaST. Open YaST and navigate to the “Software Management” section. Search for “libopenssl1_0_0” and select it for installation. Apply the changes, and YaST will install the required OpenSSL dependencies.

After completing the installation process, you can verify that PowerShell is properly installed by opening a terminal and running the following command:

pwsh
  • Method 2: Install from Tarball

If you prefer a manual installation or encounter issues with the RPM method, you can install PowerShell from the tarball package. Follow these steps:

Before installing PowerShell from the tarball, you need to ensure that the necessary dependencies are installed on your system. Open a terminal and run the following command:

sudo zypper install curl tar libicu libcurl libopenssl1_0_0

Visit the PowerShell GitHub releases page and download the latest tarball package for openSUSE. Save the downloaded file to a location of your choice:

wget https://github.com/PowerShell/PowerShell/releases/download/v7.5.0-preview.3/powershell-7.5.0-preview.3-linux-x64.tar.gz

Create a directory where you want to extract and install PowerShell. For example, you can use the following command to create a directory named “powershell” in the /opt directory:

sudo mkdir -p /opt/powershell

Extract the downloaded tarball to the installation directory using the following command:

sudo tar -xzf powershell-7.5.0-preview.3-linux-x64.tar.gz -C /opt/powershell

To make it easier to launch PowerShell, create a symlink (symbolic link) to the pwsh executable. Run the following command:

sudo ln -s /opt/powershell/pwsh /usr/bin/pwsh

To ensure that the pwsh executable can be run, set the appropriate permissions using the following command:

sudo chmod +x /opt/powershell/pwsh

After completing the installation process, you can verify that PowerShell is properly installed by opening a terminal and running the following command:

pwsh

Step 3. Troubleshooting.

If you encounter any issues during the installation process or while using PowerShell on openSUSE, try the following troubleshooting steps:

  • Check for dependency errors: Ensure that all the required dependencies are installed correctly. If you encounter any missing dependency errors, install the necessary packages using zypper.
  • Verify package integrity: If you encounter any issues with the RPM package, try downloading the tarball and installing it manually. Verify the integrity of the downloaded tarball by comparing the SHA256 checksum with the one provided on the GitHub releases page.
  • Check file permissions: Ensure that the PowerShell executable and related files have the correct permissions. Use the chmod command to set the appropriate permissions if needed.

Congratulations! You have successfully installed PowerShell. Thanks for using this tutorial for installing the PowerShell on your openSUSE system. For additional or useful information, we recommend you check the official PowerShell website.

VPS Manage Service Offer
If you don’t have time to do all of this stuff, or if this is not your area of expertise, we offer a service to do “VPS Manage Service Offer”, starting from $10 (Paypal payment). Please contact us to get the best deal!

r00t

r00t is an experienced Linux enthusiast and technical writer with a passion for open-source software. With years of hands-on experience in various Linux distributions, r00t has developed a deep understanding of the Linux ecosystem and its powerful tools. He holds certifications in SCE and has contributed to several open-source projects. r00t is dedicated to sharing her knowledge and expertise through well-researched and informative articles, helping others navigate the world of Linux with confidence.
Back to top button