How to install VS Code in an Android Phone and use any Device?
Use VS Code On Android Phone
In this post, we will see how you can install vs code on an android device. We will use one of the most popular android terminals called termux.
Install and Configure VS code
To install VS code in android, first we need to install Termux application in our device. So, download and install Termux from F-droid, DO NOT INSTALL TERMUX FROM PLAYSTORE.
After you’ve successfully downloaded and installed Termux, follow the steps below to install Visual Studio Code in android
Step 1 :- Launch Termux application, and type pkg update to update the list of packages.
pkg update
Step 2 :- Install proot-distro package by typing pkg install proot-distro
pkg install proot-distro
Step 3 :- You can install any distro you want from the list, by the way we are going to install Ubuntu. So type proot-distro install and then alias name that is ubuntu
proot-distro list
proot-distro install ubuntu
After it is installed, type proot-distro login ubuntu to launch ubuntu
proot-distro login ubuntu
In Ubuntu system that is installed in Termux, copy paste the command below to update the list and install wget package
apt update && apt install wget -y
Step 4 :- Search on google code server and open first GitHub link and scroll down and click this link
Then, copy paste the following command to download code server.
Downloading code server
wget github.com/coder/code-server/releases/downl..
Extract the tarball using the following command:
tar -xvf ./code-server-4.5.1-linux-arm64.tar.gz
Run Visual Studio Code On Android
After the extraction is completed, you’ll see new directory named code-server-4.5.1-linux-arm64. Change the working directory to code-server-4.5.1-linux-arm64 using cd command.
cd code-server-4.5.1-linux-arm64
Get inside bin directory that is in code-server-4.5.1-linux-arm64 directory.
cd bin
Set password for your VS code using the following command
export PASSWORD="password"
Launch the VS code by executing code-server file.
./code-server
Now open any browser in you phone and visit
http://127.0.0.1:8080
In password section enter password and then submit. Congrats ! now you must be seeing VS code in your browser.
Bonus Trick
Close termux and open again and install this
pkg install openssh
ssh-keygen
Login Ubuntu and Start VS Code Server
- proot-distro login ubuntu
- cd code-server-4.5.1-linux-arm64
- cd bin
- export PASSWORD="password"
- ./code-server
Open new session on termux
ssh -R 80:127.0.0.1:8080 localhost.run
Copy this link and open it
Conclusion
So this is how you can install and run VS code in your android phone with the help of Termux application. If you are going to use this thing, I would recommend you to get external keyboard and mouse for your phone. Because using this thing without external keyboard and mouse can be pain in the ass. You can also watch my YouTube video that will be uploaded soon on installing visual studio code on android.