Skip to content

Commit 90a3cd7

Browse files
authored
Update termux.md
1) Updated information to use PRoot (simpler than Andronix and the way supported by Termux) to create and access the Debian distro. 2) Added helpful information on using PRoot with your dev environment. 3) Cleaned up spelling, grammar, and made documentation more consistent between sections.
1 parent 3ba3caa commit 90a3cd7

File tree

1 file changed

+52
-24
lines changed

1 file changed

+52
-24
lines changed

docs/termux.md

Lines changed: 52 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -10,40 +10,44 @@
1010
- [Create a new user](#create-a-new-user)
1111
- [Install Go](#install-go)
1212
- [Install Python](#install-python)
13+
- [Working with PRoot](#working-with-proot)
1314

1415
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
1516

1617
## Install
1718

1819
1. Get [Termux](https://f-droid.org/en/packages/com.termux/) from **F-Droid**.
19-
2. Install Debian by running the following.
20+
2. Install Debian by running the following:
2021
- Run `termux-setup-storage` to allow storage access, or else code-server won't be able to read from `/sdcard`.\
21-
If you used the Andronix command then you may have to edit the `start-debian.sh` script to mount `/sdcard` just as simple as uncommenting the `command+=" -b /sdcard"` line.
22-
> The following command was extracted from [Andronix](https://andronix.app/) you can also use [proot-distro](https://github.com/termux/proot-distro).
22+
> The following command is from [proot-distro](https://github.com/termux/proot-distro) you can also use [Andronix](https://andronix.app/).
2323
> After Debian is installed the `~ $` will change to `root@localhost`.
2424
2525
```bash
26-
pkg update -y && pkg install wget curl proot tar -y && wget https://raw.githubusercontent.com/AndronixApp/AndronixOrigin/master/Installer/Debian/debian.sh -O debian.sh && chmod +x debian.sh && bash debian.sh
26+
pkg up -y && pkg in proot-distro -y && proot-distro install debian && proot-distro login debian
2727
```
2828

29-
3. Run the following commands to setup Debian.
29+
3. Run the following commands to setup Debian:
3030

3131
```bash
32-
apt update
33-
apt upgrade -y
34-
apt-get install nano vim sudo curl wget git -y
32+
apt update && apt upgrade -y && apt-get install git -y
3533
```
3634

37-
4. Install [NVM](https://github.com/nvm-sh/nvm) by following the install guide in the README, just a curl/wget command.
38-
5. 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;
35+
4. Install [NVM](https://github.com/nvm-sh/nvm#install--update-script) by following the install guide in the README, just a curl/wget command.
36+
37+
5. 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:
3938

4039
- Copy the lines NVM asks you to run after running the install script.
4140
- Run `nano /root/.bashrc` and comment out those lines by adding a `#` at the start.
42-
- Run `nano /etc/profile` and paste those lines at the end and make sure to replace `$HOME` with `/root`
43-
- Now run `exit` and start Debain again.
41+
- 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.
42+
- Now run `exit`
43+
- Start Debian again `proot-distro login debian`
44+
45+
6. After following the instructions and setting up NVM you can now install the [required node version](https://coder.com/docs/code-server/latest/npm#nodejs-version) by running:
46+
```bash
47+
nvm install v<major_version_here>
48+
```
4449

45-
6. After following the instructions and setting up NVM you can now install the [required node version](https://coder.com/docs/code-server/latest/npm#nodejs-version) using `nvm install version_here`.
46-
7. To install `code-server` run the following.
50+
7. To install `code-server` run the following:
4751
> To check the install process (Will not actually install code-server)
4852
> If it all looks good, you can install code-server by running the second command
4953
@@ -82,11 +86,11 @@ Potential Workaround :
8286

8387
To create a new user follow these simple steps -
8488

85-
1. Create a new user by running `useradd username -m`.
86-
2. Change the password by running `passwd username`.
87-
3. Give your new user sudo access by runnning `visudo`, scroll down to `User privilege specification` and add the following line after root `username ALL=(ALL:ALL) ALL`.
88-
4. Now edit the `/etc/passwd` file with your commadline editor of choice and at the end of the line that specifies your user change `/bin/sh` to `/bin/bash`.
89-
5. Now switch users, by running `su - username`
89+
1. Create a new user by running `useradd <username> -m`.
90+
2. Change the password by running `passwd <username>`.
91+
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`.
92+
4. Now edit the `/etc/passwd` file with your commandline editor of choice and at the end of the line that specifies your user change `/bin/sh` to `/bin/bash`.
93+
5. Now switch users, by running `su - <username>`
9094

9195
- Remember the `-` betweeen `su` and username is required to execute `/etc/profile`,\
9296
since `/etc/profile` may have some necessary things to be executed you should always add a `-`.
@@ -95,7 +99,7 @@ To create a new user follow these simple steps -
9599

96100
> From https://golang.org/doc/install
97101
98-
1. Go to https://golang.org/dl/ and copy the download link for `linux arm` and run the following.
102+
1. Go to https://golang.org/dl/ and copy the download link for `linux arm` and run the following:
99103

100104
```bash
101105
wget download_link
@@ -115,7 +119,7 @@ rm -rf /usr/local/go && tar -C /usr/local -xzf archive_name
115119

116120
> Run these commands as root
117121
118-
1. Run the following command to install required packages to build python.
122+
1. Run the following commands to install required packages to build python:
119123

120124
```bash
121125
sudo apt-get update
@@ -124,13 +128,13 @@ sudo apt-get install make build-essential libssl-dev zlib1g-dev \
124128
libncursesw5-dev xz-utils tk-dev libxml2-dev libxmlsec1-dev libffi-dev liblzma-dev
125129
```
126130

127-
2. Install [pyenv](https://github.com/pyenv/pyenv/) from [pyenv-installer](https://github.com/pyenv/pyenv-installer) by running.
131+
2. Install [pyenv](https://github.com/pyenv/pyenv/) from [pyenv-installer](https://github.com/pyenv/pyenv-installer) by running:
128132

129133
```bash
130134
curl -L https://github.com/pyenv/pyenv-installer/raw/master/bin/pyenv-installer | bash
131135
```
132136

133-
3. Run `nano /etc/profile` and add the following
137+
3. Run `nano /etc/profile` and add the following:
134138

135139
```bash
136140
export PYENV_ROOT="/root/.pyenv"
@@ -139,10 +143,34 @@ eval "$(pyenv init --path)"
139143
eval "$(pyenv virtualenv-init -)"
140144
```
141145

142-
4. Exit start Debian again.
146+
4. Exit and start Debian again.
143147
5. Run `pyenv versions` to list all installable versions.
144148
6. Run `pyenv install version` to install the desired python version.
145149
> The build process may take some time (an hour or 2 depending on your device).
146150
7. Run `touch /root/.pyenv/version && echo "your_version_here" > /root/.pyenv/version`
147151
8. (You may have to start Debian again) Run `python3 -V` to verify if PATH works or not.
148152
> 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`.
153+
154+
### Working with PRoot
155+
156+
Debian PRoot Distro Dev Environment
157+
- 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.
158+
- The terminal accessible in code-server will bring up the filesystem and `~/.bashrc` in the Debian PRoot distro.
159+
160+
Accessing files in the Debian PRoot Distro
161+
- The `/data/data/com.termux/files/home` directory in PRoot accesses the termux home directory (`~`)
162+
- The `/sdcard` directory in PRoot accesses the Android storage directory, though there are [known issues with git and files in the `/sdcard` path](#git-wont-work-in-sdcard)
163+
164+
Accessing the Debian PRoot distro/Starting code-server
165+
- Run the following command to access the Debian PRoot distro, from the termux shell:
166+
```bash
167+
proot-distro login debian
168+
```
169+
- Run the following command to start code-server directly in the Debian PRoot distro, from the termux shell:
170+
```bash
171+
proot-distro login debian -- code-server
172+
```
173+
- If you [created a new user](#create-a-new-user), you'll need to insert the `--user <username>` option between `login` and `debian` in the commands above to run as the user instead of root in PRoot.
174+
175+
Additional information on PRoot and Termux
176+
- Additional information on using your Debian PRoot Distro can be [found here](https://github.com/termux/proot-distro#functionality-overview).

0 commit comments

Comments
 (0)