{"id":17084435,"url":"https://github.com/niklasf/build-raspbian-image","last_synced_at":"2025-04-12T21:09:21.111Z","repository":{"id":25717042,"uuid":"29153929","full_name":"niklasf/build-raspbian-image","owner":"niklasf","description":"Builds a minimal Raspbian Stretch image","archived":false,"fork":false,"pushed_at":"2021-04-25T16:11:08.000Z","size":33,"stargazers_count":40,"open_issues_count":0,"forks_count":18,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-12T21:09:09.658Z","etag":null,"topics":["debian","raspberry-pi","raspbian"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/niklasf.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null},"funding":{"github":"niklasf"}},"created_at":"2015-01-12T19:55:53.000Z","updated_at":"2024-05-03T11:51:21.000Z","dependencies_parsed_at":"2022-07-10T13:00:26.646Z","dependency_job_id":null,"html_url":"https://github.com/niklasf/build-raspbian-image","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/niklasf%2Fbuild-raspbian-image","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/niklasf%2Fbuild-raspbian-image/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/niklasf%2Fbuild-raspbian-image/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/niklasf%2Fbuild-raspbian-image/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/niklasf","download_url":"https://codeload.github.com/niklasf/build-raspbian-image/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248631676,"owners_count":21136562,"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":["debian","raspberry-pi","raspbian"],"created_at":"2024-10-14T13:07:13.771Z","updated_at":"2025-04-12T21:09:21.083Z","avatar_url":"https://github.com/niklasf.png","language":"Shell","funding_links":["https://github.com/sponsors/niklasf"],"categories":[],"sub_categories":[],"readme":"build-raspbian-image\n====================\n\nBuilds a minimal [Raspbian](http://raspbian.org/) Stretch image.\n\nLogin: `root`  \nPassword: `raspberry`\n\nOnly a basic Debian with standard networking utilities.\n\n**:exclamation: Careful: As an exception openssh-server is pre-installed and\nwill allow root login with the default password.** Host keys are generated on\nfirst boot.\n\nDownloads\n---------\n\nLatest download (Raspbian Stretch): [raspbian-20150729.img.zip](https://www.dropbox.com/s/dejepys2h9u5j55/raspbian-20150729.img.zip?dl=1) (263MB)  \nSHA1: `481a39566af76d942f7a24fc48cb9d5361e0d524`  \nSHA256: `425452d0edaae4f4e21177295bae01d1300b530d00b7278d2b7a947fb27bb1ab`  \nGPG Signature: [raspbian-20150729.img.zip.asc](/raspbian-20150729.img.zip.asc)\n\nRaspbian Jessie: [raspbian-20150214.img.zip](https://www.dropbox.com/s/hunl4libi6hdy14/raspbian-20150214.img.zip?dl=1) (214MB)  \nSHA1: `ad16b80dd8b59eb64d069dda2fdfeb01175e2c74`  \nSHA256: `3067de2bcd29536aaa72a1925febab62490fc973d982f936a3d0b82365658fa5`  \nGPG Signature: [raspbian-20150214.img.zip.asc](/raspbian-20150214.img.zip.asc)\n\nDependencies\n------------\n\n * `apt-get install vmdebootstrap` (at least `0.11` required)\n * `apt-get install binfmt-support qemu-user-static`\n * `apt-get install ca-certificates curl binutils git-core kmod` (required\n   by the rpi-update script)\n * `apt-get install apt-cacher-ng` (or change mirror URLs in `bootstrap.sh`\n    and `customize.sh`)\n\nUsage\n-----\n\nRun `sudo ./bootstrap.sh` (root required for loopback device management)\nto create a fresh raspbian-yyyy-mm-dd.img in the current directory.\n\nForbid root login\n-----------------\n\nIf you boot your Raspberry Pi in a non-trusted environment, you may want\nto disable login with the default (`raspberry`) password.\nTo disable passworded root login, add a file named `authorized_keys` in\nthe `config/` folder, which will be copied to `/root/.ssh/`, and will\ndisable root's password.\n\nWriting the image to an SD card\n-------------------------------\n\n`dd if=raspbian-yyyy-mm-dd.img of=/dev/mmcblk0 bs=1M \u0026\u0026 sync`\n\nRecommended packages\n--------------------\n\n * Install `console-common` to select a keyboard layout.\n\n * Install `ntp` to automatically synchronize the clock over the network.\n   Without a synchronized clock there may be problems when checking validity\n   and expiration dates of SSL certificates.  Also `dpkg-reconfigure tzdata`\n   to select a time zone.\n\n * Install `locales`. Also `dpkg-reconfigure locales` and select at least one\n   UTF-8 locale to generate.\n\n * Install `iptables` for firewall configuration. Sample\n   `/etc/network/iptables`:\n\n   ```\n   *filter\n   :INPUT DROP [23:2584]\n   :FORWARD ACCEPT [0:0]\n   :OUTPUT ACCEPT [1161:105847]\n   -A INPUT -i lo -j ACCEPT\n   -A INPUT -p tcp -m tcp --dport 22 -j ACCEPT\n   -A INPUT -p udp -m udp --dport 5353 -j ACCEPT\n   -A INPUT -p icmp -m icmp --icmp-type 8 -j ACCEPT\n   -A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT\n   COMMIT\n   ```\n\n   Append `pre-up iptables-restore \u003c /etc/network/iptables` to\n   `/etc/network/interfaces`.\n\n * `fail2ban` to ban IPs trying too many wrong SSH passwords for some time.\n   Works without any configuration.\n\n * `needrestart`, telling you which services to restart after package upgrades.\n\n * Install `cron-apt` to automatically look for package updates. Regularly\n   updates the package lists (but does not install anything) if installed\n   without any reconfiguration.\n\n * Install `avahi-daemon` to broadcast the device address to the local network\n   using Zeroconf / Bonjour.\n\nResize the root partition to the SD card\n----------------------------------------\n\nThe default image is effectly about 200MB but actually comes with a 2GB root\nparition. Its likely the the SD card is much bigger.\n\n 1. Boot. Login. `fdisk /dev/mmcblk0p1`. Delete the partition.\n    Create a new primary ext4 parition.\n\n 2. Reboot.\n\n 3. Login. `resize2fs /dev/mmcblk0p1`.\n\nOptimize for heavy RAM usage\n----------------------------\n\n### Add a swapfile\n\n 1. Allocate a continuous file:\n\n    `dd if=/dev/zero of=/var/swapfile bs=1M count=512`\n\n 2. Create a swap file in there: `mkswap /var/swapfile`\n\n 3. Append the following line to `/etc/fstab` to activate it on future boots:\n\n    `/var/swapfile none swap sw 0 0`\n\n 4. `swapon /var/swapfile` to activate it right now. `swapon -s` to show\n     statistics.\n\n### Relinquish ramdisks\n\nRemove `tmpfs /tmp tmpfs defaults,size=100M 0 0` from `/etc/fstab`. It makes\nno sense to have a ramdisk only to swap it to disk anyway.\n\nOptimize for SD card life\n-------------------------\n\nMake sure you limit writes to your SD card. `/tmp` is already mounted as\ntmpfs (see `/etc/fstab`). If you do not need logs across reboots you could also\nmount `/var/log` as tmpfs.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fniklasf%2Fbuild-raspbian-image","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fniklasf%2Fbuild-raspbian-image","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fniklasf%2Fbuild-raspbian-image/lists"}