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

Rock64 : Les premiers pas …

Pour faire suite à mon post : https://www.cyber-neurones.org/2019/03/rock64-2-capteurs-de-debits-deau-debitmetre/ . A noter qu’il faut consommer plus de 0.075 L/s ou 4,5 L/min pour avoir une mesure fiable. Mon but est de mesure un outil qui fait dans les 50 L/min ….


Etapes n°1 : Choisir une version d’OS : http://wiki.pine64.org/index.php/ROCK64_Software_Release

Mon choix : stretch-minimal-rock64-0.7.8-1061-arm64.img.xz

  • Login avec
    • username: rock64
    • password: rock64

Etape n°2 : Décompresser :

unxz stretch-minimal-rock64-0.7.8-1061-arm64.img.xz

du -h stretch-minimal-rock64-0.7.8-1061-arm64.img 
1,8G	stretch-minimal-rock64-0.7.8-1061-arm64.img

Etape n°3 : Mettre sur la SDCard avec ApplePi.

Etape n°4 : Boot et ssh :

Etape n°5 : Mise à jours :

rock64@rock64:~$ sudo apt-get update

We trust you have received the usual lecture from the local System
Administrator. It usually boils down to these three things:

    #1) Respect the privacy of others.
    #2) Think before you type.
    #3) With great power comes great responsibility.

[sudo] password for rock64: 
...

rock64@rock64:~$ sudo apt-get dist-upgrade
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Calculating upgrade... Done
The following packages will be REMOVED:
  linux-rock64-package u-boot-rockchip-rock64
The following NEW packages will be installed:
  board-package-rock64-0.7-30 linux-headers-4.4.132-1075-rockchip-ayufan-ga83beded8524
  linux-image-4.4.132-1075-rockchip-ayufan-ga83beded8524 u-boot-rockchip-rock64-2017.09-rockchip-ayufan-1025-g482cd6ec8b
The following packages will be upgraded:
  apt apt-transport-https apt-utils base-files curl dirmngr firmware-brcm80211 firmware-realtek git git-man gnupg gnupg-agent gpgv
  libapt-inst2.0 libapt-pkg5.0 libc-bin libc-dev-bin libc-l10n libc6 libc6-dev libcurl3 libcurl3-gnutls libgnutls30 libnm0
  libpam-systemd libperl5.24 libpolkit-agent-1-0 libpolkit-backend-1-0 libpolkit-gobject-1-0 libpython3.5-minimal
  libpython3.5-stdlib libseccomp2 libssl1.0.2 libssl1.1 libsystemd0 libudev1 libxapian30 linux-libc-dev linux-rock64 locales
  multiarch-support network-manager openssh-client openssh-server openssh-sftp-server openssl perl perl-base perl-modules-5.24
  policykit-1 python3.5 python3.5-minimal ssh systemd systemd-sysv tzdata udev wpasupplicant
58 upgraded, 4 newly installed, 2 to remove and 0 not upgraded.
Need to get 76.5 MB of archives.
After this operation, 141 MB of additional disk space will be used.
Do you want to continue? [Y/n] Y

Etape n°6 : Installation pour Python

rock64@rock64:~$ sudo apt-get install python-dev python3-dev
Reading package lists... Done
Building dependency tree       
...
rock64@rock64:~$ sudo apt-get install mercurial
Reading package lists... Done
Building dependency tree       
...

Aie, perl n’est pas contant :

perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
	LANGUAGE = (unset),
	LC_ALL = (unset),
	LANG = "fr_FR.UTF-8"
    are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
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
Selecting previously unselected package libjs-excanvas.
(Reading database ... 66469 files and directories currently installed.)
Preparing to unpack .../libjs-excanvas_0.r3-4_all.deb ...
Unpacking libjs-excanvas (0.r3-4) ...
Selecting previously unselected package mercurial-common.
Preparing to unpack .../mercurial-common_4.0-1+deb9u1_all.deb ...
Unpacking mercurial-common (4.0-1+deb9u1) ...
Selecting previously unselected package mercurial.
Preparing to unpack .../mercurial_4.0-1+deb9u1_arm64.deb ...
Unpacking mercurial (4.0-1+deb9u1) ...
Setting up libjs-excanvas (0.r3-4) ...
Setting up mercurial-common (4.0-1+deb9u1) ...
Setting up mercurial (4.0-1+deb9u1) ...
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

Creating config file /etc/mercurial/hgrc.d/hgext.rc with new version

On continue :

rock64@rock64:~$ sudo apt-get install python-pip python3-pip
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following additional packages will be installed:
  python-pip-whl
Recommended packages:
  python-all-dev python-setuptools python-wheel python3-setuptools python3-wheel
The following NEW packages will be installed:
  python-pip python-pip-whl python3-pip
...

Maintenant la gestion GPIO :

rock64@rock64:~$ pip install R64.GPIO
Collecting R64.GPIO
  Could not find a version that satisfies the requirement R64.GPIO (from versions: )
No matching distribution found for R64.GPIO

Aie …

rock64@rock64:~$ sudo apt-get install git
...
rock64@rock64:~$ git clone https://github.com/Leapo/Rock64-R64.GPIO.git
Cloning into 'Rock64-R64.GPIO'...
remote: Enumerating objects: 254, done.
remote: Total 254 (delta 0), reused 0 (delta 0), pack-reused 254
Receiving objects: 100% (254/254), 79.38 KiB | 0 bytes/s, done.
Resolving deltas: 100% (125/125), done.
...
rock64@rock64:~$ sudo apt-get install python-setuptools           
Reading package lists... Done
Building dependency tree       
Reading state information... Done
...
rock64@rock64:~$ pip install spidev
Collecting spidev
  Downloading https://files.pythonhosted.org/packages/fb/14/4c2e1640f0cb04862c76d9d76ed7c945b0f67876e503ac02f7f675fe86a0/spidev-3.4.tar.gz
Building wheels for collected packages: spidev
  Running setup.py bdist_wheel for spidev ... error
  Complete output from command /usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-f9zDi7/spidev/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d /tmp/tmp2UN7bFpip-wheel- --python-tag cp27:
  usage: -c [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
     or: -c --help [cmd1 cmd2 ...]
     or: -c --help-commands
     or: -c cmd --help
  
  error: invalid command 'bdist_wheel'
  
  ----------------------------------------
  Failed building wheel for spidev
  Running setup.py clean for spidev
Failed to build spidev
Installing collected packages: spidev
  Running setup.py install for spidev ... done
Successfully installed spidev-3.4
...
rock64@rock64:~$ ln -s Rock64-R64.GPIO/R64/ .
...

Les GPIO que je vais utiliser : n°12 et n°16

La photo :

smacap_Bright

Le premier programme de test en Python :

rock64@rock64:~/Rock64-R64.GPIO$ cat R64-GPIO-test.py 
#!/usr/bin/env python

# Allison Creely, 2018, LGPLv3 License
# Rock 64 GPIO Library for Python

import R64.GPIO as GPIO
from time import sleep

print("Testing R64.GPIO Module...")

# Test Variables
print("")
print("Module Variables:")
print("Name           Value")
print("----           -----")
print("GPIO.ROCK      " + str(GPIO.ROCK))
print("GPIO.BOARD     " + str(GPIO.BOARD))
print("GPIO.BCM       " + str(GPIO.BCM))
print("GPIO.OUT       " + str(GPIO.OUT))
print("GPIO.IN        " + str(GPIO.IN))
print("GPIO.HIGH      " + str(GPIO.HIGH))
print("GPIO.LOW       " + str(GPIO.LOW))
print("GPIO.PUD_UP    " + str(GPIO.PUD_UP))
print("GPIO.PUD_DOWN  " + str(GPIO.PUD_DOWN))
print("GPIO.VERSION   " + str(GPIO.VERSION))
print("GPIO.RPI_INFO  " + str(GPIO.RPI_INFO))
# Set Variables
var_gpio_in = 12
var_gpio_in2 = 16
# GPIO Setup
GPIO.setwarnings(True)
GPIO.setmode(GPIO.BOARD)
GPIO.setup(var_gpio_in, GPIO.IN, pull_up_down=GPIO.PUD_UP)  # Set up GPIO as an input, pullup enabled
GPIO.setup(var_gpio_in2, GPIO.IN, pull_up_down=GPIO.PUD_UP)  # Set up GPIO as an input, pullup enabled
print("Testing GPIO Input:")
# Test Input
var_gpio_state = GPIO.input(var_gpio_in)                    # Return state of GPIO
print("Input State  : " + str(var_gpio_state))              # Print results
sleep(20)
# Test interrupt
print("")
print("Waiting 3 seconds for interrupt...")
var_interrupt = GPIO.wait_for_edge(var_gpio_in, GPIO.FALLING, timeout=3000)
if var_interrupt is None:
    print("Timeout!")
else:
    print("Detected!")
print("Testing GPIO Input:")
# Test Input
var_gpio_state2 = GPIO.input(var_gpio_in2)                    # Return state of GPIO
print("Input State  : " + str(var_gpio_state2))              # Print results
sleep(20)
# Test interrupt
print("")
print("Waiting 3 seconds for interrupt...")
var_interrupt2 = GPIO.wait_for_edge(var_gpio_in2, GPIO.FALLING, timeout=3000)
if var_interrupt2 is None:
    print("Timeout!")
else:
    print("Detected!")
GPIO.cleanup([var_gpio_in, var_gpio_in2])                   # Perform cleanup on specified GPIOs
print("")
print("Test Complete")

résultat :

rock64@rock64:~/Rock64-R64.GPIO$ python R64-GPIO-test.py 
Testing R64.GPIO Module...

Module Variables:
Name           Value
----           -----
GPIO.ROCK      ROCK
GPIO.BOARD     BOARD
GPIO.BCM       BCM
GPIO.OUT       out
GPIO.IN        in
GPIO.HIGH      1
GPIO.LOW       0
GPIO.PUD_UP    0
GPIO.PUD_DOWN  1
GPIO.VERSION   0.6.3
GPIO.RPI_INFO  {'P1_REVISION': 3, 'RAM': '1024M', 'REVISION': 'a22082', 'TYPE': 'Pi 3 Model B', 'PROCESSOR': 'BCM2837', 'MANUFACTURER': 'Embest'}
Error: Unable to export GPIO
Error: Unable to set GPIO direction
Error: Unable to export GPIO
Error: Unable to set GPIO direction
Testing GPIO Input:
You must setup() the GPIO channel (BOARD 12) first
Input State  : None

Waiting 3 seconds for interrupt...
You must setup() the GPIO channel (BOARD 12) as an input first
Timeout!
Testing GPIO Input:
You must setup() the GPIO channel (BOARD 16) first
Input State  : None

Waiting 3 seconds for interrupt...
You must setup() the GPIO channel (BOARD 16) as an input first
Timeout!

Test Complete

Oups il faut le faire en root, et je suis passer à 10 sec. pour l’interruption :

rock64@rock64:~/Rock64-R64.GPIO$ sudo python R64-GPIO-test.py 
Testing R64.GPIO Module...

Module Variables:
Name           Value
----           -----
GPIO.ROCK      ROCK
GPIO.BOARD     BOARD
GPIO.BCM       BCM
GPIO.OUT       out
GPIO.IN        in
GPIO.HIGH      1
GPIO.LOW       0
GPIO.PUD_UP    0
GPIO.PUD_DOWN  1
GPIO.VERSION   0.6.3
GPIO.RPI_INFO  {'P1_REVISION': 3, 'RAM': '1024M', 'REVISION': 'a22082', 'TYPE': 'Pi 3 Model B', 'PROCESSOR': 'BCM2837', 'MANUFACTURER': 'Embest'}
Testing GPIO Input:
Input State  : 0

Waiting 10 seconds for interrupt...
Detected!
Testing GPIO Input:
Input State  : 1

Waiting 10 seconds for interrupt...
Detected!

Test Complete

Donc quand je souffle, je détecte l’interruption.

La première étape est donc faite.

A noter cette documentation : https://github.com/Leapo/Rock64-R64.GPIO/wiki/GPIO-Modes , ils ne sont pas tous fonctionnel :

Et a noter aussi que la fonction suivante n’est pas disponible : Error: GPIO.add_event_detect() Not implemented.

Ce qui complique le programme ….