CentOS使用VNC远程图形桌面并使用MobaXterm连接

//系统,关闭SELinux
CentOS Linux release 7.7.1908 (AltArch)
//firewall设置或关闭
# firewall-cmd --zone=public --permanent --add-service=vnc-server
# firewall-cmd --zone=public --permanent --add-port=5901/tcp
//安装vnc
# yum install tigervnc-server tigervnc-server-module -y
# cat /etc/sysconfig/vncservers 
# THIS FILE HAS BEEN REPLACED BY /lib/systemd/system/[email protected]

# cp /lib/systemd/system/[email protected] /etc/systemd/system/vncserver\@\:1.service
# vncpasswd	//设置vnc的链接密码
# cat /etc/systemd/system/vncserver@\:1.service | grep -vE '^#|^$' 		//vncserver@\:1.service的设置
------------------------
[Unit]
Description=Remote desktop service (VNC)
After=syslog.target network.target
[Service]
Type=forking
User=root
ExecStartPre=-/usr/bin/vncserver -kill %i
ExecStart=/usr/bin/vncserver %i
PIDFile=/root/.vnc/%H%i.pid
ExecStop=/bin/sh -c '/usr/bin/vncserver -kill %i > /dev/null 2>&1 || :'
[Install]
WantedBy=multi-user.target
------------------------
//注:用 root 的话用把/home/root/.vnc/%H%i.pid 改为/root/.vnc/%H%i.pid

//相关启动命令
# systemctl daemon-reload 
# systemctl start vncserver@:1.service
# systemctl enable vncserver@:1.service
//查看端口监听
# lsof -i:5901

//其他有用命令
# vncserver -kill :1	//kill指定id的连接
# vncserver :1	//打开指定id的连接


CentOS使用VNC远程图形桌面并使用MobaXterm连接_第1张图片

你可能感兴趣的:(Raspberry,Pi)