Ubuntu18 安装 nextcloud18详细步骤

Ubuntu18 安装 nextcloud18详细步骤

 

1. 检查Ubuntu系统版本

root@nextcloud_server:~# lsb_release -a

Ubuntu18 安装 nextcloud18详细步骤

Ubuntu18 安装 nextcloud18详细步骤

2. 检查php版本

root@nextcloud_server:~# php -v

Ubuntu18 安装 nextcloud18详细步骤

升级并安装php7.2

root@nextcloud_server:~# apt-get update

root@nextcloud_server:~# apt-get install php7.2

Ubuntu18 安装 nextcloud18详细步骤

root@nextcloud_server:~# apt-get install php-fpm

Ubuntu18 安装 nextcloud18详细步骤

Ubuntu18 安装 nextcloud18详细步骤

安装php7.2 模组

# apt-get install php7.2-mysql

# apt-get install php7.2-curl

# apt-get install php7.2-json

# apt-get install php7.2-mbstring

# apt-get install php7.2-xml

# apt-get install php7.2-int

# apt-get install php7.2-imagick

# apt-get install php7.2-gd

# apt-get install php7.2-soap

# apt-get install php7.2-gmp    

# apt-get install php7.2-odbc       

# apt-get install php7.2-pspell     

# apt-get install php7.2-bcmath   

# apt-get install php7.2-enchant    

# apt-get install php7.2-imap       

# apt-get install php7.2-ldap       

# apt-get install php7.2-opcache

# apt-get install php7.2-readline   

# apt-get install php7.2-sqlite3    

# apt-get install php7.2-xmlrpc

# apt-get install php7.2-bz2

# apt-get install php7.2-interbase

# apt-get install php7.2-pgsql      

# apt-get install php7.2-recode     

# apt-get install php7.2-sybase     

# apt-get install php7.2-xsl

# apt-get install php7.2-cgi        

# apt-get install php7.2-dba

# apt-get install php7.2-phpdbg     

# apt-get install php7.2-snmp       

# apt-get install php7.2-tidy       

# apt-get install php7.2-zip

检查php7.2模块

root@nextcloud_server:~# dpkg -l | grep php

Ubuntu18 安装 nextcloud18详细步骤

加载php7.2模块

root@nextcloud_server:~# a2dismod php7.0

root@nextcloud_server:~# a2enmod php7.2

Ubuntu18 安装 nextcloud18详细步骤

重启php7.2-pfm服务

root@nextcloud_server:~# systemctl restart php7.2-fpm

Ubuntu18 安装 nextcloud18详细步骤

3. 安装mariadb数据库

检查mariadb数据库版本,可以看到Ubuntu18源库带的是mairadb10.1版数据库

root@nextcloud_server:~# apt list |grep mariadb

Ubuntu18 安装 nextcloud18详细步骤

开始安装:

root@nextcloud_server:~# apt-get install mariadb-server

Ubuntu18 安装 nextcloud18详细步骤

检查版本

root@nextcloud_server:~# mysql -v

Ubuntu18 安装 nextcloud18详细步骤

数据库基本安全设置:

root@nextcloud_server:~# mysql_secure_installation

Ubuntu18 安装 nextcloud18详细步骤

Ubuntu18 安装 nextcloud18详细步骤

Ubuntu18 安装 nextcloud18详细步骤

Ubuntu18 安装 nextcloud18详细步骤

创建数据库:

CREATE USER 'nextcloud'@'localhost' IDENTIFIED BY 'Mypassword';

CREATE DATABASE IF NOT EXISTS nextcloud CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;

GRANT ALL PRIVILEGES on nextcloud.* to 'nextcloud'@'localhost';

FLUSH privileges;

Ubuntu18 安装 nextcloud18详细步骤

Ubuntu18 安装 nextcloud18详细步骤

4. 安装apache2

root@nextcloud_server:~# apt-get install apache2

root@nextcloud_server:~# apt-get install libapache2-mod-php7.2

root@nextcloud_server:~# cd /etc/apache2/sites-available

Ubuntu18 安装 nextcloud18详细步骤

root@nextcloud_server:/etc/apache2/sites-available# vi nextcloud.conf

Alias /nextcloud "/var/www/nextcloud/"

<VirtualHost *:80>

        ServerName mynextcloud_IP

        DocumentRoot /var/www/nextcloud/

        <Directory /var/www/nextcloud/>

          Require all granted

          AllowOverride All

          Options FollowSymLinks MultiViews

          <IfModule mod_dav.c>

            Dav off

          </IfModule>

        SetEnv HOME /var/www/nextcloud

        SetEnv HTTP_HOME /var/www/nextcloud

        </Directory>

</VirtualHost>

Ubuntu18 安装 nextcloud18详细步骤

加载配置文件:

root@nextcloud_server:/etc/apache2/sites-available# a2ensite nextcloud.conf

root@nextcloud_server:/etc/apache2/sites-available# systemctl reload apache2

Ubuntu18 安装 nextcloud18详细步骤

5.  安装nextcloud18

下载nextcloud:

Ubuntu18 安装 nextcloud18详细步骤

root@nextcloud_server:/usr/local/src# wget https://download.nextcloud.com/server/releases/nextcloud-18.0.14.tar.bz2

root@nextcloud_server:/usr/local/src# tar -xjf nextcloud-18.0.14.tar.bz2

Ubuntu18 安装 nextcloud18详细步骤

拷贝到apache2的站点目录:

root@nextcloud_server:/usr/local/src# cp -r nextcloud /var/www

oot@nextcloud_server:/var/www# chown -R www-data:www-data nextcloud

Ubuntu18 安装 nextcloud18详细步骤

建立数据目录:

root@nextcloud_server:/var/www# cd /data

root@nextcloud_server:/data# mkdir nextcloud

root@nextcloud_server:/data# chown -R www-data:www-data nextcloud/

Ubuntu18 安装 nextcloud18详细步骤

5. 安装配置next cloud:

重启服务:

root@nextcloud_server:/var/www# systemctl restart apache2

root@nextcloud_server:/var/www# systemctl restart mysql

root@nextcloud_server:/var/www# systemctl restart php7.2-fpm

关闭防火墙

root@nextcloud_server:/# ufw disable

或放通80端口:

root@nextcloud_server:/# ufw allow 80

通过浏览器打开 http://mynextcloud_IP

Ubuntu18 安装 nextcloud18详细步骤

Ubuntu18 安装 nextcloud18详细步骤

如此,next cloud已基本安装OK。

6. 参考文献

参考文献:

https://docs.nextcloud.com/server/18/admin_manual/installation/example_ubuntu.html

 

 

上一篇:nextcloud如何启用LDAP/AD认证


下一篇:简单三步使用 Docker 搭建一个多端同步网盘!你学废了吗?