admin 发表于 2024-7-23 17:03:30

centos9 stream 安装vncserver

centos9 stream 安装vncserver




yum install -y xdpyinfo



yum install -y tigervnc tigervnc-server



vncserver

WARNING: vncserver has been replaced by a systemd unit and is now considered deprecated and removed in upstream.
Please read /usr/share/doc/tigervnc/HOWTO.md for more information.

Warning: python-flask:1 is taken because of /tmp/.X1-lock
Remove this file if there is no X server python-flask:1

You will require a password to access your desktops.

Password:
Verify:
Would you like to enter a view-only password (y/n)? y
Password:
Verify:

New 'python-flask:2 (root)' desktop is python-flask:2

Creating default startup script /root/.vnc/xstartup
Creating default config /root/.vnc/config
Starting applications specified in /root/.vnc/xstartup
Log file is /root/.vnc/python-flask:2.log

修改vncserver.users文件使用如下的命令修改文件
vim /etc/tigervnc/vncserver.users


# TigerVNC User assignment
#
# This file assigns users to specific VNC display numbers.
# The syntax is <display>=<username>. E.g.:
#
# :2=andrew
# :3=lisa
:1=root
:2=devops


修改vncserver-config-defaults使用如下的命令修改文件vim /etc/tigervnc/vncserver-config-defaultssession=gnomesecuritytypes=vncauth,tlsvncdesktop=sandboxgeometry=2000x1200
alwaysshared
其中localhost需要注释掉,否则将不能进行外部访问



修改vncserver-config-mandatory使用如下的命令修改文件vim /etc/tigervnc/vncserver-config-mandatorygeometry=2000x1200securitytypes=vncauth,tlsvncdesktop=sandbox#geometry=2000x1200
alwaysshared同理,需要将localhost注释修改config使用如下的命令修改文件 vim $HOME/.vnc/configsession=gnomegeometry=1000x1200

复制vncserver@x.service
cp /lib/systemd/system/vncserver@.service /etc/systemd/system/vncserver@:1.service




vncpasswd
Password:
Verify:
Would you like to enter a view-only password (y/n)? n
A view-only password is not used




# systemctl restart vncserver@:1
# systemctl status vncserver@:1
○ vncserver@:1.service - Remote desktop service (VNC)
   Loaded: loaded (/etc/systemd/system/vncserver@:1.service; enabled; preset: disabled)
   Active: inactive (dead) since Tue 2024-07-23 17:20:19 CST; 1s ago
   Duration: 17ms
    Process: 5203 ExecStartPre=/usr/libexec/vncsession-restore :1 (code=exited, status=0/SUCCESS)
    Process: 5214 ExecStart=/usr/libexec/vncsession-start :1 (code=exited, status=0/SUCCESS)
   Main PID: 5221 (code=exited, status=0/SUCCESS)
      CPU: 23ms

7月 23 17:20:18 python-flask systemd: Starting Remote desktop service (VNC)...
7月 23 17:20:18 python-flask systemd: Started Remote desktop service (VNC).
7月 23 17:20:19 python-flask systemd: vncserver@:1.service: Deactivated successfully.



至此vncserver安装完成。

admin 发表于 2024-7-23 17:25:59

# firewall-cmd --add-port=5900-6000/tcp --permanent
success
# firewall-cmd --reload
success
页: [1]
查看完整版本: centos9 stream 安装vncserver