Ubuntu24.04のインストール
公式サイトからUbuntu24.04のDesktop imageをダウンロードする
UbuntuをインストールするPCのHDDをフォーマットしての初期の状態からインストールを行う
Macで起動用USBメモリを作成
diskutil list
で起動用USBメモリを確認する。今回の場合には/dev/disk4
として見つかった。
$ diskutil list
/dev/disk0 (internal, physical):
#: TYPE NAME SIZE IDENTIFIER
0: GUID_partition_scheme *500.3 GB disk0
1: Apple_APFS_ISC Container disk1 524.3 MB disk0s1
2: Apple_APFS Container disk3 494.4 GB disk0s2
3: Apple_APFS_Recovery Container disk2 5.4 GB disk0s3
/dev/disk3 (synthesized):
#: TYPE NAME SIZE IDENTIFIER
0: APFS Container Scheme - +494.4 GB disk3
Physical Store disk0s2
1: APFS Volume Macintosh HD 14.4 GB disk3s1
2: APFS Snapshot com.apple.os.update-... 14.4 GB disk3s1s1
3: APFS Volume Preboot 12.1 GB disk3s2
4: APFS Volume Recovery 1.9 GB disk3s3
5: APFS Volume Data 236.3 GB disk3s5
6: APFS Volume VM 20.5 KB disk3s6
/dev/disk4 (external, physical):
#: TYPE NAME SIZE IDENTIFIER
0: FDisk_partition_scheme *15.5 GB disk4
1: Windows_FAT_32 15.5 GB disk4s1
USBメモリを初期化する
$ diskutil eraseDisk MS-DOS MYDISK /dev/disk4
Started erase on disk4
Unmounting disk
Creating the partition map
Waiting for partitions to activate
Formatting disk4s2 as MS-DOS (FAT) with name MYDISK
512 bytes per physical sector
/dev/rdisk4s2: 29883872 sectors in 1867742 FAT32 clusters (8192 bytes/cluster)
bps=512 spc=16 res=32 nft=2 mid=0xf8 spt=32 hds=255 hid=411648 drv=0x80 bsec=29913088 bspf=14592 rdcl=2 infs=1 bkbs=6
Mounting disk
Finished erase on disk4
初期化が終わったらアンマウントする
$ diskutil unmountDisk /dev/disk4
Unmount of all volumes on disk4 was successful
Ubuntu24.04のイメージをUSBメモリに書き込む
$ sudo dd if=./ubuntu-24.04-desktop-amd64.iso of=/dev/disk4 bs=1m
5831+1 records in
5831+1 records out
6114656256 bytes transferred in 892.260248 secs (6852996 bytes/sec)
Ubuntu24.04のインストール
作成したUSBメモリをUbuntuをインストールしたいPCのUSBに挿入する。
起動ディスクを指定するために、F2
(大抵はF2
だがESC
だったりF12
の場合もある)を押下ながら起動する。用意したUSBメモリを起動ディスクにして起動してUbuntu24.04をインストールする。
リモート作業のための設定
Ubuntu24.04のインストールが終了したらリモート開発のための環境を整える
ssh
参考情報
$ apt install openssh-server
sshの状態を確認
$ systemctl status ssh
● ssh.service - OpenBSD Secure Shell server
Loaded: loaded (/usr/lib/systemd/system/ssh.service; disabled; preset: enabled)
Active: active (running) since Sun 2024-06-09 14:44:49 JST; 4min 6s ago
TriggeredBy: ● ssh.socket
Docs: man:sshd(8)
man:sshd_config(5)
再起動時に自動でsshが起動するように
$ sudo systemctl enable ssh
もしsshが起動していない場合は起動する
$ sudo systemctl start ssh
xrdp
$ sudo apt install xrdp
でxrdpはインストールされるのだが、いろいろ設定ファイルを修正する必要がある。このような面倒なことを引き受けてくれるスクリプトが公開されているので、それを利用する。
$ wget https://www.c-nergy.be/downloads/xRDP/xrdp-installer-1.5.zip
unzip xrdp-installer-1.5.zip
chmod +x xrdp-installer-1.5.sh
./xrdp-installer-1.5.sh -s
./xrdp-installer-1.5.sh -s
で音声(Pulseaudio)をリダイレクトをサポートした形の設定ファイルとともにxrdpがインストールされる。
残念ながら、私の環境ではリダイレクトされた音声のローカルマシン(Mac)での再生がスムースに行えない不具合が発生した。
Chrome Remote Desktop
公式の Chrome Remote Desktopの設定方法
chrome-remote-desktop_current_amd64.deb
をダウンロードし、次のコマンドを実行して必要なライブラリ一式とChrome Remote Desktopアプリをインストールする
$ sudo apt-get install xvfb xserver-xorg-video-dummy xbase-clients python3-packaging $ $ python3-psutil libutempter0
$ sudo dpkg -i chrome-remote-desktop_current_amd64.deb
私の環境では音声のリダイレクトも問題なく動作し、かつ xrdp
よりもサクサク動作した。特にスクロールの動きが良い。これは、xrdp
が静止画のリモート画面をローカルに送っているが、Chrome Remote Desktopは動画でリモート画面をローカルに送っている違いによるものだと思われる。
Android Studioのインストールと設定
公式サイト
64bit環境の場合には32bitのライブラリをインストールする
$ sudo dpkg --add-architecture i386
$ sudo apt update
$ sudo apt-get install libc6:i386 libncurses5:i386 libstdc++6:i386 lib32z1 libbz2-1.0:i386
Android Studioのインストール
$ cd ~
$ tar zxvf ~Download/android-studio-2023.3.1.19-linux.tar.gz
Android Studioの実行
$ ~/android-studio/bin/studio.sh
今後の開発のことを考慮してstudio.sh
にPATHを通しておく
# vi .bashrc
export PATH=$PATH:/home/raiko/android-studio/bin
export PATH=$PATH:/home/raiko/Android/Sdk/platform-tools
Android StudioでAndroidのEmulatorを動作させる
Emulatorが正常に起動しない場合がある。Emulatorの ...
ボタンから edit
を選択した際に
“/dev/kvm device: permission denied.”
のエラーが発生する場合には下記で対処する。
Android Studioを起動する$USERをkvmのグループに追加して再起動する。
$ sudo adduser $USER kvm
[sudo] password for raiko:
info: Adding user `raiko' to group `kvm' ...
$ groups $USER
raiko : raiko adm cdrom sudo dip plugdev users kvm lpadmin
$ sudo reboot now