mini主机 NAS计划 (amd&Intel)

debian 国内源内源

命令:nano /etc/apt/sources.list

11 bullseye

deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye main non-free contrib
deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye main non-free contrib
deb https://mirrors.tuna.tsinghua.edu.cn/debian-security/ bullseye-security main
deb-src https://mirrors.tuna.tsinghua.edu.cn/debian-security/ bullseye-security main
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye-updates main non-free contrib
deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye-updates main non-free contrib
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye-backports main non-free contrib
deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye-backports main non-free contrib

12 bookworm

deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm main contrib non-free non-free-firmware
deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm main contrib non-free non-free-firmware
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm-updates main contrib non-free non-free-firmware
deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm-updates main contrib non-free non-free-firmware
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm-backports main contrib non-free non-free-firmware
deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm-backports main contrib non-free non-free-firmware
deb https://mirrors.tuna.tsinghua.edu.cn/debian-security bookworm-security main contrib non-free non-free-firmware
deb-src https://mirrors.tuna.tsinghua.edu.cn/debian-security bookworm-security main contrib non-free non-free-firmware
deb http://mirrors.ustc.edu.cn/debian bookworm main contrib non-free non-free-firmware
deb http://mirrors.ustc.edu.cn/debian bookworm-updates main contrib non-free non-free-firmware
deb http://mirrors.ustc.edu.cn/debian bookworm-backports main contrib non-free non-free-firmware
deb http://mirrors.ustc.edu.cn/debian-security bookworm-security main contrib non-free non-free-firmware

更新

apt-get update & apt-get upgrade


安装软件VIM CURL

apt-get install vim -y
apt-get install curl -y
apt-get install hdparm -y
apt-get install avahi-daemon -y
curl -fsSL https://get.docker.com | bash -s docker --mirror Aliyun

开启root登录

vim /etc/ssh/sshd_config
PermitRootLogin yes
systemctl restart sshd.service
Ubuntu:service ssh restart

升级内核

apt search linux-image-generic
apt install  linux-image-6.2.0-25-generic
apt install linux-headers-6.1.0-16-amd64
update-grub

Intel 更新微码

apt-get install intel-microcode


casaos

wget -qO- https://get.casaos.io | bash


核显监控

apt-get install intel-gpu-tools -y 
intel_gpu_abrt  intel_gpu_time  intel_gpu_top
查看错误 :dmesg -l err

Intel 核显接管

加入i915 固件 linux-firmware(kernel/git/firmware/linux-firmware.git - Repository of firmware blobs for use with the Linux kernel

/etc/default/grub

update-grub2

GRUB_CMDLINE_LINUX_DEFAULT="intel_iommu=on i915.enable_guc=3 quiet"

docker emby 加入设备/dev/dri


修复电源

apt-get install laptop-mode-tools -y

vim /etc/laptop-mode/laptop-mode.conf

ENABLE_LAPTOP_MODE_ON_AC=1

sudo laptop_mode start force


禁止mac生成临时文件给smb共享

/etc/samba/smb.conf

编辑文件在[global] 下添加

veto files = /._*/.DS_Store/
delete veto files = yes

docker设置代理

/usr/lib/systemd/system/docker.service

[Service] 下面加入
Environment=HTTP_PROXY=http://192.168.31.9:7890
Environment=HTTPS_PROXY=http://192.168.31.9:7890
systemctl daemon-reload && systemctl restart docker

电源设置

apt-get install tuned

设置powersave 可以省电

强制网卡速率 1000M 关闭自动协商

sudo ethtool -s enp1s0 speed 1000 duplex full autoneg off


终端临时代理

export http_proxy=http://192.168.31.159:7890
export https_proxy=http://192.168.31.159:7890
取消
unset http_proxy
unset https_proxy

验证
echo $http_proxy


Cockpit KVM安装与设置

安装KVM

apt update
apt install -y qemu-kvm libvirt-daemon libvirt-clients bridge-utils virt-manager
systemctl status libvirtd //验证如果不启动就重启
systemctl enable --now libvirtd
lsmod | grep -i kvm
modprobe vhost_net //加入vhost_net
lsmod | grep vhost

创建br网桥

vim /etc/network/interfaces

改成自己的网卡通过 ip a获取

auto ens18

iface ens18 inet manual

Bridge definitions

auto br0
iface br0 inet static
bridge_ports ens18
bridge_stp off
address 192.168.1.2
network 192.168.1.0
netmask 255.255.255.0
broadcast 192.168.1.255
gateway 192.168.1.1
dns-nameservers 172.20.30.252 172.20.30.251
systemctl restart networking.service //重启网络

安装Cockpit

apt install cockpit cockpit-machines cockpit-podman
systemctl enable cockpit.socket && systemctl start cockpit.socket

去除root屏蔽登录

vim /etc/cockpit/disallowed-users

去除https重定向

vim /etc/cockpit/cockpit.conf

[WebService]
AllowUnencrypted = true

KVM读取U盘或者写入U盘数据无权限

挂载 自定义挂载选项 defaults,umask=000

/etc/libvirt //kvm配置文件

/usr/share/qemu

Cockpit内显示本地网络

/etc/network/interfaces

注释或删除本地网络

第三方访问VNC

mac kkRemte

修改kvm文件 /etc/libvirt/qemu

<graphics type='vnc' port='5910' autoport='no' listen='0.0.0.0'>
      <listen type='address' address='0.0.0.0'/>
    </graphics>

重启服务

systemctl restart libvirtd.service


debian 终端模式下自动息屏

/autorun.sh

#!/bin/bash
export TERM=linux
setterm -blank 1
setterm -blank force

/etc/systemd/system/rc-local.service

[Unit]
Description=/etc/rc.local
ConditionPathExists=/etc/rc.local
After=network.target
[Service]
Type=forking
ExecStart=/etc/rc.local start
TimeoutSec=0
StandardOutput=tty
RemainAfterExit=yes
[Install]
WantedBy=multi-user.target

/etc/systemd/system/rc-local-restart.service

[Unit]
Description=rc-local Restart
[Service]
Type=oneshot
ExecStart=/bin/systemctl restart rc-local.service

/etc/systemd/system/rc-local.timer

[Unit]
Description=rc-local-restart-Timer
[Timer]
OnBootSec=2min
OnUnitActiveSec=2min
Unit=rc-local-restart.service
[Install]
WantedBy=timers.target

/etc/rc.local

#!/bin/sh -e
/autorun.sh
exit 0

重新加载 systemd 管理的单元文件

sudo systemctl daemon-reload

启用定时器,使其在每次系统启动时自动启动

sudo systemctl enable rc-local.timer

启动定时器

sudo systemctl start rc-local.timer

查看运行状态

systemctl status rc-local.timer
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容