{"id":22882567,"url":"https://github.com/nxroot/rpi-auto-setup","last_synced_at":"2025-03-31T16:38:22.592Z","repository":{"id":227052131,"uuid":"770102526","full_name":"NxRoot/rpi-auto-setup","owner":"NxRoot","description":"Setup a minimal raspbian installation with some useful features.","archived":false,"fork":false,"pushed_at":"2024-03-19T03:11:28.000Z","size":390,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-06T21:46:01.543Z","etag":null,"topics":["bootscripts","raspberry-pi","react-app","rpi3","rpi4","web-server"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/NxRoot.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-03-10T22:59:46.000Z","updated_at":"2024-10-22T00:10:28.000Z","dependencies_parsed_at":"2024-03-19T03:33:59.593Z","dependency_job_id":null,"html_url":"https://github.com/NxRoot/rpi-auto-setup","commit_stats":null,"previous_names":["nxroot/rpi-auto-setup"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NxRoot%2Frpi-auto-setup","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NxRoot%2Frpi-auto-setup/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NxRoot%2Frpi-auto-setup/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NxRoot%2Frpi-auto-setup/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/NxRoot","download_url":"https://codeload.github.com/NxRoot/rpi-auto-setup/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246499313,"owners_count":20787479,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bootscripts","raspberry-pi","react-app","rpi3","rpi4","web-server"],"created_at":"2024-12-13T18:18:25.630Z","updated_at":"2025-03-31T16:38:22.575Z","avatar_url":"https://github.com/NxRoot.png","language":"Shell","readme":"# RPI - Auto Setup \nAutomated tool to setup a minimal raspbian installation with some useful features.\n\n|TFT Screen|Script Execution|Web Applications|\n|--|--|--|\n|\u003cimg style=\"width: 280px;\" src=\"https://i.pinimg.com/originals/21/89/aa/2189aa597d68c701564159188f78ac53.jpg\"/\u003e|\u003cimg style=\"width: 280px;\" src=\"https://cdn.sparkfun.com/assets/learn_tutorials/8/1/2/screen_04.png\"/\u003e|\u003cimg style=\"width: 280px;\" src=\"https://i.pinimg.com/originals/d3/1d/70/d31d70178a86423619604b315f2d9984.jpg\"/\u003e|\n\n\n## Features\n\n* 💯 \u0026nbsp;Powerful scripting and configuration tool.\n* 🧬 \u0026nbsp;Install multiple tools with a single command.\n* ✍️ \u0026nbsp;Create your own scripts to install custom tools.\n* ✅ \u0026nbsp;Host pre-configured web servers and applications.\n* 🚀 \u0026nbsp;Extremely lightweight and ultra-flexible configuration.\n\n\n\u0026nbsp;\n\n## First Steps\n\u003cdetails\u003e\n  \u003csummary\u003e \u0026nbsp; \u003cb\u003eFlash SD Card with Raspbian OS\u003c/b\u003e\u003c/summary\u003e\n\n1. ### \u0026nbsp; Open [Raspberry Pi Imager](https://www.raspberrypi.com/software/)\n2. ### \u0026nbsp; Choose Device (RPI 3, 4, 400, 5)\n3. ### \u0026nbsp; Choose OS --\u003e `Raspberry Pi OS (Other)`\n4. ### \u0026nbsp; Select `Raspbian x64 Legacy - No Desktop (0.3gb)`\n5. ### \u0026nbsp; Choose USB Storage (SD Card Drive)\n6. ### \u0026nbsp; Configure settings before flashing\n    - Setup Wifi Network\n    - Enable SSH\n    - User: pi\n    - Password: YOUR PASSWORD\n\u003c/details\u003e\n\n\u003cdetails\u003e\n  \u003csummary\u003e \u0026nbsp; \u003cb\u003eConnect to device using SSH\u003c/b\u003e\u003c/summary\u003e\n\n1. ### \u0026nbsp; Open terminal on a pc in the same network\n2. ### \u0026nbsp; Find the IP address of your RPI\n    ```bash\n    nslookup raspberrypi\n    ```\n3. ### \u0026nbsp; Connect to RPI using SSH\n    ```bash\n    ssh pi@xxx.xxx.xxx\n    ```\n\n\u003c/details\u003e\n\n\u0026nbsp;\n\n## Installation\n\n```tsx\nsudo apt install -y git\nsudo rm -rf ~/rpia\ngit clone https://github.com/NxRoot/rpi-auto-setup.git ~/rpia\nsudo cp ~/rpia/install /usr/local/bin/rpia\nsudo chmod +x /usr/local/bin/rpia\n```\n\n## Usage\n```console\nrpia --autologin=B2 --server=node --client=js --splash=off --chrome --smb --reboot\n```\n\u003cdetails\u003e\n  \u003csummary\u003e \u0026nbsp; \u003cb\u003e--hello\u003c/b\u003e\u003c/summary\u003e\n\n  #### Test Script\n  ```bash\n  rpia --hello\n  ```\n\u003c/details\u003e\n\n\u003cdetails\u003e\n  \u003csummary\u003e \u0026nbsp; \u003cb\u003e--splash\u003c/b\u003e\u003c/summary\u003e\n\n  #### Enable/Disable Splashscreen\n  \u003e This will change the config file located at: `/boot/config.txt`\n  ```bash\n  # Enable\n  rpia --splash=on\n\n  # Disable\n  rpia --splash=off\n  ```\n\u003c/details\u003e\n\n\u003cdetails\u003e\n  \u003csummary\u003e \u0026nbsp; \u003cb\u003e--autologin\u003c/b\u003e\u003c/summary\u003e\n\n  #### Configure boot mode\n  ```bash\n  # B1 - Console\n  rpia --autologin=B1\n\n  # B2 - Console Autologin\n  rpia --autologin=B2\n\n  # B3 - Desktop\n  rpia --autologin=B3\n\n  # B4 - Desktop Autologin\n  rpia --autologin=B4\n  ```\n\u003c/details\u003e\n\n\u003cdetails\u003e\n  \u003csummary\u003e \u0026nbsp; \u003cb\u003e--reboot\u003c/b\u003e\u003c/summary\u003e\n\n  #### Reboot after installation\n  ```bash\n  rpia --reboot\n  ```\n\u003c/details\u003e\n\n\u003cdetails\u003e\n  \u003csummary\u003e \u0026nbsp; \u003cb\u003e--destroy\u003c/b\u003e\u003c/summary\u003e\n\n  #### Remove rpia after installation\n  ```bash\n  rpia --destroy\n  ```\n\u003c/details\u003e\n\n\u003cdetails\u003e\n  \u003csummary\u003e \u0026nbsp; \u003cb\u003e--server\u003c/b\u003e\u003c/summary\u003e\n\n  #### Host REST API\n  \u003e This will host a local server running on http://localhost:5001\n  ```bash\n  # Node JS\n  rpia --server=node\n\n  # Python\n  rpia --server=python\n  ```\n\u003c/details\u003e\n\n\u003cdetails\u003e\n  \u003csummary\u003e \u0026nbsp; \u003cb\u003e--client\u003c/b\u003e\u003c/summary\u003e\n\n  #### Host Web App \n  \u003e This will add a \u003cb\u003eweb application\u003c/b\u003e to a server hosted by the `--server` argument.\u003cbr\u003e\n  \u003e This can only be used after `--server`.\n  \n  ```bash\n  # Javascript\n  rpia --client=js\n\n  # React\n  rpia --client=react\n  ```\n\u003c/details\u003e\n\n\u003cdetails\u003e\n  \u003csummary\u003e \u0026nbsp; \u003cb\u003e--sherlock\u003c/b\u003e\u003c/summary\u003e\n\n  #### Install Sherlock OSINT\n  \u003e Please read documentation: [Sherlock](https://github.com/sherlock-project/sherlock)\n  ```bash\n  rpia --sherlock\n  ```\n\u003c/details\u003e\n\n\u003cdetails\u003e\n  \u003csummary\u003e \u0026nbsp; \u003cb\u003e--chrome\u003c/b\u003e\u003c/summary\u003e\n\n  #### Run Browser on Boot\n  \u003e You must enable \u003cb\u003eConsole Auto-Login\u003c/b\u003e on the Raspbian Config.\n  ```bash\n  # Open localhost\n  rpia --chrome\n\n  # Open specific URL\n  rpia --chrome=https://youtube.com\n  ```\n\u003c/details\u003e\n\n\u003cdetails\u003e\n  \u003csummary\u003e \u0026nbsp; \u003cb\u003e--msf\u003c/b\u003e\u003c/summary\u003e\n\n  #### Install Metasploit Framework\n  \u003e Please read documentation: [Metasploit](https://docs.metasploit.com/docs/using-metasploit/basics/using-metasploit.html)\n  ```bash\n  rpia --msf\n  ```\n\u003c/details\u003e\n\n\u003cdetails\u003e\n  \u003csummary\u003e \u0026nbsp; \u003cb\u003e--smb\u003c/b\u003e\u003c/summary\u003e\n\n  #### Host Shared Folder with Samba\n  \u003e Please read documentation: [Samba](https://www.jeffgeerling.com/blog/2021/htgwa-create-samba-smb-share-on-raspberry-pi)\n  ```bash\n  rpia --smb\n  ```\n\u003c/details\u003e\n\n\u003cdetails\u003e\n  \u003csummary\u003e \u0026nbsp; \u003cb\u003e--tft\u003c/b\u003e\u003c/summary\u003e\n\n  #### Setup TFT Screen\n  \u003e Please read documentation to find your TFT model: [LCD-WIKI](http://www.lcdwiki.com/Main_Page)\n  ```bash\n  rpia --tft=MHS35\n  ```\n\u003c/details\u003e\n\n\u0026nbsp;\n\n## Custom\nYou can create your own modules using ***bash*** script.\u003cbr\u003e\nThe `modules` folder contains an example script that you can use as reference.\n```bash\ncat ~/rpia/modules/hello/install\n```\nThe first 3 arguments will be received in every script.\u003cbr\u003e\n- `$root` Path to home folder\n- `$rpias` Path to rpia folder\n- `$value` Passed in command --key=value\n```bash\n#!/bin/bash\nroot=$1\nrpias=$2\nvalue=$3\ndir=$(dirname $0)\n\necho This is a test script\necho $root $rpias $value $dir\n```\n\n## Lets make a script to install nmap\nFirst steps\n```bash\n# Go to 'modules' folder\ncd ~/rpia/modules\n\n# Copy example script to 'nmap' folder \ncp hello nmap\n\n# Open the script with text editor\nnano nmap/install\n```\nThe script content\n```bash\n#!/bin/bash\nroot=$1\nrpias=$2\nvalue=$3\ndir=$(dirname $0)\n\n# install nmap\nsudo apt install -y nmap\n\n# print some message\necho \"Successfully installed 'Nmap'\"\n\n```\nCalling your script\n```console\nrpia --nmap\n```\n\n\u0026nbsp;\n\n## Documentation\n\u003cdetails\u003e\n  \u003csummary\u003e \u0026nbsp; \u003cb\u003eHost REST API + UI\u003c/b\u003e\u003c/summary\u003e\n\n  \u003cbr\u003e\n  \n  ## REST API\n  \u003e This will host a local server running on http://localhost:5001\n  \u003cdetails\u003e\n    \u003csummary\u003e \u0026nbsp; \u003cb\u003eUsing NodeJS\u003c/b\u003e\u003c/summary\u003e\n  \n  ### Install NodeJS \n  ```bash\n  curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash -\n  sudo apt-get install -y nodejs\n  ```\n  \n  ### Create Folder \n  ```bash\n  mkdir ~/pi-server\n  cd ~/pi-server\n  ```\n  \n  ### Create Server \n  `sudo nano server.js`\n  ```js\n  const path = require('path')\n  const express = require('express')\n  const app = express()\n  const PORT = 5001\n  \n  // serve static assets\n  app.use(express.static('client/build'));\n  \n  // Create API endpoints\n  app.get('/api/message', (req, res) =\u003e {\n      res.json({message: \"Hello from Express JS\"})\n  });\n  \n  // Send everything else to static content\n  app.get('*', (req, res) =\u003e res.sendFile(path.resolve(__dirname, 'client/build', 'index.html')));\n  \n  // Open server on specified port\n  console.log('Server started on port:', PORT)\n  app.listen(PORT)\n  ```\n  \n  ### Initialize Project \n  ```bash\n  npm init\n  ```\n  \n  ### Install Express JS\n  ```bash\n  npm i express\n  ```\n  \n  ### Start Server\n  ```bash\n  npm start\n  ```\n  \u003c/details\u003e\n  \n  \u003cdetails\u003e\n    \u003csummary\u003e \u0026nbsp; \u003cb\u003eUsing Python\u003c/b\u003e\u003c/summary\u003e\n  \n  ### Create Folder \n  ```bash\n  mkdir ~/pi-server\n  cd ~/pi-server\n  ```\n  \n  ### Create virtual environment\n  ```bash\n  python3 -m venv venv\n  ```\n  \n  ### Activate virtual environment\n  ```bash\n  source venv/bin/activate\n  ```\n  \n  ### Install Flask\n  ```bash\n  pip install flask\n  pip install python-dotenv\n  ```\n  \n  ### Create Server\n  `sudo nano server.py`\n  ```py\n  from flask import Flask\n  \n  app = Flask(__name__, static_folder='./client/build', static_url_path='/')\n  \n  @app.route('/', methods=['GET'])\n  def index():\n      return app.send_static_file('index.html')\n  \n  @app.route('/api/message', methods=['GET'])\n  def message():\n      return \"Hello from Python\"\n  ```\n  \n  ### Start Server\n  ```bash\n  venv/bin/flask --app ./server.py run --no-debugger\n  ```\n  \u003c/details\u003e\n  \n  \u003cbr\u003e\u003c/br\u003e\n  ## Web App\n  \u003e This will add a web application to the previously hosted server.\n  \u003cdetails\u003e\n    \u003csummary\u003e \u0026nbsp; \u003cb\u003eUsing Html\u003c/b\u003e\u003c/summary\u003e\n  \n  ### Create Folders\n  ```bash\n  cd ~/pi-server\n  mkdir client\n  mkdir client/build\n  ```\n  ### Create Website\n  `sudo nano client/build/index.html`\n  ```html\n  \u003c!doctype html\u003e\n  \u003chtml\u003e\n    \u003chead\u003e\n      \u003cmeta charset=\"UTF-8\"\u003e\n      \u003cmeta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\"\u003e\n    \u003c/head\u003e\n    \u003cbody\u003e\n      \u003ch1\u003e\n        Hello world!\n      \u003c/h1\u003e\n    \u003c/body\u003e\n  \u003c/html\u003e\n  ```\n  \u003c/details\u003e\n  \n  \u003cdetails\u003e\n    \u003csummary\u003e \u0026nbsp; \u003cb\u003eUsing React\u003c/b\u003e\u003c/summary\u003e\n  \n  ### Install NodeJS \n  ```bash\n  curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash -\n  sudo apt-get install -y nodejs\n  ```\n  ### Create React App\n  ```bash\n  cd ~/pi-server\n  npx create-react-app client\n  ```\n  ### Build Website\n  ```bash\n  cd ~/pi-server/client\n  npm run build\n  ```\n  \u003c/details\u003e\n  \n  \u003cbr\u003e\u003c/br\u003e\n\n\u003c/details\u003e\n\n\n\u003cdetails\u003e\n  \u003csummary\u003e \u0026nbsp; \u003cb\u003eSharing Files with SMB \u003c/b\u003e\u003c/summary\u003e\n\n  ### Create Folder \n  ```bash\n  mkdir ~/shared\n  sudo chmod -R 777 ~/shared\n  ```\n  ### Install Samba \n  ```bash\n  sudo apt install -y samba samba-common-bin\n  ```\n  ### Config Samba ([More](https://www.jeffgeerling.com/blog/2021/htgwa-create-samba-smb-share-on-raspberry-pi))\n  `sudo nano /etc/samba/smb.conf`\n  ```bash\n  # Add to end of file\n  [shared]\n  path=/home/pi/shared\n  public = yes\n  read only = no\n  guest only = yes\n  writeable = yes\n  browseable = yes\n  guest ok = yes\n  force create mode = 0666\n  force directory mode = 0777\n  ```\n\u003c/details\u003e\n\n\u003cdetails\u003e\n  \u003csummary\u003e \u0026nbsp; \u003cb\u003eOpen browser on boot\u003c/b\u003e\u003c/summary\u003e\n\n  \u003cbr\u003e\n  \n  \u003e You must enable \u003cb\u003eConsole Auto-Login\u003c/b\u003e on the Raspbian Config.\n  \n  ### Install Chromium \n  ```bash\n  sudo apt-get install --no-install-recommends xserver-xorg x11-xserver-utils xinit openbox chromium-browser\n  ```\n  \n  ### Boot Config\n  `sudo nano ~/.bash_profile`\n  ```bash\n  [[ -z $DISPLAY \u0026\u0026 $XDG_VTNR -eq 1 ]] \u0026\u0026 startx -- -nocursor\n  ```\n  \n  ### Start Script\n  `sudo nano ~/.xinitrc`\n  ```bash\n  #!/usr/bin/env sh\n  \n  GEO=\"$(fbset -s | awk '$1 == \"geometry\" { print $2\":\"$3 }')\"\n  WIDTH=$(echo \"$GEO\" | cut -d: -f1)\n  HEIGHT=$(echo \"$GEO\" | cut -d: -f2)\n  \n  # Hide console\n  xset -dpms\n  xset s off\n  xset s noblank\n  \n  # Start browser\n  chromium-browser --kiosk \"http://localhost:5001\" \\\n    --window-size=$WIDTH,$HEIGHT \\\n    --window-position=-10,0 \\\n    --start-fullscreen \\\n    --start-maximized \\\n    --kiosk \\\n    --incognito \\\n    --noerrdialogs \\\n    --disable-translate \\\n    --no-first-run \\\n    --fast \\\n    --fast-start \\\n    --use-gl=none \\\n    --autoplay-policy=no-user-gesture-required \\\n    --disable-infobars \\\n    --disable-features=TranslateUI \\\n    --disk-cache-dir=/dev/null \\\n    --overscroll-history-navigation=0 \\\n    --disable-pinch \\\n    --enable-kiosk-mode \\\n    --enabled \\\n    --disable-java \\\n    --disable-restore-session-state \\\n    --disable-sync --disable-translate \\\n    --disable-touch-drag-drop \\\n    --disable-touch-editing \\\n    --test-type \\\n    --ignore-certificate-errors \\\n    --no-sandbox\n  \n  ```\n\u003c/details\u003e\n\n\u003cdetails\u003e\n  \u003csummary\u003e \u0026nbsp; \u003cb\u003eSetup TFT Screen\u003c/b\u003e\u003c/summary\u003e\n\n  \u003cbr\u003e\n\n  \u003e Please read documentation for your TFT model: [LCD-WIKI](http://www.lcdwiki.com/Main_Page)\n  \n  ### Install GIT \n  ```bash\n  sudo apt install -y git\n  ```\n  \n  ### Install TFT Drivers\n  ```bash\n  git clone https://github.com/goodtft/LCD-show.git\n  chmod -R 755 LCD-show\n  cd LCD-show/\n  sudo ./MHS35-show\n  sudo reboot\n  ```\n\u003c/details\u003e\n\n\u003cbr\u003e\u003c/br\u003e\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnxroot%2Frpi-auto-setup","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnxroot%2Frpi-auto-setup","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnxroot%2Frpi-auto-setup/lists"}