Table of Contents
1 Download and install PowerShell
PowerShell deb package is provided.
$ DL=https://github.com/PowerShell/PowerShell/releases/download/$ wget ${DL}/v6.0.0-alpha.9/powershell_6.0.0-alpha.9-1ubuntu1.16.04.1_amd64.deb$ sudo apt install -y libunwind8 libicu55$ sudo dpkg -i powershell_6.0.0-alpha.9-1ubuntu1.16.04.1_amd64.deb
2 Build and install PowerShell
Build and install PowerShell from source code..
2.1 Install dotnet
Install dotnet package with this.
$ sudo sh -c ‘echo “deb [arch=amd64] https://apt-mo.trafficmanager.net/repos/dotnet-release/ xenial main” > /etc/apt/sources.list.d/dotnetdev.list’$ sudo apt-key adv –keyserver apt-mo.trafficmanager.net –recv-keys 417A0893$ sudo apt update -y$ sudo apt install -y dotnet-dev-*
2.2 Install packages for building PowerShell
Install packages for building PowerShell with apt.
$ sudo apt install -y cmake make g++
2.3 Download PowerShell source code
Download PowerShell source code with git clone –recursive.
$ git clone –recursive cd PowerShell
2.4 Build PowerShell
Build PowerShell with this.
$ cd src/libpsl-native$ cmake -DCMAKE_BUILD_TYPE=Debug .$ make$ cd ../..$ dotnet restore$ cd src/ResGen$ dotnet run -c Linux$ cd ../TypeCatalogParser$ dotnet run -c Linux$ cd ../TypeCatalogGen$ dotnet run -c Linux ../Microsoft.PowerShell.CoreCLR.AssemblyLoadContext/CorePsTypeCatalog.cs powershell.inc$ cd ../powershell-unix$ dotnet build -c Linux
2.5 Install PowerShell
Install PowerShell binaries to /opt and create symbolic link to power shell command.
$ sudo cp -a bin/Linux/netcoreapp1.0/ubuntu.16.04-x64 /opt/powershell$ sudo ln -s /opt/powershell/powershell /usr/local/bin/
Run powershell command.
$ powershellPowerShellCopyright (C) 2016 Microsoft Corporation. All rights reserved.PS /home/hiroom2/src/PowerShell/src/powershell-unix> dir Directory: /home/hiroom2/src/PowerShell/src/powershell-unixMode LastWriteTime Length Name—- ————- —— —-d—– 8/24/16 4:29 AM bind—– 8/24/16 4:29 AM obj—— 8/24/16 4:26 AM 42092 libgtest_main.a—— 8/24/16 4:26 AM 2793922 libgtest.a—— 8/24/16 4:26 AM 194760 libpsl-native.so—— 8/24/16 4:25 AM 2338 project.json—— 8/24/16 4:27 AM 1369383 project.lock.jsonPS /home/hiroom2/src/PowerShell/src/powershell-unix>