--- title: OMV与Debian安装与使用笔记 date: 2022-09-20 09:31:42 excerpt: 摘要 tags: Debian rating: ⭐⭐ --- ## 前言 推荐入门文章: - [Debian 新手指南(持续更新)](https://zhuanlan.zhihu.com/p/488109156) - [锐角云 N3450折腾OMV记录](https://www.cnblogs.com/wxfy/p/15765363.html): - omv5 基于debian 10 - omv6 基于debian 11 后台:http://ipv4.blueroses.top/ | 版本 | 说明 | 示例 | | -------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------- | | alpine | Alpine Linux 操作系统,它是一个独立发行版本,相比较 Debian 操作系统来说 Alpine,更加轻巧 https://alpinelinux.org | docker pull node:alpine3.14 | | jessie | Debian 8,更旧的稳定(oldoldstable)版,马上就淘汰了 2015 https://wiki.debian.org/DebianJessie | docker pull node:10.22.0-jessie | | stretch | Debian 9,旧的稳定(oldstable)版,现有长期支持 2017,比较老,目前除了 LTS 其他版本已经不再提供技术支持了,所以我们非必要情况下还是不要选择它比较好 https://wiki.debian.org/DebianStretch | docker pull node:lts-stretch | | buster | Debian 10,当前的稳定(stable)版 2019,比较新,支持比较全面,受广大Debian爱好者的好评!像 PHP、Python 之类的语言、应用都会使用这个版本的 Debian 搭建 Docker 基础镜像 https://wiki.debian.org/DebianBuster | docker pull node:lts-buster | | bullseye | Debian 11,即将上位的稳定(stable)版 2021https://wiki.debian.org/DebianBullseye docker pull node:lts-bullseye xxx-slim 一般都基于 Debian 和 glibc,删除了许多非必需的软件包,优化了体积 docker pull node:stretch-slim | docker pull node:buster-slim | ## 在Debian上安装OMV ### 添加秘钥 ``` apt-get install --yes gnupg wget -O "/etc/apt/trusted.gpg.d/openmediavault-archive-keyring.asc" https://packages.openmediavault.org/public/archive.key apt-key add "/etc/apt/trusted.gpg.d/openmediavault-archive-keyring.asc" ``` ### 添加软件包存储库 大陆地区使用TUNA的源: ```ini cat < /etc/apt/sources.list.d/openmediavault.list deb https://mirrors.tuna.tsinghua.edu.cn/OpenMediaVault/public usul main deb https://mirrors.tuna.tsinghua.edu.cn/OpenMediaVault/packages usul main ## Uncomment the following line to add software from the proposed repository. # deb https://mirrors.tuna.tsinghua.edu.cn/OpenMediaVault/public usul-proposed main # deb https://mirrors.tuna.tsinghua.edu.cn/OpenMediaVault/packages usul-proposed main ## This software is not part of OpenMediaVault, but is offered by third-party ## developers as a service to OpenMediaVault users. # deb https://mirrors.tuna.tsinghua.edu.cn/OpenMediaVault/public usul partner # deb https://mirrors.tuna.tsinghua.edu.cn/OpenMediaVault/packages usul partner EOF ``` ### 安装 ```c++ export LANG=C.UTF-8 export DEBIAN_FRONTEND=noninteractive export APT_LISTCHANGES_FRONTEND=none apt-get update apt-get --yes --auto-remove --show-upgraded \ --allow-downgrades --allow-change-held-packages \ --no-install-recommends \ --option DPkg::Options::="--force-confdef" \ --option DPkg::Options::="--force-confold" \ install openmediavault-keyring openmediavault omv-confdbadm populate ``` ### 安装脚本(非桌面环境有效) 大概率是需要没有安装过桌面的Debian:https://github.com/OpenMediaVault-Plugin-Developers/installScript ## Debian检查软件包依赖 - 查看谁依赖了这个包: - aptitude why libboost1.71-tools-dev - 查看libboost-all-dev 依赖哪些包 - apt-cache depends libboost-all-dev - 查看所有带libboost的包 - dpkg -l | grep libboost Debian phpapi-20151012 不能安装的原因可能是因为某个包安装了更新phpapi的版本。(可能是php7.4系列) ### 用apt安装时,出现依赖障碍时,如何解决? 出现因依赖无法安装,可以尝试: >aptitude   install   xxx-软件 ```ini install - 安装/升级软件包 remove - 卸载软件包 purge - 卸载软件包并删除其配置文件 hold - 将软件包置于保持状态 unhold - 取消对一个软件包的保持命令 markauto - 将软件包标记为自动安装 unmarkauto - 将软件包标记为手动安装 forbid-version - 禁止 aptitude 升级到某一特定版本的软件包。 update - 下载新/可升级软件包列表 safe-upgrade - 执行一次安全的升级 full-upgrade - 执行升级,可能会安装和卸载软件包 forget-new - 忘记哪些软件包是“新”的 search - 按名称 和/或 表达式搜索软件包 show - 显示一个软件包的详细信息 clean - 删除已下载的软件包文件 autoclean - 删除旧的已下载软件包文件 changelog - 查看一个软件包的变更日志 download - 下载软件包的 .deb 文件 reinstall - 下载并(可能)重新安装一个现在已经安装了的软件包 ``` ## Debian安装时驱动加载 参考:https://wiki.debian.org/Firmware 一种简单的方法是使用直接包含所有非免费固件包的**安装程序映像** :[https://cdimage.debian.org/cdimage/unofficial/non-free/cd-including-firmware/](https://cdimage.debian.org/cdimage/unofficial/non-free/cd-including-firmware/)。另一种方法是单独下载固件已经烧纸镜像的移动介质中(U盘)。可以在[https://cdimage.debian.org/cdimage/unofficial/non-free/firmware/](https://cdimage.debian.org/cdimage/unofficial/non-free/firmware/)中寻找对应Debian版本的固件。 - Debian软件包查找:https://packages.debian.org/ - firmware-iwlwifi_20210315-3_all.deb:https://packages.debian.org/bullseye/all/firmware-iwlwifi/download - 带有Nonfree固件的Debian镜像:https://cdimage.debian.org/cdimage/unofficial/non-free/cd-including-firmware/ - https://cdimage.debian.org/cdimage/unofficial/non-free/cd-including-firmware/11.5.0+nonfree/amd64/iso-dvd/ ### 加载驱动 将下载的驱动`*.ucode`放到`/lib/firmware`(该目录需要手动新建)。或者在另一个U盘( 分区fat32)里新建一个目录`/firmware`并放置`*.ucode`或者deb软件包,或者放在根目录。 ### OMV驱动版本 >**openmediavault 是否有适用于我的硬件的驱动程序?** 所有模块驱动程序均由 oldstable 8.9 版(又名 Jessie)的 Debian 标准内核提供。默认情况下,此发行版附带内核 3.16。可以选择安装 backport kernel 4.9。如果 Debian Jessie 支持硬件,那么 openmediavault 也支持硬件。Jessie backport kernel 4.9 是目前 Stretch (Debian 9.3) 使用的默认内核,因此它为较新的硬件提供支持。 ## 更新源 源目录: - 官方源 ```ini deb http://deb.debian.org/debian buster main contrib non-free # deb-src http://deb.debian.org/debian buster main contrib non-free deb http://deb.debian.org/debian buster-updates main contrib non-free # deb-src http://deb.debian.org/debian buster-updates main contrib non-free deb http://deb.debian.org/debian-security/ buster/updates main contrib non-free # deb-src http://deb.debian.org/debian-security/ buster/updates main contrib non-free ``` - 清华 ```ini deb https://mirrors.tuna.tsinghua.edu.cn/debian/ testing main contrib non-free # deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ testing main contrib non-free deb https://mirrors.tuna.tsinghua.edu.cn/debian/ testing-updates main contrib non-free # deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ testing-updates main contrib non-free deb https://mirrors.tuna.tsinghua.edu.cn/debian/ testing-backports main contrib non-free # deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ testing-backports main contrib non-free deb https://mirrors.tuna.tsinghua.edu.cn/debian-security testing-security main contrib non-free # deb-src https://mirrors.tuna.tsinghua.edu.cn/debian-security testing-security main contrib non-free ``` - 中国科技大学 ```ini deb https://mirrors.ustc.edu.cn/debian/ stretch main non-free contrib #deb-src https://mirrors.ustc.edu.cn/debian/ stretch main non-free contrib deb https://mirrors.ustc.edu.cn/debian/ stretch-updates main non-free contrib #deb-src https://mirrors.ustc.edu.cn/debian/ stretch-updates main non-free contrib deb https://mirrors.ustc.edu.cn/debian/ stretch-backports main non-free contrib #deb-src https://mirrors.ustc.edu.cn/debian/ stretch-backports main non-free contrib deb https://mirrors.ustc.edu.cn/debian-security/ stretch/updates main non-free contrib #deb-src https://mirrors.ustc.edu.cn/debian-security/ stretch/updates main non-free contrib ``` - 阿里云 ```ini deb http://mirrors.aliyun.com/debian/ stretch main non-free contrib #deb-src http://mirrors.aliyun.com/debian/ stretch main non-free contrib deb http://mirrors.aliyun.com/debian/ stretch-updates main non-free contrib #deb-src http://mirrors.aliyun.com/debian/ stretch-updates main non-free contrib deb http://mirrors.aliyun.com/debian/ stretch-backports main non-free contrib #deb-src http://mirrors.aliyun.com/debian/ stretch-backports main non-free contrib deb http://mirrors.aliyun.com/debian-security/ stretch/updates main non-free contrib #deb-src http://mirrors.aliyun.com/debian-security/ stretch/updates main non-free contrib ``` 更新操作: ```c++ sudo apt-get update sudo apt-get upgrade sudo apt-get dist-upgrade ``` `apt-get dist-upgrade `为更新发行版/分支操作。 ### 替换源解决源失效问题 如果提示下面的问题,可以使用替换源的方式来解决: >E: Some index files failed to download, they have been ignored, or old ones used instead. >E: 仓库 “https://download.docker.com/linux/debian n/a Release” 没有 Release 文件 1. 修改`/etc/apt/sources.list`文件,在桌面系统内可以使用`gedit /etc/apt/sources.list`。 2. 替换成其他的源。比如阿里云的: ```ini deb http://mirrors.aliyun.com/debian wheezy main contrib non-free #deb-src http://mirrors.aliyun.com/debian wheezy main contrib non-free deb http://mirrors.aliyun.com/debian wheezy-updates main contrib non-free #deb-src http://mirrors.aliyun.com/debian wheezy-updates main contrib non-free deb http://mirrors.aliyun.com/debian-security wheezy/updates main contrib non-free #deb-src http://mirrors.aliyun.com/debian-security wheezy/updates main contrib non-free ``` 3. 如果还是提示错误就需要删除 **/etc/apt/sources.list.d** 下的所有文件了。 ```ini cd /etc/apt/sources.list.d ls rm XXXX ``` #### 其他更换源命令 ```ini mv /etc/apt/sources.list /etc/apt/sources.list.bak ?(先备份) echo "deb https://mirrors.ustc.edu.cn/debian/ stretch main non-free contrib" >/etc/apt/sources.list echo "deb https://mirrors.ustc.edu.cn/debian/ stretch-updates main non-free contrib " >>/etc/apt/sources.list echo "deb https://mirrors.ustc.edu.cn/debian/ stretch-backports main non-free contrib" >>/etc/apt/sources.list ``` ## 远程登录 ***第一次安装完需要手动安装ssh*** 需要使用网线连接安装,Wifi安装会导致进系统后无法连接Lan。 使用`omv-firstaid`可以进行其他设置。重新设置WorkBench就可以了。 ## 杂项 ### 允许Root用户登录 默认情况下debian是不允许以root用户登录的,只能以其他用户登录系统中,然后su到root用户下进行操作。 1. 修改/etc/gdm3/daemon.conf文件,新增下面一行AllowRoot = true。 ```ini [security] AllowRoot = true ``` 2. 修改/etc/pam.d/gdm-password,注释掉下面内容 ```ini #auth required pam_succeed_if.so user != root quiet_success ``` 然后重启操作系统,就可以使用root用户登录操作系统了。 ### 安装V2rayA客户端 https://v2raya.org/docs/prologue/installation/debian/ ### Debian设置Http代理 方法一:有系统变量文件/etc/profile 里增加 >export http_proxy=[http://username:password@proxyIP:proxyPORT](http://username:password@proxyip:proxyPORT/)(或者ip地址+端口号) 方法二:有用户变量文件~/.bashrc 里增加上面那句,只对指定的用户生效。 方法三:修改/etc/apt/apt.conf 文件,如果没有这个文件可以新建一个 增加一句: >Acquire::http::Proxy  "[http://username:password@proxyIP:proxyPORT](http://username:password@proxyip:proxyPORT/)"; (或者ip地址+端口号)注意后面有一个分号。 最后输入 sudo apt-get update  测试 # OMV网页后台出错解决方法 清楚网页缓存 Try if clearing the browser cache solves it. Or try Ctrl+Shift+R when you are on the OMV web GUI