# ASF on Android
**Repository Path**: lussac/ASFonAndroid
## Basic Information
- **Project Name**: ASF on Android
- **Description**: 使用 Termux 在 Android 上运行 ArchiSteamFarm(未Root)
- **Primary Language**: Shell
- **License**: Not specified
- **Default Branch**: master
- **Homepage**: None
- **GVP Project**: No
## Statistics
- **Stars**: 0
- **Forks**: 0
- **Created**: 2019-03-30
- **Last Updated**: 2020-12-19
## Categories & Tags
**Categories**: Uncategorized
**Tags**: None
## README
# ASF on Android (NO ROOT)
# 使用Termux在Android上运行ArchiSteamFarm的尝试 (未Root)
---
> **如果你是从博客来的,请[点击此处](#相关文件下载)**
本文简要叙述了 使用Termux在Android上运行ArchiSteamFarm 的步骤。
---
## 安装步骤
1. [配置Termux](#配置termux)
2. [在Termux中安装Ubuntu发行版](#在termux中安装ubuntu发行版)
3. [安装 .NET Core](#安装-net-core)
4. [安装ASF](#安装asf)
5. [配置和运行ASF](#配置和运行asf)
---
## 配置Termux
安装好[Termux](https://termux.com/)[ \[1\]](https://play.google.com/store/apps/details?id=com.termux) [\[2\] ](https://f-droid.org/repository/browse/?fdid=com.termux)后,第一次进入需要等待一段时间。
### 更换清华源镜像
```bash
export EDITOR=vi
apt edit-sources
```
把第二行替换成以下内容
```bash
deb [arch=all,aarch64] https://mirrors.tuna.tsinghua.edu.cn/termux stable main
```
### 安装基本软件
```bash
apt update
apt upgrade
apt install wget unzip proot nano -y
# nano 可以换成 vim
```
---
## 在Termux中安装Ubuntu发行版
### 安装Ubuntu
需要在Termux中安装其他Linux发行版[ \[PRoot\] ](https://wiki.termux.com/wiki/PRoot)才能安装 .NET Core 依赖。本文以Ubuntu[ \[Ubuntu\] ](https://wiki.termux.com/wiki/Ubuntu)为例。
```bash
mkdir ~/jails/ubuntu -p
cd ~/jails/ubuntu
wget https://raw.githubusercontent.com/Neo-Oli/termux-ubuntu/master/ubuntu.sh
chmod +x ubuntu.sh
```
> `ubuntu.sh` 脚本有一步是下载文件 `ubuntu.tar.gz` 。可能是由于国内访问外网的网速问题,下载速度十分缓慢。可以在执行 `ubuntu.sh` 前将 `ubuntu.tar.gz` 下载到 `~/jails/ubuntu/` 下。
> ``` bash
> wget https://dev.tencent.com/u/Lussac/p/ASFonAndroid/git/raw/master/termux-ubuntu/ubuntu.tar.gz
> ```
```bash
bash ubuntu.sh
chmod +x start-ubuntu.sh
bash start-ubuntu.sh
```
如果成功了应该会显示:
```bash
root@localhost:~#
```
### 更改DNS并修改Ubuntu源
返回Termux并修改 `resolv.conf`
```bash
exit
nano ~/jails/ubuntu/ubuntu-fs/etc/resolv.conf
```
按下例修改DNS并保存退出
```
nameserver 8.8.8.8
nameserver 8.8.4.4
```
进入Ubuntu并修改[Ubuntu Ports源](http://mirrors.ustc.edu.cn/help/ubuntu-ports.html)
```bash
bash ~/jails/ubuntu/start-ubuntu.sh
apt-get install nano apt-transport-https -y
cp /etc/apt/sources.list /etc/apt/sources.list.bak
nano /etc/apt/sources.list
```
将 `sources.list` 中的所有 `http://ports.ubuntu.com/ubuntu-ports/` 换成 `https://mirrors.ustc.edu.cn/ubuntu-ports/`。
```bash
apt-get update
```
---
## 安装 .NET Core
在Termux上运行ASF,需要安装完整的 .NET Core 。
下载链接可以从 [Daily Builds](https://github.com/dotnet/core-setup#daily-builds) 或 [Officially Released Builds](https://dotnet.microsoft.com/download#core) 获取,注意选择 **Linux (arm64)** 进行下载。下文以 Daily Builds 为例:
```bash
apt-get install curl libunwind8 gettext wget unzip -y
wget https://dotnetcli.blob.core.windows.net/dotnet/Runtime/release/2.2/dotnet-runtime-latest-linux-arm64.tar.gz
mkdir -p /opt/dotnet && sudo tar zxf dotnet-runtime-latest-linux-arm64.tar.gz -C /opt/dotnet
ln -s /opt/dotnet/dotnet /usr/local/bin
```
输入命令 `dotnet --info` 或 `dotnet --help` 即可判断是否安装成功。
---
## 安装ASF
ArchiSteamFarm的最新版本的下载链接可以在[Releases页面](https://github.com/JustArchiNET/ArchiSteamFarm/releases/latest)上找到。注意选择 **ASF-generic** 版本。
```bash
wget https://github.com/JustArchiNET/ArchiSteamFarm/releases/download/4.0.1.0/ASF-generic.zip
mkdir -p ~/ASF
unzip ASF-generic.zip -d ~/ASF/
cd ~/ASF
chmod +x ArchiSteamFarm.sh
```
---
## 配置和运行ASF
### 配置ASF / config
关于如何配置ASF本文不再赘述。值得一提的是,ASF-ui同样能在Android上使用。打开IPC服务设置便能启用 ASF-ui,具体方法是在 `ASF.json` 中设置 `IPC` 为 `true` 。而启用ASF的**中文界面**则是设置 `CurrentCulture` 为 `zh-CN`。最后 `ASF.json` 看起来应该像是这样:
```json
{
"s_SteamOwnerID": "12345678987654321",
"CurrentCulture": "zh-CN",
"IPC": true,
}
```
### 启动ASF
```bash
bash ~/ASF/core/ArchiSteamFarm.sh
```
如果一切配置正常,ASF会有与在Windows上运行时相似的输出。类似于:
```
2019-03-28 19:31:41|dotnet-2333|INFO|ASF|InitASF() ArchiSteamFarm V4.0.1.0
...
2019-03-28 19:32:02|dotnet-2333|INFO|ASF|StartInteractiveConsole() 交互式控制台已启用,输入 c 以进入命令模式。
2019-03-28 19:32:03|dotnet-2333|INFO|ASF|Start() 正在启动 IPC 服务……
2019-03-28 19:32:15|dotnet-2333|INFO|ASF|Start() IPC 服务已就绪!
2019-03-28 19:32:17|dotnet-2333|INFO|botname|Start() 正在启动……
...
```
如果你启用了IPC服务,用手机浏览器访问 `http://127.0.0.1:1242` 即可使用ASF-ui。
ASF挂卡需要访问 steamcommunity.com ,因此手机需要开启加速器或科学上网才能使ASF正常挂卡。
至此,ASF即成功运行在未Root的Android设备上。
---
## 其他
> 更加详细的步骤说明另见[博客](http://blog.lussac.net/archives/107/)。
### 相关文件下载
*我只是把文件下载后上传到了这里,便于提高国内下载速度,请自行校对 MD5 或 SHA 值。*
- `ubuntu.tar.gz`
```bash
wget https://dev.tencent.com/u/Lussac/p/ASFonAndroid/git/raw/master/termux-ubuntu/ubuntu.tar.gz
```
- `dotnet-runtime-latest-linux-arm64.tar.gz`
```bash
wget https://dev.tencent.com/u/Lussac/p/ASFonAndroid/git/raw/master/dotNET-core/Release_%202.2.X/dotnet-runtime-latest-linux-arm64.tar.gz
```
- `ASF-generic.zip`
```bash
wget https://dev.tencent.com/u/Lussac/p/ASFonAndroid/git/raw/master/ArchiSteamFarm/V4.0.1.0/ASF-generic.zip
```