运维相关 · 2019年3月25日 0

在树莓派3B+上部署walle2.0

作为小微开发,专门弄个内网服务器部署walle2.0太奢侈,经过几天研究,发现可以部署在树莓派上,感觉又省了一大笔钱呢。

保存以下为rpi.sh并sudo执行,做一些初始化操作

#!/bin/bash
sed -i 's#://raspbian.raspberrypi.org#s://mirrors.tuna.tsinghua.edu.cn/raspbian#g' /etc/apt/sources.list
sed -i 's#://archive.raspberrypi.org/debian#s://mirrors.tuna.tsinghua.edu.cn/raspberrypi#g' /etc/apt/sources.list.d/raspi.list
sed -i 's#compatible#nocompatible#g' /etc/vim/vimrc.tiny
sed -i 's#=100#=2048#g' /etc/dphys-swapfile
service dphys-swapfile restart
echo 'set backspace=2' >> /etc/vim/vimrc.tiny
timedatectl set-ntp true
mkdir /data
chown pi:pi /data
apt update -y
apt dist-upgrade -y
apt install git mariadb-server nginx -y

然后clone官方代码,修改admin.sh

function SystemName() {
    source /etc/os-release
    case $ID in
        centos|fedora|rhel)
            which pip
            if [ $? != "0" ]; then
                wget https://bootstrap.pypa.io/3.3/get-pip.py
                python get-pip.py
            fi
            echo "安装/更新可能缺少的依赖: mysql-community-devel gcc gcc-c++ python-devel"
            sudo yum install -y mysql-devel gcc gcc-c++ python-devel MySQL-python
            ;;
        debian|ubuntu|devuan)
            echo "安装/更新可能缺少的依赖: ibmysqld-dev gcc gcc-c++ python-dev"
            sudo apt update -y
            sudo apt install -y libmysqld-dev python-dev virtualenv python-pip
            ;;
        raspbian)
            echo "安装/更新可能缺少的依赖"
            sudo apt update -y
            sudo apt install -y gcc g++ python-dev virtualenv python-pip libpq-dev libffi-dev libssl-dev libmariadbd18 libmariadbd-dev
            ;;
        *)
            exit 1
            ;;
    esac
}

主要是添加树莓派的依赖ok,剩下的就跟官方文档一致了,稍后会提交官方pr

mysql这里用的是mariadb,初始化命令是 mysql_secure_installation,跟着提示做就行了。

注意,git clone以后的所有操作必须在root账号下执行

git clone xxxxx
cd walle-web
sudo su