1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

【個人メモ】Raspberry pi セットアップ手順

Last updated at Posted at 2020-06-15

初期化

microSDをSDFormatter4.0以降を使用して初期化する
FAT32でフォーマットすること
公式サイトからNoobsの最新版をDLする
公式サイト:https://www.raspberrypi.org/downloads/raspbian/

当該ファイルを展開し、フォルダの中身をSDカードにコピーする
SDカードをRaspberrypiにセットして起動する

raspberrypi zero w の場合

microSDをSDFormatter4.0以降を使用して初期化する
FAT32でフォーマットすること
公式サイトからraspbian-stretch-liteの最新版をDLする
公式サイト:https://www.raspberrypi.org/downloads/raspbian/
Etcherを使いSDにイメージファイルを書き込む
boot直下にsshファイルを作成する
boot直下cmdline.txtにmodules-load=dwc2,g_ether を追加する
boot直下config.txtに"dtoverlay=dwc2"を追加する 要""。touchコマンドがよい

参考:https://qiita.com/hishi/items/8bdfd9d72fa8fe2e7573

ファイルによるwifi設定

boot直下にwpa_supplicant.confを作成し、下記を書き込む。

country=JP
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
network={
    ssid="hoge"
    psk=hugahuga
}

pskについて下記サイトでSSIDとパスキーから生成する。SSIDは""で囲む。pskは囲まない
http://jorisvr.nl/wpapsk.html

参考:https://qiita.com/mascii/items/0d1a280ac58ed8f6f999

最新化

apt-get update および apt-get upgrade を実行

apt-get update && apt-get upgrade -y

SSH有効化

sudo raspi-configを実行
5 Interfacing Optionsを選択し、SSH を enableとする

Vimインストール

dpkg -l | grep vi
sudo apt-get --purge remove vim-common vim-tiny
sudo apt-get install vim

:set mouse= # Visualモード無効化
https://qiita.com/morikooooo/items/9fd41bcd8d1ce9170301

IP固定

sudo vim /etc/dhcpcd.conf
interface eth0
static ip_address=xxx.xxx.xxx.xxx/24
static routers=xxx.xxx.xxx.xxx
static domain_name_servers=xxx.xxx.xxx.xxx

interface wlan0
static ip_address=xxx.xxx.xxx.xxx/24
static routers=xxx.xxx.xxx.xxx
static domain_name_servers=xxx.xxx.xxx.xxx

Samba有効化

参考:https://qiita.com/ARBALEST000/items/78f459567e1e90de99e5

NTP設定

sudo apt-get update && sudo apt-get -y install ntp

Webiopiインストール

最近はFastapiでAPIサーバを実装しちゃうので利用しないけど
利用する際は下記でインストール

wget https://sourceforge.net/projects/webiopi/files/WebIOPi-0.7.1.tar.gz
tar xvzf WebIOPi-0.7.1.tar.gz
cd WebIOPi-0.7.1
wget https://raw.githubusercontent.com/doublebind/raspi/master/webiopi-pi2bplus.patch
patch -p1 -i webiopi-pi2bplus.patch
sudo ./setup.sh

※ webiopi over internet はOFFにする

その他、gitのsettingsリポジトリからファイルを取得
/usr/local/lib/python3.7/dist-packages/WebIOPi-0.7.1-py3.7-linux-armv6l.egg/webiopi/utils/thread.py
の runLoop関数を下記の通り修正

def runLoop(func=None, async_=False):
    global RUNNING
    RUNNING = True
    signal.signal(signal.SIGINT, stop)
    signal.signal(signal.SIGTERM, stop)

    if func != None:
        if async_:
            TASKS.append(Task(func, True))
        else:
            while RUNNING:
                func()
    else:
        while RUNNING:
            time.sleep(1)

OPENCVをインストール

参考:https://qiita.com/mt08/items/e8e8e728cf106ac83218

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?