Orange Pi Zero 2 Setup – Debian Buster

Orange Pi Zero 2

The Orange PI Zero 2 is a powerful development board offering many possibilities with its 64-bit 4-core processor (H6), 1GB, ethernet, WIFI, Bluetooth, HDMI, USB for around € 30. Take a look at aliexpress.com. Be careful not to confuse it with the Orange Pi Zero which uses an H3, 32-bit processor.

Operating System Installation

In general on Orange Pi boards, I install the Armbian OS. This one is not yet available (early 2021) for this board, I turned to the site http://www.orangepi.org which offers different OS including Debian. In the Resources section you can download the Debian image corresponding to the Orange Pi Zero 2 ‘.

Note: in 2022 a stable version of Armbian exists.

Connect in ssh (Bitwise software for example) with the user ‘root’ and the password ‘orangepi’.

In the ‘Terminal’ window make the updates:
apt-get update
apt-get upgrade

Install TightVNC to have remote graphical access through the VNC client extension of the Chrome browser.
apt-get install tightvncserver

Install xfonts-base to avoid the “could not open default font” fixed “” error when launching vncserver.

apt-get install xfonts-base

Start VNC in manual mode:
vncserver :1

You will be asked for a password. Do not put more than 8 characters. You can now test VNC with for example the chrome VNC extension by connecting to ‘orangepi_ip_address: 5901’.

For an automated launch we will create a script file:
nano /usr/local/bin/mon_vnc.sh

#!/bin/bash
PATH="$PATH:/usr/bin/"
DISPLAY="1"
DEPTH="16"
GEOMETRY="1280x720"
OPTIONS="-depth ${DEPTH} -geometry ${GEOMETRY} :${DISPLAY}"
case "$1" in
start)
/usr/bin/vncserver ${OPTIONS}
;;
stop)
/usr/bin/vncserver -kill :${DISPLAY}
;;
restart)
$0 stop
$0 start
;;
esac
exit 0

Copy the text above and copy it into nano with a right click if you are using Bitwise SSH. Remember to make this file executable.
 chmod +x /usr/local/bin/mon_vnc.sh

We can now perform the following 3 operations:
/usr/local/bin/mon_vnc.sh start
/usr/local/bin/mon_vnc.sh stop
/usr/local/bin/mon_vnc.sh restart

For an automatic launch of VNC when booting the orangepi we create a service in “systemd”.
nano /lib/systemd/system/mon_vnc.service

[Unit]
 Description=Manage Mon Serveur VNC 
 [Service]
 Type=forking
 ExecStart=/usr/local/bin/mon_vnc.sh start
 ExecStop=/usr/local/bin/mon_vnc.sh stop
 ExecReload=/usr/local/bin/mon_vnc.sh restart
 User=root
 [Install]
 WantedBy=multi-user.target

For the inclusion of this new service in systemd.
systemctl daemon-reload
systemctl enable mon_vnc.service

Now you can reboot your system and verify with VNC the connection in graphical mode.
systemctl start mon_vnc.service
systemctl stop mon_vnc.service
systemctl restart mon_vnc.service
systemctl status mon_vnc.service

Now you have an OrangePi Zero 2 that can be controlled remotely from a PC on your network.

Samba Installation

To easily exchange files between the OrangePi and a PC on the network, it is interesting to install Samba which will allow you to view it directly.

Install Samba.
apt-get install samba samba-common-bin

You must modify the configuration file to adapt it to the network and define the permissions.
 nano /etc/samba/smb.conf

At the bottom of the file add the following lines:

[OpiZero2]
comment =  Samba on Orange Pi
path = /
writable = yes
guest ok = yes
guest only = yes
create mode = 0777
directory mode = 0777
share modes = yes 

With path = / we directly access the root of the system to have the freedom to browse anywhere. Be careful to put, if necessary, the chmod permissions… which are fine.

Restart samba.
systemctl restart smbd.service

Now the OrangePi should be visible to other PCs on the network. You can change your name on the network by typing in a terminal window:
hostnamectl set-hostname new-name

WIFI Activation

Switch to graphics mode using VNC from a remote PC or by connecting a monitor to the micro-HDMI, keyboard and mouse.

Go to the ‘Settings’, ‘Advanced Network Configuration’ menus and click on + to create a WiFi type connection. Enter the name of your network (SSID) and in the ‘security’ tab enter the password.

Then go to your box to find the IP address that has been assigned to your Orange Pi and you will be able to connect to it by wifi.

Posts about Orange Pi Zero 2

F1ATB André

Ham Radio - Home automation - Photovoltaic

You may also like...

2 Responses

  1. Moes says:

    Maybe you would like to update your guide the Armbian image is availible in a “stable” form..

Leave a Reply

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