搭建私有云盘
# 搭建私有云盘
在自己的家庭服务器(ubuntu18.04)上使用nextcloud搭建私有云盘。
# 安装
nextcloud
官网网址:https://nextcloud.com/install/ (opens new window)
# 安装nginx和php7.x
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install nginx
sudo apt-get install php7.3-dev php7.3-fpm php7.3-cli php7.3-curl php7.3-gd php7.3-cgi php7.3-intl php7.3-opcache php7.3-zip php7.3-xml php7.3-mbstring php7.3-mysql php7.3-sqlite3 php-apcu php-imagick
sudo service nginx restart
sudo service php7.3-fpm restart
1
2
3
4
5
6
7
2
3
4
5
6
7
nextcloud
下载地址: https://download.nextcloud.com/server/releases/nextcloud-18.0.3.zip (opens new window)
将nextcloud
压缩包解压到/var/www/
wget https://download.nextcloud.com/server/releases/nextcloud-18.0.3.zip
sudo unzip nextcloud-18.0.3.zip -d /var/www/
sudo chown -R www-data:www-data /var/www/nextcloud
1
2
3
2
3
# 配置
sudo cp /etc/nginx/sites-available/default /etc/nginx/sites-available/default.bk
sudo vim /etc/nginx/sites-available/default
# 使用官方提供的配置,将官方的配置复制并进行相应的修改。
1
2
3
2
3
官方提供方的配置:https://docs.nextcloud.com/server/18/admin_manual/installation/nginx.html (opens new window)
# 配置 SSL 证书
sudo openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /etc/ssl/private/your-selfsigned.key -out /etc/ssl/certs/your-selfsigned.crt
# 官方配置中默认将http重定向到https,所以需要自签名SSL证书
1
2
2
sudo service nginx restart
# 测试 ip 192.168.33.123/nextcloud
1
2
2
# 配置 mysql 数据库
sudo apt-get install mysql-server
sudo mysql
create database nextcloud;
# mysql8.0.4 密码认证方式发生了变化
create user 'nc_admin'@'localhost' identified with mysql_native_password by 'password';
# 如果执行失败,则需要修改mysql配置文件/etc/mysql/mysql.conf.d/mysqlq.cnf
#
grant all on nextcloud.* to 'user_name'@'your_ip';
flush privileges;
exit
mysql -u user_name -p
create datebase nextcloud;
1
2
3
4
5
6
7
8
9
10
11
12
2
3
4
5
6
7
8
9
10
11
12
然后浏览器访问ip/nextcloud/index.php
,配置用户名和密码已经数据库。
# 消除告警
cd /var/www/nextcloud
sudo -u www-data ./occ db:add-missing-indices
sudo -u www-data ./occ db:convert-filecache-bigint
# 关于缓存的告警参考官方文档:https://docs.nextcloud.com/server/13/admin_manual/configuration_server/caching_configuration.html
1
2
3
4
2
3
4
# 使用外部存储
启动External storage support
应用。
挂载外部存储。
上次更新: 2022/06/17, 07:22:19