机械革命无界16安装Debian


机械革命无界16安装Debian

一 选择合适的Linux发行版

鉴于机械革命是一家PC二线小厂,硬件也比较新,所以选择合适的Linux发行版较为困难,经过多种发行版的浅尝辄止[安装卸载]之后,笔者作为一个半路出家的小白,仍然选择了Debian这么一个发行版来学习,尽管它由于配置上的难度,一度劝退了我,兜兜转转之后笔者有了解决问题的信心,选择了这个众多发行版的基石版本,因为它的软件包丰富,很多软件都有deb包,但缺乏rpm包。详细的版本是:Debian non-free 11.3(amd64),在中科大源下载的。

二 基本配置

2.1 换国内源

使用中科大镜像源替换

# http://mirrors.ustc.edu.cn/help/debian.html
# http://mirrors.ustc.edu.cn/help/debian-security.html

# 备份一下 /etc/apt/sources.list 
# 修改 /etc/apt/sources.list 的内容为如下内容
deb http://mirrors.ustc.edu.cn/debian stable main contrib non-free
# deb-src http://mirrors.ustc.edu.cn/debian stable main contrib non-free
deb http://mirrors.ustc.edu.cn/debian stable-updates main contrib non-free
# deb-src http://mirrors.ustc.edu.cn/debian stable-updates main contrib non-free
deb http://mirrors.ustc.edu.cn/debian-security/ stable-security main non-free contrib
# deb-src http://mirrors.ustc.edu.cn/debian-security/ stable-security main non-free contrib

# 最后更新一下,有问题按照提示解决问题。
sudo apt update
sudo apt upgrade

2.2 配置中文环境及输入法

最开始安装的时候,选的英文,所以后续需要配置中文环境,设置中文输入法fcitx5并配置自动启动。

fcitx5    im-config
fcitx5 可以设置在 i3 的配置文件中去启动
配置中文环境
# 重新配置中文环境
➤ sudo dpkg-reconfigure locales

2.3 自动挂载win的硬盘

1)# 查看当前系统磁盘信息
➤ sudo fdisk -l                                                                                                                                                                             11:01:10
Disk /dev/nvme1n1: 476.94 GiB, 512110190592 bytes, 1000215216 sectors
Disk model: INTEL SSDPEKNW512G8                     
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: 0EFF2D18-CCB3-4C3B-8452-83499C9D8A99

Device         Start        End    Sectors   Size Type
/dev/nvme1n1p1  2048 1000215182 1000213135 476.9G Microsoft basic data


Disk /dev/nvme0n1: 953.87 GiB, 1024209543168 bytes, 2000409264 sectors
Disk model: ZHITAI PC005 Active 1TB                 
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: 657B17D6-761D-4976-B29D-9B39A9116A62

Device               Start        End    Sectors   Size Type
/dev/nvme0n1p1        2048     616447     614400   300M EFI System
/dev/nvme0n1p2      616448     649215      32768    16M Microsoft reserved
/dev/nvme0n1p3      649216  322682879  322033664 153.6G Microsoft basic data
/dev/nvme0n1p4   322682880 1371260927 1048578048   500G Microsoft basic data
/dev/nvme0n1p5  1371260928 1375455231    4194304     2G Linux filesystem
/dev/nvme0n1p6  1375455232 1564198911  188743680    90G Linux filesystem
/dev/nvme0n1p7  1564198912 1595656191   31457280    15G Linux filesystem
/dev/nvme0n1p8  1595656192 1679542271   83886080    40G Linux filesystem
/dev/nvme0n1p9  1679542272 1757136895   77594624    37G Linux filesystem
/dev/nvme0n1p10 1757136896 1790691327   33554432    16G Linux filesystem

2)# 去目标挂载目录设置挂载点
tom@ccf:/m/tom
➤ ls                                                                                      
winc/  wind-soft/  wine-data/

3)# 手动挂载
sudo mount -t ntfs /dev/nvme0n1p3 /media/tom/winc
sudo mount -t ntfs /dev/nvme0n1p4 /media/tom/wind-soft
sudo mount -t ntfs /dev/nvme1n1p1 /media/tom/wine-data
# 报错
NTFS signature is missing.
Failed to mount '/dev/nvme0n1p2': Invalid argument
The device '/dev/nvme0n1p2' doesn't seem to have a valid NTFS.
Maybe the wrong device is used? Or the whole disk instead of a
# 安装 fuse ntfs-3g
sudo apt install fuse
sudo apt install ntfs-3g

4)# 开机自动挂载磁盘  sudo vim /etc/fstab  可以使用 UUID 和 设备目录两种方式
# /media/tom/winc was on /dev/nvme0n1p3 during installation
/dev/nvme0n1p3 /media/tom/winc            ntfs    defaults        0       0
# /media/tom/wind-soft was on /dev/nvme0n1p4 during installation
/dev/nvme0n1p4 /media/tom/wind-soft            ntfs    defaults        0       0
# /media/tom/wine-data was on /dev/nvme1n1p1 during installation
/dev/nvme1n1p1 /media/tom/wine-data            ntfs    defaults        0       0

2.4 高分屏设置

sudo vim ~/.Xresources
# 写入如下内容:
Xft.dpi: 200

屏幕设置的一些问题

# 笔者后来采用了 Xft.dpi: 200, 通过xrandr来设置屏幕的缩放比,在fish终端里面设置两个别名
alias 85 'xrandr --output eDP-1 --scale 0.85x0.85'
alias 95 'xrandr --output eDP-1 --scale 0.95x0.95'

# 这么做的原因是遇到了BUG且笔者无法解决,只能绕行,BUG是设置在i3和fish终端的配置文件中,均会导致开机进入桌面黑屏只显示光标,在查阅了诸多资料后均无法解决

# 设置别名之后,在终端输入 85 之后,亦会导致黑屏,但是再开一个i3窗口[super+enter]就可以解决此问题。

三 驱动问题解决

3.1 升级内核

# 当前版本的Debian使用的内核比较老,不更新内核又不能适配我这个机器的无线网卡,那么就离线更新一下内核吧,从ubuntu内核离线更新的方法那边借鉴了一下,于是乎去中科大的镜像源[https://mirrors.ustc.edu.cn/debian/pool/main/l/linux/]下载了内核deb包,如下:
linux-headers-5.16.0-5-amd64_5.16.14-1_amd64.deb  
linux-image-5.16.0-5-amd64-unsigned_5.16.14-1_amd64.deb
linux-headers-5.16.0-5-common_5.16.14-1_all.deb

# 然后手动安装,重启就完事了
sudo dpkg -i linux*

3.2 查看有那些驱动问题

查看内核信息,有哪些报错,针对性的解决。

sudo dmesg | grep Error
sudo dmesg | grep Failed

3.3 解决无线网驱动问题

# 系统提示我,无线网卡缺少 iwlwifi-so-a0-hr-b0-xx.ucode
# 于是我就去了 https://www.kernel.org/  找到了 https://mirrors.edge.kernel.org/pub/linux/kernel/firmware/
# 去下载一个新版的固件包,找到你想缺失的固件,比如:
iwlwifi-so-a0-hr-b0-64.ucode
# 把这个固件拷贝到 /lib/firmware 这个文件夹下面,重启系统就好了

3.4 解决音频/蓝牙驱动问题

[    7.645724] bluetooth hci0: firmware: failed to load intel/ibt-0040-4150.sfi (-2)
[    7.645730] Bluetooth: hci0: Failed to load Intel firmware file intel/ibt-0040-4150.sfi (-2)
...
[    7.767583] sof-audio-pci-intel-tgl 0000:00:1f.3: firmware: failed to load intel/sof/sof-adl.ri (-2)
[    7.767599] sof-audio-pci-intel-tgl 0000:00:1f.3: Direct firmware load for intel/sof/sof-adl.ri failed with error -2
[    7.767612] sof-audio-pci-intel-tgl 0000:00:1f.3: error: sof firmware file is missing, you might need to
[    7.767619] sof-audio-pci-intel-tgl 0000:00:1f.3:        download it from https://github.com/thesofproject/sof-bin/
[    7.767624] sof-audio-pci-intel-tgl 0000:00:1f.3: error: failed to load DSP firmware -2
[    7.767905] sof-audio-pci-intel-tgl 0000:00:1f.3: error: sof_probe_work failed err: -2

# 我这台机器缺少音频以及蓝牙驱动,先去找音频,因为已经给出解决方案了,
# 注意!!!:一定要把我们下载的文件,放到指定目录里,笔者一开始放到了 /lib/firmware 中,结果进不了桌面环境,然后从 recovery 模式,把文件重新放到了 /lib/firmware/intel/sof/ 下面就好了。
sudo cp sof-adl.ri /lib/firmware/intel/sof/

# 蓝牙驱动文件,我们在之前下载好的固件包里面能找到,找不到就多去下载几个包,总能找得到的,按照提示去放到 /lib/firmware/intel/ 下面
# 注意:笔者这边也遇到了一个BUG,就是外接显示器启动的时候,进入桌面失败了,后来拿下来外接显示器之后,就成功了,虽然不知道为啥,但是问题不大。

3.5 解决intel核显驱动问题

# 查看 i915
tom@ccf:~$ sudo dmesg | grep i915
[    2.040123] i915 0000:00:02.0: Your graphics device 4626 is not properly supported by the driver in this
               kernel version. To force driver probe anyway, use i915.force_probe=4626
[   68.656795] sof-audio-pci-intel-tgl 0000:00:1f.3: init of i915 and HDMI codec failed

# 参考 https://github.com/intel-gpu/documentation/issues/14
# 编辑 /etc/default/grub,添加如下内容
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash i915.force_probe=4626"

# Then regenerate your grub boot loader:
# sudo grub2-mkconfig  如果是 红帽 系使用这条命令,咱们 debian 使用下面这个
sudo update-grub

尝试过多个发行版及桌面之后,最放不下的还是Debian,最终也发现,还是这个debian cinnamon解决了高分屏以及双屏的问题,并且可以分别给双屏设置缩放比,设置笔记本屏幕缩放比不为100%之后,也解决了之前高分屏主屏幕会有抖动现象的情况。解决了以上驱动问题之后,我们基本就可以愉快的使用Debian了。

四 软件之日常

4.1 浏览器Edge

不错的浏览器,但是目前发现Linux版本的同步功能不行,win版本上的书签不能完全同步,还是用优化更好的firefox吧。

## 安装微软的签名密钥和 sources.lst
sudo wget https://packages.microsoft.com/keys/microsoft.asc
sudo gpg --dearmor microsoft.asc
sudo mv microsoft.asc.gpg microsoft.gpg
sudo install -o root -g root -m 644 microsoft.gpg /etc/apt/trusted.gpg.d/

sudo sh -c 'echo "deb [arch=amd64] https://packages.microsoft.com/repos/edge stable main" > /etc/apt/sources.list.d/microsoft-edge-stable.list'

sudo rm microsoft.asc microsoft.gpg

## 开始安装 Micorsoft Edge Stable
sudo apt update
sudo apt install microsoft-edge-stable

4.2 截图软件 flameshot

# https://github.com/flameshot-org/flameshot
# 安装
sudo apt install flameshot

# 基本使用之 Capture with GUI:
flameshot gui

# 用法有很多,github主页都有介绍,或者使用 man 命令查看,咱们也可以设置一下快捷键

4.3 笔记软件组合

使用坚果云+obsidian+typora+腾讯云COS

坚果云

配置坚果云

# https://www.jianguoyun.com/s/downloads/linux
# 咱们选择 Debian 64-bit 然后按照官方教程来就好了
sudo dpkg -i nautilus_nutstore_amd64.deb
# 下面的命令我没使用,应该是用来解决报错的
sudo apt-get install -f

命令行启动坚果云

# 在更换了 i3 桌面之后,笔者的坚果云就不能开机自动启动了,咱们需要知道先知道在 fish 终端命令行如何启动坚果云
➤ bash -c "python3 ~/.nutstore/dist/bin/nutstore-pydaemon.py &"

# 咱们可以给他设置一个快捷键,输入快捷键启动
➤ alias nutstore 'bash -c "python3 ~/.nutstore/dist/bin/nutstore-pydaemon.py &"'
# 来个保存,以后就可以愉快的命令行使用坚果云了
➤ funcsave nutstore

obsidian

强大的obsidian,用于在多平台、手机端方便的查看

# https://obsidian.md/
# 这个就不多说了,下载AppImage,设置为可执行文件,直接使用就好了

typora

易用的可视化markdown编辑器

# 这个不多说,现在是收费软件了,免费的老版本请自行寻找。
# 捎带提一句,笔者一开始使用英文版的时候,Image Uploader 选项是没有app这个选项的,语言换成了汉语之后,出现了这个选项。

image-20220402172855017

picgo

使用Picgo+腾讯云图床,避免免费的图床突然不能使用

# 参考 https://zhuanlan.zhihu.com/p/119250383

4.4 录屏软件simplescreenrecorder

 sudo apt install simplescreenrecorder

4.5 键盘捕捉screenkey

sudo apt install screenkey

五 软件之开发

5.1 fish

# 安装fish
sudo apt install fish

# 查看fish的位置
tom@ccf:~$ which fish
/usr/bin/fish

# 修改默认的终端,从bash改为fish
tom@ccf:~$ chsh -s /usr/bin/fish

# 安装 fish 的插件 oh-my-fish # https://github.com/oh-my-fish/oh-my-fish#getting-started
curl -L https://get.oh-my.fish | fish

# 这样fish就可以很容易修改终端样式,在浏览器中就可以修改
fish_config

fish的使用

# fish下的好多操作都很便捷,比如可以直接命令行使用 alias
➤ alias c clear
# funcsave 给临时设置的 alias 保存,下次启动fish终端就可以使用了 
➤ funcsave c
# 设置 l 为 ls -la
➤ alias l "ls -la" 
➤ funcsave l

# 设置 sudo 为 "sudo -E",注:保存当前用户的变量不被 sudo 所覆盖
➤ alias sudo "sudo -E"
➤ funcsave sudo

fish兼容bash脚本

# 有很多脚本都是在bash下可以执行,fish不兼容,笔者网上找到了一个解决找办法,https://segmentfault.com/a/1190000015253899
# 举个栗子,比如,安装rust之后,需要执行一句source 命令:
➤ source $HOME/.cargo/env                                               
~/.cargo/env (line 4): 'case' builtin not inside of switch block
case ":${PATH}:" in
^
from sourcing file ~/.cargo/env
source: Error while reading file “/home/tom/.cargo/env”

# 咱们可以使用下面的命令来实现 fish 里面执行 bash 脚本
➤ bash -c "source $HOME/.cargo/env" 

fish终端alias

➤ alias
alias 85 'xrandr --output eDP-1 --scale 0.85x0.85'
alias 95 'xrandr --output eDP-1 --scale 0.95x0.95'
alias c clear
alias l 'ls -la'
alias nutstore 'bash -c "python3 ~/.nutstore/dist/bin/nutstore-pydaemon.py &"'
alias sudo 'sudo -E'
alias typora /home/tom/Software/Typora-linux-x64/Typora
alias vpn /opt/cisco/anyconnect/bin/vpn

5.2 i3桌面环境

i3wm:窗口管理器
feh:设置桌面
compton:窗口透明化
polybar:状态栏
# 安装 i3 桌面环境
➤ sudo apt install i3

# 进入桌面配置
vim ~/.config/i3/config

feh

图片查看器、设置桌面壁纸

# 安装
➤ sudo apt install feh
# i3 config 中设置

compton

窗口透明化

# 安装
➤ sudo apt install compton
# i3 config 中设置
exec compton -b

# 透明设置需要在终端中调整,这边在alacritty中去设置

polybar

代替 i3 bar

# 安装
➤ sudo apt install polybar
# i3 config 中设置

5.3 alacritty

5.3.1 安装 rust

前提:安装rust

➤ curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh                                          19:35:54
info: downloading installer

Welcome to Rust!

This will download and install the official compiler for the Rust
programming language, and its package manager, Cargo.

Rustup metadata and toolchains will be installed into the Rustup
home directory, located at:

  /home/tom/.rustup

This can be modified with the RUSTUP_HOME environment variable.

The Cargo home directory located at:

  /home/tom/.cargo

This can be modified with the CARGO_HOME environment variable.

The cargo, rustc, rustup and other commands will be added to
Cargo's bin directory, located at:

  /home/tom/.cargo/bin

This path will then be added to your PATH environment variable by
modifying the profile files located at:

  /home/tom/.profile
  /home/tom/.bashrc

You can uninstall at any time with rustup self uninstall and
these changes will be reverted.

Current installation options:


   default host triple: x86_64-unknown-linux-gnu
     default toolchain: stable (default)
               profile: default
  modify PATH variable: yes

1) Proceed with installation (default)
2) Customize installation
3) Cancel installation
>1

info: profile set to 'default'
info: default host triple is x86_64-unknown-linux-gnu
warning: Updating existing toolchain, profile choice will be ignored
info: syncing channel updates for 'stable-x86_64-unknown-linux-gnu'
info: default toolchain set to 'stable-x86_64-unknown-linux-gnu'

  stable-x86_64-unknown-linux-gnu unchanged - rustc 1.59.0 (9d1b2106e 2022-02-23)


Rust is installed now. Great!

To get started you may need to restart your current shell.
This would reload your PATH environment variable to include
Cargo's bin directory ($HOME/.cargo/bin).

To configure your current shell, run:
source $HOME/.cargo/env

5.3.2 安装 alacritty

# debian 的仓库里面没有 alacritty ,咱们去 github 上面
# https://github.com/alacritty/alacritty/blob/master/INSTALL.md#clone-the-source-code

# 根据文档依次安装,注意!!!!:一定要跟文档的步骤和命令一致,笔者犯了一个低级错误,在 git clone 文件的时候,使用了 sudo 提权,导致文件全是root属主和属组,无法编译

配置alacritty

# 如何在i3桌面中设置默认的终端为 alacritty 呢?
# 编辑 i3 配置文件
vim ~/.config/i3/config

"""
# start a terminal
# bindsym $mod+Return exec i3-sensible-terminal
bindsym $mod+Return exec alacritty
"""

5.4 ranger 终端文件管理器

# 非常好用的终端文件管理器,使用 hjkl 就可以轻松的管理键盘
sudo apt install ranger 

基本使用


六 软件之其他

6.1 Docker

docker 安装

# 参考 https://yeasy.gitbook.io/docker_practice/install/debian
# 卸载旧版本
sudo apt-get remove docker docker-engine docker.io

# 使用 APT 安装
sudo apt-get update
sudo apt-get install apt-transport-https ca-certificates curl gnupg lsb-release

# 添加国内源/软件源的 GPG 密钥
curl -fsSL https://mirrors.aliyun.com/docker-ce/linux/debian/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg

# 向 sources.list 中添加 Docker 软件源:
echo \
  "deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://mirrors.aliyun.com/docker-ce/linux/debian \
  $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null

# 更新 apt 软件包缓存,并安装 docker-ce。
sudo apt-get update
sudo apt-get install docker-ce docker-ce-cli containerd.io

docker 配置

# 启动 Docker
sudo systemctl enable docker
sudo systemctl start docker

# 建立 docker 用户组
sudo groupadd docker

# 将当前用户加入 docker 组:
sudo gpasswd -a $USER docker
# 更新docker用户组
newgrp docker 

七 尾声

# 使用无界16安装linux已基本可用,这东西就是会者不难,Linux不熟悉的小白挠头,希望笔者半吊子的水平,能对苦苦搜索非主流PC/笔记本安装linux的人有帮助。
# 笔者在折腾过程中对Arch产生了兴趣,也对其他许多东西产生了兴趣,借着疫情延迟入职失业在家的机会,正在学习vim和其他知识,早日给无界16装上Arch。


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM