# 1st week

In this week i have completed basic fundamentals of devops. in which i covered the following topics :-

1. Git & GitHub
    
2. Bash & Terminal mastery
    
3. Virtual machines
    
4. SSH protocol (password & keypair authentication using public/private keys)
    
5. Hosting full-stack (MERN) projects
    
6. AWS fundamentals
    
7. Reverse proxies & process management
    
8. Streamlined development & development workflows
    

Let’s look at all the topics one by one

1. Git & GitHub :- **Git** is a **distributed version control system (VCS)** that helps developers track changes in their code over time. It allows teams to collaborate on code without overwriting each other’s work, making development more efficient, safe, and auditable.
    
    **GitHub** is a **cloud-based platform** that hosts Git repositories. It adds collaboration tools like issue tracking, pull requests, and CI/CD integration on top of Git. It acts as a **central hub** for DevOps workflows.
    
    In a **DevOps environment**, Git and GitHub play a **foundational role** in enabling **Continuous Integration (CI)** and **Continuous Deployment (CD)**.
    
2. Bash & Terminal mastery :- **Bash** (Bourne Again SHell) is a command-line shell used to interact with Unix/Linux systems. It allows DevOps engineers to execute commands, automate tasks via shell scripts, and manage system operations efficiently.
    
    Some basic Terminal commands are :-
    
    | Command | Description |
    | --- | --- |
    | File and Directory Navigation |  |
    
    <table><tbody><tr><td colspan="1" rowspan="1"><p><code>pwd</code></p></td><td colspan="1" rowspan="1"><p>Show current working directory</p></td></tr></tbody></table>
    
    <table><tbody><tr><td colspan="1" rowspan="1"><p><code>ls</code></p></td><td colspan="1" rowspan="1"><p>List files and directories</p></td></tr></tbody></table>
    
    <table><tbody><tr><td colspan="1" rowspan="1"><p><code>ls -l</code></p></td><td colspan="1" rowspan="1"><p>Long list with details (permissions, size, etc.)</p></td></tr></tbody></table>
    
    <table><tbody><tr><td colspan="1" rowspan="1"><p><code>cd folder_name</code></p></td><td colspan="1" rowspan="1"><p>Change to a directory</p></td></tr></tbody></table>
    
    <table><tbody><tr><td colspan="1" rowspan="1"><p><code>cd ..</code></p></td><td colspan="1" rowspan="1"><p>Go one directory up</p></td></tr></tbody></table>
    
    <table><tbody><tr><td colspan="1" rowspan="1"><p><code>cd /</code></p></td><td colspan="1" rowspan="1"><p>Go to root directory</p></td></tr></tbody></table>
    
    <table><tbody><tr><td colspan="1" rowspan="1"><p><code>cd ~</code></p></td><td colspan="1" rowspan="1"><p>Go to home directory</p></td></tr></tbody></table>
    
    <table><tbody><tr><td colspan="1" rowspan="1"><p><code>mkdir folder</code></p></td><td colspan="1" rowspan="1"><p>Create a new directory</p></td></tr></tbody></table>
    
    <table><tbody><tr><td colspan="1" rowspan="1"><p><code>rmdir folder</code></p></td><td colspan="1" rowspan="1"><p>Remove empty directory</p></td></tr></tbody></table>
    
    <table><tbody><tr><td colspan="1" rowspan="1"><p>File Operations</p></td><td colspan="1" rowspan="1"><p></p></td></tr><tr><td colspan="1" rowspan="1"><p><code>touch filename.txt</code></p></td><td colspan="1" rowspan="1"><p>Create a new empty file</p></td></tr></tbody></table>
    
    <table><tbody><tr><td colspan="1" rowspan="1"><p><code>cp source dest</code></p></td><td colspan="1" rowspan="1"><p>Copy file or folder</p></td></tr></tbody></table>
    
    <table><tbody><tr><td colspan="1" rowspan="1"><p><code>mv oldname newname</code></p></td><td colspan="1" rowspan="1"><p>Move or rename file/folder</p></td></tr></tbody></table>
    
    <table><tbody><tr><td colspan="1" rowspan="1"><p><code>rm filename.txt</code></p></td><td colspan="1" rowspan="1"><p>Delete file</p></td></tr></tbody></table>
    
    <table><tbody><tr><td colspan="1" rowspan="1"><p><code>rm -r folder</code></p></td><td colspan="1" rowspan="1"><p>Delete folder and its contents</p></td></tr></tbody></table>
    
    <table><tbody><tr><td colspan="1" rowspan="1"><p><code>cat file.txt</code></p></td><td colspan="1" rowspan="1"><p>View file contents</p></td></tr></tbody></table>
    
    <table><tbody><tr><td colspan="1" rowspan="1"><p><code>nano file.txt</code> or <code>vi file.txt</code></p></td><td colspan="1" rowspan="1"><p>Edit file in terminal editor</p></td></tr></tbody></table>
    
    <table><tbody><tr><td colspan="1" rowspan="1"><p>User &amp; Superuser</p></td><td colspan="1" rowspan="1"><p></p></td></tr><tr><td colspan="1" rowspan="1"><p><code>sudo</code></p></td><td colspan="1" rowspan="1"><p>Run command with superuser rights</p></td></tr></tbody></table>
    
    <table><tbody><tr><td colspan="1" rowspan="1"><p><code>su</code></p></td><td colspan="1" rowspan="1"><p>Switch user</p></td></tr></tbody></table>
    
    <table><tbody><tr><td colspan="1" rowspan="1"><p><code>adduser user</code></p></td><td colspan="1" rowspan="1"><p>Add new user</p></td></tr></tbody></table>
    
    <table><tbody><tr><td colspan="1" rowspan="1"><p><code>passwd</code></p></td><td colspan="1" rowspan="1"><p>Change password</p></td></tr></tbody></table>
    
    <table><tbody><tr><td colspan="1" rowspan="1"><p>Networking</p></td><td colspan="1" rowspan="1"><p></p></td></tr><tr><td colspan="1" rowspan="1"><p><code>ping </code><a target="_self" rel="noopener noreferrer nofollow" href="http://google.com" style="pointer-events: none"><code>google.com</code></a></p></td><td colspan="1" rowspan="1"><p>Check internet connection</p></td></tr></tbody></table>
    
    <table><tbody><tr><td colspan="1" rowspan="1"><p><code>ifconfig</code> or <code>ip a</code></p></td><td colspan="1" rowspan="1"><p>Show IP address and interfaces</p></td></tr></tbody></table>
    
    <table><tbody><tr><td colspan="1" rowspan="1"><p><code>netstat -tulnp</code></p></td><td colspan="1" rowspan="1"><p>Show open ports and services</p></td></tr></tbody></table>
    
    <table><tbody><tr><td colspan="1" rowspan="1"><p>Package Management (Debian/Ubuntu)</p></td></tr></tbody></table>
    
    <table><tbody><tr><td colspan="1" rowspan="1"><p><code>sudo apt update</code></p></td><td colspan="1" rowspan="1"><p>Update package list</p></td></tr></tbody></table>
    
    <table><tbody><tr><td colspan="1" rowspan="1"><p><code>sudo apt upgrade</code></p></td><td colspan="1" rowspan="1"><p>Upgrade installed packages</p></td></tr></tbody></table>
    
    <table><tbody><tr><td colspan="1" rowspan="1"><p><code>sudo apt install packagename</code></p></td><td colspan="1" rowspan="1"><p>Install new software</p></td></tr></tbody></table>
    
    <table><tbody><tr><td colspan="1" rowspan="1"><p><code>sudo apt remove packagename</code></p></td><td colspan="1" rowspan="1"><p>Remove installed software</p></td></tr></tbody></table>
    
    <table><tbody><tr><td colspan="1" rowspan="1"><p><code>curl url</code></p></td><td colspan="1" rowspan="1"><p>Make web requests</p></td></tr></tbody></table>
    
3. Virtual machines :- A **Virtual Machine (VM)** is a **software-based simulation of a physical computer**. It runs an operating system and applications just like a real machine but is hosted on a physical computer (called the **host**) using a **hypervisor**.
    
4. SSH protocol :- **SSH (Secure Shell)** is a **network protocol** used to securely access and control remote machines over an unsecured network.
    
    commads use:-
    
    ```bash
    ssh username@host
    ssh -i ~/.ssh/id_rsa username@host
    ```
    
5. Hosting full-stack (MERN) projects :- MERN hosting is a key DevOps skill that combines deployment, configuration, and secure integration of a full-stack application.
    
6. AWS fundamentals :- One of the most fundamental skills in DevOps is deploying backend applications on cloud infrastructure. In this guide, we'll walk through how to launch a virtual server (EC2 instance) on **Amazon Web Services (AWS)** and deploy a **Node.js backend application** securely.
    
    1\. **Launching an EC2 Instance**
    
    Start by heading to the AWS EC2 dashboard and clicking **“Launch Instance”**. Here, you’ll configure your virtual server:
    
    * **Name** your instance for clarity (e.g., `node-backend-server`).
        
    * Choose an **Amazon Machine Image (AMI)** — we’ll use **Ubuntu 20.04 LTS**.
        
    * Select an instance type like **t2.micro**, which is free-tier eligible.
        
    * **Create or use a key pair** to securely connect to the server via SSH.
        
    * Configure a **security group** to allow:
        
        * Port **22** (SSH) from your IP address
            
        * Port **3000** or **5000** (your Node.js app port) from anywhere
            
        * Port **80** if your app uses HTTP
            
    
    ### 2 . **Connecting via SSH**
    
    Use your terminal to connect to the server:
    
    ```bash
    bashCopyEditchmod 400 your-key.pem
    ssh -i your-key.pem ubuntu@<your-ec2-public-ip>
    ```
    
    This gives you shell access to the remote server.
    
    ---
    
    ### ✅ 3. **Setting Up the Server Environment**
    
    Once inside the EC2 server:
    
    * Update packages and install **Node.js** and **npm**:
        
    
    ```bash
    bashCopyEditsudo apt update && sudo apt install nodejs npm -y
    ```
    
    * (Optional) Install Git if you're pulling from a GitHub repository:
        
    
    ```bash
    bashCopyEditsudo apt install git -y
    ```
    
    * Clone your backend project:
        
    
    ```bash
    bashCopyEditgit clone https://github.com/your-username/your-backend-repo.git
    cd your-backend-repo
    npm install
    ```
    
    ---
    
    ### ✅ 4. **Configure Environment Variables**
    
    Set environment variables like database URI or JWT secret keys. You can either:
    
    * Use a `.env` file with the `dotenv` package, or
        
    * Export them directly in the terminal:
        
    
    ```bash
    bashCopyEditexport MONGO_URI=your_mongo_url
    export JWT_SECRET=your_jwt_secret
    ```
    
    ---
    
    ### ✅ 5. **Run the Node.js Backend**
    
    Now start your backend server:
    
    ```bash
    bashCopyEditnode index.js
    ```
    
    Or, for a production-grade setup, install a process manager like `pm2`:
    
    ```bash
    bashCopyEditnpm install -g pm2
    pm2 start index.js
    ```
    
    This ensures your server stays running even if the terminal closes or crashes.
    
    ---
    
    ### ✅ 6. **Accessing the Server**
    
    Open a browser and go to:
    
    ```bash
    cppCopyEdithttp://<your-ec2-public-ip>:3000
    ```
    
    You should see your backend API or homepage response
    
7. Reverse proxies & process management :- A **reverse proxy** is a server that sits **in front of your application server**. Instead of users directly accessing your Node.js backend, they interact with the reverse proxy, which **forwards the request** to your app behind the scenes.
    
    ### **How Reverse Proxies Work**
    
    * Clients send requests to [`example.com`](http://example.com)
        
    * A reverse proxy server (e.g., **Nginx**, **Apache**) listens on port 80/443
        
    * The proxy forwards the request to your backend running on, say, port 3000
        
    * The backend processes the request and returns a response to the proxy
        
    * The proxy then sends the final response back to the client
        
        In Summary :-
        
    * A **reverse proxy** (like Nginx) manages **incoming traffic** and forwards it to your backend app — handling ports, HTTPS, and security.
        
    * A **process manager** (like PM2) ensures your app **keeps running** in the background and recovers from crashes.
        
8. Streamlined development & development workflows :- Streamlined development focuses on efficient, organized workflows to speed up software delivery and improve quality. Key elements include clear planning, using version control with branching strategies, and automated testing to catch bugs early. Continuous Integration and Deployment (CI/CD) pipelines automate builds and deployments, ensuring consistency. Code reviews and modular, reusable code enhance maintainability. Consistent development environments, enabled by tools like Docker, prevent setup issues. Documentation and communication keep teams aligned and informed. Agile methodologies support iterative progress and quick adaptation. Overall, streamlined workflows reduce errors, save time, and promote collaboration for faster, reliable software development.
    

## Thanks For read… Stay connected
