Rocky linux8.5安装vncserver

发布时间:2022-09-07 04:30

在Rocky linux8.5下安装vncserver。
首先更新一下系统:

dnf upgrade

查看可用的包组:

dnf group list

得到下面的显示:

Available Environment Groups:
   Server with GUI
   Server
   Workstation
   Virtualization Host
   Custom Operating System
Installed Environment Groups:
   Minimal Install
Available Groups:
   Container Management
   .NET Core Development
   RPM Development Tools
   Development Tools
   Graphical Administration Tools
   Headless Management
   Legacy UNIX Compatibility
   Network Servers
   Scientific Support
   Security Tools
   Smart Card Support
   System Tools

安装 Gnome 桌面,Gnome桌面包含在“Server with GUI”里面:

dnf groupinstall "Server with GUI" -y

安装vncserver:

dnf install tigervnc-server

复制文件:

cp /lib/systemd/system/vncserver@.service /etc/systemd/system/vncserver@:2.service
#这里的数字是启动vnc的端口号,我用的2表示端口号是5902,也就是加上了一个5900

修改模板文件,替换其中的[Service】部分:
vim /etc/systemd/system/vncserver@:2.service

[Service]
Type=forking
User=root
# Clean any existing files in /tmp/.X11-unix environment
ExecStartPre=-/usr/bin/vncserver -kill %i
ExecStart=/sbin/runuser -l root -c "/usr/bin/vncserver %i"
PIDFile=/root/.vnc/%H%i.pid
ExecStop=-/usr/bin/vncserver -kill %i

设置vnc密码,这里输入两次密码,然后键入n,表示不启动单独查看用的密码:

vncpasswd

启动vncserver:

systemctl start vncserver@:2.service

最后不要忘了在相应的防火墙打开外网对5902端口的访问

ItVuer - 免责声明 - 关于我们 - 联系我们

本网站信息来源于互联网,如有侵权请联系:561261067@qq.com

桂ICP备16001015号