Quantcast
Channel: TechNet Blogs
Viewing all articles
Browse latest Browse all 36188

Running PowerShell Core on Raspberry Pi 2

$
0
0

While enjoying some days off during Christmas and New Year I found some time to install PowerShell Core on my Raspberry Pi 2.

Pre-requisites:

  • Raspberry Pi version 2 or higher
  • Windows 10 with Windows Subsystem for Linux enabled
  • The following tools:
    • Windows Subsystem for Linux (Ubuntu)
    • Chocolatey (Package Manager for Windows)
    • Putty
    • WinSCP
    • Etcher

Here are the steps to get it working.

Step 1. Setup your Pi

Download Raspbian and follow the installation instructions to get it onto your Pi.
Once your Pi is up and running, enable SSH remoting.

I downloaded the Raspbian Stretch with Desktop version. This can take some time to download. Please be patient 😃 and get a cup of coffee or tea while the image is being downloaded.

Next download Etcher (graphical SD card writing tool) and install it.

The easiest way is using Chocolatey, which is a Windows Package Manager and install it with:

choco install Etcher

And while you are installing Etcher it's also a good idea to install Putty and WinSCP too using Chocolatey.

choco install putty
choco install winscp

Open Etcher and select downloaded Raspbian Image and select correct USB drive and click on Flash.

Wait for the flash to complete.

Insert your micro-SD in your Raspberry Pi and make sure you can connect to it. You need to enable SSH as a first step.
It can be enabled manually from the desktop:

  1. Launch Raspberry Pi Configuration from the Preferences menu
  2. Navigate to the Interfaces tab
  3. Select Enabled next to SSH
  4. Click OK

Pro tip: Use Fing tool to scan you network to find the IP Address of your Raspberry Pi.

Open Windows Subsystem for Linux (WSL) and SSH into your raspberry pi.

Change you pi password. Enter:

passwd

Step 2. Install Powerhell Core on Raspberry Pi

Connect to your Raspberry Pi with Putty or WSL and run the following commands:

# Install prerequisites
sudo apt-get install libunwind8

# Grab the latest tar.gz
wget https://github.com/PowerShell/PowerShell/releases/download/v6.0.0-rc.2/powershell-6.0.0-rc.2-linux-arm32.tar.gz

# Make folder to put powershell
mkdir ~/powershell

# Unpack the tar.gz file
tar -xvf ./powershell-6.0.0-rc.2-linux-arm32.tar.gz -C ~/powershell

Start PowerShell

~/powershell/pwsh

If everything worked out correctly you see the following.

What's next?

You could start installing the PowerShell UniversalDashboard module from Adam Driscoll.

Run:

install-module universaldashboard -scope currentuser

You can now use WinSCP to copy files from your local machine to the remote RaspberryPi. You can download some example Dashboards here: https://github.com/adamdriscoll/poshprotools/tree/master/examples/universal-dashboard

Now go back to your RaspberryPi SSH connection and run:

Start-UDDashboard -Content { & '/home/pi/New-UDWeatherDashboard.ps1' -State 'Noord-Holland' -City 'Halfweg'} -Port 9292

Open now http://(raspberrypi ipaddress):9292 and you should see something like this.

Have fun running PowerShell Core on your Raspberry Pi!

References:


Viewing all articles
Browse latest Browse all 36188

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>