用户:pi 密码:raspberry
启用root用户https://blog.csdn.net/chenxd1101/article/details/53437925(防止特殊原因pi用户不能登录时使用)
查看硬盘UUID:blkid
根据UUID 编辑 “sudo nano /etc/fstab”
在文件新增最后一行
UUID=73156133-2d10-4509-beb7-2144db0ec643 /media/disk1 ext3 defaults 0 0
查看外接硬盘:df
查看启动日志:cat /var/log/boot.log
乱码显示中文:sudo apt-get install ttf-wqy-zenhei
更新源链接:
sudo nano /etc/apt/sources.list
用#注释原来的链接
增加
deb http://mirrors.tuna.tsinghua.edu.cn/raspbian/raspbian/ stretch main contrib non-free rpi
deb-src http://mirrors.tuna.tsinghua.edu.cn/raspbian/raspbian/ stretch main contrib non-free rpi
seafile自启方法1(不起作用):
sudo nano /etc/rc.local
su -c "/media/disk1/haiwen/seafile-server-latest/seafile.sh start &" pi
su -c "/media/disk1/haiwen/seafile-server-latest/seahub.sh start &" pi
seafile自启方法2:
创建 systemd 服务文件
sudo nano /etc/systemd/system/seafile.service
内容如下(注意用户名和路径要正确):
[Unit]
Description=Seafile
# add mysql.service or postgresql.service depending on your database to the line below
After=network.target
[Service]
Type=oneshot
ExecStart=/media/disk1/haiwen/seafile-server-latest/seafile.sh start
ExecStop=/media/disk1/haiwen/seafile-server-latest/seafile.sh stop
RemainAfterExit=yes
User=pi
Group=pi
[Install]
WantedBy=multi-user.target
创建 systemd 服务文件
sudo nano /etc/systemd/system/seahub.service
文件内容如下(如果你想要运行fastcgi模式,请不要忘记修改它。)
[Unit]
Description=Seafile hub
After=network.target seafile.service
[Service]
# change start to start-fastcgi if you want to run fastcgi
ExecStart=/media/disk1/haiwen/seafile-server-latest/seahub.sh start
ExecStop=/media/disk1/haiwen/seafile-server-latest/seahub.sh stop
User=pi
Group=pi
Type=oneshot
RemainAfterExit=yes
[Install]
WantedBy=multi-user.target
保存文件后,执行以下命令注册未开机自启动项。
sudo systemctl enable seafile.service
sudo systemctl enable seahub.service
如果要取消开机自启动,并停止服务,执行以下命令。
sudo systemctl disable seafile.service
sudo systemctl disable seahub.service
安装 memcached提高性能(可选)
sudo apt-get install libmemcached-dev
sudo pip install pylibmc
sudo pip install django-pylibmc
sudo nano /media/disk1/haiwen/conf/seahub_settings.py
增加以下内容
CACHES = {
'default': {
'BACKEND': 'django_pylibmc.memcached.PyLibMCCache',
'LOCATION': '127.0.0.1:11211',
},
'locmem': {
'BACKEND': 'django.core.cache.backends.locmem.LocMemCache',
},
}
COMPRESS_CACHE_BACKEND = 'locmem'