树莓派更新软件源的脚本

 

每次树莓派重新刷镜像都要手动换源,太麻烦了。直接整理成脚本。其他linux系统也可以参考

当前脚本对应raspberry的debain10版本

 

#!/bin/bash
#设置时区上海
timedatectl set-timezone Asia/Shanghai
#备份并且更新 软件更新源
cp /etc/apt/sources.list /etc/apt/sources.list.bak
echo "deb http://mirrors.tuna.tsinghua.edu.cn/raspbian/raspbian/ buster main non-free contrib rpi" > /etc/apt/sources.list
echo "deb-src http://mirrors.tuna.tsinghua.edu.cn/raspbian/raspbian/ buster main non-free contrib rpi" >> /etc/apt/sources.list
#备份并且更新 系统更新源
cp /etc/apt/sources.list.d/raspi.list /etc/apt/sources.list.d/raspi.list.bak
echo "deb http://mirrors.tuna.tsinghua.edu.cn/raspberrypi/ buster main ui" > /etc/apt/sources.list.d/raspi.list
echo "deb-src http://mirrors.tuna.tsinghua.edu.cn/raspberrypi/ buster main ui" > /etc/apt/sources.list.d/raspi.list
#同步更新源
sudo apt-get update
#更新升级以安装软件包 耗时较长,需要的时候再放开注释
#sudo apt-get upgrade
#安装vim,根据需要再放开注释
sudo apt-get install vim
#pip换源
mkdir -p ~/.pip
touch ~/.pip/pip.conf
echo "index-url = https://mirrors.aliyun.com/pypi/simple/" > ~/.pip/pip.conf

  

  

posted @ 2020-10-25 18:45  佟歌  阅读(257)  评论(0编辑  收藏  举报