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

  1. Check current hostname with hostname
  2. Check current fully qualified domain name (or FQDN) with hostname --fqd
  3. Set new hostname: sudo hostname pi
  4. Update /etc/hostname for Debian to get new hostname after reboot
  5. 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
  6. 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.

  1. wpa_supplicant should be installed but needs to be run as root: sudo wpa_supplicant -v.`
  2. In the next steps you will need BSSID (access point MAC address) and channel. Turn on your WIFI card with sudo ifconfig wlan0 upand scan for
    your network with sudo iwlist wlan0 scan | egrep 'Address|ESSID|Channel'.
  3. Prepare configuration file for wpa_supplicant in /etc/wpa_supplicant folder. You could have more files there with different names. Our file
    will be named wifi.conf.
  4. Adjust the content of the file: replace 00:14:6C:AE:EA:AEmy-wifi and P@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"
    }
  5. Create a script and add execute permissions. Replace my-wifi8 and wifi.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
  6. Run the script as root

Armbian hostname and WiFi configuration的更多相关文章

  1. 最简单的RASPBERRY PI wifi配置

    Setting up Wifi with the Command Line  SIMON MONK   This tutorial works best if your router is broad ...

  2. Docker Network Configuration 高级网络配置

    Network Configuration TL;DR When Docker starts, it creates a virtual interface named docker0 on the ...

  3. 树莓派 Zero W——随身钥匙扣

    前言 原创文章,转载引用务必注明链接.水平有限,如有疏漏,欢迎指正. 本文使用Markdown写成,为获得更好的阅读体验和正确的格式显示,请访问我的博客原文: http://www.cnblogs.c ...

  4. 【译】Android 6.0 Changes (机翻加轻微人工校对)

    Android 6.0 Changes In this document Runtime Permissions Doze and App Standby Apache HTTP Client Rem ...

  5. Android M新特性之Behavior Changes

    1.Runtime Permissions On your apps that target the M Preview release or higher, make sure to check f ...

  6. 分布式Hadoop安装(一)

    本文旨在介绍通过两台物理节点,实现完全分布式hadoop程序的部署 writen by Bob Pan@20140609 环境介绍: 主机名 机器IP 用途 描述 Hadoop0 192.168.80 ...

  7. hadoop完全分布式模式的安装和配置

    本文是将三台电脑用路由器搭建本地局域网,系统为centos6.5,已经实验验证,搭建成功. 一.设置静态IP&修改主机名&关闭防火墙(all-root)(对三台电脑都需要进行操作) 0 ...

  8. Hadoop1.1.2伪分布式安装笔记

    一.设置Linux的静态IP 修改桌面图标修改,或者修改配置文件修改 1.先执行ifconfig,得到网络设备的名称eth0 2.编辑/etc/sysconfig/network-scripts/if ...

  9. 智传播客hadoop视频学习笔记(共2天)

    第一天:1.答疑解惑•  就业前景•  学习hadoop要有什么基础•  hadoop会像塞班一样,热一阵子吗•  hadoop学习起来容易还是困难•  课堂上的学习方法(所有实验必须按照要求做,重原 ...

随机推荐

  1. BZOJ 4103 [Thusc 2015]异或运算 (可持久化01Trie+二分)

    题目大意:给你一个长方形矩阵,位置$i,j$上的数是$a_{i}\;xor\;b_{j}$,求某个子矩阵内第$K$大的值 最先想的是二分答案然后验证,然而是$O(qnlogmloga_{i})$,不出 ...

  2. centeros 7开机自动挂载磁盘

    场景: 使用mount命令将新发现的磁盘/dev/sdb挂载给/liu后,但是重启后又看不到磁盘? 问题导致原因: 虽然我们可以使用mount命令去挂载磁盘,但是此操作只对服务器运行期间有效,也就是临 ...

  3. [LeetCode] 122. 买卖股票的最佳时机ii best-time-to-buy-and-sell-stock-ii(贪心算法)

    思路: 只要第二天的价格高于第一天,就进行交易.(这样的话就默认可以同一天内先卖出再买进) class Solution(object): def maxProfit(self, prices): & ...

  4. vs解决方案里复制一个项目

    首先,保证要复制的项目的整洁无垃圾文件: 然后,选“文件”/“导出模板”,起个名字: 再者,创建一个同类型的项目,这时项目模板里就会出现你刚才导出的项目了.

  5. POJ——T 3020 Antenna Placement

    http://poj.org/problem?id=3020 Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 9844   A ...

  6. P2899 [USACO08JAN]手机网络Cell Phone Network

    P2899 [USACO08JAN]手机网络Cell Phone Networ题目描述 Farmer John has decided to give each of his cows a cell ...

  7. SparkStreaming基础

    * SparkStreaming基础 打开之前构建好的Maven工程,如何构建?请参看SparkCore基础(二)的最后部分. 在SparkCore中,我们操作的数据都在RDD中,是Spark的一个抽 ...

  8. 文件IO流总结

    文件在网络上或不同设备之间是怎么传输的,在Java程序中又是怎么来实现文件的传输,带着这两个问题,来了解一下Java中的IO流相关类及操作. 一.什么是流及流的用途 流是一组有顺序,有起点和终点的字节 ...

  9. CentOS 7.4 安装 网易云音乐

    CentOS 7.4 安装 网易云音乐 本文包含: 安装dnf 编译gcc 5.4.0 安装各种包 安装网易云音乐贯穿全局; 安装环境: CentOS 7.4, kernel3.10.0, gcc4. ...

  10. [BJWC2011]禁忌 AC 自动机 概率与期望

    #include<cstdio> #include<algorithm> #include<cstring> #include<string> #inc ...