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! Restarting the system to load the new kernel will not be handled automatically, 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. |
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 PS /tmp> |