Archived
1
0
This repository has been archived on 2024-09-09. You can view files and clone it, but cannot push or open issues or pull requests.
code-server/docs/termux.md
Joe Previte d835cb9865
docs: add new termux installation method (#5938)
* docs: add new termux installation method

* fixup: formatting
2023-01-04 17:16:23 +00:00

5.0 KiB

Termux

Install

  1. Get Termux from F-Droid.
  2. Run pkg install tur-repo
  3. Run pkg install code-server
  4. You can now start code server by simply running code-server.

NPM Installation

  1. Get Termux from F-Droid.

  2. 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.

  1. After successfully updating of repository update and upgrade all the packages by the following command
pkg update
pkg upgrade -y
  1. 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

  1. Now install code-server following our guide on installing with npm

  2. Congratulation code-server is installed on your device using the following command.

code-server --auth none
  1. If already installed then use the following command for upgradation.
npm update --global code-server --unsafe-perm

Upgrade

  1. Remove all previous installs rm -rf ~/.local/lib/code-server-*
  2. 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 :

  1. Create a soft-link from the debian-fs to your folder in /sdcard
  2. Use git from termux (preferred)

Extra

Create a new user

To create a new user follow these simple steps -

  1. Create a new user by running useradd <username> -m.
  2. Change the password by running passwd <username>.
  3. Give your new user sudo access by running visudo, scroll down to User privilege specification and add the following line after root username ALL=(ALL:ALL) ALL.
  4. 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.
  5. Now switch users by running su - <username>
  • Remember the - betweeen su 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

From https://golang.org/doc/install

  1. Go to https://golang.org/dl/ and copy the download link for linux arm and run the following:
wget download_link
  1. 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
  1. Run nano /etc/profile and add the following line export PATH=$PATH:/usr/local/go/bin.
  2. Now run exit (depending on if you have switched users or not, you may have to run exit multiple times to get to normal termux shell) and start Debian again.
  3. Check if your install was successful by running go version

Install Python

Run these commands as root

  1. 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
  1. Install pyenv from pyenv-installer by running:
curl -L https://github.com/pyenv/pyenv-installer/raw/master/bin/pyenv-installer | bash
  1. 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 -)"
  1. Exit and start Debian again.
  2. Run pyenv versions to list all installable versions.
  3. 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).

  4. Run touch /root/.pyenv/version && echo "your_version_here" > /root/.pyenv/version
  5. (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.