You can use this script to set up adb network debugging on the phone with the terminal application and root.
Terminal application recommend Termux
If you are working on an SD card:
wget -O air-adb https://raw.githubusercontent.com/moeshin/air-adb/master/air-adb
sh air-adb
Else we can:
wget -O air-adb https://raw.githubusercontent.com/moeshin/air-adb/master/air-adb && chmod +x air-adb
./air-adb
./air-adb -?|-h|--help Get help
./air-adb [port] Start adb over networ, default by 5555
./air-adb stop Stop adb over network
./air-adb status Get Status