Translate

Termux(transled from older post)

After using Termux for a while, its volume gradually increases. Initially, I used various strange methods to forcibly install the libraries I needed. However, if I accidentally installed the wrong things, I had to start over again. If I didn't summarize my previous experiences well, I might even fail if I tried to install them again. If I always had to start over every time I encountered a problem, it would be impossible to make progress. It's better to leave repetitive work to the machines. Although we may become skilled at doing it ourselves, we can never beat machines and it will only result in a waste of time. Currently, I use "proot-distro" to install Debian, where I install everything I need. Then, I backup the environment. If there is a problem, I restore it to the last perfect environment. I can easily deploy it to other devices as well. I have not compared it with other Linux versions, but I chose it because it is a newer and more stable version. When I tried to install various python modules, I succeeded using normal methods, so I didn't delve deeper into it. I still need to focus my time and energy on my goals. Now, let me summarize the process. If you don't follow each step carefully, there is a high probability that you will fail
Install Termux:
Since the Termux on Play Store has not been updated for a long time, I recommend downloading it from F-Droid instead.
https://f-droid.org/en/packages/com.termux/
https://f-droid.org/en/packages/com.termux.widget/
First of all, you need to authorize and change the installation source. I suggest switching to the Cloudflare source and then installing the tur source. Once you have a source that can install "proot-distro," you're ready to go.

termux-setup-storage

termux-wake-lock

termux-change-repo

pkg install tur-repo

pkg update && pkg upgrade 

pkg install proot-distro

proot-distro install debian 

proot-distro --help

After that, it's time to configure Debian:
First, install Termux-widget. Then, replace 'brian' with your username. Then, copy and paste the following commands:
user='brian'
echo 'proot-distro login debian' >> .shortcuts/debian.sh
echo "proot-distro login debian --user $user">> .shortcuts/user_debian.sh
After completing the steps mentioned above, you can log in to Debian
proot-distro login debian
Creating a user:
Although it may be a bit cumbersome, it is recommended to not use root directly to avoid potential issues in the future.
The method I have provided is already very simple. You just need to change the username and copy it. Remember to make note of the password when executing `adduser` as it will be required when running `sudo`.

user='brian'

apt update && apt upgrade

apt install sudo 

adduser $user

gpasswd -a $user sudo
echo "$user ALL=(ALL:ALL) ALL" >> /etc/sudoers login $user
If everything before this is correct and complete, then you can move on to the green text below.
Install Python and various libraries. Do not copy the last few lines. Customize them according to your personal needs, and don't forget to create a backup.

sudo apt update && apt upgrade

sudo apt install python3-pip wget curl

alias python=python3

sudo echo 'alias python=python3'  >> .bashrc

sudo python -m pip install --upgrade pip

sudo pip install flask pydantic sqlalchemy

sudo pip install pandas matplotlib scipy numpy 

sudo pip install scikit-learn tensorflow jupyyerlab==3

Logout then backup
logout
exit
Make sure to exit everything completely before creating a backup. If there are any error messages during the backup process, it means that the backup is incomplete. Don't wait until you need to restore and encounter problems in the future before regretting not creating a complete backup.
proot-distro backup debian --output /sdcard/bak.tar.gz

沒有留言:

發佈留言