Up in the Air!
在云端
Home
Categories
Archives
Tags
About
Home
手把手教你自建开源免费私有云盘服务nextcloud 14
手把手教你自建开源免费私有云盘服务nextcloud 14
取消
手把手教你自建开源免费私有云盘服务nextcloud 14
由
aoeII
发布于 2017-07-04
·
最后更新:2018-11-05
2934
本文基于官方文档,介绍如何在Centos 6/7上安装nextcloud 14源码,架设属于自己的私有云盘服务。 欢迎转载,转载请注明出处:https://aoeii.com/posts/how_to_install_nextcloud_on_centos_6_and_7 ---------- ![nextcloud](/api/file/getImage?fileId=5bdfc9903a4859049b000018) NextCloud 是一款开源网络硬盘系统。任何人都可以自由的获取NextCloud程序,在家庭或公司构建私有且免费的网络硬盘。它是完全由你用户控制的私有、安全且功能完整的文件同步与共享解决方案。 NextCloud 源代码完全开放,任何个人或企业都可以自由获取并在开源许可协议的约束下免费使用,对于需要专业支持的用户可以购买 NextCloud 官方的专业版订阅服务。 有了 NextCloud 你可以在自己的计算机上共享任何文件或文件夹,并将它们与NextCloud服务器同步。当你把文件放入共享目录,这些文件就会立即同步到 NextCloud 服务器以及所有相关联的 NextCloud / ownCloud 桌面客户端、Android 客户端或 iOS 客户端。 ---------- # 下载最新版的源代码 yum -y install wget vim zip unzip wget -O nextcloud.zip https://download.nextcloud.com/server/releases/latest.zip # 解压缩,并设置文件夹权限 unzip nextcloud.zip mv nextcloud /var/www/ # 如果是用 apache/httpd 作为 web 服务器 chown -R apache.apache /var/www/nextcloud # 如果是用 nginx 作为 web 服务器 chown -R nginx.nginx /var/www/nextcloud/ # 安装php5.6或以上版本 看这里 [在Centos 6和7上安装设置php 5.6/7.0/7.1/7.2](https://aoeii.com/posts/how_to_install_php_on_centos_6_and_7) # 安装php组件 yum install -y php php-mysql php-imap php-ldap php-odbc php-pear php-xml php-xmlrpc php-fpm php-zip php-pdo_sqlite php-curl php-fileinfo php-zlib php-posix php-mbstring php-mcrypt php-libxml php-json php-iconv php-gd php-dom php-ctype php-exif php-apcu php-memcached php-opcache php-imagick php-pcntl php-redis php-pecl-redis redis # 安装mysql 5.5以上版本 看这里 [在Centos 6和7上安装设置mysql 5.5](https://aoeii.com/posts/how_to_install_mysql_on_centos_6_and_7) # 安装Web Server ## 安装apache/httpd 2.2以上版本 看这里 [在Centos 6和7上安装设置httpd ](https://aoeii.com/posts/how_to_install_httpd_on_centos_6_and_7) ## 安装nginx 1.10以上版本 看这里 [在Centos 6和7上安装设置nginx ](https://aoeii.com/posts/how_to_install_nginx_on_centos_6_and_7) # 配置Web Server ## Apache ### 方法一:单独添加一个虚拟主机配置文件,指定访问域名为cloud.example.com vim /etc/httpd/conf.d/nextcloud.conf ``` <VirtualHost *:80> ServerAdmin webmaster@cloud.example.com DocumentRoot /var/www/nextcloud ServerName cloud.example.com ErrorLog logs/cloud.example.com-error_log CustomLog logs/cloud.example.com-access_log common <Directory /var/www/nextcloud/> Options +FollowSymlinks AllowOverride All <IfModule mod_dav.c> Dav off </IfModule> SetEnv HOME /var/www/nextcloud SetEnv HTTP_HOME /var/www/nextcloud </Directory> </VirtualHost> ``` ### 方法二:加入现有的主机cloud.example.com.conf文件中,通过http://cloud.example.com/cloud 访问 Alias /cloud "/var/www/nextcloud/" <Directory /var/www/nextcloud/> Options +FollowSymlinks AllowOverride All <IfModule mod_dav.c> Dav off </IfModule> SetEnv HOME /var/www/nextcloud SetEnv HTTP_HOME /var/www/nextcloud </Directory> ## nginx ### 第一种情况:通过主/子域名直接访问 安装目录 `/var/www/nextcloud/` 通过 `https://cloud.example.com/`访问 ``` ustream php-handler { server 127.0.0.1:9000; #server unix:/var/run/php5-fpm.sock; } server { listen 80; server_name cloud.example.com; # enforce https return 301 https://$server_name$request_uri; } server { listen 443 ssl http2; server_name cloud.example.com; ssl_certificate /etc/ssl/nginx/cloud.example.com.crt; ssl_certificate_key /etc/ssl/nginx/cloud.example.com.key; # Add headers to serve security related headers # Before enabling Strict-Transport-Security headers please read into this # topic first. # add_header Strict-Transport-Security "max-age=15768000; # includeSubDomains; preload;"; # # WARNING: Only add the preload option once you read about # the consequences in https://hstspreload.org/. This option # will add the domain to a hardcoded list that is shipped # in all major browsers and getting removed from this list # could take several months. add_header X-Content-Type-Options nosniff; add_header X-XSS-Protection "1; mode=block"; add_header X-Robots-Tag none; add_header X-Download-Options noopen; add_header X-Permitted-Cross-Domain-Policies none; # Path to the root of your installation root /var/www/nextcloud/; location = /robots.txt { allow all; log_not_found off; access_log off; } # The following 2 rules are only needed for the user_webfinger app. # Uncomment it if you're planning to use this app. #rewrite ^/.well-known/host-meta /public.php?service=host-meta last; #rewrite ^/.well-known/host-meta.json /public.php?service=host-meta-json # last; location = /.well-known/carddav { return 301 $scheme://$host/remote.php/dav; } location = /.well-known/caldav { return 301 $scheme://$host/remote.php/dav; } # set max upload size client_max_body_size 512M; fastcgi_buffers 64 4K; # Enable gzip but do not remove ETag headers gzip on; gzip_vary on; gzip_comp_level 4; gzip_min_length 256; gzip_proxied expired no-cache no-store private no_last_modified no_etag auth; gzip_types application/atom+xml application/javascript application/json application/ld+json application/manifest+json application/rss+xml application/vnd.geo+json application/vnd.ms-fontobject application/x-font-ttf application/x-web-app-manifest+json application/xhtml+xml application/xml font/opentype image/bmp image/svg+xml image/x-icon text/cache-manifest text/css text/plain text/vcard text/vnd.rim.location.xloc text/vtt text/x-component text/x-cross-domain-policy; # Uncomment if your server is build with the ngx_pagespeed module # This module is currently not supported. #pagespeed off; location / { rewrite ^ /index.php$uri; } location ~ ^/(?:build|tests|config|lib|3rdparty|templates|data)/ { deny all; } location ~ ^/(?:\.|autotest|occ|issue|indie|db_|console) { deny all; } location ~ ^/(?:index|remote|public|cron|core/ajax/update|status|ocs/v[12]|updater/.+|ocs-provider/.+)\.php(?:$|/) { fastcgi_split_path_info ^(.+\.php)(/.*)$; include fastcgi_params; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_param PATH_INFO $fastcgi_path_info; fastcgi_param HTTPS on; #Avoid sending the security headers twice fastcgi_param modHeadersAvailable true; fastcgi_param front_controller_active true; fastcgi_pass php-handler; fastcgi_intercept_errors on; fastcgi_request_buffering off; } location ~ ^/(?:updater|ocs-provider)(?:$|/) { try_files $uri/ =404; index index.php; } # Adding the cache control header for js and css files # Make sure it is BELOW the PHP block location ~ \.(?:css|js|woff|svg|gif)$ { try_files $uri /index.php$uri$is_args$args; add_header Cache-Control "public, max-age=15778463"; # Add headers to serve security related headers (It is intended to # have those duplicated to the ones above) # Before enabling Strict-Transport-Security headers please read into # this topic first. # add_header Strict-Transport-Security "max-age=15768000; # includeSubDomains; preload;"; # # WARNING: Only add the preload option once you read about # the consequences in https://hstspreload.org/. This option # will add the domain to a hardcoded list that is shipped # in all major browsers and getting removed from this list # could take several months. add_header X-Content-Type-Options nosniff; add_header X-XSS-Protection "1; mode=block"; add_header X-Robots-Tag none; add_header X-Download-Options noopen; add_header X-Permitted-Cross-Domain-Policies none; # Optional: Don't log access to assets access_log off; } location ~ \.(?:png|html|ttf|ico|jpg|jpeg)$ { try_files $uri /index.php$uri$is_args$args; # Optional: Don't log access to other assets access_log off; } } ``` ## 第二种情况:通过主/子域名下的二级目录访问 安装目录`/var/www/nextcloud` 通过 `https://cloud.example.com/nextcloud/` 访问 ``` upstream php-handler { server 127.0.0.1:9000; #server unix:/var/run/php5-fpm.sock; } server { listen 80; server_name cloud.example.com; # enforce https return 301 https://$server_name$request_uri; } server { listen 443 ssl http2; server_name cloud.example.com; ssl_certificate /etc/ssl/nginx/cloud.example.com.crt; ssl_certificate_key /etc/ssl/nginx/cloud.example.com.key; # Add headers to serve security related headers # Before enabling Strict-Transport-Security headers please read into this # topic first. #add_header Strict-Transport-Security "max-age=15768000; # includeSubDomains; preload;"; add_header X-Content-Type-Options nosniff; add_header X-XSS-Protection "1; mode=block"; add_header X-Robots-Tag none; add_header X-Download-Options noopen; add_header X-Permitted-Cross-Domain-Policies none; # Path to the root of your installation root /var/www; location = /robots.txt { allow all; log_not_found off; access_log off; } # The following 2 rules are only needed for the user_webfinger app. # Uncomment it if you're planning to use this app. # rewrite ^/.well-known/host-meta /nextcloud/public.php?service=host-meta # last; #rewrite ^/.well-known/host-meta.json # /nextcloud/public.php?service=host-meta-json last; location = /.well-known/carddav { return 301 $scheme://$host/nextcloud/remote.php/dav; } location = /.well-known/caldav { return 301 $scheme://$host/nextcloud/remote.php/dav; } location /.well-known/acme-challenge { } location ^~ /nextcloud { # set max upload size client_max_body_size 512M; fastcgi_buffers 64 4K; # Enable gzip but do not remove ETag headers gzip on; gzip_vary on; gzip_comp_level 4; gzip_min_length 256; gzip_proxied expired no-cache no-store private no_last_modified no_etag auth; gzip_types application/atom+xml application/javascript application/json application/ld+json application/manifest+json application/rss+xml application/vnd.geo+json application/vnd.ms-fontobject application/x-font-ttf application/x-web-app-manifest+json application/xhtml+xml application/xml font/opentype image/bmp image/svg+xml image/x-icon text/cache-manifest text/css text/plain text/vcard text/vnd.rim.location.xloc text/vtt text/x-component text/x-cross-domain-policy; # Uncomment if your server is build with the ngx_pagespeed module # This module is currently not supported. #pagespeed off; location /nextcloud { rewrite ^ /nextcloud/index.php$uri; } location ~ ^/nextcloud/(?:build|tests|config|lib|3rdparty|templates|data)/ { deny all; } location ~ ^/nextcloud/(?:\.|autotest|occ|issue|indie|db_|console) { deny all; } location ~ ^/nextcloud/(?:index|remote|public|cron|core/ajax/update|status|ocs/v[12]|updater/.+|ocs-provider/.+)\.php(?:$|/) { fastcgi_split_path_info ^(.+\.php)(/.*)$; include fastcgi_params; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_param PATH_INFO $fastcgi_path_info; fastcgi_param HTTPS on; #Avoid sending the security headers twice fastcgi_param modHeadersAvailable true; fastcgi_param front_controller_active true; fastcgi_pass php-handler; fastcgi_intercept_errors on; fastcgi_request_buffering off; } location ~ ^/nextcloud/(?:updater|ocs-provider)(?:$|/) { try_files $uri/ =404; index index.php; } # Adding the cache control header for js and css files # Make sure it is BELOW the PHP block location ~ \.(?:css|js|woff|svg|gif)$ { try_files $uri /nextcloud/index.php$uri$is_args$args; add_header Cache-Control "public, max-age=15778463"; # Add headers to serve security related headers (It is intended # to have those duplicated to the ones above) # Before enabling Strict-Transport-Security headers please read # into this topic first. # add_header Strict-Transport-Security "max-age=15768000; # includeSubDomains; preload;"; add_header X-Content-Type-Options nosniff; add_header X-XSS-Protection "1; mode=block"; add_header X-Robots-Tag none; add_header X-Download-Options noopen; add_header X-Permitted-Cross-Domain-Policies none; # Optional: Don't log access to assets access_log off; } location ~ \.(?:png|html|ttf|ico|jpg|jpeg)$ { try_files $uri /nextcloud/index.php$uri$is_args$args; # Optional: Don't log access to other assets access_log off; } } } ``` ### nginx Tips and Tricks - Suppressing Log Messages If you’re seeing meaningless messages in your logfile, for example client denied by server configuration: /var/www/nextcloud/htaccesstest.txt, add this section to your nginx configuration to suppress them: ``` location = /data/htaccesstest.txt { allow all; log_not_found off; access_log off; } ``` - JavaScript (.js) or CSS (.css) files not served properly A common issue with custom nginx configs is that JavaScript (.js) or CSS (.css) files are not served properly leading to a 404 (File not found) error on those files and a broken webinterface. This could be caused by the: location ~* \.(?:css|js)$ { block shown above not located below the: location ~ \.php(?:$|/) { block. Other custom configurations like caching JavaScript (.js) or CSS (.css) files via gzip could also cause such issues. ## 设置数据库用户 ### 方法一:使用phpMyAdmin 安装phpMyAdmin并完成设置,通过`https://cloud.example.com/phpMyAdmin`登入系统进行管理 ### 方法二:使用命令行 To start the MySQL command line mode use: mysql -uroot -p Then a mysql> or MariaDB [root]> prompt will appear. Now enter the following lines and confirm them with the enter key: CREATE USER 'username'@'localhost' IDENTIFIED BY 'password'; CREATE DATABASE IF NOT EXISTS nextcloud CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci; GRANT ALL PRIVILEGES ON nextcloud.* TO 'username'@'localhost' IDENTIFIED BY 'password'; You can quit the prompt by entering: quit ## 访问URL开始安装 按照提示分别填入管理员账号,管理员密码,选择MySql数据库,输入数据库用户名,数据库用户密码,数据库名,主机默认是localhost # 安全及性能优化 ## 配置https访问参数 ssl证书配置参见其他文章 <VirtualHost *:443> ServerName cloud.nextcloud.com <IfModule mod_headers.c> Header always set Strict-Transport-Security "max-age=15552000; includeSubDomains" </IfModule> </VirtualHost> ## 配置php-fpm服务的php环境变量(适用于nginx服务器) 编辑配置文件 vim /etc/php-fpm.d/www.conf 找到以下内容,去掉前面的注释符号“`;`” ;env[HOSTNAME] = $HOSTNAME ;env[PATH] = /usr/local/bin:/usr/bin:/bin ;env[TMP] = /tmp ;env[TMPDIR] = /tmp ;env[TEMP] = /tmp 用命令`printenv`查询环境变量 printenv PATH > /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin 将查询到的环境变量复制到`env[PATH] =`后面 env[HOSTNAME] = $HOSTNAME env[PATH] = /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin env[TMP] = /tmp env[TMPDIR] = /tmp env[TEMP] = /tmp 重启php-fpm服务 service php-fpm restart #Centos 6 systemctl restart php-fpm #Centos 7 ## 配置php缓存 对单一服务器的应用场景,建议缓存配置按下面设置 ### APCu 安装必要的组件 yum install -y php-pecl-apcu 编辑配置文件,在`/var/www/html/nextcloud/config/config.php`里添加或者修改对应的参数: 'memcache.local' => '\OC\Memcache\APCu', ### Memcached 安装必要的组件 yum install -y memcached php-pecl-memcached 启动服务并设置为自动启动 service php-fpm start #Centos 6 chkconfig php-fpm on #Centos 6 systemctl start memcached #Centos 7 systemctl enable memcached #Centos 7 查看服务运行情况 ps ax | grep memcached > 19563 ? Sl 0:02 /usr/bin/memcached -m 64 -p 11211 -u memcache -l > 127.0.0.1 重启web服务器 service nginx restart #Centos 6 systemctl restart nginx #Centos 7 编辑配置文件,在`/var/www/html/nextcloud/config/config.php`里添加或者修改对应的参数: 'memcache.local' => '\OC\Memcache\APCu', 'memcache.distributed' => '\OC\Memcache\Memcached', 'memcached_servers' => array( array('localhost', 11211), array('server1.example.com', 11211), array('server2.example.com', 11211), ), ### Redis 安装必要的组件 yum install -y redis php-pecl-redis 启动服务并设置自动启动 chkconfig redis on #Centos6 service redis start #Centos6 systemctl start redis #Centos7 systemctl enable redis #Centos7 查看服务运行情况 ps ax | grep redis 返回信息 > 22203 ? Ssl 0:00 /usr/bin/redis-server 127.0.0.1:6379 编辑配置文件,在`/var/www/html/nextcloud/config/config.php`里添加或者修改对应的参数: vim /var/www/nextcloud/config/config.php 'memcache.locking' => '\OC\Memcache\Redis', 'redis' => array( 'host' => 'localhost', 'port' => 6379, ), ### Opcache 修改配置文件`/etc/php.d/10-opcache.ini` vim /etc/php.d/10-opcache.ini 添加或者修改对应的参数: opcache.enable=1 opcache.enable_cli=1 opcache.interned_strings_buffer=8 opcache.max_accelerated_files=10000 opcache.memory_consumption=128 opcache.save_comments=1 opcache.revalidate_freq=1 重启php-fpm服务 service php-fpm restart #Centos6 systemctl restart php-fpm #Centos7 ### 文件夹权限详细设置 创建脚本 vim nextcloud_permission.sh 输入以下内容 ``` #!/bin/bash ocpath='/var/www/nextcloud' ocdata='/var/www/nextcloud/data' htuser='nginx' htgroup='nginx' rootuser='root' printf "Creating possible missing Directories\n" mkdir -p $ocdata mkdir -p $ocpath/assets mkdir -p $ocpath/updater printf "chmod Files and Directories\n" find ${ocpath}/ -type f -print0 | xargs -0 chmod 0640 find ${ocpath}/ -type d -print0 | xargs -0 chmod 0750 find ${ocdata}/ -type f -print0 | xargs -0 chmod 0640 find ${ocdata}/ -type d -print0 | xargs -0 chmod 0750 printf "chown Directories\n" chown -R ${rootuser}:${htgroup} ${ocpath}/ chown -R ${htuser}:${htgroup} ${ocpath}/apps/ chown -R ${htuser}:${htgroup} ${ocpath}/assets/ chown -R ${htuser}:${htgroup} ${ocpath}/config/ chown -R ${htuser}:${htgroup} ${ocdata}/ chown -R ${htuser}:${htgroup} ${ocpath}/themes/ chown -R ${htuser}:${htgroup} ${ocpath}/updater/ chmod +x ${ocpath}/occ printf "chmod/chown .htaccess\n" if [ -f ${ocpath}/.htaccess ] then chmod 0644 ${ocpath}/.htaccess chown ${rootuser}:${htgroup} ${ocpath}/.htaccess fi if [ -f ${ocdata}/.htaccess ] then chmod 0644 ${ocdata}/.htaccess chown ${rootuser}:${htgroup} ${ocdata}/.htaccess fi ``` 执行脚本 chmod +x nextcloud_permission.sh bash nextcloud_permission.sh ### URL伪静态化 vim /var/www/html/nextcloud/config/config.php 输入或修改以下内容: 'overwrite.cli.url' => 'http://cloud.example.com/cloud', 'htaccess.RewriteBase' => '/cloud', 或者 'overwrite.cli.url' => 'http://cloud.example.com', 'htaccess.RewriteBase' => '/', 更新.htaccess文件 cd /var/www/nextcloud/ && sudo -u apache php occ maintenance:update:htaccess #httpd cd /var/www/nextcloud/ && sudo -u nginx php occ maintenance:update:htaccess #nginx 注意: - 执行上面的命令,apache/nginx用户必须有读写`.htaccess`的权限。 - 如果web服务使用其他用户如nginx,请做相应的替换。 ### 修改上传文件大小的限制 php.ini里有几个重要的参数,根据实际需要进行修改,下面假设最大上传文件大小为4GB post_max_size = 4G upload_max_filesize = 4G max_file_uploads = 50 max_execution_time = 3000 max_input_time = 6000 max_input_vars = 2000 memory_limit = 512M ## 重启服务 apache/httpd #Centos 6 service httpd restart #Centos 7 systemctl restart httpd.service nginx #Centos 6 service php-fpm restart #Centos 7 systemctl restart php-fpm.service ## 让 MySQL 支持4字节unicode编码utf8mb4 为使用 Emojis (textbased smilies) 这样的四字节字符,请先确认Nextcloud的版本号大于等于 11. 修改配置文件,启用InnoDB settings vim /etc/my.cnf 添加以下内容并保存 [mysqld] innodb_large_prefix=1 innodb_file_format=barracuda innodb_file_per_table=1 添加以下内容并保存 service mysqld restart # Centos6 systemctl restart mariadb # Centos7 改变nextcloud数据库(这个案例里的名字是`nextcloud`)的字符集设置 ALTER DATABASE nextcloud CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci; 修改配置文件`config.php`中的`mysql.utf8mb4`设置 cd /var/www/nextcloud/ # apache/httpd sudo -u apache php occ config:system:set mysql.utf8mb4 --type boolean --value="true" # nginx sudo -u nginx php occ config:system:set mysql.utf8mb4 --type boolean --value="true" 返回信息 > System config value mysql.utf8mb4 set to boolean true 运行修复程序,转换所有表为新的字符集 # apache/httpd sudo -u apache php occ maintenance:repair # nginx sudo -u nginx php occ maintenance:repair 现在已经可以在文件名、日历等所有地方使用四字节的 Emojis 字符了。 # 定时任务 Cron 建议使用linux自带的crontab为nextcloud建立定时任务 假设使用的是nginx,为nginx用户添加定时任务,如果使用的是apache/httpd,请自己替换nginx为apache: crontab -u nginx -e 输入保存 */15 * * * * php -f /var/www/nextcloud/cron.php 检查 crontab -u nginx -l 返回 > */15 * * * * php -f /var/www/nextcloud/cron.php 请替换 `/var/www/nextcloud/cron.php` 为Nextcloud 的**实际安装路径**。 **注意**:某些系统里需要使用 `php-cli`命令 替代 `php` 命令. 相当于每15分钟执行一次下面的命令 sudo -u nginx php -f /var/www/nextcloud/cron.php # 手动升级 此部分转载自 秋水逸冰 » [如何手动升级owncloud](https://teddysun.com/211.html) owncloud/nextcloud是一款保持更新的开源私有云系统,基于PHP开发的。支持SQLite、MySQL、Oracle以及PostgreSQL等数据库。本文介绍的是如何手动升级的步骤。 **请务必遵循以下原则升级:** - 1、备份原文件夹; - 2、停用所有第三方apps; - 3、解压最新版的安装包,覆盖到原文件夹中; - 4、确认所有的文件和文件夹权限是正确的; - 5、打开nextcloud首页,升级自动进行。 假设将nextcloud安装在web根目录下的/var/www/nextcloud/文件夹中,SSH登录,进入web根目录后按照如下步骤进行升级: 1、使用rsync命令的存档模式备份./nextcloud/文件夹(该模式可以保留文件权限、拥有者、时间戳等信息),执行命令如下: rsync -a /var/www/nextcloud/ /var/www/nextcloud_bkp`date +"%Y%m%d"`/ 2、官网下载最新版nextcloud,执行命令如下: wget -O nextcloud.tar.bz2 https://download.nextcloud.com/server/releases/latest.tar.bz2 3、将最新版的压缩包解压到/var/www/nextcloud_latest/文件夹,执行命令如下: mkdir /var/www/nextcloud_latest tar -C /var/www/nextcloud_latest -xjf nextcloud.tar.bz2 4、使用rsync命令覆盖/var/www/nextcloud/文件夹,执行命令如下: rsync --inplace -rtv /var/www/nextcloud_latest/nextcloud/ /var/www/nextcloud/ 5、删除安装包(安全起见),执行命令如下: rm -rf nextcloud-latest.tar.bz2 nextcloud_latest/ 6、手动升级 cd /var/www/nextcloud/ && sudo -u nginx php occ upgrade **注意事项:** 1. 如果你已经上传了大量的数据,请在升级时确认硬盘空间是否足够; 2. 在后台点击升级,只会下载最新版安装包到backup文件夹,并不会自动安装,同时会将config.php中的maintenance mode修改为true。 这就会导致一个错误提示“nextcloud is in maintenance mode”,因此在手动升级后,需要将/var/www/nextcloud/config/config.php中的maintenance mode从true改为false,再打开首页才能顺利升级; 3. 升级完成后,可能会因为旧版本文件的残留而出现代码完整性警告integrity warnings,请对照提示信息逐个删除多余文件 > 参考原文:http://doc.owncloud.org/server/5.0/admin_manual/maintenance/update.html # 其他常用命令 清理 cd /var/www/nextcloud/ && sudo -u nginx php occ files:cleanup > 0 orphaned file cache entries deleted 扫描文件 cd /var/www/nextcloud/ && sudo -u nginx php occ files:scan --all > Scanning files for 3 users > Starting scan for user 1 out of 3 (user1) > Starting scan for user 2 out of 3 (user2) > Starting scan for user 3 out of 3 (user3) > > +---------+-------+--------------+ > | Folders | Files | Elapsed time | > +---------+-------+--------------+ > | 2663 | 15696 | 00:00:32 | > +---------+-------+--------------+ 检查核心代码完整性 cd /var/www/nextcloud/ && sudo -u nginx php occ integrity:check-core 检查app代码完整性 cd /var/www/nextcloud/ && sudo -u nginx php occ integrity:check-app
blog
linux
nextcloud
centos
linux
该博客文章由作者通过
CC BY 4.0
进行授权。
分享
最近更新
ESXi 6.7 离线升级 7.0U3
N5105 软路由安装 ESXi 7 直通核显给 Debian / Ubuntu 虚拟机通过 Docker 实现 jellyfin 硬件转码视频文件(硬解/编码)
Leanote 支持 emoji、chart.js 以及 mermaid
手把手教你自建开源免费私有云盘服务nextcloud 14
在Centos 6和7上安装设置MySQL / MariaDB 5.5或以上的版本
热门标签
linux
centos
python
ESXi
windows
leanote
mysql
font
Docker
phpmyadmin
文章目录
systemctl 中文手册
CentOS 6 x86_64 安装Python2.7.15