Skip to content

JJPEOPLES/weblinux

Repository files navigation

WebLinux

A real Linux terminal experience in your web browser. This project provides a web-based terminal that connects to a real Linux shell on the server.

Features

  • Real Linux terminal in the browser
  • Full support for bash commands
  • Persistent sessions
  • Modern terminal UI with themes
  • Responsive design

Prerequisites

  • Node.js (v14 or higher)
  • npm (v6 or higher)
  • Linux/macOS (for full functionality)

Installation

  1. Clone this repository:

    git clone https://github.com/yourusername/weblinux.git
    cd weblinux
    
  2. Install dependencies:

    npm install
    
  3. Start the server:

    npm start
    
  4. Open your browser and navigate to:

    http://localhost:3000
    

How It Works

WebLinux uses:

  • Frontend: HTML, CSS, JavaScript with the xterm.js library for terminal emulation
  • Backend: Node.js with Express for serving static files
  • Communication: WebSockets for real-time bidirectional communication
  • Terminal: node-pty to spawn real terminal processes on the server

The web interface connects to a real bash shell running on the server, allowing you to execute actual Linux commands.

Deployment Options

Local Deployment with Docker

  1. Make sure Docker and Docker Compose are installed
  2. Run the application:
    ./run.sh
    
  3. Open your browser and navigate to http://localhost:3000

Netlify Deployment

This project can be deployed to Netlify with limited functionality:

  1. Fork this repository to your GitHub account

  2. Sign up for a Netlify account if you don't have one

  3. Connect your GitHub repository to Netlify:

    • Log in to Netlify
    • Click "New site from Git"
    • Choose GitHub and select your repository
    • Configure build settings:
      • Build command: npm run build
      • Publish directory: public
    • Click "Deploy site"
  4. Set up environment variables in Netlify:

    • Go to Site settings > Build & deploy > Environment
    • Add the following variables:
      • NODE_VERSION: 16
  5. For GitHub Actions deployment:

    • Add these secrets to your GitHub repository:
      • NETLIFY_AUTH_TOKEN: Your Netlify personal access token
      • NETLIFY_SITE_ID: Your Netlify site ID

Note: The Netlify version has limited functionality due to serverless constraints. For the full experience, run the project locally or on a server with WebSocket support.

Advanced Usage

Custom Shell

You can modify the shell used in server.js:

const shell = 'zsh'; // Change to your preferred shell

Security Considerations

This project gives terminal access to the server. In production:

  1. Implement proper authentication
  2. Set up user isolation
  3. Restrict command execution
  4. Consider using Docker containers for isolation

License

MIT

About

A real Linux terminal experience in your web browser

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published