In previous post i have described installation of Armbian on Orange Pi PC Plus. Now is the time for some initial configuration (hostname and WIFI setup).
Table of Contents
Changing hostname
- Check current hostname with
hostname
- Check current fully qualified domain name (or FQDN) with
hostname --fqd
- Set new hostname:
sudo hostname pi
- Update
/etc/hostname
for Debian to get new hostname after reboot -
Update
/etc/hosts
so that FQDN is before short localhost next to IP:127.0.0.1 pi.example.com pi localhost ::1 pi.example.com pi localhost ip6-localhost ip6-loopback fe00::0 ip6-localnet ff00::0 ip6-mcastprefix ff02::1 ip6-allnodes ff02::2 ip6-allrouters
-
Reboot with
sudo reboot
Configuring WIFI to work with WPA2
There are various ways for configuring WIFI with wpa_suplicant. You may consider settings things up in /etc/network/interfaces
if you want WIFI
to be started automatically upon system startup. I have decided on another approach: using script for starting all manually.
- wpa_supplicant should be installed but needs to be run as root:
sudo wpa_supplicant -v
.` - In the next steps you will need BSSID (access point MAC address) and channel. Turn on your WIFI card with
sudo ifconfig wlan0 up
and scan for your network withsudo iwlist wlan0 scan | egrep 'Address|ESSID|Channel'
. - Prepare configuration file for wpa_supplicant in
/etc/wpa_supplicant
folder. You could have more files there with different names. Our file will be namedwifi.conf
. -
Adjust the content of the file: replace
00:14:6C:AE:EA:AE
,my-wifi
andP@ssw0rd
with your access point MAC address, your WIFI network name and your WIFI password respectively:ctrl_interface=DIR=/var/run/wpa_supplicant network={ bssid=00:14:6C:AE:EA:AE ssid="my-wifi" scan_ssid=1 key_mgmt=WPA-PSK psk="P@ssw0rd" }
-
Create a script and add execute permissions. Replace
my-wifi
,8
andwifi.conf
with your WIFI name, channel and WPA supplicant configuration file name:#!/usr/bin/env bash DEV=$(iw dev | awk '/Interface/ {interf=$2} END {print interf}') DHCL_PIDFILE=/var/run/dhclient-$DEV.pid WPA_PIDFILE=/var/run/wpa_supplicant-$DEV.pid if [[ -f $DHCL_PIDFILE ]] && kill -9 $(cat $DHCL_PIDFILE) then dhclient -v -r $DEV echo "IP address released" fi if [[ -f $WPA_PIDFILE ]] && kill -9 $(cat $WPA_PIDFILE) then echo "WPA supplicant killed" fi killall wpa_supplicant echo "wpa_supplicant killed :)" ifconfig -v $DEV down sleep 1 ifconfig -v $DEV up echo "$DEV interface is up again" iwconfig $DEV essid 'my-wifi' channel 8 echo "starting wpa_supplicant.." sleep 2 wpa_supplicant -B -dd -i$DEV -P$WPA_PIDFILE -c/etc/wpa_supplicant/wifi.conf sleep 2 echo "getting IP address.." dhclient -v -pf $DHCL_PIDFILE $DEV
-
Run the script as root