Skip to content

Instantly share code, notes, and snippets.

@sanaehirotaka
Last active May 5, 2023 22:51
Show Gist options
  • Save sanaehirotaka/69da7a7dcc2029a287abc9843fd8cba8 to your computer and use it in GitHub Desktop.
Save sanaehirotaka/69da7a7dcc2029a287abc9843fd8cba8 to your computer and use it in GitHub Desktop.
Google Compute Engine でUbuntu Desktop (KDE)環境を構築してリモートデスクトップから接続する

Google Compute Engine でUbuntu Desktop (KDE)環境を構築してリモートデスクトップから接続する

インスタンスの作成時にブートディスクとしてUbuntu 20.04 TLSを使用。 可用性ポリシーからプリエンプティブをオンにするとかなり金額を低くできる(ただし24時間以内に必ずシャットダウンされるようになる)

言語・キーボード・タイムゾーンの設定

sudo localectl set-locale LANG=ja_JP.UTF-8 LANGUAGE="ja_JP:ja"
sudo locale-gen --purge "ja_JP.UTF-8"
sudo dpkg-reconfigure --frontend noninteractive locales

sudo ln -fs /usr/share/zoneinfo/Asia/Tokyo /etc/localtime
sudo dpkg-reconfigure --frontend noninteractive tzdata

Kubuntu Desktopと日本語入力インストール(fcitx)

参考 https://help.ubuntu.com/community/InstallingKDE

sudo apt update
sudo apt -y upgrade
sudo apt install aptitude
sudo aptitude install kde-plasma-desktop fcitx-mozc

Polkitの設定

$sudo nano /etc/polkit-1/localauthority/50-local.d/org.freedesktop.color-manager.pkla

[ColorManager]
Identity=unix-user:*
Action=org.freedesktop.color-manager.*
ResultAny=yes
ResultInactive=yes
ResultActive=yes

$sudo nano /etc/polkit-1/localauthority/50-local.d/org.freedesktop.NetworkManager.pkla

[NetworkManager]
Identity=unix-user:*
Action=org.freedesktop.NetworkManager.*
ResultAny=yes
ResultInactive=yes
ResultActive=yes

ファイアウォールの設定

$sudo ufw limit ssh
$sudo ufw enable

再起動

$sudo reboot

追加の設定

スワップ領域の追加

とりあえず2GBで設定

sudo dd if=/dev/zero of=/swap bs=2M count=1024
sudo chmod 0600 /swap
sudo mkswap /swap
sudo swapon /swap
echo "/swap none swap sw 0 0" | sudo tee -a /etc/fstab

Google Chromeのインストール

wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
sudo apt -y install ./google-chrome-stable_current_amd64.deb

Chrome Remote Desktopの設定

SSHからのセットアップ https://remotedesktop.google.com/headless?hl=ja

wget https://dl.google.com/linux/direct/chrome-remote-desktop_current_amd64.deb
sudo apt -y install ./chrome-remote-desktop_current_amd64.deb

追加で、Chrome Remote Desktopを使うときにXセッションの選択が毎回出てきて煩わしいのでXsessionを固定する

echo "exec /etc/X11/Xsession /usr/bin/startplasma-x11" | sudo tee -a /etc/chrome-remote-desktop-session

Ubuntuユーザーのパスワードを設定

デスクトップ操作中にパスワードを聞かれた場合、ubuntuユーザーのパスワードを入れる必要がある

sudo passwd ubuntu

インストール後のメモ

  • キーボードがUSになっているのでJapaneseを追加
  • スクリーンロックの設定を外す
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment