Skip to content

java2786/MasterLinuxCommands

Repository files navigation

Ubuntu Development Environment Setup Guide

Overview

This guide will help you set up a complete development environment on Ubuntu for live coding sessions. We'll install all necessary tools and prepare sample projects.


Phase 1: System Update

Before installing anything, update your system packages.

sudo apt update
sudo apt upgrade -y

Phase 2: Essential Tools Installation

Install Git

sudo apt install git -y
git --version

Configure Git (Replace with your details)

git config --global user.name "Suresh Kumar"
git config --global user.email "suresh@example.com"

Install curl and wget

sudo apt install curl wget -y

Phase 3: Java Development Setup

Install Java (OpenJDK 17)

sudo apt install openjdk-17-jdk -y
java -version
javac -version

Set JAVA_HOME

echo 'export JAVA_HOME=/usr/lib/jvm/java-17-openjdk-amd64' >> ~/.bashrc
echo 'export PATH=$PATH:$JAVA_HOME/bin' >> ~/.bashrc
source ~/.bashrc

Install Maven

sudo apt install maven -y
mvn -version

Phase 4: Node.js and npm Setup

Install Node.js (LTS version using NodeSource)

curl -fsSL https://deb.nodesource.com/setup_lts.x | sudo -E bash -
sudo apt install -y nodejs
node --version
npm --version

Phase 5: Python Setup

Install Python 3 and pip

sudo apt install python3 python3-pip -y
python3 --version
pip3 --version

Phase 6: Database Setup

Install MySQL

sudo apt install mysql-server -y
sudo systemctl start mysql
sudo systemctl enable mysql

Secure MySQL (Optional but recommended)

sudo mysql_secure_installation

Install PostgreSQL

sudo apt install postgresql postgresql-contrib -y
sudo systemctl start postgresql
sudo systemctl enable postgresql

Phase 7: Frontend Tools

Install Angular CLI

sudo npm install -g @angular/cli
ng version

Install React (create-react-app)

sudo npm install -g create-react-app

Phase 8: Code Editor

Install Visual Studio Code

sudo snap install code --classic

Or download from website

wget -qO- https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > packages.microsoft.gpg
sudo install -D -o root -g root -m 644 packages.microsoft.gpg /etc/apt/keyrings/packages.microsoft.gpg
sudo sh -c 'echo "deb [arch=amd64,arm64,armhf signed-by=/etc/apt/keyrings/packages.microsoft.gpg] https://packages.microsoft.com/repos/code stable main" > /etc/apt/sources.list.d/vscode.list'
sudo apt update
sudo apt install code -y

Phase 9: Clone Sample Projects

Create a workspace directory for your projects.

mkdir -p ~/workspace
cd ~/workspace

Clone Java Project (Spring Boot Example)

git clone https://github.com/spring-projects/spring-petclinic.git
cd spring-petclinic
mvn clean install
cd ..

Clone Node.js Project (Express Example)

git clone https://github.com/expressjs/express.git express-demo
cd express-demo
npm install
cd ..

Clone React Project (Sample App)

git clone https://github.com/facebook/create-react-app.git react-demo
cd react-demo
npm install
cd ..

Clone Angular Project (Tour of Heroes)

git clone https://github.com/johnpapa/angular-tour-of-heroes.git
cd angular-tour-of-heroes
npm install
cd ..

Phase 10: Additional Useful Tools

Install Docker (Optional for containerization)

sudo apt install docker.io -y
sudo systemctl start docker
sudo systemctl enable docker
sudo usermod -aG docker $USER

Install Postman (API Testing)

sudo snap install postman

Verification Checklist

Run these commands to verify all installations:

echo "=== Git ===" && git --version
echo "=== Java ===" && java -version
echo "=== Maven ===" && mvn -version
echo "=== Node.js ===" && node --version
echo "=== npm ===" && npm --version
echo "=== Python ===" && python3 --version
echo "=== Angular CLI ===" && ng version
echo "=== MySQL ===" && mysql --version
echo "=== PostgreSQL ===" && psql --version

Quick Start Commands for Live Coding

Start a Spring Boot Project

cd ~/workspace/spring-petclinic
mvn spring-boot:run

Start a Node.js Express Server

cd ~/workspace/express-demo
node examples/hello-world/index.js

Start a React App

cd ~/workspace/react-demo
npm start

Start an Angular App

cd ~/workspace/angular-tour-of-heroes
ng serve

Troubleshooting Tips

If npm permission errors occur

mkdir ~/.npm-global
npm config set prefix '~/.npm-global'
echo 'export PATH=~/.npm-global/bin:$PATH' >> ~/.bashrc
source ~/.bashrc

If MySQL access denied

sudo mysql
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'newpassword';
FLUSH PRIVILEGES;
exit;

If port already in use

sudo lsof -i :8080
sudo kill -9 <PID>

Notes for Live Session

  1. Always run sudo apt update before installing new packages
  2. Keep terminal open for quick command execution
  3. Use separate terminal tabs for different projects
  4. Bookmark localhost:8080, localhost:3000, localhost:4200 in browser
  5. Keep VS Code open with workspace folder loaded

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published