title: "Running vs Code on an Android Device"
date: 2021-02-15T22:35:51+08:00
draft: true
tags: ['vscode']
author: "dadigang"
author_cn: "大地缸"
personal: "http://www.real007.cn"
关于作者
Running VS Code on an Android Device
Nov 18, 2020
4 min read
[图片上传失败...(image-6dc719-1615936702203)]
IF you're the sort of person who's phone is their workhorse as I am, then finding a decent IDE for quick edits on code is while a personal choice a bit of a problem as there are not many out there.
While i'm not advocating trying to do all your coding on a phone,having access to a familiar interface would make things useful.
With its library of plugins and easy to use interface VSCode is the defacto standard for nany when editing code such as ansible, bash or python. While its not supported as an app on android it is possible with a little tinkering to get it working on your phone.
Termux
imageTermux is a Terminal emulator for Android which doesn't require root, its available on either the Google Play store or fDroid for download. Once installed you get a local terminal which can run bash, fish, zsh or others and the same tools you use on Linux desktops like ssh, nano, rsync and grep are all available and there is a package management system to pull in other applications
imageInstall Termux
First step is to install Termux from either the Google Play stor of FDroid and launch the application. This will take you to a command prompt.
Install Termux Files
Once installed we need to update the system and install some key files
Update termux:
apt-get update && apt-get upgrade -y
Install wget:
apt-get install wget -y
Install proot:
apt-get install proot -y
Install git:
apt-get install git -y
Go to HOME folder:
cd ~
IF this all went forward ok, we are now ready to install Ubuntu onto the app.
Install Ubuntu on Termux
MFD Gaming has a script which will do the heavy lifting for this and install Ubuntu 20.10 (at time of writing) into Termux (Link Below)
Download script:
git clone https://github.com/MFDGaming/ubuntu-in-termux.git
Go to script folder:
cd ubuntu-in-termux
Give execution permission:
chmod +x ubuntu.sh
Run the script:
./ubuntu.sh -y
Now just start ubuntu:
./startubuntu.sh
Update Ubuntu
apt update
apt upgrade
Install Wget
apt install wget
VSCode
Install VSCode on Termux
Now Ubuntu is running in Termux the next step is to install the ARM version of VS Code into the Termux environment
wget https://github.com/cdr/code-server/releases/download/v3.7.1/code-server-3.7.1-linux-arm64.tar.gz
imageNote: To Find the latest version please look at
tar -xvf ./code-server-3.7.1-linux-arm64.tar.gz
rm ./code-server-3.7.1-linux-arm64.tar.gz
cp -r code-server-3.7.1-linux-arm64 /lib/
ln -s /lib/code-server-3.7.1-linux-arm64/code-server /bin/
Open VSCode on your mobile
Having Installed vscode you can now run the server
code-server
Copy the passcode it generates as you'll need this to login later
Alternative method for getting password
tail ~/.config/code-server/config.yaml
Open in Browser on Android Device
localhost:8080
in the browser and paste the passcode generated in the terminal
In summary
The reality is i'd suggest that unless you're running this on a Linux Tablet then really its a bit too fiddly to use as a daily driver however it is a good guide for seeing the power of Termux and what you could do with it.
网友评论