{"id":15172829,"url":"https://github.com/quanglv1996/setup-raspberrypi","last_synced_at":"2026-02-07T05:01:32.775Z","repository":{"id":207602930,"uuid":"719639571","full_name":"quanglv1996/setup-raspberrypi","owner":"quanglv1996","description":"The source code contains instructions for installing the necessary software and configuration for a Pi server.","archived":false,"fork":false,"pushed_at":"2023-11-19T17:43:50.000Z","size":6,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-07-24T07:57:10.494Z","etag":null,"topics":["ddns-script","docker","docker-compose","openmediavault","portainer","raspberry-pi-3","ssh-key"],"latest_commit_sha":null,"homepage":"","language":null,"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/quanglv1996.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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":"2023-11-16T15:38:37.000Z","updated_at":"2024-05-07T02:25:09.000Z","dependencies_parsed_at":"2023-11-19T18:44:24.357Z","dependency_job_id":"4591ec73-ac41-4536-b4f0-eca9afcf2eaa","html_url":"https://github.com/quanglv1996/setup-raspberrypi","commit_stats":{"total_commits":7,"total_committers":2,"mean_commits":3.5,"dds":0.1428571428571429,"last_synced_commit":"b9eda21d340f703fd1a5780ca966b979b7b5beed"},"previous_names":["quanglv1996/setup-raspberrypi"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/quanglv1996/setup-raspberrypi","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/quanglv1996%2Fsetup-raspberrypi","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/quanglv1996%2Fsetup-raspberrypi/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/quanglv1996%2Fsetup-raspberrypi/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/quanglv1996%2Fsetup-raspberrypi/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/quanglv1996","download_url":"https://codeload.github.com/quanglv1996/setup-raspberrypi/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/quanglv1996%2Fsetup-raspberrypi/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29186742,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-07T03:35:06.566Z","status":"ssl_error","status_checked_at":"2026-02-07T03:34:57.604Z","response_time":63,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["ddns-script","docker","docker-compose","openmediavault","portainer","raspberry-pi-3","ssh-key"],"created_at":"2024-09-27T10:20:35.748Z","updated_at":"2026-02-07T05:01:32.759Z","avatar_url":"https://github.com/quanglv1996.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# Setup Raspberry-pi 3B+\n## [1. Turn on SSH with Pi Server](https://phoenixnap.com/kb/enable-ssh-raspberry-pi)\n\n#### Enable SSH using the raspi-config too\n```bash\nsudo raspi-config\n```\n\n#### Use systemctl to Enable SSH\n```bash\nsudo systemctl enable ssh\nsudo systemctl start ssh\n```\n\n#### Check Raspberry Pi’s local IP address\n```bash\nhostname -I\n```\n\n#### Connect via SSH\n```bash\nssh pi@[raspberrypi_ip_address]\n```\n\n## [2. Increasing Swap on a Raspberry Pi](https://pimylifeup.com/raspberry-pi-swap-file/)\n\n#### Stop the operating system from using the current swap file\n```bash\nsudo dphys-swapfile swapoff\n```\n\n#### Modify the swap file configuration file\n```bash\nsudo nano /etc/dphys-swapfile\n```\n\n#### Increase our swap size to 2GB\n```bash\nCONF_SWAPSIZE=2048\n```\n\n#### Re-initialize the Raspberry Pi’s swap file\n```bash\nsudo dphys-swapfile setup\n```\n\n#### Start the operating systems swap system\n```bash\nsudo dphys-swapfile swapon\n```\n\n#### Reboot\n```bash\nsudo reboot\n```\n\n## [3. Installing Docker](https://pimylifeup.com/raspberry-pi-docker/)\n\n#### Upgrade all existing packages\n```bash\nsudo apt update\nsudo apt upgrade\n```\n\n#### Download and run the official Docker setup script\n```bash\ncurl -sSL https://get.docker.com | sh\n```\n\n#### Add current user to the docker group.\n```bash\nsudo usermod -aG docker $USER\n```\n\n#### Log out\n```bash\nlogout\n```\n\n#### Verify that the docker group\n```bash\ngroups\n```\n\n#### Test docker working\n```bash\ndocker run hello-world\n```\n\n## [4. Installing Docker compose](https://linuxhint.com/install-docker-compose-raspberry-pi/)\n\n#### Upgrade all existing packages\n```bash\nsudo apt update\nsudo apt upgrade\n```\n\n#### Install Docker Compose\n```bash\nsudo apt install docker-compose -y\n```\n\n#### Confirm Docker Compose Version\n```bash\ndocker-compose version\n```\n\n#### Test Docker Compose\n```bash\nsudo docker compose up -d\n```\n\n#### Remove Docker Compose\n```bash\nsudo apt remove --autoremove docker-compose\n```\n\n\n## [5. Installing Portainer](https://pimylifeup.com/raspberry-pi-portainer/)\n\n#### Upgrade all existing packages\n```bash\nsudo apt update\nsudo apt upgrade\n```\n\n#### Portainer is available as a Docker container on the official Docker hub\n```bash\nsudo docker pull portainer/portainer-ce:latest\n```\n\n#### Start up Portainer\n```bash\nsudo docker run -d -p 9000:9000 --name=portainer --restart=always -v /var/run/docker.sock:/var/run/docker.sock -v portainer_data:/data portainer/portainer-ce:latest\n```\n\n#### Check Raspberry Pi’s local IP address\n```bash\nhostname -I\n```\n\n#### Aaccess Portainer\n```bash\nhttp://[PIIPADDRESS]:9000\n```\n\n\n## [6. Installing OpenMediaVault](https://pimylifeup.com/raspberry-pi-openmediavault/)\n\n#### Upgrade all existing packages\n```bash\nsudo apt update\nsudo apt upgrade\n```\n\n#### Download the OpenMediaVault install script and pipe it directly through to bash\n```bash\nwget -O - https://raw.githubusercontent.com/OpenMediaVault-Plugin-Developers/installScript/master/install | sudo bash\n```\n\n#### Restart Raspberry Pi\n```bash\nsudo reboot\n```\n\n#### Check Raspberry Pi’s local IP address\n```bash\nhostname -I\n```\n\n#### Aaccess Portainer\n```bash\nhttp://[PIIPADDRESS]:80\n```\n\n\n## 7. Set DDNS Google with API Python Script\n\n#### Create file setddns.py\n```bash\nnano setddns.py\n```\n\n#### Copy code\n```python\n#!/usr/bin/python3\nimport requests\nimport logging\nimport time\nfrom urllib.request import urlopen\n\nlogging.basicConfig(filename='ddns.log', level=logging.DEBUG, filemode='a', format='%(asctime)s - %(message)s')\n\nusername = 'youruserddns'\npassword = 'yourpasswordddns'\nhostname = 'subdomain.yourdomain.com'\nold_ip = ''\n\nwhile True:\n\ttry:\n\t\tmy_ip = urlopen('https://domains.google.com/checkip').read() \n\texcept:\n\t\tlogging.debug('CATCHED AN ERROR... RETRYING IN 10 SECONDS')\n\t\ttime.sleep(10)\n\telse:\n\t\tif my_ip != old_ip:\n\t\t\turl = 'https://{}:{}@domains.google.com/nic/update?hostname={}'.format(username, password, hostname)\n\t\t\tresponse = requests.post(url)\n\t\t\toutput = response.content.decode('utf-8')\n\t\t\tif 'good' in output or 'nochg' in output:\n\t\t\t\told_ip = my_ip\n\t\t\tlogging.debug('-- OUTPUT FOR UPDATE: '+ hostname +' --')\n\t\t\tlogging.debug('Response from DDNS update: '+ output)\n\t\ttime.sleep(10)\n```\n\n#### Set file setddns.py auto run when start\n```bash\nsudo -i\nnano /etc/rc.local\n```\n\n#### Fix file\n```bash\n#!/bin/sh -e\n#\n# rc.local\n#\n# This script is executed at the end of each multiuser runlevel.\n# Make sure that the script will \"exit 0\" on success or any other\n# value on error.\n#\n# In order to enable or disable this script just change the execution\n# bits.\n#\n# By default this script does nothing.\n\n# Print the IP address\n_IP=$(hostname -I) || true\nif [ \"$_IP\" ]; then\n  printf \"My IP address is %s\\n\" \"$_IP\"\nfi\npython3 /path/to/file/setddns.py\nexit 0\n\n```\n\n#### Reboot\n```bash\nsudo reboot\n```\n\n## [8. Mount a USB Drive](https://thesecmaster.com/how-to-partition-and-format-the-hard-drives-on-raspberry-pi/)\n\n#### Filesystem Types\n1. NTFS: This file system is developed by Microsoft in the early 90s. All new versions of Windows operating systems will support this file system. Theoretically, NTFS can support hard drives up to just under 16 EB. The individual file size is capped at just under 256 TB, at least in Windows 8 and Windows 10, as well as in some newer Windows Server versions. When it comes to supporting, this file system is universally supported. Although it’s developed by Microsoft, it is supported by most Linux distributions and Mac.\n2. EXT4: This file system is developed based on the older Minix filesystem, A file system being used by Linux systems for ages. The higher maximum volume size it supports is 1 EB. That’s, again, a mathematical number. I know all these numbers don’t bother you like many of us. After all, who is going to use such a gigantic drive at home with Raspberry Pi!\n\n#### List out the connected drives and use ‘print all’ to read the drive information\n```bash\nsudo parted\n(parted) print all\n```\n\n#### Select the drive to partition\nSelect the drive to format and create new partitions. Type the ‘select’ command with the drive path.\n```bash\n(parted) select /dev/sda\n```\n\n#### Create a fresh GPT partition table\nCreate a fresh GPT partition table by typing ‘mklabel gpt’ command. You will get a warning to wipe out all your drive. Type ‘yes’ to continue. Please bear in mind, that it’s just a partition table, not the partitions.\n```bash\n(parted) mklabel gpt\n```\n\n#### Type ‘print’ to make sure the new GPT partition is created\n```bash\n(parted) print\n```\n\n#### Create new partitions\nCreate three partitions on this drive using ‘mkpart’ command: data-nas, and data-all.\nType ‘mkpart’ command to create a new partition. It asks four simple questions to create a partition. Your partition will be created upon supplying the answers. Just pay attention to the commands we used to create three partitions. You can create partitions in a single line command as well, as we show in the below screenshot.\n```bash\n(parted) mkpart data-nas ext4 0% 50%\n(parted) mkpart data-all ext4 50% 100%\n```\n\n#### Exit from parted\n```bash\n(parted) q\n```\n\n#### Format the partitions\nYou can’t use the partitions until you format them. Let’s use mkfs commands to format the partitions. Different versions of mkfs commends are there to format NTFS and EXT4 file systems. In this command -L specifies the label of the drive, and -Q specifies quick format, which takes the partition name as a parameter. Note: EXT4 doesn’t take -Q as it doesn’t support the quick format.\n```bash\nsudo mkfs.ext4 -L data-nas /dev/sda1\nsudo mkfs.ext4 -L data-all /dev/sda2\n```\n\n#### Reboot the Raspberry Pi\n```bash\nsudo reboot\n```\n\n#### Remount these partitions under /mnt\nChange the directory to /mnt.\n```bash\ncd /mnt\n```\nCreate two directories named ‘data-nas’ and ‘data-all’ under /mnt.\n```bash\nsudo mkdir data-nas\nsudo mkdir data-all\n```\nLet’s now give our pi user ownership of this folder by running the command below.\n```bash\nsudo chown -R pi:pi /mnt/data-nas\nsudo chown -R pi:pi /mnt/data-all\n```\nMount the partitions using the mount command. Note: This is just a temp mount. It is not going to work after reboot.\n```bash\nsudo mount /dev/sda1 /mnt/data-nas\nsudo mount /dev/sda2 /mnt/data-all\n```\nDo you remember the fstab? It’s a file system table. This is where you can mount a partition forever. Open the /etc/fstab file and see how it looks. You can only see the SD card at this time.\n```bash\ncat /etc/fstab\n```\n\n#### Take the PARTUUID value of the two partitions\nYou need to add those two partitions to /etc/fstab to mount permanently. Before that, make a note of PARTUUID value of the two partitions.\n```bash\nsudo blkid\n```\n\n#### Create a permanent mount\nUse your choice of a text editor to edit and add the partition information in the /etc/fstab. You can add the two lines representing each line for a partition. Write this information separated by TAB.\n```bash\nsudo blkid\n```\n\n```bash\nPARTUUID=VALUE\nMount path\nFile System\ndefault or default, notime: The word ‘notime’ just tells us to keep track of the access time along with created and modified time.\n0\n0\n```\nOpen fstab\n```bash\nsudo nano /etc/fstab\n```\n\nAdd the partition information. Examples\n```bash\nPARTUUID=8c8816b4-13d5-4345-8410-85263b3c5891\t/mnt/data-gitea\text4\tdefaults,noatime\t0\t0\nPARTUUID=6d56b35f-d771-4be0-9ae2-d4faf98e2326\t/mnt/data-all\text4\tdefaults,noatime\t0\t0\n```\n\n#### Reboot the Raspberry Pi\n```bash\nsudo reboot\n```\n\n## [9. Generating SSH Keys on Linux based systems](https://pimylifeup.com/raspberry-pi-ssh-keys/)\n\n#### Generate SSH Keys\n```bash\nssh-keygen\n```\n\n#### View ssh public key\n```bash\ncat ~/.ssh/id_rsa.pub\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fquanglv1996%2Fsetup-raspberrypi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fquanglv1996%2Fsetup-raspberrypi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fquanglv1996%2Fsetup-raspberrypi/lists"}