Handelingen

NextCloud

Uit WaaaghPedia

Nieuwe Installatie

Easy copy of ITZGeek

  • Apache
  • PHP 7.x
  • Nextcloud 16

Voorbereiding

Installeer CentOS en Finetune CentOS

Installatie

yum install -y centos-release-scl epel-release 
yum install -y httpd mod_ssl
#php
yum install -y rh-php72 rh-php72-php rh-php72-php-gd rh-php72-php-mbstring rh-php72-php-intl rh-php72-php-pecl-apcu rh-php72-php-mysqlnd rh-php72-php-pecl-redis rh-php72-php-opcache rh-php72-php-imagick rh-php72-php-ldap
#mysql
yum install -y mariadb-server mariadb
#other
yum install -y wget bzip2 samba-client samba-common cifs-utils nfs-utils openssl unzip 

#Create symlinks so that Apache can support PHP 7.x.
ln -s /opt/rh/httpd24/root/etc/httpd/conf.d/rh-php72-php.conf /etc/httpd/conf.d/
ln -s /opt/rh/httpd24/root/etc/httpd/conf.modules.d/15-rh-php72-php.conf /etc/httpd/conf.modules.d/
ln -s /opt/rh/httpd24/root/etc/httpd/modules/librh-php72-php7.so /etc/httpd/modules/
#Also, create a symlink for executing the php command.
ln -s /opt/rh/rh-php72/root/bin/php /usr/bin/php

#Services
systemctl start httpd
systemctl enable httpd
systemctl start mariadb
systemctl enable mariadb

Database

mysql_secure_installation
mysql -u root -p

Voer wachtwoord in. Leeg bij default installatie

create database nextclouddb;
grant all on nextclouddb.* to 'nextclouduser'@'localhost' identified by 'nextclouddbpasswd';
quit

Firewall

firewall-cmd --permanent --add-service=http
firewall-cmd --permanent --add-service=https
firewall-cmd --reload

Apache

Beveiliging (Optie)

https://docs.nextcloud.com/server/16/admin_manual/installation/harden_server.html#serve-security-related-headers-by-the-web-server

SSL (Optie)

We beginnen met het aanmaken van de benodigde bestanden

mkdir /ssl
touch /ssl/certificate.crt
touch /ssl/key.key


Bewerk key.key en certificate.crt

nano /ssl/certificate.crt
nano /ssl/key.key


Bewerk ssl.conf

nano /etc/httpd/conf.d/ssl.conf

en vervang onderstaande regels

SSLCertificateFile /etc/pki/tls/certs/localhost.crt
SSLCertificateKeyFile /etc/pki/tls/private/localhost.key

met

SSLCertificateFile /ssl/certificate.crt
SSLCertificateKeyFile /ssl/key.key

Herstart webserver

service httpd restart

PHP

sed -i /etc/opt/rh/rh-php72/php.ini -r -e 's/^memory_limit = .*/memory_limit = 1G/g'
sed -i /etc/opt/rh/rh-php72/php.ini -r -e 's/^post_max_size = .*/post_max_size = 100G/g'
sed -i /etc/opt/rh/rh-php72/php.ini -r -e 's/^upload_max_filesize = .*/upload_max_filesize = 100G/g'

nano /etc/opt/rh/rh-php72/php.ini Pas de config aan naar onderstaande waardes date.timezone = "Europe/Amsterdam"

Herstart webserver

service httpd restart

Mount Share (optie)

mkdir /mnt/NextcloudData
nano /etc/fstab

Remount alles na een edit

mount -a

NFS

HOST:/mnt/StorageTank/Nextcloud-Data /mnt/NextcloudData nfs auto,nofail,noatime,nolock,intr,tcp,actimeo=1800 0 0

Samba/CIFS

//HOST/Nextcloud-Data /mnt/NextcloudData cifs user,uid=997,rw,suid,username=share,password=2v35YrDA78JhV9Zz 0 0

Nextcloud

cd /tmp/ 
wget https://download.nextcloud.com/server/releases/latest.tar.bz2
tar -jxvf latest.tar.bz2
mv nextcloud /var/www/html/ 
mkdir /var/www/html/nextcloud/data
mv /var/www/html/nextcloud/* /var/www/html
rm -rf /var/www/html/nextcloud
chown -R apache:apache /var/www/html

Nu gaan we door naar een browser.

ip addr

Ga naar http://<ip>/ https://<ip>/ http://<hostname>/ of https://<hostname>/

Nextcloud setup.png

Todo

  • Setup SMTP outgoing email

Tweaks

Hieronder vindt u een aantal tweaks om uw installatie nog beter te maken.

Pretty URLs (Optie)

https://docs.nextcloud.com/server/16/admin_manual/installation/source_installation.html#pretty-urls Open nano /var/www/html/config/config.php en voeg 'htaccess.RewriteBase' => '/', toe aan de array

sudo -u apache php /var/www/html/occ maintenance:update:htaccess

Trusted domains

nano /var/www/html/config/config.php

'trusted_domains' =>
  array (
   0 => 'localhost',
   1 => 'server1.example.com',
   2 => '192.168.1.50',
   3 => '[fe80::1:50]',
),


Config Folders

#apache /etc/httpd/conf.d
#php /etc/opt/rh/rh-php72
#nextcloud /var/www/html/config
OLD!



Speedup Nextcloud

nano /etc/php.d/opcache.ini

Verander de instellingen naar onderstaande waardes.

opcache.enable=1
opcache.enable_cli=1
opcache.interned_strings_buffer=8
opcache.max_accelerated_files=10000
opcache.memory_consumption=128
opcache.save_comments=1
opcache.revalidate_freq=1

Nog even apache opnieuw opstarten zodat de instellingen door gevoerd worden

systemctl restart httpd

Klaar

Gefeliciteerd u heeft nu een werkende NextCloud installatie. U kunt nu gebruik gaan maken van nextcloud.