当前位置:网站首页>Use Cloudreve to build a private cloud disk
Use Cloudreve to build a private cloud disk
2022-08-10 21:52:00 【Learn programming to find Tony】
1. 下载解压到指定目录
# Go to the user directory and unzip it,user_name 是登录用户名
mkdir -p /home/user_name/www/cloudreve
cd /home/user_name/www/cloudreve
wget https://github.com/cloudreve/Cloudreve/releases/download/3.5.3/cloudreve_3.5.3_linux_amd64.tar.gz
tar zxvf cloudreve_3.5.3_linux_amd64.tar.gz
sudo chmod +x cloudreve
2. Create a configuration file and specify a folder
cd /home/user_name/www/cloudreve
# 创建文件夹
mkdir avatar
mkdir uploads
sudo chmod -R 777 avatar
sudo chmod -R 777 uploads
# 添加配置文件,内容如下
# 按需修改配置文件,如想使用 Redis,configure as needed Redis 相关注释
vim conf.ini
[System]
; 运行模式
Mode = master
; 监听端口
Listen = :5212
; 是否开启 Debug
Debug = false
; Session 密钥, 一般在首次启动时自动生成
SessionSecret = bJyC70ESr1gjzoZ4UDwaULtUMsUHGRsm1dQdbCyhtLlniNF3mOWSpnNFShcQgzas
; Hash 加盐, 一般在首次启动时自动生成
HashIDSalt = UozmQYsmWLyRhUTF1H0psmvNGtkobrBNkmoVywfpam8HaS9xXOKdONnnbqNnpLea
; SSL 相关
;[SSL]
; SSL 监听端口
;Listen = :443
; 证书路径
;CertPath = C:\Users\i\Documents\fullchain.pem
; 私钥路径
;KeyPath = C:\Users\i\Documents\privkey.pem
; 启用 Unix Socket 监听
;[UnixSocket]
;Listen = /var/run/cloudreve/cloudreve.sock
; 数据库相关,如果你只想使用内置的 SQLite 数据库,这一部分直接删去即可
;[Database]
; 数据库类型,目前支持 sqlite/mysql/mssql/postgres
;Type = mysql
; MySQL 端口
;Port = 3306
; 用户名
;User = root
; 密码
;Password = root
; 数据库地址
;Host = 127.0.0.1
; 数据库名称
;Name = v3
; 数据表前缀
;TablePrefix = cd_
; 字符集
;Charset = utf8mb4
; SQLite 数据库文件路径
;DBFile = cloudreve.db
; 从机模式下的配置
;[Slave]
; 通信密钥
;Secret = 1234567891234567123456789123456712345678912345671234567891234567
; 回调请求超时时间 (s)
;CallbackTimeout = 20
; 签名有效期
;SignatureTTL = 60
; 跨域配置
[CORS]
AllowOrigins = *
AllowMethods = OPTIONS,GET,POST
AllowHeaders = *
AllowCredentials = false
; Redis 相关
;[Redis]
;Server = 127.0.0.1:6379
;Password =
;DB = 0
[OptionOverwrite]
; The maximum number of tasks that the task queue can execute in parallel
max_worker_num = 50
; When the task queue transfers the task transmission,Maximum number of parallel coroutines
max_parallel_transfer = 10
; The maximum number of retries after a failed partial upload in transit
chunk_retries = 10
3. Create control scripts and start-up
Create a control script
sudo vim /etc/systemd/system/cloudreve.service
内容如下:把 /home/user_name/www/cloudreve
改成自己的目录
[Unit]
Description=Cloudreve
Documentation=https://docs.cloudreve.org
After=network.target
After=mysqld.service
Wants=network.target
[Service]
WorkingDirectory=/home/user_name/www/cloudreve
ExecStart=/home/user_name/www/cloudreve/cloudreve
Restart=on-abnormal
RestartSec=5s
KillMode=mixed
StandardOutput=null
StandardError=syslog
[Install]
WantedBy=multi-user.target
Grant executable rights
sudo chmod +x /etc/systemd/system/cloudreve.service
# 更新配置
sudo systemctl daemon-reload
Create a control script
sudo vim /etc/init.d/cloudreve
内容如下:把 /home/user_name/www/cloudreve
改成自己的目录
#!/bin/sh
### BEGIN INIT INFO
# Provides: cloudreve
# Required-Start: $local_fs $remote_fs $network $syslog $named
# Required-Stop: $local_fs $remote_fs $network $syslog $named
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: starts the cloudreve web server
# Description: starts cloudreve using start-stop-daemon
### END INIT INFO
# Author: wangbiao
# mail: [email protected]
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
# /home/user_name/www/cloudreve/ Change to your own directory
DAEMON=/home/user_name/www/cloudreve/cloudreve
DAEMON_ARGS=/home/user_name/www/cloudreve/conf.ini
NAME=cloudreve
DESC=cloudreve
RUNDIR=/var/run/cloudreve
SOCKETFILE=$RUNDIR/cloudreve.sock
test -x $DAEMON || exit 0
if [ -r /etc/default/$NAME ]
then
. /etc/default/$NAME
fi
. /lib/lsb/init-functions
set -e
if [ "$(id -u)" != "0" ]
then
log_failure_msg "Must be run as root."
exit 1
fi
case "$1" in
start)
echo -n "Starting $DESC: "
mkdir -p $RUNDIR
touch $SOCKETFILE
chown dlsj:dlsj $RUNDIR $SOCKETFILE
chmod 755 $RUNDIR
if [ -n "$ULIMIT" ]
then
ulimit -n $ULIMIT || true
fi
if start-stop-daemon --start --quiet --oknodo --umask 007 --chuid dlsj:dlsj --exec $DAEMON -- $DAEMON_ARGS
then
echo "$NAME."
else
echo "failed"
fi
;;
stop)
echo -n "Stopping $DESC: "
if start-stop-daemon --stop --retry forever/TERM/1 --quiet --oknodo --exec $DAEMON
then
echo "$NAME."
else
echo "failed"
fi
rm -f $SOCKETFILE
sleep 1
;;
restart)
${0} stop
${0} start
;;
status)
if netstat -tnpl | grep -q cloudreve; then
PID=`pidof cloudreve`
echo "$NAME (pid $PID) is running..."
else
echo "$NAME is stopped"
exit 0
fi
;;
restart)
$0 stop
sleep 1
$0 start
;;
configtest)
echo -n "Test $NAME configure files... "
$DAEMON -t
;;
*)
echo "Usage: $0 {start|stop|restart|status|configtest}"
exit 1
;;
esac
exit 0
Grant executable rights
sudo chmod +x /etc/init.d/cloudreve
4. 手动启动,生成 用户名 及 密码
cd /home/user_name/www/cloudreve
./cloudreve
# The first boot will initialize the relevant files,It will be notified in the log 用户名 及 密码 .
# Please record it yourself,Avoid losing the inability to log in to the system.
启动项目
# 启动服务
sudo systemctl start cloudreve
# 设置开机启动
sudo systemctl enable cloudreve
# 停止服务
sudo systemctl stop cloudreve
# 重启服务
sudo systemctl restart cloudreve
# 查看状态
sudo systemctl status cloudreve
访问服务
浏览器输入服务器 ip:port 方式访问:
http://192.168.0.20:5212
访问后台
浏览器输入服务器 ip:port/admin 方式访问:
http://192.168.0.20:5212/admin
边栏推荐
- 用汇编带你看Golang里到底有没有值类型、引用类型
- 快消品行业经销商协同系统:实现经销商可视化管理,提高沟通执行效率
- 2022.8.9 Mock Competition
- B. Same Parity Summands
- JS中的filter、map、reduce
- FPGA - 7系列 FPGA内部结构之Memory Resources -03- 内置纠错功能
- Redis 性能影响 - 异步机制和响应延迟
- RADIUS Authentication Server Deployment Costs That Administrators Must Know
- c语言之 练习题1 大贤者福尔:魔法数,神奇的等式
- labelme-5.0.1版本编辑多边形闪退
猜你喜欢
内置模板市场,DataEase开源数据可视化分析平台v1.13.0发布
JVM classic fifty questions, now the interview is stable
ES6中的for...in/of的使用
华为路由器旁挂引流实验(使用流策略)
Redis 性能影响 - 异步机制和响应延迟
PROCEDURE :存储过程结构——《mysql 从入门到内卷再到入土》
Redis Performance Impact - Asynchronous Mechanisms and Response Latency
为什么一般公司面试结束后会说「回去等消息」,而不是直接告诉面试者结果?
Uniapp编译后小程序的代码反编译一些思路
阿里巴巴、蚂蚁集团推出分布式数据库 OceanBase 4.0,单机部署性能超 MySQL
随机推荐
ENVI感兴趣区ROI文件由XML格式转为ROI格式
使用 Cloudreve 搭建私有云盘
石油化工行业商业供应链管理系统:标准化供应商管理,优化企业供应链采购流程
国内Gravatar头像的完美替代方案Cravatar
RTL8721DM 双频WIFI + 蓝牙5.0 物联网(IoT)应用
【nvm】【node多版本管理工具】使用说明和踩坑(exit status 1)
Redis Command Manual
[Golang]如何优雅管理系统中的几十个UDF(API)
C. Rotation Matching
内置模板市场,DataEase开源数据可视化分析平台v1.13.0发布
2021DASCTF实战精英夏令营暨DASCTF July X CBCTF 4th
LeetCode-36-二叉搜索树与双向链表
2022.8.8 Selected Lectures on Good Topics (Number Theory Field)
Kubernetes Notes / Getting Started / Production Environment / Installing Kubernetes with Deployment Tools / Starting a Cluster with kubeadm / Creating a Cluster with kubeadm
ACM模板笔记:最长不下降/上升子序列
Bedtime story | made a Bitmap and AST length system configuration
Thread State 详解
优化是一种习惯●出发点是'站在靠近临界'的地方
B. Trouble Sort
【Windows】你不能访问此共享文件夹,因为你组织的安全策略阻止未经身份验证的来宾访问,这些策略可帮助保护你的电脑