LoginSignup
1
1

ラズパイマウスの Raspberry Pi 3 B に Ubuntu Server 22.04 をインストール

Last updated at Posted at 2024-02-21

更新:2024年2月21日

React frontend + Go言語 backend(aws) + ラズパイマウス(edge) でラズパイマウス操作アプリを作っていきたいと思います。ROS2 Humble をインストールするために、今回は Raspberry Pi 3 B に Ubuntu Server 22.04 をインストールするところまで進めます。

Raspberry Pi 3 B に Ubuntu Server 22.04 をインストール(1回目)

Raspberry Pi Imager を使って、SDカードに Ubuntu Server 22.04 (64bit) を Macbook を使ってインストールします。

OS Customization で次の項目を設定しました・・・後述のエラーが出るので設定しない方がいいです。
・ホスト名:raspberrypy.local
・ユーザー名とパスワード
・Wi-Fi
・SSHを有効化:パスワード認証を行う

ラズパイを起動

SDカードをラズパイに差して、ラズパイマウスの電源を入れます。
1がACアダプタの接続コネクタです。
2がラズパイの電源スイッチです。

起動したら、エラーが出て止まりました。もう一回 OS Customization 無しでインストールしてみたいと思います。
S__38117449.jpg

Raspberry Pi 3 B に Ubuntu Server 22.04 をインストール(2回目)

OS Customization 無しでインストールしたら、無事起動しました。
最初のログインで新しいパスワード設定を促されて、新しいパスワードを入れたら無事起動しました。
(少し待たないと正しい初期パスワードを入れても Login incorrect になります)

netplanを用いてWi-Fiを有効化して、SSH接続

Raspberry Pi Terminal
$ sudo vim /etc/netplan/50-cloud-init.yaml

eth0: に optional: true を入れると起動が早くなります。
入れないと、
A start job is running for Wait for Network to be Configured (48s / no limit)
が出て120秒待たされます。

/etc/netplan/50-cloud-init.yaml
network:
    ethernets:
        eth0:
            dhcp4: true
            optional: true
    wifis:
        wlan0:
            optional: true
            access-points:
                ここにSSIDを書く:
                    password: ここにパスワードを書く
            dhcp4: false
            addresses: [192.168.11.89/24]
            gateway4: 192.168.11.1
            nameservers:
                addresses: [8.8.8.8, 192.168.11.1]
    version: 2
Raspberry Pi Terminal
$ sudo netplan apply

# ネットワークに接続されているか確認する
# 設定したIPアドレスが表示されていればOK
$ ip addr
--- 省略 ---
3: wlan0: ---省略---
    link/ether --- 省略
    inet 192.168.11.89

ssh接続できました。

Macbook Terminal
% ssh ubuntu@192.168.11.89
ubuntu@192.168.11.89's password: 
Welcome to Ubuntu 22.04.3 LTS (GNU/Linux 5.15.0-1034-raspi aarch64)

 * Documentation:  https://help.ubuntu.com
 * Management:     https://landscape.canonical.com
 * Support:        https://ubuntu.com/advantage

  System information as of Wed Feb 21 12:53:13 UTC 2024

  System load:            2.38427734375
  Usage of /:             4.8% of 56.58GB
  Memory usage:           20%
  Swap usage:             0%
  Temperature:            52.1 C
  Processes:              150
  Users logged in:        0
  IPv4 address for wlan0: 192.168.11.89
  IPv6 address for wlan0: 2001:f70:a3a0:d00:ba27:ebff:feec:c649


Expanded Security Maintenance for Applications is not enabled.

0 updates can be applied immediately.

Enable ESM Apps to receive additional future security updates.
See https://ubuntu.com/esm or run: sudo pro status


The list of available updates is more than a week old.
To check for new updates run: sudo apt update

Last login: Wed Feb 21 12:50:42 2024 from 192.168.11.3

次は、ROS2 Humble のインストールを進めたいと思います。

参考:
Raspberry Pi 4 Model BにUbuntu 18.04 をインストールする
Raspberry Pi 4 Model BにUbuntu 20.04 とROS 2 Foxyをインストールする

以降、参考情報(過去の情報:Ubuntu 16 の時の設定)

ラズパイの wifi 接続設定

raspi Terminal
$ sudo -s
# apt install wpasuplicant
# wpa_passphrase SSID PASSWORD > /etc/wpa_supplicant/labwifi
/etc/network/interfaces
#source /etc/network/interfaces.d/*.cfg

auto wlan0
iface wlan0 inet dhcp
wpa-conf /etc/wpa_supplicant/labwifi.conf
wireless-power off
raspi Terminal
$ ping google.com
PING google.com (142.251.42.174) 56(84) bytes of data.
64 bytes from nrt12s46-in-f14.1e100.net (142.251.42.174): icmp_seq=1 ttl=117 time=7.72 ms

オフライン起動の高速化

次のリンクを参考にしてwifi設定とオフライン起動の高速化の設定を行いました。
Raspberry Pi 3 の Ubuntu を設定する

raspi terminal
$ sudo vim /etc/dhcp/dhclient.conf
/etc/dhcp/dhclient.conf
timeout 3;
1
1
2

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
1