ArchLinux创建多用户VNC

1.安装xfce4

[root@vmSrv srv]# pacman -S xorg xfce4 xfce4-goodies alsa-utils kmix pipewire-pulse pavucontrol

2安装LightDM(如果你需要在显示器里面登录)

[root@vmSrv srv]# pacman -S lightdm lightdm-gtk-greeter
[root@vmSrv srv]# systemctl enable lightdm

2.安装一些依赖软件

 [root@vmSrv srv]# pacman -S tigervnc novnc websockify
 [root@vmSrv software]# pacman -U websockify-0.12.0-1-any.pkg.tar.zst novnc-1.4.0-1-any.pkg.tar.zst

3.设置文字环境

[root@vmSrv srv]# pacman -S wqy-microhei wqy-microhei-lite wqy-bitmapfont wqy-zenhei ttf-arphic-ukai ttf-arphic-uming adobe-source-han-sans-cn-fonts adobe-source-han-serif-cn-fonts noto-fonts-cjk

nano -w /etc/locale.conf

LANG=en_US.UTF-8
LANGUAGE=zh_CN:zh:en_US:en
LC_ALL=C
LC_COLLATE=C
LC_MESSAGES=C
LC_TIME=en_US.UTF-8
SUPPORTED=zh_CN.UTF-8:zh_CN:zh:en_US.UTF-8:en_US:en

4.安装浏览器和中文输入法
[root@vmSrv srv]# pacman -S fcitx5-im fcitx5-chinese-addons fcitx5-material-color

nano -w /etc/environment

#
# This file is parsed by pam_env module
#
# Syntax: simple "KEY=VAL" pairs on separate lines
#
LANG=en_US.UTF-8
LANGUAGE=zh_CN:zh:en_US:en

GTK_IM_MODULE=fcitx
QT_IM_MODULE=fcitx
XMODIFIERS=@im=fcitx
SDL_IM_MODULE=fcitx
GLFW_IM_MODULE=ibus


5.配置TigerVNC

[root@vmSrv srv]# useradd -m zeno
[root@vmSrv srv]# passwd zeno
[root@vmSrv srv]# su – zeno
[zeno@vmSrv srv]# vncpasswd
[zeno@vmSrv srv]# exit

[root@vmSrv srv]# nano -w /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
:2=zeno

[root@vmSrv srv]# su – zeno
[zeno@vmSrv srv]# mkdir -p ~/.config/vnc/ && nano ~/.config/vnc/config

session=xfce4
geometry=1920x1080
#localhost
alwaysshared

nano -w ~/.config/vnc/xstartup

#!/bin/sh

# Start the window manager
unset SESSION_MANAGER
unset DBUS_SESSION_BUS_ADDRESS
exec /usr/bin/startxfce4 &

[root@vmSrv srv]$ nano /usr/bin/vncsrv.sh

#!/bin/bash
#
#  Copyright 2019 Pierre Ossman for Cendio AB
#
#  This is free software; you can redistribute it and/or modify
#  it under the terms of the GNU General Public License as published by
#  the Free Software Foundation; either version 2 of the License, or
#  (at your option) any later version.
#
#  This software is distributed in the hope that it will be useful,
#  but WITHOUT ANY WARRANTY; without even the implied warranty of
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#  GNU General Public License for more details.
#
#  You should have received a copy of the GNU General Public License
#  along with this software; if not, write to the Free Software
#  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,
#  USA.
#

USERSFILE="/etc/tigervnc/vncserver.users"
CMD=/usr/bin/vncsession

if [ $# -ne 1 ]; then
        echo "Syntax:" >&2
        echo "    $0 <display>" >&2
        exit 1
fi

if [ ! -f "${USERSFILE}" ]; then
        echo "Users file ${USERSFILE} missing" >&2
        exit 1
fi

DISPLAY="$1"

USER=`grep "^ *${DISPLAY}=" "${USERSFILE}" 2>/dev/null | head -1 | cut -d = -f 2- | sed 's/ *$//g'`

if [ -z "${USER}" ]; then
        echo "No user configured for display ${DISPLAY}" >&2
        exit 1
fi

cd /home/${USER}/

exec "/usr/bin/vncsession" "${USER}" "${DISPLAY}"

[root@vmSrv srv]$ systemctl enable vncserver@:2
[root@vmSrv srv]$ systemctl start vncserver@:2

6.配置noVNC

[root@vmSrv srv]$ systemctl enable novnc@localhost:5902
[root@vmSrv srv]$ systemctl start novnc@localhost:5902

关于Zeno Chen

本人涉及的领域较多,杂而不精 程序设计语言: Perl, Java, PHP, Python; 数据库系统: MySQL,Oracle; 偶尔做做电路板的开发,主攻STM32单片机
此条目发表在Linux, 默认分类分类目录。将固定链接加入收藏夹。