debian最小化+sway安装记录

最小化安装debian(基于虚拟机kwm安装,gui界面virt-manager)

  • 因为虚拟机安装,虚拟机中粘贴复制命令操作不方便,安装ssh服务器便于操作,其它皆未安装。
    image
  • 安装完成后配置ssh允许root密码登录,在/etc/ssh/sshd_config中将PermitRootLogin项设置为yes
    image
  • 重启sshd服务是设置生效systemctl restart sshd

配置网卡

  • debian安装无论你是否选择网络源安装貌似默认会寻找安全源,但是国内很慢,一般断网安装(虚拟机安装前勾选不激活网卡),这样在安装是选择不自动配置网卡,需要安装后自己配置网卡
  • ip a查询网卡网卡信息获取网卡名,比如enp1s0
    # /etc/network/interfaces中添加如下
    allow-hotplug enp1s0
    iface enp1s0 inet dhcp
    
  • 配置完连接网线,启动网卡ifup enp1s0,停用网卡ifdown enp1s0

配置时区及时间同步

  • 如果安装的时候是用英文安装的,则时区不是中国上海,通过命令配置 ln -fs /usr/share/zoneinfo/Asia/ShangHai /etc/localtime
  • 时间同步,安装 sudo apt install systemd-timesyncd, 参考 https://www.likecs.com/show-306698790.html

配置apt软件源 /etc/apt/source.list

tips:注意最小化安装系统没有安装ca-certificates包,会导任何软件源因安全问题无法使用,需要每个软件源的deb后面添加"[trusted=yes]"规避,比如: deb [trusted=yes] xxxx

  1. 本地软件源
    • 光盘作为本地软件源
      • 插入光盘
      • 挂载光盘 mount /dev/sr0 /media/cdrom
      • 执行命令 apt-cdrom ident识别(如果源不可用,执行apt update更新源的时会有相关提示,如果不行在执行apt-cdrom add
      • 规避安全问题 sed -e "s/deb /deb [trusted=yes] /g" -i.bak /etc/apt/source.list(注意命令中的空格)
      • apt update更新成功,安装需要的软件apt -y install ca-certificates sudo vim thunar xfce4-terminal
    • ios镜像文件作为本地软件源
      • 参考https://www.cnblogs.com/smoggy/p/17017112.html
      • 其它参考前面
  2. 国内镜像源,比如清华镜像源tuna(最好通过u盘或者ssh复制文件覆盖进去)
    # /etc/apt/sources.list
    deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye main contrib non-free
    deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye main contrib non-free
    deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye-updates main contrib non-free
    deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye-updates main contrib non-free
    
    deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye-backports main contrib non-free
    deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye-backports main contrib non-free
    
    deb https://mirrors.tuna.tsinghua.edu.cn/debian-security bullseye-security main contrib non-free
    deb-src https://mirrors.tuna.tsinghua.edu.cn/debian-security bullseye-security main contrib non-free
    #deb https://typora.io/linux ./
    
  3. 更新
    apt -y update
    apt -y upgrade
    

修改软件源为testing,更新系统到testing,为了更高的软件版本,谋求可能对wayland更好的支持

  1. 修改源为testing并备份bullseye源
  • sed -e "s/bullseye/testing/g" -i.bullseye /etc/apt/sources.list
  • 最新的testing更新后提示non-free和non-free-firmware分开了,需要修改下sed -e "s/non-free/non-free non-free-firmware" -i /etc/apt/sources.list
  1. 升级系统至testing
    sudo apt-get clean  # 首先清理下apt缓存,否则后面可能会遇到错误
    sudo apt -y update  # 更新apt缓存
    apt -y upgrade            # 更新系统
    sudo apt -y full-upgrade  # 升级系统
    

配置普通用户拥有sudo权限,并且不需要输入密码执行

  • echo "yourname ALL=(ALL:ALL) NOPASSWD:ALL" >> /etc/sudoers
  • 执行sudo命令检查是否sudo配置文件是否有语法错误,如果能正常输入sudo的参数提示信息,就是正确的

后面就可以切换普通账户执行了(sway好像限制了root账户的运行,可能)

安装sway及相关

  • 安装

    sudo apt -y install sway
    sudo apt -y install swayidle	# sway窗口管理器的空闲管理
    sudo apt -y install swaylock	# sway窗口管理器的锁
    sudo apt -y install swaybg	# sway窗口管理的背景图片设置工具
    
  • 让应用运行在wayland上的一些环境变量配置(也包含了fcitx5的相关环境变量配置)向/etc/environment内添加(这块在GitHub上抄的,但是似乎也不太有用)

    # Wayland compatibility
    QT_QPA_PLATFORM         DEFAULT=wayland
    CLUTTER_BACKEND         DEFAULT=wayland
    SDL_VIDEODRIVER         DEFAULT=wayland
    MOZ_ENABLE_WAYLAND=1
    MOZ_WEBRENDER           DEFAULT=1
    XDG_SESSION_TYPE        DEFAULT=wayland
    XDG_CURRENT_DESKTOP     DEFAULT=sway
    
    # QT-related theming
    QT_QPA_PLATFORMTHEME    DEFAULT=qt5ct
    
    # FCITX input-related
    #GLFW_IM_MODULE         DEFAULT=ibus
    GLFW_IM_MODULE          DEFAULT=fcitx
    GTK_IM_MODULE           DEFAULT=fcitx
    INPUT_METHOD            DEFAULT=fcitx
    XMODIFIERS              DEFAULT=@im=fcitx
    IMSETTINGS_MODULE       DEFAULT=fcitx
    QT_IM_MODULE            DEFAULT=fcitx
    
  • 测试使用fcitx4的fcitx-rime,通过xwayland可以在一些wayland软件中输入中文,比如火狐,就是选词框定位不准,总算能用,
    需要在/etc/environment中添加如下

    export XIM=fcitx
    export GTK_IM_MODULE=fcitx
    export QT_IM_MODULE=fcitx
    export XIM_PROGRAM=fcitx
    export XMODIFIERS="@im=fcitx"
    
  • 如果是虚拟机,打开sway不能显示鼠标,需要在 ~/.profile 中添加配置环境变量, export WLR_NO_HARDWARE_CURSORS=1

应用起动器wofi

  • 安装
    sudo apt -y install wofi
  • 配置
    # ~/.config/sway/config 中设置menu变量
    set $menu wofi --show drun | xargs swaymsg exec --
    

sway默认的foot终端挺好用的,是wayland原生。也可以配置很多:https://man.archlinux.org/man/foot.ini.5.en

  • 安装
    sudo apt -y install foot
  • 简单配置
    # 复制 /etc/xdg/foot/foot.ini 到 ~/.config/foot/
    font=monospace:size=20    # 找到font定义字体及字体大小,上面的连接有说明,man foot中也有说明
    # 在colors模块设置透明度
    [colors]
    alpha=0.8  # 取值0-1.0
    # 在csd模块配置隐藏标题栏
    [csd]
    preferre=none
    
  • tips: gnome-terminal/xfce4-terminal都支持wayland,适配比较好,可以正常输入中文,foot合alacrity输入中文不能弹出候选框,不知道怎么解决

安装waybar(比sway自带的swaybar功能多,更漂亮)

  • 安装
    sudo apt -y install waybar
  • 注释掉原来的swaybar配置
  • 简单配置,在sway配置文件中配置(cp /etc/sway/config ~/.config/sway/config)
    # 配置使用waybar
    bar {
      swaybar_command waybar
    }
    # 配置隐藏标题栏
    font pango: monospace 0.001
    titlebar_border_thickness 0
    titlebar_padding 0
    
  • waybar默认的图标此时无法正确显示,需要安装ota-font-awesome字体。不过网上大都是arch教程,经尝试在debian中需要安装的包名是fonts-fork-awesome,sudo apt -y install fonts-fork-awesome
  • waybar的默认配置文件在/etc/xdg/waybar/config,前面安装了awesome字体,但是貌似还是小部分图标不能显示,可以拷贝到家目录下自定义,参考github官方文档说明
    mkdir -p ~/.config/waybar
    cp /etc/xdg/waybar/config ~/.config/waybar

安装alacrity

  • 安装
    sudo apt -y install alacritty
  • 简单配置
    # .config/alacritty/alacritty.yml # 新建
    window:
    	decorations: none
    	opacity: 0.8    # 透明度
    
    font:
    	size: 18       # 字体大小
    

安装中文输入法fcitx5、fcitx5-rime, 参考: https://zhuanlan.zhihu.com/p/379583988

  • 安装
    sudo apt -y install fcitx5
    sudo apt -y install fcitx5-rime
  • tips: 默认输入是繁体,要切换繁体,在繁体中文输入模式下(开始打字)按F4键,然后在按4,就可以设置rime输入法为简体中文输入
  • 配置fcitx5自动启动,需要在sway配置文件(.config/sway/config)中添加 exec_always fcitx5 -d --replace
  • 刚开始配置的时候,Firefox/gedit/xfce4-terminal这些应用中还可以显示输入法框,更新之后都出问题了-_-

安装chromium

  • 安装
    sudo apt -y install chromium
  • 配置wayland启动并支持中文输入, 在/usr/share/applications/chromium.desktop文件中Exec参数里边添加参数--enable-features=UseOzonePlatform --ozone-platform=wayland --gtk-version=4
    Exec=/usr/bin/chromium --enable-features=UseOzonePlatform --ozone-platform=wayland --gtk-version=4 %U
    

配置自动登录(无登录管理器)

其它

alsa-utils/pulseaudio:  调节音量
firefox         支持wayland, 可以正常输入中文
vlc           支持wayland
vscode在wayland上运行,需要像chromium一样编辑code.desktop文件Exec处添加--enable-features=UseOzonePlatform --ozone-platform=wayland(无法输入中文)
pycharm等许多软件需要安装xwayland运行,并且pycharm无法中文输入,不知如何解决
bookworm: Elementary OS的电子书阅读器支持EUPU、PDF等格式,支持wayland
debian-reference-zh-cn

参考文章:
https://swaywm.com/useful-add-ons-for-sway/
https://zhuanlan.zhihu.com/p/379583988
https://zhuanlan.zhihu.com/p/462322143
https://wiki.archlinuxcn.org/wiki/Sway?rdfrom=https%3A%2F%2Fwiki.archlinux.org%2Findex.php%3Ftitle%3DSway_(%25E7%25AE%2580%25E4%25BD%2593%25E4%25B8%25AD%25E6%2596%2587)%26redirect%3Dno
https://man.archlinux.org/man/foot.ini.5.en
https://bugs.chromium.org/p/chromium/issues/detail?id=1183262&q=ime wayland&can=2

About Input Method:
https://github.com/fcitx/fcitx5/issues/118
https://wenqixiang.com/input-method-with-sway-window-manager/comment-page-1/#comment-23882
https://wiki.archlinux.org/title/Fcitx5
https://www.fcitx-im.org/wiki/Setup_Fcitx_5
https://github.com/fcitx/fcitx5/issues/292
https://github.com/fcitx/fcitx5/issues/263
https://blog.csdn.net/sinat_19551431/article/details/88188625#:~:text=其实非常简单,只要四步,100%25可以配置成功 wayland 下的 fcitx 输入法。 1. 安装 fcitx,fcitx fcitx-configtool fcitx-table-chinese fcitx-qt5 2. 在 %2Fetc%2Fenvironment 文件中添加以下配置。

posted on 2023-03-05 20:54  smoggy  阅读(2535)  评论(0编辑  收藏  举报