* docs: add toc to CODE OF CONDUCT * chore: add prettier ignore blocks to docs * chore: update styles for Dockerfile * refactor: separate prettier, doctoc This does a couple things: - update `.prettierignore` - split `prettier` and `doctoc` commands. you can still run with `yarn fmt` - delete `fmt.sh` and add `doctoc.sh` By doing so, we can run tasks in parallel in CI and we should also have less false positives than before with `yarn fmt` locally. * refactor: update prettier job, add doctoc This modifies the prettier job to use actionsx/prettier. It also adds a job for `doctoc`. * chore: upgrade to prettier 2.7.1 * chore: pin doctoc to 2.0.0 * fixup!: add .pc to prettierignore * feat: add --cache to prettier cmd
8.4 KiB
Termux
Install
- Get Termux from F-Droid.
- Install Debian by running the following:
- Run
termux-setup-storage
to allow storage access, or else code-server won't be able to read from/sdcard
.\The following command is from proot-distro, but you can also use Andronix. After Debian is installed the
~ $
will change toroot@localhost
.
- Run
pkg update -y && pkg install proot-distro -y && proot-distro install debian && proot-distro login debian
- Run the following commands to setup Debian:
apt update && apt upgrade -y && apt-get install sudo vim git -y
-
Install NVM by following the install guide in the README, just a curl/wget command.
-
Set up NVM for multi-user. After installing NVM it automatically adds the necessary commands for it to work, but it will only work if you are logged in as root:
- Copy the lines NVM asks you to run after running the install script.
- Run
nano /root/.bashrc
and comment out those lines by adding a#
at the start. - Run
nano /etc/profile
and paste those lines at the end of the file. Make sure to replace$HOME
with/root
on the first line. - Now run
exit
- Start Debian again
proot-distro login debian
-
After following the instructions and setting up NVM you can now install the required node version by running:
nvm install v<major_version_here>
- To install
code-server
run the following:To check the install process (Will not actually install code-server) If it all looks good, you can install code-server by running the second command
curl -fsSL https://code-server.dev/install.sh | sh -s -- --dry-run
curl -fsSL https://code-server.dev/install.sh | sh
- You can now start code server by simply running
code-server
.
Consider using a new user instead of root, read here why using root is not recommended.
Learn how to add a user here.
NPM Installation
-
Get Termux from F-Droid.
-
We will now change using the following command.
termux-change-repo
Now select Main Repository
then change repo to Mirrors by Grimler Hosted on grimler.se
.
- After successfully updating of repository update and upgrade all the packages by the following command
pkg update
pkg upgrade -y
- Now let's install requirement dependancy.
pkg install -y \
build-essential \
binutils \
pkg-config \
python3 \
nodejs-lts
npm config set python python3
node -v
you will get node version v16.15.0
-
Now install code-server following our guide on installing with npm
-
Congratulation code-server is installed on your device using the following command.
code-server --auth none
- If already installed then use the following command for upgradation.
npm update --global code-server --unsafe-perm
Upgrade
- Remove all previous installs
rm -rf ~/.local/lib/code-server-*
- Run the install script again
curl -fsSL https://code-server.dev/install.sh | sh
Known Issues
Git won't work in /sdcard
Issue : Using git in the /sdcard
directory will fail during cloning/commit/staging/etc...
Fix : None
Potential Workaround :
- Create a soft-link from the debian-fs to your folder in
/sdcard
- Use git from termux (preferred)
Extra
Create a new user
To create a new user follow these simple steps -
- Create a new user by running
useradd <username> -m
. - Change the password by running
passwd <username>
. - Give your new user sudo access by running
visudo
, scroll down toUser privilege specification
and add the following line after rootusername ALL=(ALL:ALL) ALL
. - Now edit the
/etc/passwd
file with your command line editor of choice and at the end of the line that specifies your user change/bin/sh
to/bin/bash
. - Now switch users by running
su - <username>
- Remember the
-
betweeensu
and username is required to execute/etc/profile
,
since/etc/profile
may have some necessary things to be executed you should always add a-
.
Install Go
- Go to https://golang.org/dl/ and copy the download link for
linux arm
and run the following:
wget download_link
- Extract the downloaded archive. (This step will erase all previous GO installs, make sure to create a backup if you have previously installed GO)
rm -rf /usr/local/go && tar -C /usr/local -xzf archive_name
- Run
nano /etc/profile
and add the following lineexport PATH=$PATH:/usr/local/go/bin
. - Now run
exit
(depending on if you have switched users or not, you may have to runexit
multiple times to get to normal termux shell) and start Debian again. - Check if your install was successful by running
go version
Install Python
Run these commands as root
- Run the following commands to install required packages to build python:
sudo apt-get update
sudo apt-get install make build-essential libssl-dev zlib1g-dev \
libbz2-dev libreadline-dev libsqlite3-dev wget curl llvm \
libncursesw5-dev xz-utils tk-dev libxml2-dev libxmlsec1-dev libffi-dev liblzma-dev
- Install pyenv from pyenv-installer by running:
curl -L https://github.com/pyenv/pyenv-installer/raw/master/bin/pyenv-installer | bash
- Run
nano /etc/profile
and add the following:
export PYENV_ROOT="/root/.pyenv"
export PATH="/root/.pyenv/bin:$PATH"
eval "$(pyenv init --path)"
eval "$(pyenv virtualenv-init -)"
- Exit and start Debian again.
- Run
pyenv versions
to list all installable versions. - Run
pyenv install version
to install the desired python version.The build process may take some time (an hour or 2 depending on your device).
- Run
touch /root/.pyenv/version && echo "your_version_here" > /root/.pyenv/version
- (You may have to start Debian again) Run
python3 -V
to verify if PATH works or not.If
python3
doesn't work but pyenv says that the install was successful in step 6 then try running$PYENV_ROOT/versions/your_version/bin/python3
.
Working with PRoot
Debian PRoot Distro Dev Environment
- Since Node and code-server are installed in the Debian PRoot distro, your
~/.ssh/
configuration,~/.bashrc
, git, npm packages, etc. should be setup in PRoot as well. - The terminal accessible in code-server will bring up the filesystem and
~/.bashrc
in the Debian PRoot distro.
Accessing files in the Debian PRoot Distro
- The
/data/data/com.termux/files/home
directory in PRoot accesses the termux home directory (~
) - The
/sdcard
directory in PRoot accesses the Android storage directory, though there are known issues with git and files in the/sdcard
path
Accessing the Debian PRoot distro/Starting code-server
- Run the following command to access the Debian PRoot distro, from the termux shell:
proot-distro login debian
- Run the following command to start code-server directly in the Debian PRoot distro, from the termux shell:
proot-distro login debian -- code-server
- If you created a new user, you'll need to insert the
--user <username>
option betweenlogin
anddebian
in the commands above to run as the user instead of root in PRoot.
Additional information on PRoot and Termux
- Additional information on using your Debian PRoot Distro can be found here.