LoginSignup
0
2

More than 1 year has passed since last update.

VPS(仮想専用サーバー)環境でXvfb (X virtual framebuffer)を使いたい

Posted at

VPS(仮想専用サーバー)環境でXvfb (X virtual framebuffer)を使いたい

Xvfb (X virtual framebuffer) は X Window System の仮想ディスプレイを作ることのできるソフトウェア

VPS上で画像表示を伴うアプリを動かそうとした際に以下のようなエラーメッセージが出た場合の解決策

Traceback (most recent call last):
  File "game_manager/game_manager.py", line 5, in <module>
    from PyQt5.QtWidgets import QMainWindow, QFrame, QDesktopWidget, QApplication, QHBoxLayout, QLabel
ImportError: libGL.so.1: cannot open shared object file: No such file or directory
qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "" even though it was found.
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.

Available platform plugins are: eglfs, linuxfb, minimal, minimalegl, offscreen, vnc, wayland-egl, wayland, wayland-xcomposite-egl, wayland-xcomposite-glx, webgl, xcb.
qt.qpa.xcb: could not connect to display localhost:10.0

以下を実行して解決

sudo apt install -y libgl1-mesa-glx
sudo apt -y update && sudo apt install -y ffmpeg libsm6 libxext6
sudo apt install -y libxkbcommon-x11-0
sudo apt -y install libxkbcommon-x11-0 libxcb-icccm4 libxcb-image0 libxcb-keysyms1 libxcb-render-util0 libxcb-xinerama0
sudo apt install -y xvfb
export DISPLAY=:1
Xvfb -ac ${DISPLAY} -screen 0 1280x780x24 &

参考

ImportError: libGL.so.1: cannot open shared object file: No such file or directory
PyQt5をUbuntuで使うときにGUI周りでエラー (WSL2)

0
2
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
0
2