# RasPi-Config **Repository Path**: archiguru/raspi-config ## Basic Information - **Project Name**: RasPi-Config - **Description**: 树莓派配置脚本仓库 - **Primary Language**: Shell - **License**: MIT - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2023-07-23 - **Last Updated**: 2023-08-04 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # RasPi-Config ## 0. 介绍 树莓派配置脚本仓库 ## 1. 手动初始化内容 ```bash # 1. 允许root登录 sudo sed -i 's/^#PermitRootLogin.*/PermitRootLogin yes/' /etc/ssh/sshd_config # 2. 允许密码登录 sudo sed -i 's/^#PasswordAuthentication.*/PasswordAuthentication yes/' /etc/ssh/sshd_config # 3. 允许密钥登录 sudo sed -i 's/^#PubkeyAuthentication.*/PubkeyAuthentication yes/' /etc/ssh/sshd_config # 4. 配置会话超时为永不超时 sudo sed -i '$a\ClientAliveInterval 0' /etc/ssh/sshd_config sudo sed -i '$a\ClientAliveCountMax 0' /etc/ssh/sshd_config # 重启SSH服务使配置生效 sudo systemctl restart sshd.service ``` - 设置root密码(输入两次) `sudo passwd root` - 添加本地密钥的公钥 `ssh-copy-id root@10.132.1.xxx` - 配置中科大源 ```shell # 配置中科大apt软件源 cat << EOF > /etc/apt/sources.list deb http://mirrors.ustc.edu.cn/debian/ bullseye main contrib non-free deb-src http://mirrors.ustc.edu.cn/debian/ bullseye main contrib non-free deb http://mirrors.ustc.edu.cn/debian/ bullseye-updates main contrib non-free deb-src http://mirrors.ustc.edu.cn/debian/ bullseye-updates main contrib non-free deb http://mirrors.ustc.edu.cn/debian/ bullseye-backports main contrib non-free deb-src http://mirrors.ustc.edu.cn/debian/ bullseye-backports main contrib non-free deb http://mirrors.ustc.edu.cn/debian-security/ bullseye-security main contrib non-free deb-src http://mirrors.ustc.edu.cn/debian-security/ bullseye-security main contrib non-free EOF sed -i 's|//archive.raspberrypi.org|//mirrors.ustc.edu.cn/archive.raspberrypi.org|g' /etc/apt/sources.list.d/raspi.list apt update ``` - 错误处理 ``` # 如果 update 报错,将报错中的 gpg 添加即可; 其中 E77FC0EC34276B4B 替换成报错信息中的 keys apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E77FC0EC34276B4B apt update ``` - 更新系统 ```shell apt update -y apt upgrade -y apt autoremove -y ``` **:warning: 注意:** 在执行完以上操作后切换成 *root* 用户登录 !!! ## 2. 基本依赖安装和语言配置 ```shell sh -c "$(curl -fsSL https://gitee.com/jonnyhub/raspi-config/raw/master/init/init_01.sh)" ``` ## 3. 配置更多 ```shell # 脚本 02 sh -c "$(curl -fsSL https://gitee.com/jonnyhub/raspi-config/raw/master/init/init_02.sh)" # 安装 ohmyzsh sh -c "$(curl -fsSL https://gitee.com/mirrors/ohmyzsh/raw/master/tools/install.sh | sed 's/-ohmyzsh\/ohmyzsh/-mirrors\/ohmyzsh/' | sed 's/-https:\/\/github.com/-https:\/\/gitee.com/')" chsh -s $(which zsh) ``` ## 4. 工具安装 参考[这里](tools/README.md)