关于为什么不用最新的7.1.5版本
因为seafile从7.1.0版本开始,Python使用3.x版本,环境安装过程中出现问题过多,暂时没有精力一一解决故采用了Python使用2.7的7.0.5的版本
工具准备
参考连接:https://blog.csdn.net/a496298685/article/details/108909927
系统镜像:2020-12-02-raspios-buster-armhf-lite.zip(437MB)解压后得到镜像2020-12-02-raspios-buster-armhf-lite.img
Seafile版本:seafile-server_7.0.5_stable_pi.tar.gz
刻录软件:Win32DiskImager
上传软件:WinSCP
SSH软件:SecureCRT
手机局域网IP及主机查看软件:PingTools Pro
安装步骤:
(一)安装树莓派系统
1、刻录镜像,刻录完后在Boot分区写入ssh文件及wpa_supplicant.conf
ssh文件不需要写入任何内容,空文件即可,目的是开启远程ssh;
wpa_supplicant.conf内容如下:
country=CN
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
network={
ssid="WIFI-SSID" //wifi ssid
psk="WIFI-PASSWD" //wifi密码
key_mgmt=WPA-PSK //wifi加密方式
priority=1 //连接优先级,数字越大优先级越高
}
2、通电,开机,获取树莓派IP地址:手机接入同一个WiFi网络,打开PingTools Pro-->本地网络 找到raspbeerypi
3、ssh连接到树莓派,修改pi密码跟root密码,pi默认密码是raspbeery
sudo passwd pi
sudo passwd root
4、修改软件源跟系统源
备份源文件
sudo cp /etc/apt/sources.list /etc/apt/sources.list.save
sudo cp /etc/apt/sources.list.d/raspi.list /etc/apt/sources.list.d/raspi.list.save
如果需还原
sudo cp /etc/apt/sources.list.save /etc/apt/sources.list
sudo cp /etc/apt/sources.list.d/raspi.list.save /etc/apt/sources.list.d/raspi.list
一键替换软件源跟系统源:二选一
上海交大
sudo sed -i "s?http://raspbian.raspberrypi.org/raspbian/?https://mirrors.sjtug.sjtu.edu.cn/raspbian/raspbian/?g" /etc/apt/sources.list
sudo sed -i "s?http://archive.raspberrypi.org/debian/?https://mirrors.sjtug.sjtu.edu.cn/raspberrypi/debian/?g" /etc/apt/sources.list.d/raspi.list
清华大学
sudo sed -i "s?http://raspbian.raspberrypi.org/raspbian/?https://mirrors.tuna.tsinghua.edu.cn/raspbian/raspbian/?g" /etc/apt/sources.list
sudo sed -i "s?http://archive.raspberrypi.org/debian/?https://mirrors.tuna.tsinghua.edu.cn/raspberrypi/?g" /etc/apt/sources.list.d/raspi.list
安装pip
sudo apt-get install python-pip
修改pip源:修改文件/etc/pip.conf
[global]
extra-index-url=https://pypi.tuna.tsinghua.edu.cn/simple
[install]
trusted-host=pypi.tuna.tsinghua.edu.cn
设置IP地址:修改文件/etc/dhcpcd.conf
interface eth0
static ip_address=192.168.0.10/24
static routers=192.168.0.1
static domain_name_servers=192.168.0.1 8.8.8.8
更新软件及系统
apt-get install update
apt-get install upgrade
(二)安装依赖环境
这里官网文档有些坑,如imagine库
//切换到root用户
apt-get install python2.7
apt-get install python-setuptools
apt-get install python-mysqldb
apt-get install python-urllib3
apt-get install python-ldap
apt-get install python-pil //代替python-imaging
apt-get install mariadb-server //代替mysql-server
pip install certifi
pip install pillow moviepy //可能不需要
或者统一安装
apt-get install python2.7 python-setuptools python-mysqldb python-urllib3 python-ldap python-pil mariadb-server -y
pip install certifi
安装完之后需要马上初始化mariadb数据库(mysql数据库的另一个分支),设置mysql的root密码
mysql_secure_installation
(三)安装seafile服务端
1、上传seafile-server_7.0.5_stable_pi.tar.gz到/home/pi
//切换到root账户
mkdir /opt/seafile
mv /home/pi/seafile-server_7.0.5_stable_pi.tar.gz /opt/seafile
cd /opt/seafile
tar xzf seafile-server_7.0.5_stable_pi.tar.gz
cd /opt/seafile/seafile-server-7.0.5
./setup-seafile-mysql.sh
按照提示直至安装完成
修改访问地址,修为文件/opt/seafile/conf/gunicorn.conf
import os
daemon = True
workers = 5
# default localhost:8000
bind = "0.0.0.0:8000" //原来是127.0.0.1:8000
# Pid
pids_dir = '/opt/seafile/pids'
pidfile = os.path.join(pids_dir, 'seahub.pid')
# for file upload, we need a longer timeout value (default is only 30s, too short)
timeout = 1200
limit_request_line = 8190
启动服务
./seafile.sh start
./seahub.sh start