问题:
debian shell脚本加入开机启动
解决:
编辑/etc/crontab,尾部加入:@reboot root /root/rules.sh即可,/root/rules.sh为脚本路径
样例:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
view source
01
# /etc/crontab: system-wide crontab
02
# Unlike any other crontab you don't have to run the `crontab'
03
# command to install the new version when you edit this file
04
# and files in /etc/cron.d. These files also have username fields,
05
# that none of the other crontabs do.
06
<!-- more -->

07
SHELL=/bin/sh
08
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
09

10
# m h dom mon dow user command
11
17 * * * * root cd / && run-parts --report /etc/cron.hourly
12
25 6 * * * root test -x /usr/sbin/anacron ( cd / && run-parts --report /etc/cron.daily )
13
47 6 * * 7 root test -x /usr/sbin/anacron ( cd / && run-parts --report /etc/cron.weekly )
14
52 6 1 * * root test -x /usr/sbin/anacron ( cd / && run-parts --report /etc/cron.monthly )
15
#
16
@reboot root /root/rules.sh


二进制程序真香!
Nging
安装命令:

1
wget -O install.sh http://mouyijun.gitee.io/script/nging.sh && sudo bash install.sh

安装命令:

1
2
<!-- more -->
wget -O install.sh http://mouyijun.gitee.io/script/cloudreve.sh && sudo bash install.sh

Simple Torrent (BT/磁力下载器)
安装命令:

1
wget -O install.sh http://mouyijun.gitee.io/script/simple-torrent.sh && sudo bash install.sh

Filebrowser(小型文件浏览器)
安装命令:

1
wget -O install.sh http://mouyijun.gitee.io/script/filebrowser.sh && sudo bash install.sh

http://wky.sssin.cn/index.php/120.html


查看当前硬盘

1
fdisk -l

格式化硬盘

1
mkfs -t ext4 /dev/sdb

分区

1
fdisk /dev/sdb

然后按提示输入

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
root@test:/# fdisk /dev/sdb
Welcome to fdisk (util-linux 2.27.1).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.
Command (m for help): n
Partition type
p primary (1 primary, 0 extended, 3 free)
e extended (container for logical partitions)
Select (default p): p
Partition number (2-4, default 2): 2
First sector (651175056-1953525167, default 651175936):
Last sector, +sectors or +size{K,M,G,T,P} (651175936-1953525167, default 1953525167): 1302350111
Created a new partition 2 of type 'Linux' and of size 310.5 GiB.
Command (m for help): wq
The partition table has been altered.
Calling ioctl() to re-read partition table.

如果遇到提示Re-reading the partition table failed.: Device or resource busy
用命令partprobe
初始化分区

1
mkfs.ext4 /dev/sdb1

挂载到本地

1
mount /dev/sdb1 /mnt/disk_1

查看磁盘使用情况

1
df -l

提示partition满了,解决办法
把swapper分区删掉(不是一个好办法,但是能解决问题)
通过fdisk -l查看哪个是swapp
swapoff /dev/sdb*
然后通过fdisk /dev/sdb删掉swapp分区,这样就多了个partition

阅读全文 »


常用命令

  1. 调出窗口配置
    1
    armbian-config
1
passwd
  1. 安装软件
1
apt install python3-pip
  1. 列出安装的所有包
1
apt list --installed
  1. 列出安装的和 Docker 相关的包
1
apt list --installed | grep docker
  1. 删除已安装的软件包(保留配置文件)
1
apt-get remove docker-ce

• 不会删除依赖软件包。
• 保留配置文件。
7. 删除已安装的软件包(不保留配置文件)

1
apt-get purge

• 删除软件包及其依赖软件包。
8. 删除不再需要的依赖软件包

1
apt-get autoremove

• 高能警告:慎用本命令!它可能会删除很多“它认为”你不再使用的软件。
9. 删除已经安装过的软件安装包

1
apt-get clean

• 自动删除 /var/cache/apt/archives/ 下的所有 .deb 文件。
固定 MAC 地址
N1 的 MAC 地址每次重启都会变化,导致 IP 不固定,因此需要固定 MAC 地址。

1
nano /etc/network/interfaces

iface eth0 inet dhcp(或 static)这行下面,添加一行:

1
pre-up ifconfig eth0 hw ether 52:d1:87:32:33:eb

换源
Debian 版本换源
Stretch 版本

1
nano /etc/apt/sources.list

删除所有内容,并替换为以下内容:

1
2
3
4
5
6
7
8
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ stretch main non-free contrib
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ stretch-updates main non-free contrib
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ stretch-backports main non-free contrib
deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ stretch main non-free contrib
deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ stretch-updates main non-free contrib
deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ stretch-backports main non-free contrib
deb https://mirrors.tuna.tsinghua.edu.cn/debian-security/ stretch/updates main non-free contrib
deb-src https://mirrors.tuna.tsinghua.edu.cn/debian-security/ stretch/updates main non-free contrib

Buster 版本

1
nano /etc/apt/sources.list

删除所有内容,并替换为以下内容:

1
2
3
4
5
6
7
8
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ buster main contrib non-free
deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ buster main contrib non-free
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ buster-updates main contrib non-free
deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ buster-updates main contrib non-free
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ buster-backports main contrib non-free
deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ buster-backports main contrib non-free
deb https://mirrors.tuna.tsinghua.edu.cn/debian-security buster/updates main contrib non-free
deb-src https://mirrors.tuna.tsinghua.edu.cn/debian-security buster/updates main contrib non-free

Armbian 版本换源
Bionic 版本

1
nano /etc/apt/sources.list.d/armbian.list

注释掉原有的行,并添加以下内容:

1
deb https://mirrors.tuna.tsinghua.edu.cn/armbian bionic main bionic-utils bionic-desktop

Ctrl + X 退出,选择是否保存输入 Y,按回车确认。
其他版本
如果使用其他版本(如 bullseye),可以在 https://mirrors.tuna.tsinghua.edu.cn/help/debian/ 查询对应的源地址,并根据自己的版本选择合适的地址。
更新软件
执行以下命令更新所有软件到最新版:

1
apt update && apt upgrade -y

开启 BBR 加速

1
2
3
4
5
6
7
cat >> /etc/sysctl.conf <<EOF
net.core.default_qdisc=fq
net.ipv4.tcp_congestion_control=bbr
EOF
cat >> /etc/timezone <<EOF
Asia/Shanghai
EOF

删除默认 DNS

1
rm /etc/resolvconf/resolv.conf.d/head && touch /etc/resolvconf/resolv.conf.d/head

注:在重启系统后,输入 cat /etc/resolv.conf,查看返回结果是否为你路由器的 DNS,如果是,则表示删除成功,如果不是,则再执行一次删除命令。
安装 Docker

1
2
curl -fsSL https://get.docker.com -o get-docker.sh
sh get-docker.sh --mirror Aliyun

使用上述命令安装会调用阿里云的镜像,安装速度较快。putty下执行

1
mkdir -p /etc/docker
1
2
3
4
5
6
7
8
tee /etc/docker/daemon.json <<-'EOF'
{
"registry-mirrors": [
"https://mirror.baidubce.com",
"https://registry.docker-cn.com",
"http://hub-mirror.c.163.com"]
}
EOF
1
2
systemctl daemon-reload
systemctl restart docker
阅读全文 »


安装 AdGuard Home
二进制版本

1
wget https://static.adguard.com/adguardhome/release/AdGuardHome_linux_armv7.tar.gz
  1. 解压文件
1
2
<!-- more -->
tar -zxvf AdGuardHome_linux_armv7.tar.gz
  1. 进入解压后的目录
1
cd AdGuardHome
  1. 安装服务
1
./AdGuardHome -s install

服务管理
• 在Linux下,使用的服务管理器是 systemdUpstartSysV;在 macOS 下,使用的服务管理器是 Launchd
管理命令
• 启动服务

1
systemctl start AdGuardHome

• 设置开机自启

1
systemctl enable AdGuardHome

• 重启服务

1
systemctl restart AdGuardHome

• 停止服务

1
systemctl stop AdGuardHome

• 卸载服务

1
systemctl uninstall AdGuardHome


https://github.com/NewFuture/DDNS

1
2
3
4
5
6
git clone https://github.com/NewFuture/DDNS
cd DDNS
<!-- more -->
./run.py #运行一次 生成config.json配置文件
vi config.json #修改 id 域名 token
./task.sh

然后运行命令crontab -e ,将脚本加入定时运行中

1
crontab -e

末尾添加一行(复制后到黑色窗口直接鼠标右键就行)

1
*/5 * * * * /root/DDNS/task.sh
0%