DEV Community

Cover image for Setting Up Termux for Web Development: A Complete Guide
Hishantik Sarkar
Hishantik Sarkar

Posted on

Setting Up Termux for Web Development: A Complete Guide

Termux is a powerful terminal emulator for Android that allows you to
run a Linux environment without root. With the right setup, you can
turn Termux into a fully functional web development environment with
Oh My Zsh, Oh My Posh, Git, Neovim/LunarVim, and Node.js (Live Server).

In this guide, you’ll learn how to:

✅ Install and configure Termux

✅ Set up a powerful shell with Oh My Zsh and Oh My Posh

✅ Install Git for version control

✅ Configure Neovim/LunarVim for coding

✅ Set up Node.js with a Live Server for web development


1. Installing Termux & Required Packages

Step 1: Install Termux

Download and install Termux from F-Droid (recommended) or from GitHub (Termux GitHub).

⚠️ DO NOT install Termux from the Play Store as it’s outdated!

Step 2: Update Termux and Install Basic Packages

Open Termux and run:

pkg update && pkg upgrade -y
pkg install termux-api x11-repo tur-repo
pkg install zsh git neovim nodejs python wget curl unzip -y
Enter fullscreen mode Exit fullscreen mode

Step 3: Create a Symlink to an External SD Card for Easy Access

If your device has an external SD card, you can create a symbolic link (symlink) to access it easily from your home directory.

  • Step 1: Find the Name of Your External SD Card.

The system assigns a unique name to your SD card, usually in the format /XXXX-XXXX (e.g., /3454-3377). To find the name of your SD card, open a terminal and type:

df
Enter fullscreen mode Exit fullscreen mode

The output would be somewhat similar to this :

Filesystem 1K-blocks Used Available Use% Mounted on
/dev/root 305248512 12345678 292902834 5% /
devtmpfs 4000000 0 4000000 0% /dev
tmpfs 4023456 456 4023000 1% /dev/shm
tmpfs 4023456 1234 4022222 1% /run
tmpfs 4023456 0 4023456 0% /sys/fs/cgroup
/dev/mmcblk1p1 6233392 2123456 4109936 35% /boot
/dev/sda1 976762584 234567890 742194694 25% /mnt/data
/dev/mmcblk0p1 6233392 3123456 3109936 50% /storage/3454-3377
tmpfs 4023456 12 4023444 1% /run/user/1000
/storage/3454-3377 3488388 3 36637727 6% /mnt

Look at the last line of the output—it typically contains the mount point of your SD card.

In this example, the external SD card is mounted at:

/storage/3454-3377

This is the value you need to use when creating the symlink.

  • Step 2: Create a Symlink to the SD Card

Once you have the SD card name, create a symlink to it using the following command (replace 3454-3377 with the actual name of your SD card):

ln -s /storage/3454-3377 ~/sdcard
Enter fullscreen mode Exit fullscreen mode

This command creates a symbolic link (~/sdcard) in your home directory, allowing you to access your SD card easily without navigating through long directory paths.


2. Setting Up a Powerful Shell (Oh My Zsh & Oh My Posh)

Step 1: Install and Configure Oh My Zsh

pkg install zsh -y
chsh -s zsh
Enter fullscreen mode Exit fullscreen mode

Restart Termux, then install Oh My Zsh:

sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
Enter fullscreen mode Exit fullscreen mode

Install the Powerlevel10k theme for a better experience:

git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ~/.oh-my-zsh/custom/themes/powerlevel10k
Enter fullscreen mode Exit fullscreen mode

Set the theme in ~/.zshrc:

nano ~/.zshrc
Enter fullscreen mode Exit fullscreen mode

Change the line:

ZSH_THEME="powerlevel10k/powerlevel10k"

Save and exit (CTRL + X, then Y, then ENTER).

Restart Termux:

source ~/.zshrc
Enter fullscreen mode Exit fullscreen mode

Step 2: Install and Configure Oh My Posh (Optional)

pkg install oh-my-posh -y
oh-my-posh font install
Enter fullscreen mode Exit fullscreen mode

To use Oh My Posh, add this to ~/.zshrc:

eval "$(oh-my-posh init zsh --config ~/.config/oh-my-posh/theme.json)"


3. Installing Git for Version Control

Git is essential for managing your code and collaborating with others.

pkg install git -y
Enter fullscreen mode Exit fullscreen mode

Replace "YourName" and "your@email.com" with your preferred Git username and email address.

git config --global user.name "YourName"
git config --global user.email "your@email.com"
Enter fullscreen mode Exit fullscreen mode

To check if Git is working:

git --version
Enter fullscreen mode Exit fullscreen mode

4. Setting Up Neovim and configure it with LunarVim for Coding

Step: Install Neovim

pkg install neovim -y

Enter fullscreen mode Exit fullscreen mode

To check whether neovim have installed properly:

nvim --version
Enter fullscreen mode Exit fullscreen mode

step 2: Install LunarVim

pkg install python rust nodejs ripgrep make fd -y
Enter fullscreen mode Exit fullscreen mode
  • Resolve EACCES permissions when installing packages globally to avoid error when installing packages with npm.

To minimize the chance of permissions errors, you can configure npm to use a different directory. In this example, you will create and use hidden directory in your home directory.

  • On the command line, in your home directory, create a directory for global installations:
    mkdir -p ~/.npm-global/lib
Enter fullscreen mode Exit fullscreen mode
  • Configure npm to use the new directory path:
npm config set prefix '~/.npm-global'
Enter fullscreen mode Exit fullscreen mode
  • In your preferred text editor, open ~/.zshrc file and add this line:
export PATH=~/.npm-global/bin:$PATH
Enter fullscreen mode Exit fullscreen mode
  • On the command line, update your system variables:
source ~/.zshrc
Enter fullscreen mode Exit fullscreen mode
  • To test your new configuration, install a package globally without using sudo:
npm install -g jshint
Enter fullscreen mode Exit fullscreen mode

Now, run the below command in the terminal to install lunarvim :

LV_BRANCH='release-1.4/neovim-0.9' bash <(curl -s https://raw.githubusercontent.com/LunarVim/LunarVim/release-1.4/neovim-0.9/utils/installer/install.sh)
Enter fullscreen mode Exit fullscreen mode

Type yes whenever prompted during installation.

  • Run LunarVim:
lvim
Enter fullscreen mode Exit fullscreen mode

For plugins, edit ~/.config/lvim/config.lua :

lvim ~/.config/lvim/config.lua
Enter fullscreen mode Exit fullscreen mode

Essential Plugins for Web Development

Add these to your LunarVim config (~/.config/lvim/config.lua):

lvim.plugins = {
  {"neoclide/coc.nvim", branch = "release"},
  {"preservim/nerdtree"},
  {"tpope/vim-fugitive"},
  {"vim-airline/vim-airline"},
}
Enter fullscreen mode Exit fullscreen mode

Now to save and restart LunarVim, type:

:lvimreload
Enter fullscreen mode Exit fullscreen mode

To make lunarvim your default editor:

export EDITOR=lvim
echo 'export EDITOR=lvim' >> ~/.zshrc
Enter fullscreen mode Exit fullscreen mode

5. Setting Up a Live Server for wev-development.

  • Install Live Server and configure it : add the following lines in "/.config/lvim/config.lua" inside lvim.plugins{...}
{
    'barrett-ruth/live-server.nvim',
    build = 'pnpm add -g live-server',
    cmd = { 'LiveServerStart', 'LiveServerStop' },
    config = true
}
Enter fullscreen mode Exit fullscreen mode

To start a live server in your project folder through lunarvim, type:

:LiveServerStart
Enter fullscreen mode Exit fullscreen mode

Then, it will automatically open project at http://localhost:8080 in a default browser (using a browser that supports local networking, like Firefox,chrome,etc).


6. Additional Tweaks for a Better Experience

  • Enable Clipboard Support

Install termux-api if not already installed:

pkg install termux-api -y
Enter fullscreen mode Exit fullscreen mode
  • To copy to clipboard:
echo "Hello, Termux!" | termux-clipboard-set
Enter fullscreen mode Exit fullscreen mode
  • To paste:
termux-clipboard-get
Enter fullscreen mode Exit fullscreen mode
  • Enable Storage Access

Run the following command to allow Termux to access your phone's storage:

 termux-setup-storage
Enter fullscreen mode Exit fullscreen mode
  • Your internal storage will be available in:

/storage/emulated/0/

  • Enable X11 Support for GUI Apps

If you want to run GUI applications (e.g., a browser, VS Code alternative), install a VNC server:

pkg install tigervnc
vncserver
Enter fullscreen mode Exit fullscreen mode

Then, connect using a VNC client.


7. Running a Complete Web Development Workflow

Step 1: Clone a Web Project

git clone https://github.com/your-username/your-project.git
cd your-project
Enter fullscreen mode Exit fullscreen mode

Step 2: Start Neovim/LunarVim

lvim index.html
Enter fullscreen mode Exit fullscreen mode

Step 3: Run the Live Server from inside lunarvim

:LiveServerStart
Enter fullscreen mode Exit fullscreen mode

Opens http://localhost:8080 on a default browser.


Final Thoughts

With this setup, your Android phone can become a powerful web development machine! You now have:

Oh My Zsh & Oh My Posh for a great shell experience

Git for version control

Neovim/LunarVim for advanced coding

Node.js with a Live Server for real-time development

Top comments (0)