发布于 2026-01-06 6 阅读
0

我可以在安卓系统上运行 PowerShell,你也可以!由 Mux 主办的 DEV 全球项目展示挑战赛:展示你的项目吧!

我可以在安卓系统上运行 PowerShell,你也可以!

由 Mux 主办的 DEV 全球展示挑战赛:展示你的项目!

欢迎各位 PowerShell 爱好者、Android 开发者和极客们!

以下是我在安卓设备上运行 PowerShell 的步骤指南。

快速免责声明:

所有信息和文件(包括源代码和编译后的文件)均按“原样”提供。不提供任何明示或暗示的保证或担保。用户须自行承担可能发生的任何损失风险,包括但不限于数据丢失、硬件损坏或业务利润损失。请自行承担使用风险。请注意,除非您的设备保修条款明确允许,否则如果您篡改系统软件或硬件,则您设备的任何保修都将失效。

本指南中使用的设备和安卓版本如下:

一加 5 - Android 9.0 Pie

好的,我们开始吧!

  1. 从应用商店下载 UserLAnd(链接)
  2. 运行 UserLAnd,首次打开应用程序时,您需要选择一个发行版,选择 Arch(我选择 Arch 而不是 Ubuntu,因为我使用 Ubuntu 时遇到了很多稳定性问题,导致我的手机卡顿和死机)。
  3. 选择发行版后,您需要输入用户名、密码和 VNC 密码,然后按继续。
  4. 在连接类型屏幕上选择 SSH,然后按继续。
  5. UserLAnd 会获取 Arch 发行版并为您进行设置。设置完成后,请转到“会话”并从列表中选择 Arch。
  6. 输入您在步骤 3 中选择的密码。
  7. 登录到 Arch 后,我们需要执行几个步骤。首先,运行以下代码来更新所有软件包。

sudo pacman -Syu

     when you see a list of packages and are prompted to proceed with the installation press y 
     This process will take a bit of time depending on your internet connection speed and the processor of your device, you might see some errors during the update process its normal and can be ignored 
<img src='https://thepracticaldev.s3.amazonaws.com/i/6zp9q0r6xdt9mt8h6q3z.jpg' width=400>
8. Once the upgrade completed we need to install wget and libuv 
     ```


sudo pacman -S wget libuv 


Enter fullscreen mode Exit fullscreen mode
  1. 让我们创建一个 PowerShell 文件夹,并将 PowerShell 7 预览版 3 下载到该文件夹​​中。

mkdir powershell
cd powershell

#If your android device has an arm64 CPU download the arm64 package by running the below line
Enter fullscreen mode Exit fullscreen mode

wget https://github.com/PowerShell/PowerShell/releases/download/v7.0.0-preview.3/powershell-7.0.0-preview.3-linux-arm64.tar.gz

#If your android device has an arm32 CPU download the arm32 package by running the below line
Enter fullscreen mode Exit fullscreen mode

https://github.com/PowerShell/PowerShell/releases/download/v7.0.0-preview.3/powershell-7.0.0-preview.3-linux-arm32.tar.gz

      <img src='https://thepracticaldev.s3.amazonaws.com/i/2h5d07yvbt1mqkh7cdw8.jpg' width=400>

10. Once the powershell tar.gz file downloads we need to extract it
     ```


tar xzvf powershell*.tar.gz


Enter fullscreen mode Exit fullscreen mode
  <img src='https://thepracticaldev.s3.amazonaws.com/i/86ms6mvewhbed0y2qkzs.jpg' width=400>
Enter fullscreen mode Exit fullscreen mode
  1. 让我们运行 PowerShell!!!

    
    
     ./pwsh
    
      <img src='https://thepracticaldev.s3.amazonaws.com/i/xhuiga6p6c7yp3vvuem4.jpg' width=400>

There we have it folks we have PowerShell running on Android.

Now for the fun of it lets install the UniversalDashboard.Community by Adam Driscoll from [IronmanSoftware](https://ironmansoftware.com/universal-dashboard-2-4-release/) Module and run it.
Enter fullscreen mode Exit fullscreen mode

Find-Module UniversalDashboard.Community | Install-Module -AcceptLicence
Import-Module UniversalDashboard.Community
Start-UDDashboard -Port 10001

It's running the UniversalDashboard locally on the phone rendering pages, graphs and everything else you can think of on PowerShell.
<img src='https://thepracticaldev.s3.amazonaws.com/i/jatd7r2gtq88ht41gsml.jpg' width=400>

<img src='https://thepracticaldev.s3.amazonaws.com/i/nm6zobxz0a3n4im4t98c.jpg' width=400>

<img src='https://thepracticaldev.s3.amazonaws.com/i/gtkvswqb28qoez5pgrc3.jpg' width=400>


Thank you for reading my guide !
Feel free to comment and ask questions.
You can find more of me on twitter [PowershellOnLinux](https://www.twitter.com/@Posh4Linux)
Also you can join the [PowerShellOnLinux Telegram Group](https://t.me/PowershellOnLinux)

-TheMentor

Enter fullscreen mode Exit fullscreen mode
文章来源:https://dev.to/thementor/i-run-powershell-on-android-and-so-can-you-458k