Installing Microsoft Powershell on Ubuntu 24.04

By | March 28, 2025

I previously installed Powershell on CentOS. That time for Ubuntu I started from Microsoft repositories too and began to add Microsoft repository as well. I checked Microsoft repositories for Ubuntu. First I download prod.list info /etc/apt/sources.d directory:


$ cd /etc/apt/sources.list.d/
$ sudo curl -O https://packages.microsoft.com/config/ubuntu/24.04/prod.list

The prod.list looks like:


$ cat /etc/apt/sources.list.d/prod.list
deb [arch=amd64,arm64,armhf signed-by=/usr/share/keyrings/microsoft-prod.gpg] https://packages.microsoft.com/ubuntu/24.04/prod noble main

Then I downloaded packages-microsoft-prod.deb file into /tmp directory and installed it:


$ cd /tmp
$ wget https://packages.microsoft.com/config/ubuntu/24.04/packages-microsoft-prod.deb -O packages-microsoft-prod.deb
$ dpkg -i packages-microsoft-prod.deb

It adds gpg key mentioned in /etc/apt/sources.list.d/prod.list and updates /etc/apt/sources.list.d directory.


$ sudo find / -name microsoft-prod.gpg
[sudo] password for nable:
/usr/share/doc/packages-microsoft-prod/microsoft-prod.gpg
/usr/share/keyrings/microsoft-prod.gpg

The content of /etc/apt/sources.list.d directory looks like:


$ ls -l /etc/apt/sources.list.d
total 16
$ ls -l /etc/apt/sources.list.d
total 16
-rw-r–r– 1 root root 138 Mar 11 2024 microsoft-prod.list
-rw-r–r– 1 root root 138 Mar 27 15:44 prod.list
-rw-r–r– 1 root root 386 Oct 16 05:03 ubuntu.sources
-rw-r–r– 1 root root 2552 Aug 27 2024 ubuntu.sources.curtin.orig

I supposed that Powershell was ready to install:


$ sudo apt install powershell
Reading package lists… Done
Building dependency tree… Done
Reading state information… Done
The following NEW packages will be installed:
powershell
0 upgraded, 1 newly installed, 0 to remove and 118 not upgraded.
Need to get 75.4 MB of archives.
After this operation, 192 MB of additional disk space will be used.
Get:1 https://packages.microsoft.com/ubuntu/24.04/prod noble/main amd64 powershell amd64 7.5.0-1.deb [75.4 MB]
Fetched 75.4 MB in 1s (92.1 MB/s)
Selecting previously unselected package powershell.
(Reading database … 128446 files and directories currently installed.)
Preparing to unpack …/powershell_7.5.0-1.deb_amd64.deb …
Unpacking powershell (7.5.0-1.deb) …
Setting up powershell (7.5.0-1.deb) …
Processing triggers for man-db (2.12.0-4build2) …
Scanning processes…
Scanning linux images…

Pending kernel upgrade!
Running kernel version:
6.8.0-55-generic
Diagnostics:
The currently running kernel version is not the expected kernel version
6.8.0-56-generic.

Restarting the system to load the new kernel will not be handled automatically,
so you should consider rebooting.

No services need to be restarted.

No containers need to be restarted.

No user sessions are running outdated binaries.

No VM guests are running outdated hypervisor (qemu) binaries on this host.
W: Target Packages (main/binary-amd64/Packages) is configured multiple times in /etc/apt/sources.list.d/microsoft-prod.list:1 and /etc/apt/sources.list.d/prod.list:1
W: Target Packages (main/binary-arm64/Packages) is configured multiple times in /etc/apt/sources.list.d/microsoft-prod.list:1 and /etc/apt/sources.list.d/prod.list:1
W: Target Packages (main/binary-armhf/Packages) is configured multiple times in /etc/apt/sources.list.d/microsoft-prod.list:1 and /etc/apt/sources.list.d/prod.list:1
W: Target Packages (main/binary-all/Packages) is configured multiple times in /etc/apt/sources.list.d/microsoft-prod.list:1 and /etc/apt/sources.list.d/prod.list:1
W: Target Translations (main/i18n/Translation-en_US) is configured multiple times in /etc/apt/sources.list.d/microsoft-prod.list:1 and /etc/apt/sources.list.d/prod.list:1
W: Target Translations (main/i18n/Translation-en) is configured multiple times in /etc/apt/sources.list.d/microsoft-prod.list:1 and /etc/apt/sources.list.d/prod.list:1
W: Target DEP-11 (main/dep11/Components-amd64.yml) is configured multiple times in /etc/apt/sources.list.d/microsoft-prod.list:1 and /etc/apt/sources.list.d/prod.list:1
W: Target DEP-11 (main/dep11/Components-all.yml) is configured multiple times in /etc/apt/sources.list.d/microsoft-prod.list:1 and /etc/apt/sources.list.d/prod.list:1
W: Target CNF (main/cnf/Commands-amd64) is configured multiple times in /etc/apt/sources.list.d/microsoft-prod.list:1 and /etc/apt/sources.list.d/prod.list:1
W: Target CNF (main/cnf/Commands-all) is configured multiple times in /etc/apt/sources.list.d/microsoft-prod.list:1 and /etc/apt/sources.list.d/prod.list:1

It was installed with multiple warnings. I tried and it worked:


$ ls -l /etc/apt/sources.list.d
total 16
$ pwsh
PowerShell 7.5.0
PS /tmp> $PSVersionTable

Name Value
—- —–
PSVersion 7.5.0
PSEdition Core
GitCommitId 7.5.0
OS Ubuntu 24.04.1 LTS
Platform Unix
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0

PS /tmp>

Leave a Reply

Your email address will not be published. Required fields are marked *