HOw to run localserver on smartphone using termux

Hello, comrades

I can now run a local server on my smartphone

but back to the beginning

First you need to install termux, can be found in google playmarket.
Then open termux and install packages.
list of packages to install: wget, openssl-tools, proot.

pkg install proot

And time to install Java, info taken from github


here is the command to install

wget https://raw.githubusercontent.com/MasterDevX/java/master/installjava && bash installjava

on the phone java will not start without the proot package. so we have to pretend that we are a superuser.

Just write in concole:
proot -0


check if java works
java -version

if everything works, then load the server file
wget "https://github.com/blynkkk/blynk-server/releases/download/v0.41.13/server-0.41.13-java8.jar"

Before starting, you need to make a certificate for the server, otherwise it will not start
openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout key.key -out cert.crt

and then write them in the server.propeties file. And add the file storage path
should look something like this

server.ssl.cert=cert.crt
server.ssl.key=key.key
server.ssl.key.pass=
data.folder=blynkdata/

always run proot before starting the server.
proot -0

then
java -jar server-0.41.13-java8.jar

???
Profit?
Devide was Honor 9X with Android 10

3 Likes

Π•Ρ‰Ρ‘ сдСлал скрипт Π½Π° автозапуск, наслаТдайтС, Π΅ΡΡ‚ΡŒ Π΄Π²Π΅ ΠΊΠΎΠΌΠ°Π½Π΄Ρ‹ start ΠΈ stop. МоТно ΠΏΠΎΠΌΠ΅ΡΡ‚ΠΈΡ‚ΡŒ Π½Π°Π·Π²Π°Π½ΠΈΠ΅ скрипта Π² Ρ„Π°ΠΉΠ» .profiles Ρ‡Ρ‚ΠΎΠ±Ρ‹ запускался ΠΊΠ°ΠΆΠ΄Ρ‹ΠΉ Ρ€Π°Π· ΠΏΡ€ΠΈ запускС Ρ‚Π΅Ρ€ΠΌΠΈΠ½Π°Π»Π°, сСрвСр Π·Π°ΠΏΡƒΡ‰Π΅Π½ ΠΏΠΎΠ΄ ΠΊΠΎΠΌΠ°Π½Π΄ΠΎΠΉ nohup Ρ‚Π°ΠΊ Ρ‡Ρ‚ΠΎ привязки ΠΊ Ρ‚Π΅Ρ€ΠΌΠΈΠ½Π°Π»Ρƒ Π½Π΅Ρ‚ ΠΈ Π±ΡƒΠ΄Π΅Ρ‚ Ρ€Π°Π±ΠΎΡ‚Π°Ρ‚ΡŒ Π² Ρ„ΠΎΠ½Π΅ Π΄Π°ΠΆΠ΅ послС logout.

ΠΊΠΎΠΏΠΈΡ€ΡƒΠ΅ΠΌ ΠΊΠΎΠ΄ Π² Ρ„Π°ΠΉΠ» Π½Π°ΠΏΡ€ΠΈΠΌΠ΅Ρ€ top.sh пишСм Π² консоль
chmod 700 top.sh
ΠΈ ΠΌΠΎΠΆΠ½ΠΎ ΠΏΠΎΠ»ΡŒΠ·ΠΎΠ²Π°Ρ‚ΡŒΡΡ

#!/bin/bash
pidjava=$(ps -aux | grep "[j]dk8" | awk '{print $2}')

case $1 in

        start)
         #echo "case start"
         if [ $pidjava > 0 ]
         then 
         echo "server online PID $pidjava"
         else
         echo "server offline"
         echo "starting"
         nohup proot -0 java -jar server.jar &
         date >> nohup.out
         sleep 10
         tail -n 4 nohup.out
         tail -n 15 logs/blynk.log | grep "Region"
         echo "ready"

         fi

         ;;

        stop)
         #echo "case stop"
         if [ $pidjava > 0 ]
         then
         kill $pidjava
         sleep 2
         tail nohup.out
         else 
         echo "404"
         fi
         ;;



        *)
        # echocase empty"
         exec ./top.sh start
         ;;
esac

exit 0

Is it possible to run the local server and the Blynk App on the same smartphone?

Greetings to the forum.

Yes, just write in blynk app β€œlocalhost” ipaddress