在你的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,其它配置如下: 

640?wx_fmt=png

640?wx_fmt=png

 

 另外以上的图形子系统非必要,本来打算安装个 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用户<br><br> sudo  apt-get  install  vim<br> su  root <br>vim  /etc/profile <br><br>键盘输入i

<em  id = "__mceDel" >按方向键向下到底,在最后一行下面插入以下两行< /em >

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


 
 

.NET社区新闻,深度好文,欢迎访问公众号文章汇总 http://www.csharpkit.com

640?wx_fmt=jpeg

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值