X11

在 Linux 上运行一些图形化软件:https://x.org,类似的还有 Wayland:https://wayland.freedesktop.org

 

一、安装

Windows 上 Xstart 安装:https://www.cnblogs.com/jhxxb/p/10672634.html

CentOS 环境安装(X11-forwarding)

# IDEA
sudo yum install -y xorg-x11-xauth
sudo yum install -y libXtst.x86_64 libXrender.x86_64

# 查看
sudo yum group list

# 安装
sudo yum group install -y "X Window System"
sudo yum install -y xterm

Debain 环境安装(X11-forwarding)

sudo apt-get install xorg
export DISPLAY=:0.0

设置

sudo vim /etc/ssh/sshd_config

#AllowAgentForwarding yes
#AllowTcpForwarding yes
#GatewayPorts no
X11Forwarding yes
#X11DisplayOffset 10
X11UseLocalhost no

sudo systemctl restart sshd.service

安装字体:https://www.jetbrains.com/zh-cn/lp/mono,mono 字体没有中文

# 安装工具
sudo yum install -y fontconfig mkfontscale
sudo apt install -y fontconfig xfonts-utils

# 查看已安装字体
fc-list
# 查看已安装中文字体
fc-list :lang=zh

# 安装字体
# 可以把 C:\Windows\Fonts 下的 msyh.ttf(或 msyh.ttc,微软雅黑) 复制到 Linux 的 /usr/share/fonts/ 目录下,或复制到 ~/.fonts/ 或 ~/.local/share/fonts/ 目录
sudo cp /mnt/c/Windows/Fonts/msyh.ttc /usr/share/fonts/
# 注意字体文件权限和所有者

# 刷新字体缓存
cd /usr/share/fonts/
mkfontscale
mkfontdir
fc-cache -vf

IDEA 中无法打开 MarkDown,提示 Could not initialize class org.intellij.plugins.markdown.ui.preview.jcef.MarkdownJCEFHtmlPanel

yum install -y libXss*

IDEA 提示 libfontmanager.so: libfreetype.so.6: cannot open shared object file: No such file or directory

sudo apt install -y fontconfig

IDEA 提示 libawt_xawt.so: libXrender.so.1: cannot open shared object file: No such file or directory 或 java.lang.NoClassDefFoundError: Could not initialize class java.awt.Toolkit

sudo apt install -y libxrender-dev libxtst-dev

WSL 添加桌面图标:"C:\Program Files\WSL\wslg.exe" -d Ubuntu-22.04 /home/my/clion/bin/clion.sh

 

二、使用

打开 Xmanager,新建会话

执行命令选择第二个

/usr/bin/xterm -ls -display $DISPLAY

直接打开的命令行不好用。右键使用 SSH 打开(用的是 Xshell)

安装一个时钟,测试一下效果

# 安装
yum install -y xclock

# 运行
xclock

另外 Xming 也能达到同样的效果

 


https://putty.org

https://sourceforge.net/projects/xming

https://einverne.github.io/post/2015/10/install-fonts-under-linux.html

posted @ 2019-04-08 19:19  江湖小小白  阅读(2381)  评论(0编辑  收藏  举报