NextCloud

BamB00 2018-11-18 16:27:22
Categories: Tags:

一,环境准备

我使用的是Vltur Ubuntu 18.06环境

  1. Apache2

    apt-get install apache2 -t

– more –
2. ### Mysql

apt-get install mysql-server

  1. PHP7

    现在的PHP到7.2版本了

    所以所有环境以PHP7.2版本开始 先装

    apt-get install php7.2 libapache2-mod-php7.2 php7.2-mbstring php7.2-mysql php7.2-zip php7.2-dom php7.2-xml php7.2-gd php7.2-curl

二: 环境配置

  1. 给Nextcloud文件夹(根据个人喜好配置)

    cd /
    mkdir Nextcloud
    cd Nextcloud 
    mkdir log nextcloud data
    
  2. apache

vim /etc/apache2/sites-enabled/000-default.conf

配置修改一下几个地方

```      shell
<VirtuaHost *:80>   #改为*为你的域名
例<VirtuaHost www.baozouzhugan.com:80>

#ServerName www.example.com
例ServerName www.baozouzhugan.com  #注意把#去掉

DocumentROOT /var/www/html     #修改为你修改的目录文件下的nextcloud文件夹

ErrorLog ${APACHE_LOG_DIR}/error.log 
CustomLog ${APACHE_LOG_DIR}/access.log combined
#以上两个修改到NextCloud/log/error.log 和 NextCloud/log/access.log combined
```

再修改apche2.conf文件

vim /etc/apache2/apache2.conf

```shell
<Directory /var/www>   #修改目录文件就可以了例/NextCloud 
    Options Indexes FollowSymLinks 
    AllowOverride None 
    Require all granted
</Directory>
```

重启apache

service apache2 restart

  1. MYSQL

mysql -u root -p    #登陆
create database bamboo; #创建数据库
use bamboo;  #调用数据库
grant all on bamboo.* to username@localhost identifien by 'password';  #添加用户名并赋予该数据库的权限
exit; #退出

三:安装NextCloud

```shell   
cd /NextCloud/nextcloud #去根目录
wget https://download.nextcloud.com/server/releases/nextcloud-14.0.3.zip   #https://download.nextcloud.com/server/releases 可以去官网找最新版本
unzip nextcloud-14.0.3.zip #解压
mv nextcloud ../  #安装完成
```

四:给权限

#!/bin/bash
ocpath='/NextCloud/nextcloud'
htuser='www-data'
htgroup='www-data'
rootuser='root'
printf "Creating possible missing Directories\n"
mkdir -p $ocpath/data
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
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} ${ocpath}/data/
chown -R ${htuser}:${htgroup} ${ocpath}/themes/
chown -R ${htuser}:${htgroup} ${ocpath}/updater/
chmod +x ${ocpath}/occ
printf "chmod/chown .htaccess\n"

在任意的一个地方创建一个name.sh文件写入并执行就好

另外还要对data目录赋予权限

chmod 770 /NextCloud/data/ -Rf
chown www-data /NextCloud/data/ -Rf
chown :www-data /NextCloud/data/ -Rf

这次文字教程就到这里了。图片以后再考虑要不要放,后面如果有时间会把文件路径缓存目录补上做一次完整的云盘