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?

github codespacesでLinux(LXDE)を走らせる方法

Last updated at Posted at 2025-10-27

はじめに

Github CodeSpaecsでLinuxを走らせる方法を解説します。
※すでにリポジトリは作成しているものとします。
(追記)1.の内容をスキップできるテンプレートリポジトリを作成しました。
https://github.com/roiroi140/BrowserRunLinux

環境

・Github CodeSpaces(VScode)

テンプレートリポジトリの使用方法

上記のURLを開き、右上の「Use this template」から「Create a new repository」をクリックし、repositoryを作成するだけ。

1.devcontainer.jsonファイルを作成する

/workspaces/[リポジトリ名]/.devcontainerにdevcontainer.jsonファイルを作成し、以下のコードを記述します。

{
  "name": "Ubuntu Desktop",
  "image": "dorowu/ubuntu-desktop-lxde-vnc",
  "forwardPorts": [6080],
  "overrideCommand": false,
  "containerEnv": {
    "NOVNC_PORT": "6080",
    "VNC_PORT": "5900"
  },
  "settings": { 
    "terminal.integrated.shell.linux": "/bin/bash"
  },
  "extensions": [],
  "remoteUser": "root"
}

記述できたら、右下に出てくるrebuild containerか、F1で表示されるメニューからrebuild containerを押し、コンテナを再起動します。

2.80番ポートを追加する

次に、ctrl+jから表示できる下メニューの中にあるポートを押してポート欄を開き、青い「ポートを追加」というボタンを押し、80と入力してEnterします。

3.noVNCサーバーを起動する

次に、Codespaces内のターミナルで以下のコマンドを実行します。

$ startlxde &
$ x11vnc -display :1 -nopw -forever -bg
$ websockify --web=/usr/share/novnc/ 80 localhost:5900 &

ここまでできたら完了です!

4.起動する

ポートタブから、80番ポートにカーソルを合わせ、ブラウザで開く(地球のマーク)をクリックし暫く待つとGUIが表示されます!

トラブルシューティング

80番ポートを開いても真っ白

A.待ちましょう。再起動しても良いです。

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?