Debian是较为常用的GNU/Linux的一个分支,有众多衍生版本,本文也可作为其他Linux系统的参考


一、安装过程

安装时语言应该选英文,否则安装后中文一定会出现乱码,安装软件一定要选择SSH Server,标准系统工具,不建议安装桌面,注意安装的时候换国内源,否则安装会特别慢,并且会导致安装失败
安装完成若找不到启动项,在Bios里手动添加efi
File Browser Add Boot Option -你的设备-EFI - Debian- grub64.efi - 输入名字


二、安装完成

解决运行什么命令都command not find的问题

1
2
nano .bashrc
export PATH=$PATH:/usr/sbin

使修改生效

1
source .bashrc

如果安装未选择ssh,可以手动安装

1
apt install openssh-server

安装后中文乱码

1
2
3
apt-get install locales
dpkg-reconfigure locales
勾选en_US.UTF-8 UTF-8,其他不勾选,保存退出

设置管理员密码

1
sudo passwd root

修改用户密码

1
sudo passwd pi

允许root登录SSH

1
2
nano /etc/ssh/sshd_config
PermitRootLogin yes

重启ssh服务生效

1
sudo systemctl restart ssh

三、安装软件

如果提示缺少xxx,就访问Debianpkgs搜索缺少的文件就能找出未安装的依赖
一些必要软件

1
apt-get install sudo curl gnupg net-tools

安装Python3&GCC

1
apt-get install python3-pip python3-dev libffi-dev gcc make

安装带php的apache

1
apt-get install apache2 php libapache2-mod-php

安装Webmin管理服务器,参考Linux性能监控
安装ZeroTier,参考内网穿透软件
安装文件服务器,参考搭建文件服务器
安装Syncthing,参考备份软件的使用
配置代理服务器,详见搭建代理服务器
安装Aria2,参考Aria2的使用
配置自定义的服务,参考Linux配置服务
配置定时任务,参考Linux配置定时任务
安装Wordpress,参考使用Wordpress建站
搭建Minecraft服务器,参考搭建Minecraft服务器

卸载软件

1
2
apt-get purge nginx		//apt-get卸载
aptitude purge nginx //aptitude卸载

常见命令

查看时间

1
date

设置时区

1
cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime

给权限

1
chmod 777 n.sh

察看文件夹占用

1
du -h --max-depth=1

挂载硬盘

安装硬盘SMART监视工具

1
apt-get install smartmontools

查找磁盘:

1
sudo fdisk -l

挂载硬盘

1
2
mkdir /mnt/disk
mount /dev/sda1 /mnt/disk

卸载硬盘

1
umount /dev/sda1

开机自动挂载磁盘

1
2
3
blkid /dev/sda3	#查询sda3的UUID
nano /etc/fstab #在文件后面添加配置
UUID=XXX /dev/sda3 /mnt/abc/ ext4 defaults 0 0

ACPI相关

合上盖子无操作

1
nano /etc/systemd/logind.conf

追加此代码

1
HandleLidSwitch=ignore

性能调节器

查看调节器

1
cat /sys/devices/system/cpu/cpu2/cpufreq/scaling_governor

调整调节器

1
2
3
echo performance > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor		//性能模式
echo powersave > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor //节能模式
echo ondemand > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor //平衡模式

网络代理

设置代理,详见搭建代理服务器

1
2
3
4
nano /etc/apt/apt-proxy.conf
Acquire::http::proxy "http://192.168.1.5:2333/";
Acquire::https::proxy "http://192.168.1.5:2333/";
apt-get update -c /etc/apt/apt-proxy.conf

安装ax200驱动

首先添加non-free源

1
2
3
4
5
6
7
8
nano /etc/apt/sources.list

deb http://deb.debian.org/debian bullseye main contrib non-free
deb-src http://deb.debian.org/debian bullseye main contrib non-free
deb http://deb.debian.org/debian-security/ bullseye-security main contrib non-free
deb-src http://deb.debian.org/debian-security/ bullseye-security main contrib non-free
deb http://deb.debian.org/debian bullseye-updates main contrib non-free
deb-src http://deb.debian.org/debian bullseye-updates main contrib non-free

安装并配置iwlwifi

1
2
3
4
apt update
apt install firmware-iwlwifi
modprobe -r iwlwifi
modprobe iwlwifi

Wifi相关

1
ifconfig -a	//查看所有网卡,看有没有wlxxx0

扫描wifi

1
iwlist wlxxx0 scan

如果出现“Interface doesn’t support scanning : Network is down”,激活网卡

1
sudo ifconfig wlxxx0 up

配置interfaces

1
nano /etc/network/interfaces

写入下面内容

1
2
3
4
allow-hotplug wlxxx0
auto wlxxx0
iface wlxxx0 inet dhcp
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf

wifi配置文件:

1
nano /etc/wpa_supplicant/wpa_supplicant.conf

文件内容如下

1
2
3
4
5
6
7
8
9
10
11
12
13
country=CN

network={
ssid="NTest"
psk="12345678"
key_mgmt=WPA-PSK
disabled=1
}

network={
ssid="River_Test"
psk="12345678"
}

输入下面的命令生效

1
ifup wlp6s0

扫描热点:

1
sudo iwlist scan | grep ESSID

错误排查

修复apt

1
apt --fix-broken install

清除cache

1
echo 2 > /proc/sys/vm/drop_caches

清除apt缓存

1
2
3
sudo apt-get autoclean
sudo apt-get clean
sudo apt-get autoremove

香橙派相关

连接串口后CH340的串口波特率为115200、8、1、N、N
ubuntu默认帐号和密码orangepi sudo passwd root设置root密码
armbian默认帐号密码root 1234登陆成功后需要修改密码