vnc-server
vnc-server是一个可视化的图形界面的管理工具,在Linux安装上相应的服务之后。在Windows端就可以打开一个图形的终端就行控制。
#装图形界面
[root@gby ~]# yum -y group install "Server with GUI"
[root@gby ~]# yum update
#安装vnc软件
[root@gby ~]# yum -y install tigervnc-server
[root@gby ~]# reboot
#切换普通用户
[root@gby ~]# su - gby
Last login: Mon Mar 27 15:40:11 CST 2023 on pts/0
[gby@gby ~]$ vncpasswd
Password: #密码
Verify: #密码
Would you like to enter a view-only password (y/n)? n #是否要输入仅查看的密码
A view-only password is not used
[gby@gby ~]$ vncserver :30
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.
xauth: file /home/gby/.Xauthority does not exist
New 'gby:30 (gby)' desktop is gby:30
Creating default startup script /home/gby/.vnc/xstartup
Creating default config /home/gby/.vnc/config
Starting applications specified in /home/gby/.vnc/xstartup
Log file is /home/gby/.vnc/gby:30.log
[gby@gby ~]$ vncserver -list
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.
TigerVNC server sessions:
X DISPLAY # PROCESS ID
:30 4679
[gby@gby ~]$ netstat -anpt |grep 5930
(Not all processes could be identified, non-owned process info
will not be shown, you would have to be root to see it all.)
tcp 0 0 0.0.0.0:5930 0.0.0.0:* LISTEN 4679/Xvnc
tcp6 0 0 :::5930 :::* LISTEN 4679/Xvnc
[gby@gby ~]$ exit
logout
[root@gby ~]# systemctl disable firewalld --now
#vnc进程的systemctl文件
[root@gby ~]# cat /etc/systemd/system/vncserver@.service
[Unit]
Description=Remote Desktop VNC Service
After=syslog.target network.target
[Service]
Type=forking
WorkingDirectory=/home/gby
User=gby
Group=gby
ExecStartPre=/bin/sh -c '/usr/bin/vncserver -kill %i > /dev/null 2>&1 || :'
ExecStart=/usr/bin/vncserver -autokill %i
ExecStop=/usr/bin/vncserver -kill %i
[Install]
WantedBy=multi-user.target
[root@gby ~]# systemctl enable vncserver@:30.service --now
Created symlink /etc/systemd/system/multi-user.target.wants/vncserver@:30.service → /etc/systemd/system/vncserver@.service.
[root@gby ~]# systemctl status vncserver@:30.service
● vncserver@:30.service - Remote Desktop VNC Service
Loaded: loaded (/etc/systemd/system/vncserver@.service; enabled; preset: disabled)
Active: active (running) since Sat 2023-04-15 18:16:14 CST; 1min 33s ago
Process: 11105 ExecStartPre=/bin/sh -c /usr/bin/vncserver -kill :30 > /dev/null 2>&1 || : (code=exited, status=0/SUCCESS)
Process: 11111 ExecStart=/usr/bin/vncserver -autokill :30 (code=exited, status=0/SUCCESS)
Tasks: 217 (limit: 23052)
Memory: 465.2M
CPU: 6.656s
CGroup: /system.slice/system-vncserver.slice/vncserver@:30.service
├─11118 /usr/bin/Xvnc :30 -auth /home/gby/.Xauthority -desktop "gby:30 (gby)" -fp catalogue:/etc/X11/fontpath.d -geometry 1024x768 -pn -rfbauth /home/gby/.>
├─11123 sh -c "(/home/gby/.vnc/xstartup; /usr/bin/vncserver -kill :30) >> '/home/gby/.vnc/gby:30.log' 2>&1 &"
├─11124 /bin/sh /home/gby/.vnc/xstartup
├─11125 /usr/libexec/gnome-session-binary
├─11134 dbus-launch --sh-syntax --exit-with-session
├─11135 /usr/bin/dbus-daemon --syslog --fork --print-pid 5 --print-address 7 --session
├─11142 /usr/bin/ssh-agent /etc/X11/xinit/Xclients
├─11154 /usr/libexec/at-spi-bus-launcher
├─11159 /usr/bin/dbus-daemon --config-file=/usr/share/defaults/at-spi2/accessibility.conf --nofork --print-address 3
├─11163 /usr/libexec/gvfsd
├─11168 /usr/libexec/gvfsd-fuse /home/gby/.cache/gvfs -f
├─11187 /usr/bin/gnome-keyring-daemon --start --components=ssh
├─11197 /usr/bin/gnome-shell
├─11212 ibus-daemon --panel disable --xim
结束之有话想说
既然看完了那就赶紧去试试吧骚年。👊