远程服务器配置gnome桌面环境,并在本地用tightvnc登录
【摘要】 systemctl get-defaultsystemctl status lightdmsystemctl status gdm3sudo apt remove --purge remmina-plugin-vnc tigervnc-common tigervnc-standalone-server tigervnc-toolssudo apt install libevdocument3...
systemctl get-default
systemctl status lightdm
systemctl status gdm3
sudo apt remove --purge remmina-plugin-vnc tigervnc-common tigervnc-standalone-server tigervnc-tools
sudo apt install libevdocument3-4 libevview3-3 ghostscript cups openvpn alsa-base
sudo killall apt apt-get dpkg
sudo rm /var/lib/dpkg/lock-frontend
sudo rm /var/lib/dpkg/lock
sudo apt clean
sudo apt autoclean
sudo dpkg --configure -a
sudo apt install -f
sudo apt install ubuntu-gnome-desktop -y
sudo apt install tightvncserver
sudo apt install openbox
sudo ufw allow 5901
#sudo apt install tigervnc-standalone-server -y 这个不用安装,安装tight版本
sudo apt install xfonts-100dpi xfonts-75dpi xfonts-base
touch ~/.Xresources
sudo nano /etc/vnc.conf
sudo apt install xterm
输入如下内容
$fontPath = "/usr/share/fonts/X11/misc,/usr/share/fonts/X11/Type1,/usr/share/fonts/X11/100dpi,/usr/share/fonts/X11/75dpi";
nano ~/.vnc/xstartup
chmod +x ~/.vnc/xstartup
输入如下内容
#!/bin/bash
export $(dbus-launch) # 主要是这句
export XKL_XMODMAP_DISABLE=1
unset SESSION_MANAGER
gnome-panel &
gnome-settings-daemon &
metacity &
nautilus &
gnome-terminal &
# [ -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" &
gnome-session &
vncserver :1
然后本地命令行
ssh -L 5901:localhost:5901 -p 21022 ucas1@frp.mybi.top
然后在tightvnc中localhost:1
其他相关指令
tigervncserver -xstartup /usr/bin/xterm :1 #测试相关功能
vncserver -list
开启启动:
sudo vim /etc/init.d/tightvncserver
sudo chmod +x /etc/init.d/tightvncserver
换成自己的用户名
#!/bin/sh
### BEGIN INIT INFO
# Provides: tightvncserver
# Required-Start: $local_fs
# Required-Stop: $local_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start/stop tightvncserver
### END INIT INFO
# More details see:
# http://www.penguintutor.com/linux/tightvnc
### Customize this entry
# Set the USER variable to the name of the user to start tightvncserver under
export USER='ucas1'
### End customization required
eval cd ~$USER
case "$1" in
start)
# 启动命令行。此处自定义分辨率、控制台号码或其它参数。
su $USER -c '/usr/bin/tightvncserver :1'
#su $USER -c '/usr/bin/tightvncserver -depth 16 -geometry 1928x1080 -dpi 100 :1'
echo "Starting TightVNC server for $USER "
;;
stop)
# 终止命令行。此处控制台号码与启动一致。
su $USER -c '/usr/bin/tightvncserver -kill :1'
echo "Tightvncserver stopped"
;;
*)
echo "Usage: /etc/init.d/tightvncserver {start|stop}"
exit 1
;;
esac
exit 0
【版权声明】本文为华为云社区用户原创内容,转载时必须标注文章的来源(华为云社区)、文章链接、文章作者等基本信息, 否则作者和本社区有权追究责任。如果您发现本社区中有涉嫌抄袭的内容,欢迎发送邮件进行举报,并提供相关证据,一经查实,本社区将立刻删除涉嫌侵权内容,举报邮箱:
cloudbbs@huaweicloud.com
- 点赞
- 收藏
- 关注作者
评论(0)