Installation de NextCloud sur Rock64

Présentation du Rock64 :

rock64@rock64:~$ df
Filesystem     1K-blocks    Used Available Use% Mounted on
udev             2007204       0   2007204   0% /dev
tmpfs             401844   10464    391380   3% /run
/dev/mmcblk1p7  61228716 2045964  56657512   4% /
tmpfs            2009204       0   2009204   0% /dev/shm
tmpfs               5120       4      5116   1% /run/lock
tmpfs            2009204       0   2009204   0% /sys/fs/cgroup
/dev/mmcblk1p6    114446     978    113468   1% /boot/efi
tmpfs             401840       0    401840   0% /run/user/1000

rock64@rock64:~$ uname -a
Linux rock64 4.4.132-1075-rockchip-ayufan-ga83beded8524 #1 SMP Thu Jul 26 08:22:22 UTC 2018 aarch64 GNU/Linux

rock64@rock64:~$ cat /etc/debian_version 
9.9

Voici les quelques commandes …

Je commence par faire une mise à jours :

rock64@rock64:~$ sudo apt update;sudo apt -y upgrade

Ensuite j’installe les paquets de base :

rock64@rock64:~$ sudo apt install apache2 libapache2-mod-php7.0 php7.0-cli php7.0-curl php7.0-gd php7.0-opcache php7.0-xml php7.0-zip php7.0-mbstring php7.0-mysql php-imagick unzip openssl nmap

Premier problème j’ai dans les logs, sans arrêt :

...
locale: Cannot set LC_CTYPE to default locale: No such file or directory
locale: Cannot set LC_MESSAGES to default locale: No such file or directory
locale: Cannot set LC_ALL to default locale: No such file or directory
...

J’ai ajouté dans .bashrc

export LC_ALL="en_US.UTF-8"
export LANG="en_US.UTF-8"
export LANGUAGE="en_US.UTF-8"

Ce qui donne :

$ head -20 .bashrc 
# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples

# If not running interactively, don't do anything
case $- in
    *i*) ;;
      *) return;;
esac

export LC_ALL="en_US.UTF-8"
export LANG="en_US.UTF-8"
export LANGUAGE="en_US.UTF-8"

# don't put duplicate lines or lines starting with space in the history.
# See bash(1) for more options
HISTCONTROL=ignoreboth

# append to the history file, don't overwrite it
shopt -s histappend

$ source .bashrc 
-bash: warning: setlocale: LC_ALL: cannot change locale (en_US.UTF-8): No such file or directory
$ locale
locale: Cannot set LC_CTYPE to default locale: No such file or directory
locale: Cannot set LC_MESSAGES to default locale: No such file or directory
locale: Cannot set LC_ALL to default locale: No such file or directory
LANG=en_US.UTF-8
LANGUAGE=en_US.UTF-8
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=en_US.UTF-8

Je vais voir si c’est grave plus tard …

Ensuite téléchargement de NextCloud : https://download.nextcloud.com/server/releases/nextcloud-16.0.4.zip

rock64@rock64:~$ cd /var/www/html/           

rock64@rock64:/var/www/html$ sudo wget https://download.nextcloud.com/server/releases/nextcloud-16.0.4.zip
--2019-09-07 09:07:01--  https://download.nextcloud.com/server/releases/nextcloud-16.0.4.zip
Resolving download.nextcloud.com (download.nextcloud.com)... 2a01:4f8:130:32f1::52, 176.9.217.52
Connecting to download.nextcloud.com (download.nextcloud.com)|2a01:4f8:130:32f1::52|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 80053992 (76M) [application/zip]
Saving to: 'nextcloud-16.0.4.zip'

rock64@rock64:/var/www/html$ sudo unzip nextcloud-16.0.4.zip

rock64@rock64:/var/www/html$ sudo chown -R www-data:www-data *

rock64@rock64:/var/www/html$ sudo rm *.zip

Installation de MariaDB :

rock64@rock64:/var/www/html$ sudo apt install mariadb-server

Administration de MariaDB :

$ sudo mysql
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 3
Server version: 10.1.38-MariaDB-0+deb9u1 Debian 9.8

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]> create user 'nextcloud'@'%' identified by 'mypassword';  
Query OK, 0 rows affected (0.00 sec)

MariaDB [(none)]> create database if not exists dbnextcloud CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;
Query OK, 1 row affected (0.01 sec)

MariaDB [(none)]> GRANT ALL PRIVILEGES on dbnextcloud.* to 'nextcloud'@'%';
Query OK, 0 rows affected (0.00 sec)

MariaDB [(none)]> FLUSH privileges;
Query OK, 0 rows affected (0.00 sec)

MariaDB [(none)]> exit
Bye

Initialisation de NextCloud :

rock64@rock64:/var/www/html/nextcloud$ pwd
/var/www/html/nextcloud
rock64@rock64:/var/www/html/nextcloud$ sudo -u www-data php occ maintenance:install –database "mysql" –database-host="127.0.0.1" –database-name "dbnextcloud" –database-user "nextcloud" –database-pass "mypassword" –admin-user "admin" –admin-pass "rock64next"
This version of Nextcloud requires at least PHP 7.1
You are currently running 7.0.33-0+deb9u3. Please update your PHP version.

Aie … j’ai pas la bonne version de PHP : 7.0.33 à la place de 7.1 .

rock64@rock64:/var/www/html/nextcloud$ sudo add-apt-repository ppa:ondrej/php
 Co-installable PHP versions: PHP 5.6, PHP 7.x and most requested extensions are included. Only Supported Versions of PHP (http://php.net/supported-versions.php) for Supported Ubuntu Releases (https://wiki.ubuntu.com/Releases) are provided. Don't ask for end-of-life PHP versions or Ubuntu release, they won't be provided.

Debian oldstable and stable packages are provided as well: https://deb.sury.org/#debian-dpa

You can get more information about the packages at https://deb.sury.org

BUGS&FEATURES: This PPA now has a issue tracker:
https://deb.sury.org/#bug-reporting

CAVEATS:
1. If you are using php-gearman, you need to add ppa:ondrej/pkg-gearman
2. If you are using apache2, you are advised to add ppa:ondrej/apache2
3. If you are using nginx, you are advise to add ppa:ondrej/nginx-mainline
   or ppa:ondrej/nginx

PLEASE READ: If you like my work and want to give me a little motivation, please consider donating regularly: https://donate.sury.org/

WARNING: add-apt-repository is broken with non-UTF-8 locales, see 
https://github.com/oerdnj/deb.sury.org/issues/56 for workaround:

# LC_ALL=C.UTF-8 add-apt-repository ppa:ondrej/php
 More info: https://launchpad.net/~ondrej/+archive/ubuntu/php
Press [ENTER] to continue or ctrl-c to cancel adding it

gpg: keybox '/tmp/tmp1jg_bnfh/pubring.gpg' created
gpg: /tmp/tmp1jg_bnfh/trustdb.gpg: trustdb created
gpg: key 4F4EA0AAE5267A6C: public key "Launchpad PPA for Ond\xc5\x99ej Sur?" imported
gpg: Total number processed: 1
gpg:               imported: 1
Exception in thread Thread-1:
Traceback (most recent call last):
  File "/usr/lib/python3.5/threading.py", line 914, in _bootstrap_inner
    self.run()
  File "/usr/lib/python3.5/threading.py", line 862, in run
    self._target(*self._args, **self._kwargs)
  File "/usr/lib/python3/dist-packages/softwareproperties/SoftwareProperties.py", line 688, in addkey_func
    func(**kwargs)
  File "/usr/lib/python3/dist-packages/softwareproperties/ppa.py", line 386, in add_key
    return apsk.add_ppa_signing_key()
  File "/usr/lib/python3/dist-packages/softwareproperties/ppa.py", line 263, in add_ppa_signing_key
    tmp_export_keyring, signing_key_fingerprint, tmp_keyring_dir):
  File "/usr/lib/python3/dist-packages/softwareproperties/ppa.py", line 212, in _verify_fingerprint
    got_fingerprints = self._get_fingerprints(keyring, keyring_dir)
  File "/usr/lib/python3/dist-packages/softwareproperties/ppa.py", line 204, in _get_fingerprints
    output = subprocess.check_output(cmd, universal_newlines=True)
  File "/usr/lib/python3.5/subprocess.py", line 316, in check_output
    **kwargs).stdout
  File "/usr/lib/python3.5/subprocess.py", line 385, in run
    stdout, stderr = process.communicate(input, timeout=timeout)
  File "/usr/lib/python3.5/subprocess.py", line 788, in communicate
    stdout = self.stdout.read()
  File "/usr/lib/python3.5/encodings/ascii.py", line 26, in decode
    return codecs.ascii_decode(input, self.errors)[0]
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc5 in position 223: ordinal not in range(128)

rock64@rock64:/var/www/html/nextcloud$ sudo apt-get update
Hit:1 http://ppa.launchpad.net/ayufan/rock64-ppa/ubuntu xenial InRelease
Ign:2 http://ppa.launchpad.net/ondrej/php/ubuntu eoan InRelease                                                                            
Ign:3 http://ppa.launchpad.net/ondrej/php/ubuntu eoan Release                                                                                        
Ign:4 http://ppa.launchpad.net/ondrej/php/ubuntu eoan/main all Packages                                                                                    
Get:5 http://deb.ayufan.eu/orgs/ayufan-rock64/releases  InRelease [1343 B]                                                                                 
Hit:6 http://security.debian.org stretch/updates InRelease                                                                              
Ign:7 http://ppa.launchpad.net/ondrej/php/ubuntu eoan/main arm64 Packages                                                 
Ign:9 http://ppa.launchpad.net/ondrej/php/ubuntu eoan/main Translation-en                           
Ign:4 http://ppa.launchpad.net/ondrej/php/ubuntu eoan/main all Packages                             
Ign:8 http://cdn-fastly.deb.debian.org/debian stretch InRelease                                                        
Ign:7 http://ppa.launchpad.net/ondrej/php/ubuntu eoan/main arm64 Packages                                              
Hit:10 http://cdn-fastly.deb.debian.org/debian stretch-updates InRelease                                                 
Ign:9 http://ppa.launchpad.net/ondrej/php/ubuntu eoan/main Translation-en                                                
Hit:11 http://cdn-fastly.deb.debian.org/debian stretch Release                                     
Ign:4 http://ppa.launchpad.net/ondrej/php/ubuntu eoan/main all Packages
Ign:7 http://ppa.launchpad.net/ondrej/php/ubuntu eoan/main arm64 Packages    
Ign:9 http://ppa.launchpad.net/ondrej/php/ubuntu eoan/main Translation-en     
Ign:4 http://ppa.launchpad.net/ondrej/php/ubuntu eoan/main all Packages       
Ign:7 http://ppa.launchpad.net/ondrej/php/ubuntu eoan/main arm64 Packages     
Ign:9 http://ppa.launchpad.net/ondrej/php/ubuntu eoan/main Translation-en     
Ign:4 http://ppa.launchpad.net/ondrej/php/ubuntu eoan/main all Packages       
Ign:7 http://ppa.launchpad.net/ondrej/php/ubuntu eoan/main arm64 Packages      
Ign:9 http://ppa.launchpad.net/ondrej/php/ubuntu eoan/main Translation-en      
Ign:4 http://ppa.launchpad.net/ondrej/php/ubuntu eoan/main all Packages        
Err:7 http://ppa.launchpad.net/ondrej/php/ubuntu eoan/main arm64 Packages      
  404  Not Found
Ign:9 http://ppa.launchpad.net/ondrej/php/ubuntu eoan/main Translation-en      
Fetched 1343 B in 1s (688 B/s)                                                 
Reading package lists... Done
W: The repository 'http://ppa.launchpad.net/ondrej/php/ubuntu eoan Release' does not have a Release file.
N: Data from such a repository can't be authenticated and is therefore potentially dangerous to use.
N: See apt-secure(8) manpage for repository creation and user configuration details.
E: Failed to fetch http://ppa.launchpad.net/ondrej/php/ubuntu/dists/eoan/main/binary-arm64/Packages  404  Not Found
E: Some index files failed to download. They have been ignored, or old ones used instead.

rock64@rock64:/var/www/html/nextcloud$ sudo apt-get install php7.1 php7.1-common
Reading package lists... Done
Building dependency tree       
Reading state information... Done
E: Unable to locate package php7.1
E: Couldn't find any package by glob 'php7.1'
E: Couldn't find any package by regex 'php7.1'
E: Unable to locate package php7.1-common
E: Couldn't find any package by glob 'php7.1-common'
E: Couldn't find any package by regex 'php7.1-common'

On va donc faire le plan B :

rock64@rock64:~$ sudo apt install apt-transport-https lsb-release ca-certificates

rock64@rock64:~$ sudo wget -O /etc/apt/trusted.gpg.d/php.gpg https://packages.sury.org/php/apt.gpg
--2019-09-07 09:36:32--  https://packages.sury.org/php/apt.gpg
Resolving packages.sury.org (packages.sury.org)... 2606:4700:30::681f:5fa9, 2606:4700:30::681f:5ea9, 104.31.95.169, ...
Connecting to packages.sury.org (packages.sury.org)|2606:4700:30::681f:5fa9|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 1769 (1.7K) [application/octet-stream]
Saving to: '/etc/apt/trusted.gpg.d/php.gpg'

/etc/apt/trusted.gpg.d/php.gpg                                      100%[=================================================================================================================================================================>]   1.73K  --.-KB/s    in 0s      

2019-09-07 09:36:32 (7.96 MB/s) - '/etc/apt/trusted.gpg.d/php.gpg' saved [1769/1769]

rock64@rock64:~$ sudo sh -c 'echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" > /etc/apt/sources.list.d/php.list'

rock64@rock64:~$ sudo apt update
Hit:1 http://security.debian.org stretch/updates InRelease
Hit:2 http://ppa.launchpad.net/ayufan/rock64-ppa/ubuntu xenial InRelease  
Ign:3 http://ppa.launchpad.net/ondrej/php/ubuntu eoan InRelease                                                                                               
Err:4 http://ppa.launchpad.net/ondrej/php/ubuntu eoan Release                                                                                                 
  404  Not Found
Get:5 http://deb.ayufan.eu/orgs/ayufan-rock64/releases  InRelease [1343 B]                                   
Ign:6 http://cdn-fastly.deb.debian.org/debian stretch InRelease                                      
Hit:7 http://cdn-fastly.deb.debian.org/debian stretch-updates InRelease
Hit:8 http://cdn-fastly.deb.debian.org/debian stretch Release
Get:9 https://packages.sury.org/php stretch InRelease [6760 B]
Get:11 https://packages.sury.org/php stretch/main arm64 Packages [124 kB]
Reading package lists... Done      
E: The repository 'http://ppa.launchpad.net/ondrej/php/ubuntu eoan Release' does not have a Release file.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.

rock64@rock64:~$ dpkg -l | grep php | tee packages.txt
ii  libapache2-mod-php7.0                                           7.0.33-0+deb9u3                          arm64        server-side, HTML-embedded scripting language (Apache 2 module)
ii  php-common                                                      1:49                                     all          Common files for PHP packages
ii  php-imagick                                                     3.4.3~rc2-2                              arm64        Provides a wrapper to the ImageMagick library
ii  php7.0-cli                                                      7.0.33-0+deb9u3                          arm64        command-line interpreter for the PHP scripting language
ii  php7.0-common                                                   7.0.33-0+deb9u3                          arm64        documentation, examples and common module for PHP
ii  php7.0-curl                                                     7.0.33-0+deb9u3                          arm64        CURL module for PHP
ii  php7.0-gd                                                       7.0.33-0+deb9u3                          arm64        GD module for PHP
ii  php7.0-json                                                     7.0.33-0+deb9u3                          arm64        JSON module for PHP
ii  php7.0-mbstring                                                 7.0.33-0+deb9u3                          arm64        MBSTRING module for PHP
ii  php7.0-mysql                                                    7.0.33-0+deb9u3                          arm64        MySQL module for PHP
ii  php7.0-opcache                                                  7.0.33-0+deb9u3                          arm64        Zend OpCache module for PHP
ii  php7.0-readline                                                 7.0.33-0+deb9u3                          arm64        readline module for PHP
ii  php7.0-xml                                                      7.0.33-0+deb9u3                          arm64        DOM, SimpleXML, WDDX, XML, and XSL module for PHP
ii  php7.0-zip                                                      7.0.33-0+deb9u3                          arm64        Zip module for PHP

rock64@rock64:~$ sudo apt-get install php7.1 php7.1-common 
rock64@rock64:~$ sudo -u www-data php occ maintenance:install --database "mysql" --database-host "127.0.0.1" --database-name "dbnextcloud" --database-user "nextcloud" --database-pass "mypassword" --admin-user "admin" --admin-pass "rock64next"

Nextcloud was successfully installed

rock64@rock64:~$ sudo apt-get purge php7.0 php7.0-common

La sécurité :

rock64@rock64:~$ sudo mkdir /etc/apache2/ssl/
rock64@rock64:~$ PARAMETER_CERT_C="FR"
rock64@rock64:~$ PARAMETER_CERT_ST="private"
rock64@rock64:~$ PARAMETER_CERT_L="France"
rock64@rock64:~$ PARAMETER_CERT_O="DTC" 
rock64@rock64:~$ CN="nextcloud.mtdc"
rock64@rock64:~$ PATHCERTS=/etc/apache2/ssl
rock64@rock64:~$ sudo openssl req -new -x509 -days 365 -nodes -subj "/C=$PARAMETER_CERT_C/ST=$PARAMETER_CERT_ST/L=$PARAMETER_CERT_L/O=$PARAMETER_CERT_O/CN=$CN" -out $PATHCERTS/$CN.crt -keyout $PATHCERTS/$CN.key
Generating a RSA private key
...+++++
.....................................................+++++
writing new private key to '/etc/apache2/ssl/nextcloud.mtdc.key'
-----
rock64@rock64:~$ sudo chmod 644 /etc/apache2/ssl/*.crt
rock64@rock64:~$ sudo chmod 600 /etc/apache2/ssl/*.key 

Création d’un fichier :

rock64@rock64:~$ cat /etc/apache2/sites-available/nextcloud.mtdc.conf

<IfModule mod_ssl.c>
    <VirtualHost _default_:443>
        <IfModule mod_headers.c>
            Header always set Strict-Transport-Security "max-age=15552000; includeSubDomains"
        </IfModule>
                   ServerName nextcloud.mtdc
                   ServerAdmin webmaster@localhost
                   RewriteEngine On
                   RewriteCond %{HTTPS} off
                   #RewriteRule ^(.*)$ https://%{HTTP_HOST}$1 [R=301,L]
                   DocumentRoot /var/www/html/nextcloud
                   ErrorLog ${APACHE_LOG_DIR}/error.log
                   CustomLog ${APACHE_LOG_DIR}/access.log combined
                   SSLEngine on
                   SSLCertificateFile /etc/apache2/ssl/nextcloud.mtdc.crt
                   SSLCertificateKeyFile /etc/apache2/ssl/nextcloud.mtdc.key
                   <FilesMatch "\.(cgi|shtml|phtml|php)$">
                                   SSLOptions +StdEnvVars
                   </FilesMatch>
                   <Directory /usr/lib/cgi-bin>
                                   SSLOptions +StdEnvVars
                   </Directory>
                   <Directory />
                            Options FollowSymlinks
                                   AllowOverride All
                                    Order allow,deny
                                    allow from all
                   </Directory>
                   <Directory /var/www/html/nextcloud/data>
                        Require all denied
                   </Directory>
    </VirtualHost>
</IfModule>

Fin de l’installation :

rock64@rock64:~$ sudo apt-get install apache2 libapache2-mod-wsgi python-dev
rock64@rock64:~$ sudo a2enmod wsgi
rock64@rock64:~$ sudo a2enmod ssl
rock64@rock64:~$ sudo a2enmod rewrite
rock64@rock64:~$ sudo a2ensite nextcloud.mtdc
rock64@rock64:~$ sudo a2dismod php5.0
rock64@rock64:~$ sudo a2dismod php7.0
rock64@rock64:~$ sudo a2enmod php7.1

Modification du fichier de config avec l’IP du NexCloud :

rock64@rock64:/var/www/html/nextcloud$ sudo vi config/config.php
...
  'trusted_domains' => 
  array (
	  0 => 'localhost',
	  1 => '192.168.1.22',
          2 => 'nextcloud.mtdc'
  ),
...

Fin de l’installation :

Je viens de voir l’erreur en boucle : You are using a fallback implementation of the intl extension. Installing the native one is highly recommended instead.

Je fais donc l’installation de php-intl :

$ sudo apt-get install php-intl
$ sudo apt install php7.1-intl
$ sudo systemctl restart php7.1-fpm.service

Laisser un commentaire

Votre adresse e-mail ne sera pas publiée. Les champs obligatoires sont indiqués avec *

Time limit is exhausted. Please reload CAPTCHA.