This repo is changed to https://github.com/amm834/Development-Environment-Setup-For-Android.
This thread will use TERMUX application.
Author ~ Aung Myat Moe
This
Tricks
will show you amazing things that you are very hard to make.
- Android Phone
- Good understand in basic Linux /Unix commmands
- Download Termux
- Basic Installation
- Setup
- Install ZSH Shell with OhMyZSH Themes
- Setup LAMP
- Composer Installation
- Apache Web Server Installation
- Apache and PHP Setup
- Restart Server
- MySQL (Mariadb) Installation
- Stop Mariadb
Download Termux app via Google Play or Other App Stores.
- Via Google Play
Note Your Android version should have at least 7.0.
pkg upgrade && pkg update -y
pkg install zsh
sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
When zsh ask like
Time to change your default shell to zsh: Do you want to change your default shell to zsh? [Y/n]
Y
You can edit theme and others in .zshrc
config file.
Note If shell is still bash?
Exist and open termux again.
Read More https://wiki.termux.com/wiki/ZSH
Install Composer
.
(Composer is PHP dependencies manager.)
When we install Composer
we don't need to type individual commads.
pkg install composer -y
When composer is installed,
php -v
PHP 8.0.0 (cli) (built: Dec 16 2020 14:01:56) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.0.0-dev, Copyright (c) Zend Technologies
composer
# Avaliable options will show you …
pkg install php-apache -y
# To install php-module for apache web server
Note if -y
is npt working?
Press Enter
pkg install apache2
httpd -v #check version
First check php-apache module
is installed or not.
cd $PREFIX/libexec/apache2
# Search php
grep php *
# grep: libphp.so: binary file matches
Note $PREFIX
=== /data/data/com.termux/files/usr
If you don't get libphp.so?
Install pkg install php-apache
again.
If libphp.so
file is exist,
cd $PREFIX/etc/apache2
nano httpd.conf
ctrl+w and type worker
and Enter you will find worker module.
LoadModule mpm_worker_module libexec/apache2/mod_mpm_worker.so
Close it.
By adding #
at the first of LoadModule
.
#LoadModule mpm_worker_module libexec/apache2/mod_mpm_worker.so
And open mpm_prefork_module
by uncommenting.
From ->
#LoadModule mpm_prefork_module libexec/apache2/mod_mpm_prefork.so
to ->
LoadModule mpm_prefork_module libexec/apache2/mod_mpm_prefork.so
Search Directory
and you will found -
DocumentRoot "/data/data/com.termux/files/usr/share/apache2/default-site/htdocs" < Directory "/data/data/com.termux/files/usr/share/apache2/default-site/htdocs" >
I will change it to my internal storage.
DocumentRoot "/sdcard/htdocs" < Directory "/sdcard/htdocs" >
Search ServerName
.
You will see like -
#ServerName www.example.com:8080
Change it to
ServerName 127.0.0.1:8080
apachectl start
and go to http://localhost:8080/
via any Browser.
Now,we will setup php module.
First we will open rewrite rule
module.
Search rewrite
and change it
From -
#LoadModule rewrite_module libexec/apache2/mod_rewrite.so
To -
LoadModule rewrite_module libexec/apache2/mod_rewrite.so
Add followimg lines.
LoadModule php_module libexec/apache2/libphp.so
<FilesMatch \.php$>
SetHandler application/x-httpd-php
</FilesMatch>
<IfModule dir_module>
DirectoryIndex index.php
</IfModule>
When you change rules in httpd.conf file,Restart serber ever.
apachectl stop
apachectl start
apachectl restart
# Go Browser and test again.
pkg install mariadb
Y
Start Mariadb
cd '/data/data/com.termux/files/usr' ; /data/data/com.termux/files/usr/bin/mysqld_safe --datadir='/data/data/com.termux/files/usr/var/lib/mysql'
If you want to test ?
pkg install perl
cd '/data/data/com.termux/files/usr/mysql-test' ; perl mysql-test-run.pl
If Server is not start above methods?
mysqld_safe -u root
and Open new session
.
mysql
CREATE USER 'root' IDENTIFIED BY '';
GRANT ALL ON db.* TO root@localhost IDENTIFIED BY '';
FLUSH PRIVILEGES;
ctrl+d exist from shell.
Show all process
ps aux | grep mysqld
ps aux | grep mysql
Kill process
kill $(ps aux | grep '[m]ysql' | awk '{print $2}')
- The
ps
gives you the list of all the processes. - The
grep
filters that based on your search string,[p]
is a trick to stop you picking up the actualgrep
process itself. - The
awk
just gives you the second field of each line, which is thePID
. - The
$(x)
construct means to executex
then take its output and put it on the command line. The output of thatps
pipeline inside that construct above is the list of process IDs so you end up with a command likekill 1234 1122 7654
.
Detail Here
- Node JS Installation
- Vue Global CLI Installation
- Nodemon Global CLI Installation
pkg install nodejs
Y
Test -
node -v
npm -v
npm install -g @vue/cli
npm install -g nodemon
Create node server and run nodemon fileName.js
MongoDB is not officially support by termux.So,we will use third party library.
pkg install wget
wget https://its-pointless.github.io/setup-pointless-repo.sh
sh setup-pointless-repo.sh
pkg upgrade
pkg install mongodb
Y
mkdir -p $PREFIX/data/db
mongod # -> to start mongodb service
mongo
This readme include setup LAMP in UBUNTU v-20. README v-1