Nextcloud on Clear Linux

I have a Clear Linux SBC that I am hoping to install nextcloud on.

I have found a nextcloud flatpak as well as a nextcloud client bundle (swupd). I want to install a nextcloud server, and I’d like it to have access to system resources (USB connected harddrives).

Has anyone successfully done that?

Thx!
Jeremy

Yep. tl;dr :

sudo swupd bundle-add containers-basic \
  && sudo systemctl enable --now docker \
  && sudo usermod -aG docker $USER \
  && exec su -l $USER
docker run -d \
  -p 8080:80 \
  -v ${PWD}/data:/var/www/html/data/ \
  --name nextcloud \
  -e NEXTCLOUD_ADMIN_USER=${USER} \
  -e NEXTCLOUD_ADMIN_PASSWORD=guess_me \
  nextcloud \
  && sed -i '/PASSWORD/d' $HISTFILE

You could do something like:

sudo swupd bundle-add containers-basic docker-compose
## docker-compose.yaml

version: '2'

volumes:
  nextcloud:
  db:

services:
  db:
    image: clearlinux/mariadb:latest
    command: --transaction-isolation=READ-COMMITTED --binlog-format=ROW --bind-address=0.0.0.0
    restart: always
    volumes:
      - db:/var/lib/mysql
    environment:
      - MYSQL_ROOT_PASSWORD=itsasecret
      - MYSQL_PASSWORD=donttellanyone
      - MYSQL_DATABASE=nextcloud
      - MYSQL_USER=nextcloud

  app:
    image: nextcloud:fpm
    links:
      - db
    volumes:
      - nextcloud:/var/www/html
    restart: always

  web:
    image: clearlinux/nginx:latest
    ports:
      - 8080:80
    links:
      - app
    volumes:
      - ./nginx.conf:/etc/nginx/nginx.conf:ro
    volumes_from:
      - app
    restart: always

Of course you could also manually install and run it natively. Not much to it really as far for the server setup. A simple LAMP or LEMP stack with all the necessary php extensions (apcu memcached redis imagick gd zip bcmth exif intl ldap opcache pcntl pdo_mysql | pdo_pgsql gmp) will do. Compiling all those extensions is very easy on CL:

All you need to do for php is to install the php-extras bundle – just make sure you you drop them in:

echo "extension=EXTENSION_NAME_GOES_HERE.so" | sudo tee -a /etc/php.d/ARBITRARY_FILE_NAME.ini

or

for ext in apcu memcached redis imagick gd zip bcmth exif intl ldap opcache pcntl pdo_mysql pdo_pgsql gmp; do echo "extension=${ext}.so" | sudo tee -a /etc/php.d/${ext}.ini; done

afterwards run

php -m

You will get a warning if any of the extensions were already loaded. Just remove the ones in the warning form /etc/php.d. Oh and you may have to create /etc/php.d if it doesn’t already exist.

They also distribute a tarball.

You can give access to usb drives, etc by mounting them with ownership bits set to the uid/guid that the container and/or php process is running under, then use the apps>external storage>local driver in next cloud. In docker you would have to also mount the path into the container as a volume.

Edit:
FYI Frank Karlitschek, the creator/maintainer of Nextcloud is also VP of KDE, a great guy, excellent programmer and major contributor to FOSS. I highly recommend any project he’s worked on.

1 Like