龙蜥anolis8.6部署桌面环境+tigervnc服务
1、配置yum源(可以选择配置本地yum仓库的源,这里使用官方yum源)
将原/etc/yum.repo.d/* 备份
#mkdir /etc/yum.repo.d/bak
#mv /etc/yum.repo.d/*.repo /etc/yum.repo.d/bak
在/etc/yum.repo.d/编辑文件anolis8.6.repo,复制以下内容到文件,保存退出
[AppStream]
name=AnolisOS-$releasever - AppStream
baseurl=http://mirrors.openanolis.cn/anolis/8.6/AppStream/$basearch/os
enabled=1
gpgkey=https://mirrors.openanolis.cn/anolis/RPM-GPG-KEY-ANOLIS
gpgcheck=1
[BaseOS]
name=AnolisOS-$releasever - BaseOS
baseurl=http://mirrors.openanolis.cn/anolis/8.6/BaseOS/$basearch/os
enabled=1
gpgkey=https://mirrors.openanolis.cn/anolis/RPM-GPG-KEY-ANOLIS
gpgcheck=1
[DDE]
name=AnolisOS-$releasever - DDE
baseurl=http://mirrors.openanolis.cn/anolis/8.6/DDE/$basearch/os
enabled=1
gpgkey=https://mirrors.openanolis.cn/anolis/RPM-GPG-KEY-ANOLIS
gpgcheck=1
[Plus]
name=AnolisOS-$releasever - Plus
baseurl=http://mirrors.openanolis.cn/anolis/8.6/Plus/$basearch/os
enabled=1
gpgkey=https://mirrors.openanolis.cn/anolis/RPM-GPG-KEY-ANOLIS
gpgcheck=1
[PowerTools]
name=AnolisOS-$releasever - PowerTools
baseurl=http://mirrors.openanolis.cn/anolis/8.6/PowerTools/$basearch/os
enabled=1
gpgkey=https://mirrors.openanolis.cn/anolis/RPM-GPG-KEY-ANOLIS
gpgcheck=1
#清空缓存,重新创建索引
#yum clean all && yum makecache
2、安装GUI桌面环境
#yum groupinstall "Server with GUI"
运行以下命令以启用图形模式
#systemctl set-default graphical
重新启动系统,以便获得GNOME登录屏幕
#reboot
一旦系统成功重启,请取消注释文件“ /etc/gdm/custom.conf”中的“ WaylandEnable=false”行,以便通过vnc进行的远程桌面会话请求由GNOME桌面的xorg处理,代替了Wayland显示管理器。
# GDM configuration storage
[daemon]
# Uncomment the line below to force the login screen to use Xorg
WaylandEnable=false
[security]
[xdmcp]
[chooser]
[debug]
# Uncomment the line below to turn on debugging
#Enable=true
3、安装tigervnc-server
#yum -y install tigervnc-server
为本地用户设置VNC密码,这里需要注意的是为X用户设置密码,则请切换到X用户登录,这里演示使用root
# vncpasswd
Password:密码
Verify:确认密码
Would you like to enter a view-only password (y/n)? n
A view-only password is not used
修改/etc/tigervnc/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
启动vnc服务,配置多个用户时命令对应数字请记得修改
#systemctl daemon-reload
#加载配置文件
#systemctl start vncserver@:1.service
#启动服务
#systemctl status vncserver@:1.service
#查看服务是否正常运行
#systemctl enable vncserver@:1.service
#设置开机自启动
4、验证服务运行状态,端口是否正常启动
# systemctl status vncserver@:1.service
● vncserver@:1.service - Remote desktop service (VNC)
Loaded: loaded (/usr/lib/systemd/system/[email protected]; disabled; vendor preset: disabled)
Active: active (running) since Thu 2024-09-05 14:37:48 CST; 1min 28s ago
Process: 4009 ExecStart=/usr/libexec/vncsession-start :1 (code=exited, status=0/SUCCESS)
Process: 3995 ExecStartPre=/usr/libexec/vncsession-restore :1 (code=exited, status=0/SUCCESS)
Main PID: 4016 (vncsession)
Tasks: 0 (limit: 48353)
Memory: 788.0K
CGroup: /system.slice/system-vncserver.slice/vncserver@:1.service
‣ 4016 /usr/sbin/vncsession root :1
Sep 05 14:37:48 iZip801dildms407ibe28lZ systemd[1]: Starting Remote desktop service (VNC)...
Sep 05 14:37:48 iZip801dildms407ibe28lZ systemd[1]: Started Remote desktop service (VNC).
# netstat -anpt |grep 5901
tcp 0 0 0.0.0.0:5901 0.0.0.0:* LISTEN 4028/Xvnc
tcp6 0 0 :::5901 :::* LISTEN 4028/Xvnc
# ps -ef |grep vnc
root 4016 1 0 14:37 ? 00:00:00 /usr/sbin/vncsession root :1
root 4017 4016 0 14:37 ? 00:00:00 xinit /etc/X11/xinit/Xsession gnome-session -- /usr/bin/Xvnc :1 -auth /root/.Xauthority -desktop iZip801dildms407ibe28lZ:1 (root) -fp catalogue:/etc/X11/fontpath.d -pn -rfbauth /root/.vnc/passwd -rfbport 5901
root 4028 4017 0 14:37 ? 00:00:00 /usr/bin/Xvnc :1 -auth /root/.Xauthority -desktop iZip801dildms407ibe28lZ:1 (root) -fp catalogue:/etc/X11/fontpath.d -pn -rfbauth /root/.vnc/passwd -rfbport 5901
root 4887 2413 0 14:40 pts/0 00:00:00 grep --color=auto vnc