动手实验:部署私有云盘“NextCloud”
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了动手实验:部署私有云盘“NextCloud”相关的知识,希望对你有一定的参考价值。
上篇《Linux部署nginx+mysql+php+PHPMyAdmin4环境》中,我们通过文章已经学会基本的LNMP环境的部署,本次开始部署一套私有云盘来来验证环境,并提升对Linux认识与兴趣。
首先介绍一下此次任务主角NextCloud:
NextCloud的前身叫Owncloud,Owncloud的老大被投资后不满产品商业化气息太重,Owncloud GmbH(德国)和 Owncloud Inc(美国)之间逐渐形成了无法逾越的鸿沟。公司开始通过提供技术支持赚钱,并向其他领域扩张,抱怨的声音开始在开源社区久久回荡。于是决定愤然离职重新开发了NextCloud。事实证明确实要比 OwnCloud 更体贴好用!
一、开始安装-下载
NextCloud官网:https://www.nextcloud.com
网站上有各种平台的部署包,有ovf、docker、tar等等,我们采取TAR包的形式部署。
[[email protected] /]# cd /tmp [[email protected] tmp]# wget https://download.nextcloud.com/server/releases/nextcloud-13.0.2.tar.bz2 [[email protected] tmp]# tar -jxvf nextcloud-13.0.2.tar.bz2 [[email protected] tmp]# mv nextcloud /www [[email protected] tmp]# chown -R apache:apache /www/nextcloud [[email protected] tmp]# chmod 777 /www/nextcloud/config [[email protected] tmp]# mkdir /data [[email protected] tmp]# chown -R apache:apache /data
二、开始安装-配置数据库
修改默认字符集:uft8mb4
[[email protected] /]# vim /etc/my.cnf
添加utf8mb4配置如图
[client] default-character-set = utf8mb4 [mysql] default-character-set = utf8mb4 [mysqld] character-set-client-handshake = FALSE character-set-server = utf8mb4 collation-server = utf8mb4_unicode_ci init_connect='SET NAMES utf8mb4' innodb_large_prefix=ON innodb_file_format=Barracuda innodb_file_per_table=ON [[email protected] /]# service mysqld restart [[email protected] /]# mysql -u root -p Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 3 Server version: 5.7.22 MySQL Community Server (GPL) Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql> show variables like "%character%";show variables like "%collation%"; +--------------------------+----------------------------+ | Variable_name | Value | +--------------------------+----------------------------+ | character_set_client | utf8mb4 | | character_set_connection | utf8mb4 | | character_set_database | utf8mb4 | | character_set_filesystem | binary | | character_set_results | utf8mb4 | | character_set_server | utf8mb4 | | character_set_system | utf8 | | character_sets_dir | /usr/share/mysql/charsets/ | +--------------------------+----------------------------+ 8 rows in set (0.01 sec) +----------------------+--------------------+ | Variable_name | Value | +----------------------+--------------------+ | collation_connection | utf8mb4_unicode_ci | | collation_database | utf8mb4_unicode_ci | | collation_server | utf8mb4_unicode_ci | +----------------------+--------------------+ 3 rows in set (0.02 sec) mysql> create database nextcloud; Query OK, 1 row affected (0.02 sec) mysql> show databases; +--------------------+ | Database | +--------------------+ | information_schema | | mysql | | nextcloud | | performance_schema | | phpmyadmin | | sys | +--------------------+ 6 rows in set (0.00 sec)
坑一:SQLSTATE[HY000] [2019] Can't initialize character set utf8mb4 (path: /usr/share/mysql/charsets/)
[[email protected] /]# yum remove php56w-mysql [[email protected] /]# yum install php56w-mysqlnd
三、开始安装-配置Nginx,开启pathinfo。
[[email protected] /]# cd /etc/nginx/conf.d [[email protected] conf.d]# cp default.conf nextcloud.conf [[email protected] conf.d]# vim nextcloud.conf server { listen 8082; server_name localhost; client_max_body_size 1000m; #charset koi8-r; access_log /var/log/nginx/nextcloud.log main; location / { root /www/nextcloud; index index.html index.htm index.php; } #error_page 404 /404.html; # redirect server error pages to the static page /50x.html # error_page 500 502 503 504 /50x.html; location = /50x.html { root /usr/share/nginx/html; } # proxy the PHP scripts to Apache listening on 127.0.0.1:80 # #location ~ \.php$ { # proxy_pass http://127.0.0.1; #} # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 # location ~ [^/]\.php(/|$) { root /www/nextcloud; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; fastcgi_split_path_info ^(.+?\.php)(/.*)$; set $path_info $fastcgi_path_info; fastcgi_param PATH_INFO $path_info; try_files $fastcgi_script_name =404; } # deny access to .htaccess files, if Apache's document root # concurs with nginx's one # location ~ /\.ht { deny all; } }
四、Web安装-NextCloud
访问:http://192.168.18.232:8082
当你看到最后的页面说明已经安装成功了,快享受技术带来的愉悦感吧!:)
我在公网上也部署了这套系统,有兴趣的同学要是着急体验对比可以直接访问:
NextCloud
http://111.231.86.247:8084
Name: Guest
Password: www.richcan
OwnCloud
http://111.231.86.247:8082
Name: Guest
Password: www.richcan
全文完!
以上是关于动手实验:部署私有云盘“NextCloud”的主要内容,如果未能解决你的问题,请参考以下文章