Armbian设置

Armbian设置

换源

Debian源

备份

mv /etc/apt/sources.list /etc/apt/sources.list.bak

修改nano /etc/apt/sources.list文件内容为

# 默认注释了源码镜像以提高 apt update 速度,如有需要可自行取消注释 清华源
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye main contrib non-free
# deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye main contrib non-free

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

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

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

deb https://security.debian.org/debian-security bullseye-security main contrib non-free
# deb-src https://security.debian.org/debian-security bullseye-security main contrib non-free

armbian源

编辑 /etc/apt/sources.list.d/armbian.list,将 http://apt.armbian.com 替换为

sudo sed -i 's#http://apt.armbian.com#https://mirrors.cernet.edu.cn/armbian#g' /etc/apt/sources.list.d/armbian.list

执行apt update

安装软件

执行armbian-software


--------------------------------------------------------------
ID    NAME                      STATE           MANAGE
--------------------------------------------------------------
101   Docker                    not-installed   install
102   Portainer                 not-installed   install
103   Yacht                     not-installed   install
104   Transmission              not-installed   install
105   qBittorrent               not-installed   install
106   NextCloud                 not-installed   install
107   Jellyfin                  not-installed   install
108   HomeAssistant             not-installed   install
109   Kodbox                    not-installed   install
110   CouchPotato               not-installed   install
111   Sonarr                    not-installed   install
112   Radarr                    not-installed   install
113   Syncthing                 not-installed   install
114   FileBrowser               not-installed   install
115   Heimdall                  not-installed   install
116   Node-RED                  not-installed   install
117   Mosquitto                 not-installed   install
118   OpenWrt                   not-installed   install
119   Netdata                   not-installed   install
120   XunLei                    not-installed   install
121   Docker-Headless           not-installed   install
122   Navidrome                 not-installed   install
123   Alist                     not-installed   install
124   QingLong                  not-installed   install
125   Chatgpt-Web               not-installed   install
--------------------------------------------------------------
ID    NAME                      STATE           MANAGE
--------------------------------------------------------------
201   Desktop                   not-installed   install
202   Firefox                   not-installed   install
203   VLC                       not-installed   install
204   MPV                       not-installed   install
205   GIMP                      not-installed   install
206   Krita                     not-installed   install
207   LibreOffice               not-installed   install
208   Shotcut                   not-installed   install
209   Kdenlive                  not-installed   install
210   Thunderbird               not-installed   install
211   Evolution                 not-installed   install
212   Gwenview                  not-installed   install
213   Eog                       not-installed   install
214   VisualStudioCode          not-installed   install
215   Gedit                     not-installed   install
216   Flameshot                 not-installed   install
--------------------------------------------------------------
ID    NAME                      STATE           MANAGE
--------------------------------------------------------------
301   Frps                      not-installed   install
302   Frpc                      not-installed   install
303   NPS                       not-installed   install
304   NPC                       not-installed   install
305   Plex                      not-installed   install
306   Emby-Server               not-installed   install
307   KVM                       not-installed   install
308   PVE                       not-installed   install
--------------------------------------------------------------

输入对应的ID就可以自动安装,我只安装了Docker。功能方便但是还是根据自己的需求进行个性化安装更符合个人的需要。

SSH一段时候后无法连接

出现提示问题:Server unexpectedly closed network connection

网上提出的解决办法:

  1. 关闭防火墙(不可取)
  2. 配置sshd_config配置文件,配置UseDNS=no
  3. 查看/etc/hosts.deny中的内容,删除掉自己的IP(文件无内容)
  4. 其他防火墙导致

日志排查:

ssh登录日志:

一般ssh登录日志为/var/log/secure,但我的系统没有这个文件

如果您在Linux系统上使用的是不同的日志系统,可能会导致/var/log/secure文件不存在。在这种情况下,您可以尝试以下步骤来查看SSH登录日志:

检查系统上的日志文件位置,使用以下命令查找日志文件:

grep -iR "ssh" /var/log/
如果您找到了与SSH登录相关的日志文件,请使用以下命令查看最近的SSH登录尝试:

tail -f /path/to/log/file
请将/path/to/log/file替换为您找到的日志文件的路径。

如果您找不到任何与SSH登录相关的日志文件,请检查您的系统配置,以确保日志记录已启用并正确配置。

请注意,根据您使用的Linux发行版和版本,日志文件的位置和名称可能会有所不同。

日志中大量出现

May 14 00:35:01 armbian CRON[900117]: pam_unix(cron:session): session closed for user root
May 14 00:45:01 armbian CRON[900237]: pam_unix(cron:session): session opened for user root(uid=0) by (uid=0)
May 14 00:45:01 armbian CRON[900236]: pam_unix(cron:session): session opened for user root(uid=0) by (uid=0)
May 14 00:45:01 armbian CRON[900237]: pam_unix(cron:session): session closed for user root
May 14 00:45:01 armbian CRON[900236]: pam_unix(cron:session): session closed for user root
May 14 00:55:01 armbian CRON[900370]: pam_unix(cron:session): session opened for user root(uid=0) by (uid=0)
May 14 00:55:01 armbian CRON[900370]: pam_unix(cron:session): session closed for user root
May 14 01:00:01 armbian CRON[900389]: pam_unix(cron:session): session opened for user root(uid=0) by (uid=0)
May 14 01:00:01 armbian CRON[900389]: pam_unix(cron:session): session closed for user root
May 14 01:05:01 armbian CRON[900543]: pam_unix(cron:session): session opened for user root(uid=0) by (uid=0)
May 14 01:05:01 armbian CRON[900543]: pam_unix(cron:session): session closed for user root
May 14 01:15:01 armbian CRON[900671]: pam_unix(cron:session): session opened for user root(uid=0) by (uid=0)
May 14 01:15:01 armbian CRON[900672]: pam_unix(cron:session): session opened for user root(uid=0) by (uid=0)
May 14 01:15:01 armbian CRON[900672]: pam_unix(cron:session): session closed for user root
May 14 01:15:01 armbian CRON[900671]: pam_unix(cron:session): session closed for user root
May 14 01:17:01 armbian CRON[900684]: pam_unix(cron:session): session opened for user root(uid=0) by (uid=0)
May 14 01:17:01 armbian CRON[900684]: pam_unix(cron:session): session closed for user root
May 14 01:25:01 armbian CRON[900790]: pam_unix(cron:session): session opened for user root(uid=0) by (uid=0)
May 14 01:25:01 armbian CRON[900790]: pam_unix(cron:session): session closed for user root
May 14 01:30:01 armbian CRON[900875]: pam_unix(cron:session): session opened for user root(uid=0) by (uid=0)
May 14 01:30:01 armbian CRON[900875]: pam_unix(cron:session): session closed for user root
May 14 01:35:01 armbian CRON[900932]: pam_unix(cron:session): session opened for user root(uid=0) by (uid=0)

这个日志是指定时任务(cron)在执行时打开了一个会话(session),并且是由root用户执行的。这通常是正常的,因为cron通常需要以root用户的身份运行一些系统级别的任务。

查看cron日志

在Linux系统中,cron的日志记录通常存储在/var/log/syslog中。您可以使用以下命令查看cron的日志:

sudo grep CRON /var/log/syslog
这将显示所有与cron相关的日志记录。如果您只想查看特定用户的cron日志,请使用以下命令:

sudo grep "username" /var/log/syslog | grep CRON
其中,"username"是要查看其cron日志的用户的用户名。

请注意,某些Linux系统可能使用不同的日志文件来记录cron活动。在这种情况下,您可以查看系统文档或尝试在以下目录中查找cron日志:

/var/log/cron.log
/var/log/messages
/var/log/cron
/var/log/syslog.1

日志中内容为:

May 14 17:05:01 armbian CRON[921106]: (root) CMD (command -v debian-sa1 > /dev/null && debian-sa1 1 1)
May 14 17:15:01 armbian CRON[921385]: (root) CMD (command -v debian-sa1 > /dev/null && debian-sa1 1 1)
May 14 17:15:01 armbian CRON[921384]: (root) CMD (/usr/lib/armbian/armbian-truncate-logs)
May 14 17:17:01 armbian CRON[921395]: (root) CMD (   cd / && run-parts --report /etc/cron.hourly)
May 14 17:25:02 armbian CRON[921551]: (root) CMD (command -v debian-sa1 > /dev/null && debian-sa1 1 1)
May 14 17:30:01 armbian CRON[921654]: (root) CMD (/usr/lib/armbian/armbian-truncate-logs)
May 14 17:35:01 armbian CRON[921732]: (root) CMD (command -v debian-sa1 > /dev/null && debian-sa1 1 1)
May 14 17:45:01 armbian CRON[921778]: (root) CMD (command -v debian-sa1 > /dev/null && debian-sa1 1 1)
May 14 17:45:01 armbian CRON[921777]: (root) CMD (/usr/lib/armbian/armbian-truncate-logs)
May 14 17:55:01 armbian CRON[921960]: (root) CMD (command -v debian-sa1 > /dev/null && debian-sa1 1 1)
May 14 18:00:01 armbian CRON[921979]: (root) CMD (/usr/lib/armbian/armbian-truncate-logs)
May 14 18:05:01 armbian CRON[922069]: (root) CMD (command -v debian-sa1 > /dev/null && debian-sa1 1 1)
May 14 18:15:01 armbian CRON[922599]: (root) CMD (command -v debian-sa1 > /dev/null && debian-sa1 1 1)
May 14 18:15:01 armbian CRON[922600]: (root) CMD (/usr/lib/armbian/armbian-truncate-logs)

这个日志是指cron在每分钟的第35秒执行了一个名为"debian-sa1"的命令。这个命令通常用于生成系统性能统计信息,并将其存储在/var/log/sa目录中。该命令的输出被重定向到/dev/null,这意味着它不会在终端上显示任何输出。

这个命令通常由系统管理员设置为每天运行一次,以便生成系统性能统计信息。如果您看到这个命令在cron日志中频繁出现,可能是因为它被设置为每分钟运行一次,这可能会导致日志文件变得非常大。

一般情况是通过以下命令配置cron配置文件

crontab -e

但是我文件中没有内容

您可以使用以下命令查找所有的cron任务:

sudo crontab -u username -l

其中,"username"是要查找其cron任务的用户的用户名。如果要查找系统级别的cron任务,请查看以下文件:

/etc/crontab
/etc/cron.d/*
/etc/cron.hourly/*
/etc/cron.daily/*
/etc/cron.weekly/*
/etc/cron.monthly/*

如果在这些文件中找到了"debian-sa1"命令的条目,请根据需要进行修改或删除。

另外,如果您发现cron日志中出现了大量的"debian-sa1"命令执行记录,可以考虑禁用系统性能统计信息的收集。您可以使用以下命令来禁用它:

sudo sed -i 's/ENABLED="true"/ENABLED="false"/' /etc/default/sysstat

这将在/etc/default/sysstat文件中将ENABLED选项的值从"true"改为"false",以禁用系统性能统计信息的收集。

定时重启ssh

/etc/init.d/ssh restart 2>/dev/null

posted @ 2023-05-09 22:38  云子墨  阅读(754)  评论(0编辑  收藏  举报