感觉自己就是一年瞎折腾的命,树莓派不知道装了多少遍了,这不前几天脆弱的树莓派在小儿手下突然崩溃,后来发现板子没有什么问题,只是SD卡的分区好像出现了问题,导致树莓派在重启的时候无法正常读取数据而卡在一个四色图上。万般无奈,只能重新安装系统,这里就对重新安装系统的过程做一个简单的记录,以防后面还需要重新安装。
- SD卡烧写,这个比较简单,直接官网下载最新的镜像写到SD卡就好,不过linux下一直写不成功,只好在windows下用工具写入
- 改软件源,这个是非常有必要的,raspberry自带的源太慢,还是阿里的比较靠谱:
#/etc/apt/source.list
# deb http://mirrordirector.raspbian.org/raspbian/ stretch main contrib non-free rpi
# Uncomment line below then 'apt-get update' to enable 'apt-get source'
# deb-src http://archive.raspbian.org/raspbian/ stretch main contrib non-free rpi
deb http://mirrors.aliyun.com/raspbian/raspbian/ stretch main non-free contrib
- 安装常用的软件
sudo apt update
sudo apt install redis-server tmux python3 python3-pip python3-dev default-libmysqlclient-dev aria2 samba samba-common-dev zsh nginx lua5.3 lua5.3-dev python-dev build-essential cmake w3m ncurses-dev git
- 安装oh-my-zsh
- 编译安装VIM,因为需要用到YCM,所以只能编译一个带有python扩展的VIM
cd ~
mkdir apps
wget ftp://ftp.vim.org/pub/vim/unix/vim-8.0.tar.bz2
tar -jxvf vim-8.0.tar.bz2
cd vim80
./configure --prefix=/usr/local/ --enable-multibyte --enable-cscope=yes --enable-pythoninterp=yes --enable-sniff --enable-xim --enable-python3interp=yes --with-python-config-dir=/usr/lib/python2.7/config-arm-linux-gnueabihf --with-python3-config-dir=/usr/lib/python3.5/config-3.5m-arm-linux-gnueabihf
sudo make
sudo make install
vim --version|grep python
- 安装 GO
cd ~/apps
wget https://storage.googleapis.com/golang/go1.9.2.linux-armv6l.tar.gz
tar -xzf go1.9.2.linux-armv6l.tar.gz
echo "Please add env variables"
echo "export GOROOT=$HOME/apps/go"
echo "export PATH=$PATH:$GOROOT/bin"
- 安装YCM
#bundle
git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim
cd ~/.vim/bundle
git clone --recursive https://github.com/Valloric/YouCompleteMe.git
cd YouCompleteMe
echo "When compiling YCM, Pi needs an extra swap"
sudo dd if=/dev/zero of=/swapfile1GB bs=1M count=1024
sudo mkswap /swapfile1GB
sudo swapon /swapfile1GB
./install.py --go-completer
sudo swapoff -a
sudo rm /swapfile1GB
- 安装python包
django
flask
tornado
scipy
ipython
mysqlclient
redis
django_redis
pyserial
pandas
django-extensions