1. prereqs

source /etc/cid.conf
curl -ns http://${rdsserver}/sharel/bin/inst-httpd | sh
curl -ns http://${rdsserver}/sharel/bin/inst-mariadb-server | sh
yum -y install php-pecl-imagick php-intl php-zip php-opcache php-redis redis
wget -N -nv http://${rdsserver}/sharel/etc/php.d/10-opcache.ini -P /etc/php.d/
wget -N -nv http://${rdsserver}/sharel/etc/php.d/99-nextcloud.ini -P /etc/php.d/
systemctl enable redis.service
systemctl restart httpd.service redis.service

2. installation

source /etc/cid.conf
curl -# https://download.nextcloud.com/server/releases/latest.zip -o /tmp/latest.zip
unzip -q /tmp/latest.zip -d /opt/
rm -f /tmp/latest.zip
chown apache:apache /opt/nextcloud/ -R
wget -N -nv http://${rdsserver}/sharel/etc/httpd/conf.d/nextcloud.conf -P /etc/httpd/conf.d/
cube /etc/httpd/conf.d/nextcloud.conf "%dnsdomainname%" with "$(dnsdomainname)"
systemctl reload httpd.service
mkdir -pv /data1/opt/nextcloud/data
chown apache:apache -R /data1/opt/nextcloud/data/

3. configuration

rm -fr /data1/opt/nextcloud/data/* /opt/nextcloud/config/config.php
mysql -u"root" -p"Passw0rd" -e "drop database if exists nextcloud;"
mysql -u"root" -p"Passw0rd" \
      -e "create database if not exists nextcloud character set utf8 collate utf8_bin;"
mysql -u"root" -p"Passw0rd" -e "grant all privileges on nextcloud.* to 'oc_admin'@'%' identified by 'Passw0rd';"
mysql -u"root" -p"Passw0rd" -e "grant all privileges on nextcloud.* to 'oc_admin'@'localhost' identified by 'Passw0rd';"
mysql -u"root" -p"Passw0rd" -e "flush privileges;"
sudo -u apache php /opt/nextcloud/occ maintenance:install \
     --database "mysql" \
     --database-host "localhost" --database-port "3306" \
     --database-name "nextcloud" \
     --database-user "oc_admin" --database-pass "Passw0rd" \
     --admin-user "admin" --admin-pass "Passw0rd" \
     --admin-email "alain.rykaert@telenet.be" \
     --data-dir "/data1/opt/nextcloud/data/"
prvline="    0 => 'localhost',"
newline="    1 => '*',"
sed -i "s/${prvline}/${prvline}\n${newline}/" /opt/nextcloud/config/config.php

4. mysql tables upgrade (optional)

sudo -u apache php /opt/nextcloud/occ db:convert-filecache-bigint

5. upgrade

sudo -u apache php /opt/nextcloud/occ upgrade

6. references

7. bug

Error while trying to create admin user: Failed to connect to the database:
An exception occurred in driver: SQLSTATE[HY000] [1045]
Access denied for user 'oc_admin'@'localhost' (using password: YES)
mysql -u"root" -p"Passw0rd" -e "select user,host,grant_priv from mysql.user;"

8. xtras

8.1. ldap

./pic/nc01.png

./pic/nc02.png

./pic/nc03.png

./pic/nc04.png

9. aftercares

  • enable email authentication