在你的andorid設備上運行netcore (Linux Deploy)

最近注意到.net core 的新版本已經開始支持ARM 平臺的CPU, 特意去Linux Deploy 中嘗試了一下,真的可以運行

 

Welcome to Ubuntu 16.04 LTS (GNU/Linux 4.9.65-perf+ armv8l)

 * Documentation:  https://help.ubuntu.com/
Ubuntu 16.04 LTS [running via Linux Deploy]
Last login: Thu Oct  4 20:15:39 2018 from 127.0.0.1
root@localhost:~# dotnet

Usage: dotnet [options]
Usage: dotnet [path-to-application]

Options:
  -h|--help         Display help.
  --info            Display .NET Core information.
  --list-sdks       Display the installed SDKs.
  --list-runtimes   Display the installed runtimes.

path-to-application:
  The path to an application .dll file to execute.
root@localhost:~#

  

 

此處分享下操作步驟 :

  1. root 你的安卓設備
  2. 安裝Linux Deploy
  3. 配置Linux Deploy 安裝 Ubuntu 
  4. 安裝netcore
  5. 在Linux中啓用root 賬戶密碼登陸
  6. 推薦的android ssh工具 :juiceSSH

 

1. root 你的安卓設備

這個根據不同手機廠商有不同的root 方法,我的是OnePlus6 官方給的root工具。

2. 安裝Linux Deploy

隨便一個應用商店應該都有吧,百度360或者豌豆莢

 

3.. 配置Linux Deploy 安裝 Ubuntu 

 爲了提升安裝速度 建議將鏡像源修改爲清華的:https://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/

下圖中未截到的默認即可,需要注意的是要勾選ssh,和修改默認用戶的登陸密碼,架構選擇 arm64,其它配置如下:

 

 

 另外以上的圖形子系統非必要,本來打算安裝個 vs code ,但是官方沒有提供 arm版本~。

 

4. 安裝netcore

    從以下地址下載Linux ARM64的安裝包:

  https://www.microsoft.com/net/download/dotnet-core/2.1

在下載界面下方會有一些官方建議的安裝步驟,官方命令的$home代表當前用戶, 爲了避免產生權限問題我的安裝環境是直接掛在到根目錄的,你也可以放到如: /etc/dotnet 

安裝web下載器 wget

apt-get install wget 

注意,wget 後跟的是下載地址,這個地址來自於下載頁面彈出的下載文件的地址,或者 在Try again上點擊右鍵複製連接

wget https://download.visualstudio.microsoft.com/download/pr/00038a67-bb86-4c39-88df-7c0998002a9e/97de51fd691c68e18ddd3dcaf3d60181/dotnet-sdk-2.1.403-linux-arm64.tar.gz

 

然後在Linux 系統中執行以下命令:  

mkdir -p /etc/dotnet && tar zxf dotnet-sdk-2.1.403-linux-arm64.tar.gz -C /etc/dotnet
export DOTNET_ROOT=$PATH:/etc/dotnet 
export PATH=$PATH:/etc/dotnet

 

配置環境變量:

 

切換到root用戶

sudo apt-get install vim
su root
vim /etc/profile

鍵盤輸入i
按方向鍵向下到底,在最後一行下面插入以下兩行
vim /etc/profile

export PATH=$PATH:/etc/dotnet
export DOTNET_ROOT=$PATH:/etc/dotnet
#然後按 ESC鍵 並輸入 :wq
source /etc/profile

運行 dotnet --version 測試

如果報 如下錯誤: 

FailFast:
Couldn't find a valid ICU package installed on the system. Set the configuration flag System.Globalization.Invariant to true if you want to run with no globaliz ation support.

 

執行如下命令進行安裝icu開發包

sudo apt-get install libicu-dev

 

5. 在Linux中啓用root 賬戶密碼登陸

sudo passwd root 

然後輸入密碼

6. 推薦的android 版 ssh工具 :

juiceSSH

原文連接:https://www.cnblogs.com/Qbit/p/andorid-netcore.html

轉發請註明出處

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章