项目作者: amm834

项目描述 :
Set Up
高级语言: Shell
项目地址: git://github.com/amm834/Developement-Setup.git
创建时间: 2020-12-05T15:16:05Z
项目社区:https://github.com/amm834/Developement-Setup

开源协议:MIT License

下载


This repo is changed to https://github.com/amm834/Development-Environment-Setup-For-Android.


Setup WEB Dev Environment in Android

This thread will use TERMUX application.

Author ~ Aung Myat Moe

Recommmend For Vue

This Tricks will show you amazing things that
you are very hard to make.

Vue Tricky Stuffs

Requitrments

  • Android Phone
  • Good understand in basic Linux /Unix commmands

Table of Contents

  • 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

Download Termux app via Google Play or Other App Stores.

  • Via Google Play

Download Termux

Note Your Android version should have at least 7.0.

Basic Installation

  1. pkg upgrade && pkg update -y

Install ZSH Shell with OhMyZSH Themes

  1. pkg install zsh
  2. 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]

  1. 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

Setup LAMP

Install Composer.
(Composer is PHP dependencies manager.)
When we install Composer we don’t need to type individual commads.

Composer Installation

  1. pkg install composer -y

When composer is installed,

  1. php -v
  2. PHP 8.0.0 (cli) (built: Dec 16 2020 14:01:56) (NTS)
  3. Copyright (c) The PHP Group
  4. Zend Engine v4.0.0-dev, Copyright (c) Zend Technologies
  5. composer
  6. # Avaliable options will show you …
  7. pkg install php-apache -y
  8. # To install php-module for apache web server

Note if -y is npt working?
Press Enter

Apache Web Server Installation

  1. pkg install apache2
  2. httpd -v #check version

Apache and PHP Setup

First check php-apache module is installed or not.

  1. cd $PREFIX/libexec/apache2
  2. # Search php
  3. grep php *
  4. # 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,

  1. cd $PREFIX/etc/apache2
  2. nano httpd.conf

ctrl+w and type worker and Enter you will find worker module.

  1. LoadModule mpm_worker_module libexec/apache2/mod_mpm_worker.so

Close it.
By adding # at the first of LoadModule.

  1. #LoadModule mpm_worker_module libexec/apache2/mod_mpm_worker.so

And open mpm_prefork_module by uncommenting.

From ->

  1. #LoadModule mpm_prefork_module libexec/apache2/mod_mpm_prefork.so

to ->

  1. LoadModule mpm_prefork_module libexec/apache2/mod_mpm_prefork.so

Search Directory
and you will found -

  1. 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.

  1. DocumentRoot "/sdcard/htdocs" < Directory "/sdcard/htdocs" >

Search ServerName.
You will see like -

  1. #ServerName www.example.com:8080

Change it to

  1. ServerName 127.0.0.1:8080

Test Apache Server

  1. 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 -

  1. #LoadModule rewrite_module libexec/apache2/mod_rewrite.so

To -

  1. LoadModule rewrite_module libexec/apache2/mod_rewrite.so

Load PHP8 Module

Add followimg lines.

  1. LoadModule php_module libexec/apache2/libphp.so
  2. <FilesMatch \.php$>
  3. SetHandler application/x-httpd-php
  4. </FilesMatch>
  5. <IfModule dir_module>
  6. DirectoryIndex index.php
  7. </IfModule>

Restart Server

When you change rules in httpd.conf file,Restart serber ever.

  1. apachectl stop
  2. apachectl start
  3. apachectl restart
  4. # Go Browser and test again.

MySQL (Mariadb) Installation

  1. pkg install mariadb
  2. Y

Start Mariadb

  1. 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 ?

  1. pkg install perl
  2. cd '/data/data/com.termux/files/usr/mysql-test' ; perl mysql-test-run.pl

If Server is not start above methods?

  1. mysqld_safe -u root

and Open new session.

  1. mysql
  2. CREATE USER 'root' IDENTIFIED BY '';
  3. GRANT ALL ON db.* TO root@localhost IDENTIFIED BY '';
  4. FLUSH PRIVILEGES;

ctrl+d exist from shell.

Stop Mariadb

Show all process

  1. ps aux | grep mysqld
  2. ps aux | grep mysql

Kill process

  1. 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 actual grep process itself.
  • The awk just gives you the second field of each line, which is the PID.
  • The$(x) construct means to execute x then take its output and put it on the command line. The output of that ps pipeline inside that construct above is the list of process IDs so you end up with a command like kill 1234 1122 7654.

Detail Here

@vandersonramos/kill-all-nginx-php-mysql-or-any-kind-of-processes-you-need-f5622d02d367">Medium Artical

StackOverFlow

MEVN Installation

  • Node JS Installation
  • Vue Global CLI Installation
  • Nodemon Global CLI Installation

Nodejs And NPM Installation

  1. pkg install nodejs
  2. Y

Test -

  1. node -v
  2. npm -v

Vue Global CLI Installation

  1. npm install -g @vue/cli

Nodemon Global CLI Installation

  1. npm install -g nodemon

Nodemon testing?

Create node server and run nodemon fileName.js

MongoDB Installation

MongoDB is not officially support by termux.So,we will use third party library.

  1. pkg install wget
  2. wget https://its-pointless.github.io/setup-pointless-repo.sh
  3. sh setup-pointless-repo.sh
  4. pkg upgrade
  5. pkg install mongodb
  6. Y
  7. mkdir -p $PREFIX/data/db
  8. mongod # -> to start mongodb service
  9. mongo

Old Version Avaliable

This readme include setup LAMP in UBUNTU v-20.
README v-1