Handelingen

NextCloud

Uit WaaaghPedia

Installatie

Voorbereiding

Installeer CentOS en Finetune CentOS

Installatie

yum install -y centos-release-scl rh-php70 rh-php70-php rh-php70-php-gd rh-php70-php-mbstring rh-php70-php-mysqlnd httpd mariadb-server php php-mysql php-dom php-pecl-apcu php-opcache php-mbstring php-gd php-pdo php-json php-xml php-zip php-curl php-mcrypt php-pear php-ldap php-smbclient nfs-utils samba-client samba-common mod_ssl setroubleshoot-server bzip2 rh-php70-php-ldap

mv /etc/httpd/conf.d/php.conf /etc/httpd/conf.d/php54.off
mv /etc/httpd/conf.modules.d/10-php.conf /etc/httpd/conf.modules.d/10-php54.off

ln -s /opt/rh/httpd24/root/etc/httpd/conf.d/rh-php70-php.conf /etc/httpd/conf.d/
ln -s /opt/rh/httpd24/root/etc/httpd/conf.modules.d/15-rh-php70-php.conf /etc/httpd/conf.modules.d/
ln -s /opt/rh/httpd24/root/etc/httpd/modules/librh-php70-php7.so /etc/httpd/modules/

service httpd restart

systemctl start mariadb
systemctl enable mariadb

mysql_secure_installation

Volg de stappen

NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
      SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!

In order to log into MariaDB to secure it, we'll need the current
password for the root user.  If you've just installed MariaDB, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.

Enter current password for root (enter for none):
OK, successfully used password, moving on...

Setting the root password ensures that nobody can log into the MariaDB
root user without the proper authorisation.

Set root password? [Y/n] y
New password:
Re-enter new password:
Password updated successfully!
Reloading privilege tables..
 ... Success!


By default, a MariaDB installation has an anonymous user, allowing anyone
to log into MariaDB without having to have a user account created for
them.  This is intended only for testing, and to make the installation
go a bit smoother.  You should remove them before moving into a
production environment.

Remove anonymous users? [Y/n] y
 ... Success!

Normally, root should only be allowed to connect from 'localhost'.  This
ensures that someone cannot guess at the root password from the network.

Disallow root login remotely? [Y/n] Y
 ... Success!

By default, MariaDB comes with a database named 'test' that anyone can
access.  This is also intended only for testing, and should be removed
before moving into a production environment.

Remove test database and access to it? [Y/n] Y
 - Dropping test database...
 ... Success!
 - Removing privileges on test database...
 ... Success!

Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.

Reload privilege tables now? [Y/n] Y
 ... Success!

Cleaning up...

All done!  If you've completed all of the above steps, your MariaDB
installation should now be secure.

Thanks for using MariaDB!
nano /etc/my.cnf

Toevoegen onder [mysqld]

bind-address=127.0.0.1
local-infile=0
systemctl restart mariadb
mysql -u root -p
CREATE DATABASE nextcloud;
CREATE USER 'nextcloud'@'localhost' IDENTIFIED BY 'YOUR_PASSWORD_HERE';
GRANT ALL PRIVILEGES ON nextcloud.* TO 'nextcloud'@'localhost';
FLUSH PRIVILEGES;
quit;

Install Nextcloud

cd /var/www/html
curl -o nextcloud-13-latest.tar.bz2 https://download.nextcloud.com/server/releases/latest-13.tar.bz2
tar -xvjf nextcloud-13-latest.tar.bz2
mkdir nextcloud/data
chown -R apache:apache nextcloud
rm -rf nextcloud-13-latest.tar.bz2

NAS as Cloud Storage Location

nano /etc/fstab
#
# /etc/fstab
# Created by anaconda on Thu Mar 1 12:56:17 2018
#
# Accessible filesystems, by reference, are maintained under '/dev/disk'
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
#
/dev/mapper/cl_cloud-root / xfs defaults 0 0
UUID=037ueya8-e40c-46kt-9592-62556dfgh8ueh /boot xfs defaults 0 0
/dev/mapper/cl_cloud-swap swap swap defaults 0 0
#-----------------------------------------------------------------------------------------------------------------------------------------
#NFS Network shares on NAS Server
192.168.1.1:/NAS/NextCloudData /var/www/html/nextcloud/data nfs rw,auto,noatime,nolock,bg,nfsvers=3,intr,tcp,actimeo=1800,file_mode=0777,dir_mode=0777 0 0
mount -a

Setup nextcloud

cat << EOF >> /etc/httpd/conf.d/nextcloud.conf
Alias /nextcloud "/var/www/html/nextcloud/"

<Directory /var/www/html/nextcloud/>
Options +FollowSymlinks
AllowOverride All

<IfModule mod_dav.c>
Dav off
</IfModule>

SetEnv HOME /var/www/html/nextcloud
SetEnv HTTP_HOME /var/www/html/nextcloud

</Directory>
EOF


nano /etc/httpd/conf/httpd.conf
DocumentRoot "/var/www/html/nextcloud"

SE Linux

setsebool -P httpd_can_network_connect_db 1
setsebool -P httpd_use_nfs on
setsebool -P httpd_use_cifs on
setsebool -P httpd_can_connect_ldap on
setsebool -P httpd_can_sendmail on
setsebool -P httpd_can_network_connect on
setsebool -P httpd_use_gpg on
semanage fcontext -a -t httpd_sys_rw_content_t '/var/www/html/nextcloud/data(/.*)?'
semanage fcontext -a -t httpd_sys_rw_content_t '/var/www/html/nextcloud/config(/.*)?'
semanage fcontext -a -t httpd_sys_rw_content_t '/var/www/html/nextcloud/apps(/.*)?'
semanage fcontext -a -t httpd_sys_rw_content_t '/var/www/html/nextcloud/3rdparty(/.*)?'
semanage fcontext -a -t httpd_sys_rw_content_t '/var/www/html/nextcloud/.htaccess'
semanage fcontext -a -t httpd_sys_rw_content_t '/var/www/html/nextcloud/.user.ini'
restorecon -Rv '/var/www/html/nextcloud/'

Apache

systemctl start httpd
systemctl enable httpd

Firewall

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

Setup Nextcloud Web

Open je browser en ga naar http://<IP>/nextcloud

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.

SSL

https://wiki.centos.org/HowTos/Https

nice urls

https://docs.nextcloud.com/server/13/admin_manual/installation/source_installation.html#pretty-urls-label

Tips and Tricks

https://docs.nextcloud.com/server/13/admin_manual/installation/installation_wizard.html

Bron

https://www.ladislavbrezovnik.com/2018/03/09/install-nextcloud-13-on-centos-7/

https://docs.nextcloud.com/server/13/admin_manual/installation/php_70_installation.html

https://docs.nextcloud.com/server/13/admin_manual/installation/selinux_configuration.html#allow-access-to-cifs-smb