赞
踩
前提:Ubuntu Server安装好后,ubantu其他版本是否适用这里未知,欢迎大佬们前来评论
sudo apt-get update
sudo apt-get upgrade
sudo apt-get -y install ubuntu-desktop // 桌面程序
sudo apt-get -y install wine //wine(Windows兼容层程序)
reboot
sudo apt update
sudo apt install gnome-panel gnome-settings-daemon metacity nautilus gnome-terminal ubuntu-desktop
sudo apt install tightvncserver
首次启动需要设置密码两次
注意输入两次密码
更改密码:sudo vncpasswd
sudo mv ~/.vnc/xstartup ~/.vnc/xstartup.bak
sudo vim ~/.vnc/xstartup
写入内容
#!/bin/sh
unset SESSION_MANAGER
unset DBUS_SESSION_BUS_ADDRESS
export XKL_XMODMAP_DISABLE=1
export XDG_CURRENT_DESKTOP="GNOME-Flashback:GNOME"
export XDG_MENU_PREFIX="gnome-flashback-"
[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
xsetroot -solid grey
vncconfig -iconic &
#gnome-terminal &
#nautilus &
gnome-session --session=gnome-flashback-metacity --disable-acceleration-check &
sudo chmod 777 ~/.vnc/xstartup
sudo vim /etc/init.d/vncserver
写入内容
#!/bin/sh ### BEGIN INIT INFO # Provides: tightvncserver # Required-Start: $syslog $remote_fs $network # Required-Stop: $syslog $remote_fs $network # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: Starts VNC Server on system start. # Description: Starts tight VNC Server. Script written by James Swineson. ### END INIT INFO # /etc/init.d/vncserver VNCUSER='cnki' case "$1" in start) #以pi用户运行'vncserver :1'指令,如果使用的是其他VNC 直接替换成对应的启动命令即可 su $VNCUSER -c 'vncserver :1' echo "Starting VNC Server for $VNCUSER" ;; stop) su $VNCUSER -c 'vncserver -kill :1' echo "TightVNC Server stopped" ;; *) echo "Usage: /etc/init.d/vncserver {start|stop}" exit 1 ;; esac exit 0
sudo chmod 755 /etc/init.d/vncserver
sudo update-rc.d vncserver defaults
sudo apt update
sudo apt install xfce4 xfce4-goodies
sudo apt install tigervnc-standalone-server
注意需要输入两次密码
vncpasswd
修改这个文件,更换成:
~/.vnc/xstartup
内容
#!/bin/sh
unset SESSION_MANAGER
unset DBUS_SESSION_BUS_ADDRESS
exec startxfce4
chmod u+x ~/.vnc/xstartup
vncserver -localhost no
如果访问失败,可能是iptables被限制了
sudo vim /etc/iptables/rules.v4
大概如下,请根据自身情况而定:
# Generated by iptables-save v1.8.7 on Sat Sep 16 15:22:31 2023 *filter :INPUT ACCEPT [0:0] :FORWARD ACCEPT [0:0] :OUTPUT ACCEPT [539324:46894725] -A INPUT -s 10.15.6.0/24 -p tcp -m multiport --dports 19911,2181,5901 -j ACCEPT -A INPUT -s 10.21.0.0/24 -p tcp -m tcp --dports 19911,5901 -j ACCEPT -A INPUT -s 10.11.0.0/24 -p tcp -m tcp --dports 19911,5901 -j ACCEPT -A INPUT -s 10.1.0.0/24 -p tcp -m tcp --dports 19911,5901 -j ACCEPT -A INPUT -s 10.0.0.0/24 -p tcp -m tcp --dports 19911,5901 -j ACCEPT -A INPUT -s 10.200.0.0/24 -p tcp -m tcp --dports 19911,5901 -j ACCEPT -A INPUT -p icmp -m icmp --icmp-type any -j ACCEPT -A INPUT -m addrtype --src-type LOCAL -j ACCEPT -A INPUT -s 10.0.0.0/8 -p tcp -m multiport --dports 80,443,4567,4568,6789,5901 -j ACCEPT -A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT -A INPUT -j DROP COMMIT # Completed on Sat Sep 16 15:22:31 2023
reboot
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。