在被连接的服务器上
sudo apt-get install vnc4server
可以使用以下两个命令来增加进程和结束进程:
vncserver :2
vncserver -kill: 2
配置图形界面:
# 安装gnome桌面
sudo apt-get install gnome-panel gnome-settings-daemon metacity nautilus gnome-terminal
# gnome整体(不推荐)
# sudo apt install gnome
vi ~/.vnc/xstartup
#!/bin/sh
#Uncomment the following two lines for normal desktop:
export XKL_XMODMAP_DISABLE=1
unset SESSION_MANAGER
#exec /etc/X11/xinit/xinitrc
unset DBUS_SESSION_BUS_ADDRESS
gnome-panel &
gnome-settings-daemon &
metacity &
nautilus &
gnome-terminal &
# 安装x-windows
sudo apt-get install x-window-system-core
# 安装登陆管理器
sudo apt-get install gdm
# 安装ubuntu桌面:
sudo apt-get install ubuntu-desktop
杀掉vnc进程:
vncserver -kill :1
调整分辨率:
vim /usr/bin/vncserver
在本地电脑上
下载vnc viewer
,具体很简单,自行查找方法;
遇到的问题
# 上面的方法完成后出现桌面,但是整个桌面没有开始菜单,并且无法打开终端
# 使用xfce4
sudo apt install xfce4
# 修改startup
vi ~/.vnc/xstartup
#!/bin/sh
# Uncomment the following two lines for normal desktop:
# unset SESSION_MANAGER
# exec /etc/X11/xinit/xinitrc
[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
xsetroot -solid grey
vncconfig -iconic &
#x-terminal-emulator -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
#x-window-manager &
#gnome-session &
#xubuntu-session &
#xfce4-terminal &
sesion-manager & xfdesktop & xfce4-panel &
xfce4-menu-plugin &
xfsettingsd &
xfconfd &
xfwm4 &
报错:
Failed to execute default Terminal Emulator.
# 解决:
因为默认的terminal emulator不对,可以在application-settings-settingsmanager-preferred applications中改成xfce或者gnome
# python 运行图形化界面时遇到的问题
no display name and no $DISPLAY environment variable
网友评论