Raspberry Pi Raspberry Pi install 64-bit system to build a full-featured NAS

The home’s groupware and gen8 are both eating dust, because they are not used much anymore, from the beginning of 24 hours of non-stop boot to 8 am to 11 pm boot, then to on-demand network wake up boot, to the current occasional manual boot.

This is also in order to save electricity and money, scrimp and save, I think the hard drive or do not always toss it, long life, backups do not have to be so frequent, a month and two months to do an incremental backup on the line. So there is no need to keep the computer on 24 hours a day, but usually when you want to use a little and no ……

Yesterday, I found out that the Raspberry Pi has been eating dust, it should be Raspberry Pi 3B or 3+ or 3B+ or 3Plus?

ssh connection, login password are forgotten, but fortunately guessed again and again after the successful login, ready to install a KodExplorer, used a long time ago, remember the original is just a php file management program, this time to download found that has become kodbox, also called can be called the cloud, the original mango cloud, a bit confusing. I found that the function is much more powerful than before, my Raspberry Pi installed on this with almost, not to install nextcloud and so on.

Yesterday morning began to install nginx + mysql + php, yes, I chose to install mysql, do not want to use the package installation, the results have been compiled until 10 pm are not yet installed, too unexpected, a total of more than ten hours ah, decided to terminate the.

Reinstall, this time with oneinstack one-click script (many years money tested once and never used again), only install nginx + php, from 10:00 pm compile to 3:00 am to complete the installation, this morning up to test, kodbox with a very fragrant (I do not have much demand, can share files, listen to audio online can be).

But suddenly I found a video file of more than 3G can not be played, prompting no read permission, but I looked at the file permissions are fine, I guess because the Raspberry Pi system is 32-bit, resulting in the installation of PHP is also 32-bit, PHP can not read more than 2G files. Check whether the system is 32 or 64 bit command: getconf LONG_BIT

I can only start again, reinstall the 64-bit system, before the Raspberry Pi is no 64-bit system (the magic modification does not count), but fortunately now there is, reinstall the system!

Installing a Raspberry Pi 64-bit system

Download Raspberry Pi 64-bit system, I don’t want desktop so I choose lite https://downloads.raspberrypi.org/raspios_lite_arm64/images/raspios_lite_arm64-2020-08-24/2020-08-20- raspios-buster-arm64-lite.zip

Use USB Image Tool to write the image to TF card (Win32DiskImager is just a piece of crap) usage is very simple: insert the tf card, select the disk on the left side of USB Image Tool, use “Restore” on the right side to raspios-buster -arm64-lite.img image to the tf card can be written.

Raspberry Pi open ssh service

After the write is finished, there will be an extra boot drive in Explorer, create a new empty file named ssh under the boot partition, you can open SSH service for Raspberry Pi, suitable for no screen operation.

Raspberry Pi auto link wifi

Create a new wpa_supplicant.conf file under the boot partition, and write the wireless-related configuration. Multiple wireless networks can be configured at the same time.

ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev

    ssid="wifi link name"
    psk="wifi password"

Insert the tf card into the Raspberry Pi, power on, and use the initial state Raspberry Pi default user name, password:pi, raspberry can login ssh.

Checked with getconf LONG_BIT, also with uname -a, and the result: Linux raspberrypi 5.4.51-v8+ #1333 SMP PREEMPT Mon Aug 10 16:58:35 BST 2020 aarch64 GNU/ Linux is 64-bit, by the way, check the partition.

Filesystem     Type      Size  Used Avail Use% Mounted on
/dev/root      ext4       58G  1.3G   55G   3% /
devtmpfs       devtmpfs  329M     0  329M   0% /dev
tmpfs          tmpfs     457M     0  457M   0% /dev/shm
tmpfs          tmpfs     457M   12M  445M   3% /run
tmpfs          tmpfs     5.0M  4.0K  5.0M   1% /run/lock
tmpfs          tmpfs     457M     0  457M   0% /sys/fs/cgroup
/dev/mmcblk0p1 vfat      253M   54M  199M  22% /boot
tmpfs          tmpfs      92M     0   92M   0% /run/user/1000

Change the password of pi and root account

sudo passwd pi enter the same password twice, prompt passwd: password updated successfully sudo passwd root as above

Unlock the root user without having to sudo every time.

sudo passwd –unlock root

Enable the root user to log in to the Raspberry Pi’s ssh

Modify the configuration file of ssh.

sudo nano /etc/ssh/sshd_config change the configuration item #PermitRootLogin prohibit-password to PermitRootLogin yes

Restart the ssh service.

After sudo service sshd restart you can log in with root, no more annoying sudo!

Corrected time zone

sudo dpkg-reconfigure tzdata Just select Asia/Shanghai.

[Optional] A simple configuration can be done when the Raspberry Pi is used for the first time, running the following command in command line mode will bring up a simple configuration screen: sudo raspi-config

[Optional] Install remote desktop to Raspberry Pi (windows system can connect directly)

If you need the desktop, then go to the Raspberry Pi command line to perform the installation: sudo apt-get install xrdp Note that the default source first, although the download is slow, the domestic source will not be able to find the package, so first install the package and then change the source, after installation, restart the Raspberry Pi: sudo reboot to open the Windows comes with the remote desktop enter the Raspberry Pi ip to connect to the visual interface of the Raspberry Pi, no need to vnc it.

Domestic sources available for 64-bit Raspberry Pi

cp -a /etc/apt/sources.list /etc/apt/sources.list.baknano /etc/apt/sources.list comment out or delete everything and add the following.

deb https://mirrors.tuna.tsinghua.edu.cn/debian/ buster main contrib non-free
# deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ buster main contrib non-free。
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ buster-updates main contrib non-free.
# deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ buster-updates main contrib non-free。
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ buster-backports main contrib non-free
# deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ buster-backports main contrib non-free。
deb https://mirrors.tuna.tsinghua.edu.cn/debian-security buster/updates main contrib non-free
# deb-src https://mirrors.tuna.tsinghua.edu.cn/debian-security buster/updates main contrib non-free。

Update the package index:sudo apt-get update

cp -a /etc/apt/sources.list.d/raspi.list /etc/apt/sources.list.d/raspi.list.bak/etc/apt/sources.list.d/raspi.list 这个暂时没改。

Raspberry Pi to mount a removable hard drive or USB flash drive

sudo mkdir /upansudo mount -o uid=pi,gid=pi /dev/sda1 /upanmount /dev/sda1 /upan

Uninstall the USB drive after use

sudo umount /upan

Add the mount command to /etc/rc.local so that it is automatically mounted on boot, the last time it was added to fstab there was a problem that prevented the system from booting. nano /etc/rc.local add the following mount command before exit 0: mount /dev/sda1 /upan

Installing Aria2 on Raspberry Pi

sudo apt-get install aria2sudo mkdir -p /data/conf/aria2sudo nano /data/conf/aria2/aria2.conf Add the following.

## File saving related ##

## File save directory The file save directory here is set by yourself
## Enable disk-cache, 0 is disabled, requires version 1.16 or higher, default: 16M
# Breakpoint continue

# Preallocate files, reduce disk fragmentation, default: prealloc
# Preallocation time: none < falloc ? trunc < prealloc
# falloc and trunc require file system and kernel support
# falloc is recommended for NTFS, trunc is recommended for EXT3/4, and needs to be commented out for MAC

## Download connection related ##

## max-concurrent-download-tasks, can be changed at runtime, default: 5
# Number of connections to the same server, can be specified when adding, default:1
# Overall download speed limit, modifiable at runtime, default:0 (no limit)
# Single task download speed limit, default:0 (no limit)
# Overall upload speed limit, modifiable at runtime, default: 0 (no limit)
# Single task upload speed limit, default:0 (no limit)
# Disable IPv6, default:false

# Minimum file slice size, can be specified when adding, range 1M -1024M, default:20M
# Assume size=10M, if the file is 20MiB then use two sources; if the file is 15MiB then use one source
# Maximum number of threads for a single task, specify when adding, default: 5

## Progress saving related ##

## Read the download task from the session file
# # Save incorrect, unfinished download tasks to the session file when Aria2 exits
# Save session at regular intervals, 0 for save on exit, requires version 1.16.1 or higher, default:0

## RPC related settings ##

## Enable RPC, default:false
## Allow all sources, default:false
# Allow external access, default:false
# RPC port, change only if the default port is occupied
# rpc-listen-port=6800
# Set RPC authorization token, new in v1.18.4, replaces --rpc-user and --rpc-passwd options

## BT/PT download related ##

## Automatically start a BT task when a seed (ending with .torrent) is downloaded, default: true
# Client masquerade, required for PT
# Force session saving, even if the task is completed, default:false
# Newer versions will keep the .aria2 file even after the task is completed when enabled
# force-save=false
# Continue previous BT tasks without checking again, default:false
# Save the metadata of a magnet link as a seed file (.torrent file), default:false

Launching Aria2

aria2c –conf-path=/data/conf/aria2/aria2.conf -D

aria2c adds boot-up

sudo nano /etc/init.d/aria2c adds.

# Provides:          aria2
# Required-Start:    remotefsnetwork
# Required-Stop:     remotefsnetwork
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Aria2 Downloader
case "$1" in
    echo -n "Starting aria2c"
    sudo aria2c --conf-path=/data/conf/aria2/aria2.conf -D

    echo -n "Shutting down aria2c "
    killall aria2c
    # killall aria2c
    sudo aria2c --conf-path=/data/conf/aria2/aria2.conf -D


Execute: chmod +x /etc/init.d/aria2csudo systemctl enable aria2c

Then download a AriaNg and put it under the web, AriaNg is the web management interface of aria2. Some seeds BT speed is okay, but some files download is very slow, a dozen k or dozens of k, or even simply 0, there is no good way to add a bunch of bt source, so 24 hours hanging it, anyway, power consumption is super low.

Raspberry Pi Raspberry Pi install nginx+php7 one click script

Install screen first

apt-get install screen -yscreen -S installlnmp run install nginx+php7 one-click script at

wget -c http://mirrors.linuxeye.com/oneinstack-full.tar.gz && tar xzf oneinstack-full.tar.gz && ./oneinstack/install.sh --nginx_option 2 --php_option 9 --phpcache_option 1 --php_extensions fileinfo,redis,memcached,memcache,xdebug --redis  --memcached 

The next step was to wait, and mine took over two hours:.

Total OneinStack Install Time: 125 minutes
Nginx install dir:              /usr/local/tengine
PHP install dir:                /usr/local/php
Opcache Control Panel URL:      http://blog.dngz.net/ocp.php
redis install dir:              /usr/local/redis
memcached install dir:          /usr/local/memcached
Index URL:                      http://blog.dngz.net/

Then go to https://kodcloud.com/download/ to download the kodbox server side, kodbox environment requirements: php 5.3 and above + mysql/sqlite, environment recommended: centos7 + php7.3 + nginx + mysql5.7 + redis installation is Simple next step, next step, since mysql is not installed, so using sqlite is enough.

What I like most is that kodbox will automatically mount all the disk partitions of the entire machine, access to files, watch videos, listen to music is super convenient, but the convenience is not safe in exchange, so a Raspberry Pi, I will not put any private files on it, convenience is good, security is not a problem. Watch videos downloaded with Aria2 directly in the kodbox.

That’s basically it, add more if you missed it.

How to remove swap from Raspberry Pi Raspberry Pi

Some people think that the Raspberry Pi memory is small, so get a big swap, and I think the tf card life is not good, should reduce the read and write, so I intend to remove the swap.

How to remove swap from Raspberry Pi1

Generally speaking, the swap file of Raspberry Pi is automatically configured by /etc/init.d/dphys-swapfile, it is reasonable to delete this file to not enable swap, but the test just remove this file after reboot is still enabled swap, failure.

Raspberry Pi remove swap method 2

You can try editing the value of CONF_SWAPSIZE in /etc/dphys-swapfile, this value controls the swap partition size, if you want to disable it, just change CONF_SWAPSIZE to 0. If you don’t want to disable it, change it to the swap size you want.

Raspberry Pi delete swap method 3

See where the swap swap file is

[[email protected] ~]# swapon -sFilename Type Size Used Priority/var/swap file 102396 0 -2 From the above, we can see that swap is a file type, and the file /var/swap is the Raspberry Pi’s swap Swap file

Just add the swapoff command to the /etc/rc.local file to automatically turn off swap files on boot:

echo 'swapoff /var/swap'>> /etc/rc.local
rm -f /var/swap

reboot, check with free -m, no more swap.

References:Is Raspberry Pi 3b suitable for NAS

Leave a Reply

Your email address will not be published. Required fields are marked *