Skip to content

Commit a0af39a

Browse files
thx2001rjsjoeio
authored andcommitted
docs: simplify termux installation process (coder#5078)
* 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. * docs: Termux correct packages to install Updated some erroneously missing packages (vim and sudo) necessary for multi-user setup. * docs: cleaned up verbiage Co-authored-by: Joe Previte <[email protected]> * docs: corrected punctuation Co-authored-by: Joe Previte <[email protected]> * docs: correct punctuation Co-authored-by: Joe Previte <[email protected]> * docs: clarify pkg command shorthand * Ran yarn fmt on docs Co-authored-by: Joe Previte <[email protected]>
1 parent 8164940 commit a0af39a

File tree

1 file changed

+61
-24
lines changed

1 file changed

+61
-24
lines changed

docs/termux.md

+61-24
Original file line numberDiff line numberDiff line change
@@ -10,40 +10,45 @@
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), but 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 update -y && pkg install 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 sudo vim 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+
47+
```bash
48+
nvm install v<major_version_here>
49+
```
4450

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.
51+
7. To install `code-server` run the following:
4752
> To check the install process (Will not actually install code-server)
4853
> If it all looks good, you can install code-server by running the second command
4954
@@ -82,11 +87,11 @@ Potential Workaround :
8287

8388
To create a new user follow these simple steps -
8489

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`
90+
1. Create a new user by running `useradd <username> -m`.
91+
2. Change the password by running `passwd <username>`.
92+
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`.
93+
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`.
94+
5. Now switch users by running `su - <username>`
9095

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

96101
> From https://golang.org/doc/install
97102
98-
1. Go to https://golang.org/dl/ and copy the download link for `linux arm` and run the following.
103+
1. Go to https://golang.org/dl/ and copy the download link for `linux arm` and run the following:
99104

100105
```bash
101106
wget download_link
@@ -115,7 +120,7 @@ rm -rf /usr/local/go && tar -C /usr/local -xzf archive_name
115120

116121
> Run these commands as root
117122
118-
1. Run the following command to install required packages to build python.
123+
1. Run the following commands to install required packages to build python:
119124

120125
```bash
121126
sudo apt-get update
@@ -124,13 +129,13 @@ sudo apt-get install make build-essential libssl-dev zlib1g-dev \
124129
libncursesw5-dev xz-utils tk-dev libxml2-dev libxmlsec1-dev libffi-dev liblzma-dev
125130
```
126131

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

129134
```bash
130135
curl -L https://github.com/pyenv/pyenv-installer/raw/master/bin/pyenv-installer | bash
131136
```
132137

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

135140
```bash
136141
export PYENV_ROOT="/root/.pyenv"
@@ -139,10 +144,42 @@ eval "$(pyenv init --path)"
139144
eval "$(pyenv virtualenv-init -)"
140145
```
141146

142-
4. Exit start Debian again.
147+
4. Exit and start Debian again.
143148
5. Run `pyenv versions` to list all installable versions.
144149
6. Run `pyenv install version` to install the desired python version.
145150
> The build process may take some time (an hour or 2 depending on your device).
146151
7. Run `touch /root/.pyenv/version && echo "your_version_here" > /root/.pyenv/version`
147152
8. (You may have to start Debian again) Run `python3 -V` to verify if PATH works or not.
148153
> 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`.
154+
155+
### Working with PRoot
156+
157+
Debian PRoot Distro Dev Environment
158+
159+
- 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.
160+
- The terminal accessible in code-server will bring up the filesystem and `~/.bashrc` in the Debian PRoot distro.
161+
162+
Accessing files in the Debian PRoot Distro
163+
164+
- The `/data/data/com.termux/files/home` directory in PRoot accesses the termux home directory (`~`)
165+
- 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)
166+
167+
Accessing the Debian PRoot distro/Starting code-server
168+
169+
- Run the following command to access the Debian PRoot distro, from the termux shell:
170+
171+
```bash
172+
proot-distro login debian
173+
```
174+
175+
- Run the following command to start code-server directly in the Debian PRoot distro, from the termux shell:
176+
177+
```bash
178+
proot-distro login debian -- code-server
179+
```
180+
181+
- 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.
182+
183+
Additional information on PRoot and Termux
184+
185+
- 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)