Raspberry Pi 2 Model B Basic Configuration Part 2 – Install All Kinds of Services and Self Hosted Applications

This is the second post regarding basic configuration of Raspberry Pi 2.

Enter emergency mode - single user

  1. On the SD card’s boot partition (usually mounted as "boot"), open the file named cmdline.txt.

  2. This file contains a single long line of boot parameters. Append the following to the end of that line:

    text
    init=/bin/bash

    Make sure it remains a single line (no line breaks).

Enable Chinese Support

1. Configure the System Locale 
Ensure your Raspberry Pi's locale is set to use UTF-8, which supports a wide range of characters including Chinese ones. 
  • Open the configuration menu:
    bash
    sudo raspi-config 
  • Navigate to Localisation Options -> Change Locale.
  • The default is often en_GB.UTF-8 or en_US.UTF-8, which you should keep selected.
  • Additionally, you need to enable Chinese locales like zh_CN.UTF-8 or zh_TW.UTF-8 in the list by pressing the spacebar to put an asterisk next to them.
  • Select the desired default locale for the system (e.g., you can keep en_US.UTF-8 for English interface but with Chinese support).
root@pi:~# raspi-config
Generating locales (this might take a while)...
  en_GB.UTF-8... done
  zh_CN.UTF-8... done
Generation complete.

2. Install Chinese Fonts 

Even with the correct locale, the system cannot display Chinese characters without the necessary fonts. They will appear as question marks or blocks. 

Install a common Chinese font package: 

bash
sudo apt-get install ttf-wqy-microhei # or install a range of fonts sudo apt-get install fonts-arphic-bkai00mp fonts-arphic-bsmi00lp fonts-arphic-gbsn00lp fonts-arphic-gkai00mp xfonts-intl-chinese xfonts-intl-chinese-big 


4. Reboot

After making all these changes, a full system reboot is necessary for everything to work correctly:

bash
sudo reboot

filebrowser

https://filebrowser.org/installation.html#docker
For armv7 image, the latest one is v2. 
docker run -d / --name filebrowser / --restart unless-stopped / -v /mnt/usb1/data/Pictures:/srv / -v /mnt/usb1/data/filebrowser/database:/database / -v /mnt/usb1/data/filebrowser/config:/config / -p 8080:80 / filebrowser/filebrowser:v2
root@pi:/mnt/usb1/data/filebrowser# docker run / > -v /mnt/usb1/data/Pictures:/srv / > -v /mnt/usb1/data/filebrowser/database:/database / > -v /mnt/usb1/data/filebrowser/config:/config / > -p 8080:80 / > filebrowser/filebrowser:v2 Unable to find image 'filebrowser/filebrowser:v2' locally v2: Pulling from filebrowser/filebrowser 13bd764ce982: Pull complete 04e597873be7: Pull complete 6dd2d44f53b6: Pull complete 5591e4afb5a4: Pull complete 2c2fdf33b70f: Pull complete b30f7a70e9e0: Pull complete 94f8d7225adc: Pull complete c602ce85ea36: Pull complete 1720e397c4b5: Pull complete 7f4bc9a25659: Pull complete 50a5af5c518f: Pull complete b77a310b51bd: Pull complete Digest: sha256:c751c3a0ed38a8a18b647ae7897b57c793f52a6501a75be2fe4b72d1c27b60ea Status: Downloaded newer image for filebrowser/filebrowser:v2 2025/11/01 23:13:08 Warning: filebrowser.db can't be found. Initialing in /database/ 2025/11/01 23:13:08 Using database: /database/filebrowser.db 2025/11/01 23:13:08 Using config file: /config/settings.json 2025/11/01 23:13:08 Performing quick setup 2025/11/01 23:13:08 User 'admin' initialized with randomly generated password: OVQhKcXoSOMv-Dla 2025/11/01 23:13:09 Listening on [::]:80 2025/11/01 23:16:09 /api/users/1: 400 192.168.2.248 password is too short, minimum length is 12 2025/11/01 23:16:42 /api/users/1: 400 192.168.2.248 password is too short, minimum length is 12 

https://hub.docker.com/r/filebrowser/filebrowser/tags
Grant write permission Recursively to all folders / files under /mnt/usb1/data
chmod -R a+rw /mnt/usb1/data

Home-gallery

root@pi:/mnt/usb1/data# docker pull xemle/home-gallery:1b9de1c7
1b9de1c7: Pulling from xemle/home-gallery
fda0ff469afd: Pull complete
eda6d151ef24: Pull complete
ad1216186aea: Pull complete
f959f0af4f05: Pull complete
e06a25c2d61f: Pull complete
ef3924b90bde: Pull complete
86d58e8c4d2b: Pull complete
Digest: sha256:4c7f510debe817fc70971662e4f74c39f5e1898103e5d8d2e47fed2021cfbe68
Status: Downloaded newer image for xemle/home-gallery:1b9de1c7
docker.io/xemle/home-gallery:1b9de1c7
root@pi:/mnt/usb1/data#
alias gallery="docker run -ti --rm /
  -v /mnt/usb1/data/home-gallery/data:/data /
  -v /mnt/usb1/data/Pictures:/data/Pictures /
  -u $(id -u):$(id -g) /
  -p 3000:3000 xemle/home-gallery:1b9de1c7"
gallery run init --source /data/Pictures
gallery run server
Note: to remove alias, just use unalias command such as : unalias gallery

root@pi:/mnt/usb1/data# gallery run init --source /data/Pictures
[2025-11-01 16:21:19.881]: cli.config.init Initialized configuration '/data/config/gallery.config.yml' from /app/gallery.config-example.yml
root@pi:/mnt/usb1/data# docker ps
CONTAINER ID   IMAGE     COMMAND   CREATED   STATUS    PORTS     NAMES
root@pi:/mnt/usb1/data# docker ps -all
CONTAINER ID   IMAGE     COMMAND   CREATED   STATUS    PORTS     NAMES
root@pi:/mnt/usb1/data# gallery run server
[2025-11-01 16:22:02.680]: cli.run Starting server
[2025-11-01 16:22:02.776]: cli.spawn Run cli with server
[2025-11-01 16:22:02.875]: cli.run Have a good day...
[2025-11-01 16:22:09.966]: server Your own Home Gallery is running at http://localhost:3000
[2025-11-01 16:22:09.976]: server.cli Run cli with run import --initial --update --watch...
[2025-11-01 16:22:10.070]: server.api.database.read Database file /data/config/database.db does not exists. Waiting for the database file...
[2025-11-01 16:22:13.995]: cli.run Import online sources: /data/Pictures
[2025-11-01 16:22:14.001]: cli.task.import Run import in watch mode. Start watching source dirs for file changes: /data/Pictures
[2025-11-01 16:22:22.103]: cli.task.import Run incremental import in batch mode of different file sizes
[2025-11-01 16:22:22.104]: cli.task.import Run batch import: Import files up to 20 MB
[2025-11-01 16:22:22.107]: cli.task.import Import files from source dirs: /data/Pictures
[2025-11-01 16:22:22.124]: cli.spawn Run cli with index --directory /data/Pictures --index /data/config/Pictures.idx --exclude-if-present .galleryignore --max-filesize 20M --add-limits 10,20,1.2,200 --journal 1101-BngF
[2025-11-01 16:22:25.835]: index Updating file index for directory /data/Pictures
[2025-11-01 16:22:25.945]: index.filter.maxFilesize Limit files up to 20M (20971520 bytes)
[2025-11-01 16:22:25.949]: index.filter.limit Index has 0 entries. Set index limit to max 10 new entries
[2025-11-01 16:22:25.994]: index.filter.limit Index limit of 10 exceeded. No more new files are added to the file index.
[2025-11-01 16:22:25.998]: index.create Read 10 files in /data/Pictures 47ms
[2025-11-01 16:22:26.002]: index.update Initiate index with 10 entries
[2025-11-01 16:22:26.064]: index.checksum Calculating ids for 7 entries with 5.3MB of total size 5.3MB (100.0%)
[2025-11-01 16:22:26.528]: index.checksum All ids of 5.3MB are calculated. Calculated ids of 5.3MB (100.0%) 465ms
[2025-11-01 16:22:26.548]: index File index was saved to /data/config/Pictures.idx and 7 entries have new checkums/ids 18ms
[2025-11-01 16:22:26.577]: index.journal Journal /data/config/Pictures.idx.1101-BngF.journal created
[2025-11-01 16:22:26.578]: index Updated file index for directory /data/Pictures 744ms
[2025-11-01 16:22:26.668]: cli.spawn Run cli with extract --index /data/config/Pictures.idx --journal 1101-BngF
[2025-11-01 16:22:37.608]: index.readStream Reading file index journal /data/config/Pictures.idx.1101-BngF.journal
[2025-11-01 16:22:39.605]: extractor.image.resize warn Could not load sharp image resizer
[2025-11-01 16:22:39.933]: extractor.image.resize Use vipthumbnail fallback to resize images
[2025-11-01 16:22:39.962]: extractor.image.heic warn Could not load sharp to write JPG
[2025-11-01 16:22:39.969]: extractor.image.heic warn Use slower jpeg-js to write JPG
[2025-11-01 16:22:39.991]: extractor.apiEntry warn You are using the public api server https://api.home-gallery.org. Please read its documentation at https://docs.home-gallery.org for privacy concerns
[2025-11-01 16:22:47.842]: extractor.image.preview Created 5 image previews from 1da393f:Pictures:HomePictures/2010/oaccac/IMG00009-20100210-1416.jpg with sizes of 1920,1280,800,320,128 3.7s
[2025-11-01 16:22:52.211]: extractor.image.preview Created 5 image previews from eada6cc:Pictures:HomePictures/2010/oaccac/IMG00010-20100210-1416.jpg with sizes of 1920,1280,800,320,128 4.3s
[2025-11-01 16:22:52.489]: extractor Processed 1 entries (#1, +1, processing 6 and queued 0 entries) 12.5s
[2025-11-01 16:22:54.888]: extractor.image.preview Created 4 image previews from 22cba0f:Pictures:HomePictures/2010/oaccac/IMG00012-20100210-1417.jpg with sizes of 1280,800,320,128 2.67s
[2025-11-01 16:22:58.818]: extractor.image.preview Created 5 image previews from 1f0fd2c:Pictures:HomePictures/2010/oaccac/IMG_0013.jpg with sizes of 1920,1280,800,320,128 3.9s
[2025-11-01 16:23:02.655]: extractor.image.preview Created 5 image previews from a6ebd5b:Pictures:HomePictures/2010/oaccac/IMG_0022.jpg with sizes of 1920,1280,800,320,128 3.8s
[2025-11-01 16:23:05.173]: extractor Processed 5 entries (#5, +4, processing 2 and queued 0 entries) 12.7s
[2025-11-01 16:23:07.363]: extractor.image.preview Created 5 image previews from c2a94fa:Pictures:HomePictures/2010/oaccac/IMG_0034.jpg with sizes of 1920,1280,800,320,128 4.7s
[2025-11-01 16:23:11.555]: extractor.image.preview Created 5 image previews from 53c58d4:Pictures:HomePictures/2010/oaccac/talking.JPG with sizes of 1920,1280,800,320,128 4.2s
[2025-11-01 16:23:14.094]: cli.extract Extract all meta data and calculated all preview files from 7 entries 37s
[2025-11-01 16:23:14.163]: cli.spawn Run cli with database create --index /data/config/Pictures.idx --journal 1101-BngF
[2025-11-01 16:23:19.045]: index.readStream Reading file index journal /data/config/Pictures.idx.1101-BngF.journal
[2025-11-01 16:23:19.344]: database.build Created 7 database entries 377ms
[2025-11-01 16:23:19.376]: database.mergeJournal Read file index journal /data/config/Pictures.idx.1101-BngF.journal
[2025-11-01 16:23:19.403]: database.mergeJournal Initialize non existing database file /data/config/database.db
[2025-11-01 16:23:19.418]: database.mergeJournal Merged 7 new and 0 removed entries from journals to 7 entries (+7) to the database 14ms
[2025-11-01 16:23:19.451]: database.mergeJournal Wrote database with 7 entries to /data/config/database.db 31ms
[2025-11-01 16:23:19.453]: cli.database Created database with 7 entries 0.92s


https://docs.home-gallery.org/install/index.html

https://docs.home-gallery.org/install/index.html#docker

stop the gallery docker then re-run

  • docker ps
  • docker stop <container name>
  • gallery run import
  • gallery run server
  • gallery -h
Finally, I got it up and running. It seems worked a bit. Video is fine to play, but not showing images. And also it is quite slow on my Raspberry Pi 2B. 

Mount External Hard Drive

Step 1. Check the External Hard Drive

After plugged in usb external hard drive, you will need to reboot system.
root@pi:/home/pi2b# blkid /dev/mmcblk0p2: LABEL="rootfs" UUID="37163896-0cfe-4a2e-aff1-80a0b8adcdde" BLOCK_SIZE="4096" TYPE="ext4" PARTUUID="3def1391-02" /dev/mmcblk0p1: LABEL_FATBOOT="bootfs" LABEL="bootfs" UUID="62AF-2DF5" BLOCK_SIZE="512" TYPE="vfat" PARTUUID="3def1391-01" /dev/sda1: LABEL="1T" BLOCK_SIZE="512" UUID="680615E70615B752" TYPE="ntfs" PARTUUID="df4082ca-01" root@pi:/home/pi2b# 
/dev/sda1 is the new 1T usb external hard drive we just plugged in. 
ls -l /dev/disk/by-uuid.
root@pi:~# ls -l /dev/disk/by-uuid total 0 lrwxrwxrwx 1 root root 15 Nov 1 23:34 37163896-0cfe-4a2e-aff1-80a0b8adcdde -> ../../mmcblk0p2 lrwxrwxrwx 1 root root 10 Nov 2 11:18 432f2c49-5a45-42ca-9138-6b576c7c5ddd -> ../../sda1 lrwxrwxrwx 1 root root 15 Nov 1 23:34 62AF-2DF5 -> ../../mmcblk0p1 

Step 2. Check the Partitions

We now need to check the boot name of our 1T Hard Drive’s partition.
Care: the fdisk command can do many things, including wiping your drive/partitions. Follow the steps carefully.

sudo fdisk –l

Disk /dev/mmcblk0: 7.42 GiB, 7969177600 bytes, 15564800 sectors Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disklabel type: dos Disk identifier: 0x3def1391 Device Boot Start End Sectors Size Id Type /dev/mmcblk0p1 16384 1064959 1048576 512M c W95 FAT32 (LBA) /dev/mmcblk0p2 1064960 15564799 14499840 6.9G 83 Linux Disk /dev/sda: 931.51 GiB, 1000204885504 bytes, 1953525167 sectors Disk model: GoFlex DVR Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disklabel type: dos Disk identifier: 0xdf4082ca Device Boot Start End Sectors Size Id Type /dev/sda1 63 1953520127 1953520065 931.5G 7 HPFS/NTFS/exFAT root@pi:/home/pi2b# 

root@pi:~# df -h
Filesystem      Size  Used Avail Use% Mounted on
udev            327M     0  327M   0% /dev
tmpfs           185M  3.3M  181M   2% /run
/dev/mmcblk0p2  6.8G  2.3G  4.2G  36% /
tmpfs           461M     0  461M   0% /dev/shm
tmpfs           5.0M   12K  5.0M   1% /run/lock
/dev/mmcblk0p1  510M   99M  412M  20% /boot/firmware
tmpfs            93M     0   93M   0% /run/user/1000
/dev/sda1       932G  166M  932G   1% /mnt
root@pi:~#

Step 3. Mounting it.

Now we know where our drive is, we need to mount it.
Before we mount it, lets use systemctl daemon-reload command to reload fstab.

sudo systemctl daemon-reload

sudo mount /dev/sda1 /mnt

The folder “/mnt” is the standard location for mounting permanent media, but you can always create your own folder if required using the “mkdir” command.

That’s it! Our drive is mounted. If there is any error, use "dmesg | tail " command to check issue.

use ntfsfix /dev/sda1 command to repair.

Step 4. Permissions.

As our drive is formatted in NTFS, we might need to change the /mnt drive permissions in order to enable proper access. Simply run the following command:

sudo chmod 775 /mnt

This will change your permissions and allow you to access the drive.
To test this, let’s try to create a folder. . .

cd /mnt
sudo mkdir IMGFOLDER
cd IMGFOLDER

Step 5. Auto Mounting it after reboot

root@pi:~# blkid /dev/sda1
/dev/sda1: LABEL="1T" BLOCK_SIZE="512" UUID="680615E70615B752" TYPE="ntfs" PARTUUID="df4082ca-01"

root@pi:~#nano /etc/fstab

proc            /proc           proc    defaults          0       0
PARTUUID=3def1391-01  /boot/firmware  vfat    defaults          0       2
PARTUUID=3def1391-02  /               ext4    defaults,noatime  0       1
# a swapfile is not a swap partition, no line here
#   use  dphys-swapfile swap[on|off]  for that
UUID=680615E70615B752 /mnt/usb1 ntfs defaults,auto,users,rw,nofail,noatime 0 0

To mount with these options automatically at boot, add a line like this to /etc/fstab:

text(Example)
/dev/sdXN /mnt/ntfs ntfs-3g defaults,noatime,async,big_writes 0 0
For our case:
UUID=680615E70615B752 /mnt/usb1 ntfs-3g defaults,big_writes,async,rw,nofail,noatime 0 0
[Attention] don't make a mistake with your UUID, else you will have an issue to boot your machine.
note: 
  • Mount options like noatimeasync, and big_writes can help improve NTFS performance on Linux when using ntfs-3g.

  • noatime disables updating the access time on files, reducing write overhead.

  • async allows asynchronous I/O which improves performance by not waiting for write operations to complete synchronously.

  • big_writes enables larger write requests, improving write speed on NTFS.

root@pi:~#umount /dev/sda1
reboot
Note: you can use ncdu package to see browse through each folder to see the folder size. 
For ext4 format:

Example fstab line with performance options

text
UUID=432f2c49-5a45-42ca-9138-6b576c7c5ddd /mnt/usb1 ext4 defaults,noatime,nodiratime,data=writeback,commit=60 0 2

Important notes:

  • Some options like barrier=0 may not be supported on all devices and can risk data loss on power failure.

  • data=writeback sacrifices some data integrity guarantees, so use it only if performance is critical and you have reliable power.

  • If your USB disk supports write caching at hardware level (check via hdparm), combining that with these options can further boost performance.

  • Always test and periodically check disk health when using aggressive performance flags.

NFS Server

apt install nfs-kernel-server -y

root@pi:~# id pi2b uid=1000(pi2b) gid=1000(pi2b) groups=1000(pi2b),4(adm),20(dialout),24(cdrom),27(sudo),29(audio),44(video),46(plugdev),60(games),100(users),102(input),105(render),110(netdev),995(spi),994(i2c),993(gpio) root@pi:~#

Now that we have everything we need and have prepared a folder to share. We need to go ahead and modify the “exports” file by running the command below.The Raspberry Pi NFS server software that we installed earlier reads from this file to know what directories to share out over the NFS protocol.

nano /etc/exports

add following line for everyone to read and write to it

/mnt/usb1/data *(rw,all_squash,insecure,async,no_subtree_check,anonuid=1000,anongid=1000)

Now for our newly added folder to be accessible through the NFS protocol, we must run the “exportfs” package by running the command below.This application updates the current table of exports available to the NFS server.
exportfs -ra

In addition to running the “exportfs” package we must also restart the NFS Kernel server module.
We can restart this service by using the following command in the terminal.

systemctl restart nfs-kernel-server

We need this IP address so that we can successfully connect to the Raspberry Pi NFS server.

hostname -I

To enable NFS only support version 4 

Edit the NFS configuration file to explicitly disable older versions. 
  1. Open or create the file /etc/nfs.conf.d/nfsv3-disable.conf using a text editor with root privileges (e.g., sudo nano /etc/nfs.conf.d/nfsv3-disable.conf).
  2. Add the following lines to disable NFS version 3 (NFSv2 is usually disabled by default on modern systems):
    [nfsd] vers3=n 

    You can check the available versions before and after the change using cat /proc/fs/nfsd/versions. A plus sign (+) indicates an available version, while a minus sign (-) indicates a disabled one.

  3. Check nfs support version:
root@pi:/etc/nfs.conf.d# rpcinfo -p | grep nfs
    100003    4   tcp   2049  nfs
Grant write permission Recursively to all folders / files under /mnt/usb1/data
chmod -R a+rw /mnt/usb1/data

Docker

After apt update, you can directly install docker:
apt install docker.io
root@pi:~# docker --version
Docker version 20.10.24+dfsg1, build 297e128
root@pi:~#

HetrixTools Agent

From HetrixTrool.com website, add a new monitor agent using Heartbeat Monitor as monitor type:

root@pi:~# wget -qO- https://raw.githubusercontent.com/hetrixtools/agent/master/hetrixtools_install.sh | sudo bash -s c8sf345688563453453acg9d84cf7 1 ssh 0 0 0 0
Checking root privileges...
... done.
Installing from master branch...
Checking Server ID (SID)...
... done.
Checking system utilities...
... done.
Checking if there's any old hetrixtools agent already installed...
No old hetrixtools agent found...
... done.
Creating the hetrixtools agent folder...
... done.
Fetching the agent...
... done.
Fetching the config file...
... done.
Inserting Server ID (SID) into agent config...
... done.
Checking if any services should be monitored...
Services found, inserting them into the agent config...
... done.
Checking if software RAID should be monitored...
... done.
Checking if Drive Health should be monitored...
... done.
Checking if 'View running processes' should be enabled...
... done.
Checking if any ports to monitor number of connections on...
... done.
Making sure no hetrixtools agent scripts are currently running...
kill: (10894): No such process
... done.
Checking if hetrixtools user already exists...
The hetrixtools user doesn't exist, creating it now...
Assigning permissions for the hetrixtools user...
... done.
Removing any old hetrixtools cronjob, if exists...
... done.
Setting up systemd timer...
... done.
Cleaning up the installation file...
... done.
Letting HetrixTools platform know the installation has been completed...
... done.
Starting the agent under the 'root' user...
... done.
HetrixTools agent installation completed.
root@pi:~#


Cloudfalred

Get all installation command from Cloudflare Tunnel page:

Open a terminal on your Raspberry Pi and add the Cloudflare GPG key and repository:
Code
 sudo mkdir -p --mode=0755 /usr/share/keyrings curl -fsSL https://pkg.cloudflare.com/cloudflare-main.gpg | sudo tee /usr/share/keyrings/cloudflare-main.gpg >/dev/null echo 'deb [signed-by=/usr/share/keyrings/cloudflare-main.gpg] https://pkg.cloudflare.com/cloudflared any main' | sudo tee /etc/apt/sources.list.d/cloudflared.list
  1. Update your package list and install cloudflared:
Code
 sudo apt update && sudo apt install cloudflared -y
  1. Verify the installation by checking the version:
Code
 cloudflared --version

root@pi:~# sudo cloudflared service install eyJhIjoiNDIwOTFiYzM3NjVjYmYyNDM2ZTMiLCJ0IjoAiMTgwODNjNmMtZjcyYS00NjdlLWI1NDgtFaUzAwWmpNMUxUZzVaVGd0TVdRek0yUmhOV1ZrTXpBMyJ9 2025-10-19T00:05:07Z INF Using Systemd 2025-10-19T00:05:16Z INF Linux service for cloudflared installed successfully root@pi:~# 

speedtest

apt install speedtest-cli
type speedtest or speedtest-cli to start the testing
root@pi:~# speedtest-cli
Retrieving speedtest.net configuration...
Testing from Bell Canada (61.71.161.12)...
Retrieving speedtest.net server list...
Selecting best server based on ping...
Hosted by Bell Canada (Markham, ON) [187.62 km]: 13.324 ms
Testing download speed................................................................................
Download: 31.03 Mbit/s
Testing upload speed......................................................................................................
Upload: 21.28 Mbit/s
root@pi:~#
root@pi:~# speedtest
Retrieving speedtest.net configuration...
Testing from Bell Canada (76.71.67.118)...
Retrieving speedtest.net server list...
Selecting best server based on ping...
Hosted by Bell Canada (Kingston, ON) [246.99 km]: 22.397 ms
Testing download speed................................................................................
Download: 50.76 Mbit/s
Testing upload speed......................................................................................................
Upload: 24.09 Mbit/s
root@pi:~#

Timezone change

By default, Raspberry Pi 2 will use UTC time. Command tzselect will give you continent and country selection to pick.
pi@raspberrypi ~ $ date
Tue Oct  6 13:48:38 UTC 2015
pi@raspberrypi ~ $ tzselect
Please identify a location so that time zone rules can be set correctly.
Please select a continent or ocean.
 1) Africa
 2) Americas
 3) Antarctica
 4) Arctic Ocean
 5) Asia
 6) Atlantic Ocean
 7) Australia
 8) Europe
 9) Indian Ocean
10) Pacific Ocean
11) none - I want to specify the time zone using the Posix TZ format

pi@raspberrypi ~ $ tzconfig
WARNING: the tzconfig command is deprecated, please use:
 dpkg-reconfigure tzdata
pi@raspberrypi ~ $ dpkg-reconfigure tzdata
/usr/sbin/dpkg-reconfigure must be run as root
pi@raspberrypi ~ $ sudo dpkg-reconfigure tzdata
                                                                       
Current default time zone: 'America/Toronto'
Local time is now:      Tue Oct  6 10:55:18 EDT 2015.
Universal Time is now:  Tue Oct  6 14:55:18 UTC 2015.

pi@raspberrypi ~ $ date
Tue Oct  6 10:55:28 EDT 2015

Access the Raspberry Pi Desktop

XRDP service will allow you to use remote desktop to access Raspberry Pi GUI through VNC service.

pi@raspberrypi ~ $ sudo apt-get install xrdp
Reading package lists... Done
Building dependency tree    
Reading state information... Done
The following extra packages will be installed:
  tightvncserver xfonts-base
Suggested packages:
  tightvnc-java
The following NEW packages will be installed:
  tightvncserver xfonts-base xrdp
0 upgraded, 3 newly installed, 0 to remove and 0 not upgraded.
Need to get 7,219 kB of archives.
After this operation, 11.5 MB of additional disk space will be used.
Do you want to continue [Y/n]? y
Get:1 http://mirrordirector.raspbian.org/raspbian/ wheezy/main tightvncserver armhf 1.3.9-6.4 [786 kB]
Get:2 http://mirrordirector.raspbian.org/raspbian/ wheezy/main xfonts-base all 1:1.0.3 [6,181 kB]
Get:3 http://mirrordirector.raspbian.org/raspbian/ wheezy/main xrdp armhf 0.5.0-2 [252 kB]
Fetched 7,219 kB in 14s (493 kB/s)                                                    
Selecting previously unselected package tightvncserver.
(Reading database ... 76938 files and directories currently installed.)
Unpacking tightvncserver (from .../tightvncserver_1.3.9-6.4_armhf.deb) ...
Selecting previously unselected package xfonts-base.
Unpacking xfonts-base (from .../xfonts-base_1%3a1.0.3_all.deb) ...
Selecting previously unselected package xrdp.
Unpacking xrdp (from .../xrdp_0.5.0-2_armhf.deb) ...
Processing triggers for man-db ...
Processing triggers for fontconfig ...
Setting up tightvncserver (1.3.9-6.4) ...
update-alternatives: using /usr/bin/tightvncserver to provide /usr/bin/vncserver (vncserver) in auto mode
update-alternatives: using /usr/bin/Xtightvnc to provide /usr/bin/Xvnc (Xvnc) in auto mode
update-alternatives: using /usr/bin/tightvncpasswd to provide /usr/bin/vncpasswd (vncpasswd) in auto mode
Setting up xfonts-base (1:1.0.3) ...
Setting up xrdp (0.5.0-2) ...
[....] Generating xrdp RSA keys......
Generating 512 bit rsa key...

ssl_gen_key_xrdp1 ok

saving to /etc/xrdp/rsakeys.ini

done (done).
[....] Starting Remote Desktop Protocol server : xrdp sesman.
pi@raspberrypi ~ $

List System Information

uname -a
root@pi:~# uname -a
Linux pi 6.12.47+rpt-rpi-v7 #1 SMP Raspbian 1:6.12.47-1+rpt1~bookworm (2025-09-16) armv7l GNU/Linux

cat /etc/os-release
HypriotOS/armv7: pirate@black-pearl in ~ $ ls /etc/*release /etc/os-release HypriotOS/armv7: pirate@black-pearl in ~ $ cat /etc/os-release PRETTY_NAME="Raspbian GNU/Linux 10 (buster)" NAME="Raspbian GNU/Linux" VERSION_ID="10" VERSION="10 (buster)" VERSION_CODENAME=buster ID=raspbian ID_LIKE=debian HOME_URL="http://www.raspbian.org/" SUPPORT_URL="http://www.raspbian.org/RaspbianForums" BUG_REPORT_URL="http://www.raspbian.org/RaspbianBugs" HypriotOS/armv7: pirate@black-pearl in ~ $ 

Add Cron Job

Add a cron job to halt Raspberry Pi at 23:00 everyday.
pi@raspberrypi ~ $ crontab -e

  GNU nano 2.2.6           File: /tmp/crontab.obWc51/crontab                          

# Edit this file to introduce tasks to be run by cron.
#
# Each task to run has to be defined through a single line
# indicating with different fields when the task will be run
# and what command to run for the task
#
# To define the time you can provide concrete values for
# minute (m), hour (h), day of month (dom), month (mon),
# and day of week (dow) or use '*' in these fields (for 'any').#
# Notice that tasks will be started based on the cron's system
# daemon's notion of time and timezones.
#
# Output of the crontab jobs (including errors) is sent through
# email to the user the crontab file belongs to (unless redirected).
#
# For example, you can run a backup of all your user accounts
# at 5 a.m every week with:
# 0 5 * * 1 tar -zcf /var/backups/home.tgz /home/
#
# For more information see the manual pages of crontab(5) and cron(8)
#
# m h  dom mon dow   command
0 23 * * * sudo halt

                                   [ Wrote 24 lines ]

crontab: installing new crontab

Install Portainer

Assume you have installed HypriotOS from https://blog.hypriot.com/downloads/
Docker and Docker-Compose has been installed. The default credentials for the image are user pirate with password hypriot.

You always can change it from raspi-config menu.

Check docker version and docker-compose version.
 HypriotOS/armv7: root@black-pearl in ~ # docker version Client: Docker Engine - Community Version: 19.03.12 API version: 1.40 Go version: go1.13.10 Git commit: 48a6621 Built: Mon Jun 22 15:53:41 2020 OS/Arch: linux/arm Experimental: false Server: Docker Engine - Community Engine: Version: 19.03.12 API version: 1.40 (minimum version 1.12) Go version: go1.13.10 Git commit: 48a6621 Built: Mon Jun 22 15:47:34 2020 OS/Arch: linux/arm Experimental: false containerd: Version: 1.2.13 GitCommit: 7ad184331fa3e55e52b890ea95e65ba581ae3429 runc: Version: 1.0.0-rc10 GitCommit: dc9208a3303feef5b3839f4323d9beb36df0a9dd docker-init: Version: 0.18.0 GitCommit: fec3683 HypriotOS/armv7: root@black-pearl in ~ # docker-compose version docker-compose version 1.26.1, build 634eb50 docker-py version: 4.2.2 CPython version: 3.7.3 OpenSSL version: OpenSSL 1.1.1d 10 Sep 2019 HypriotOS/armv7: root@black-pearl in ~ # 
Installing Portainer
HypriotOS/armv7: root@black-pearl in ~ # docker volume create portainer_data portainer_data HypriotOS/armv7: root@black-pearl in ~ # 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 Unable to find image 'portainer/portainer-ce:latest' locally latest: Pulling from portainer/portainer-ce 651a8e6e1630: Pull complete 56e38df73332: Pull complete c559aeebeb38: Pull complete Digest: sha256:79edf1302c9b4fdb06bc23321cc551e9118c29e6d668e12e23d4e58d993ab830 Status: Downloaded newer image for portainer/portainer-ce:latest 7434238c52b5c1a94d3cce7903c005ac7efe07ff3c250201ae7ccb683be4ee37 HypriotOS/armv7: root@black-pearl in ~ # 

Install Hypriot OS on Raspberry Pi

An OS with build-In Docker support in Raspbian release
Blog: https://blog.hypriot.com/
Github: https://github.com/hypriot/image-builder-rpi
Download: https://blog.hypriot.com/downloads/ 
Default Credentials:  user pirate with password hypriot.
Flashing tool: Etcher for Windows (x86|x64) (Portable)  (https://www.balena.io/etcher/)

Install Pi-hole

note: https://burakkarakan.com/blog/pihole-on-raspberry-using-pi-docker-and-docker-compose/
  1. Copy docker-compose.yml.example to docker-compose.yml and update as needed. See example below: Docker-compose example:
nano docker-compose.yml

version: "3" # More info at https://github.com/pi-hole/docker-pi-hole/ and https://docs.pi-hole.net/ services: pihole: container_name: pihole image: pihole/pihole:latest ports: - "53:53/tcp" - "53:53/udp" - "67:67/udp" - "80:80/tcp" environment: TZ: 'America/Toronto' WEBPASSWORD: 'Change-it-to-your-own' # We'll use host networking simply because it is way easier to setup. network_mode: host # Volumes store your data between container upgrades volumes: - './etc-pihole/:/etc/pihole/' - './etc-dnsmasq.d/:/etc/dnsmasq.d/' # Recommended but not required (DHCP needs NET_ADMIN) # https://github.com/pi-hole/docker-pi-hole#note-on-capabilities cap_add: - NET_ADMIN restart: unless-stopped

  1. Run docker-compose up --detach to build and start pi-hole

References

版权声明:
作者:zhangchen
链接:https://www.techfm.club/p/226064.html
来源:TechFM
文章版权归作者所有,未经允许请勿转载。

THE END
分享
二维码
< <上一篇
下一篇>>