NextCloud : Install2016/07/27 |
Install NextCloud which is the Cloud Storage System.
The version of NextCloud on this example is NextCloud 20 which is the latest one as of now. |
|
[1] | |
[2] |
Configure SSL/TLS for Apache httpd.
HTTPS connection is required when using Chat, Camera, Screen Sharing features and so on. |
[3] | Install PHP 7.3. |
# install from SCLo [root@dlp ~]# yum --enablerepo=centos-sclo-rh install rh-php73 rh-php73-php rh-php73-php-pear rh-php73-php-mbstring rh-php73-php-fpm rh-php73-php-pdo rh-php73-php-intl rh-php73-php-gd rh-php73-php-mysqlnd rh-php73-php-opcache rh-php73-php-gmp rh-php73-php-pecl-apcu rh-php73-php-zip rh-php73-php-devel ImageMagick ImageMagick-devel make /opt/rh/rh-php73/root/usr/bin/pecl install phpize imagick [root@dlp ~]# echo 'extension=imagick.so' >> /etc/opt/rh/rh-php73/php.ini
[root@dlp ~]#
vi /etc/opt/rh/rh-php73/php-fpm.d/nextcloud.conf # create new
[nextcloud]
user = apache
group = apache
listen = /opt/rh/rh-php73/root/run/nextcloud.sock
listen.acl_users = apache
listen.allowed_clients = 127.0.0.1
pm = dynamic
pm.max_children = 50
pm.start_servers = 5
pm.min_spare_servers = 5
pm.max_spare_servers = 35
php_value[session.save_handler] = files
php_value[session.save_path] = /opt/rh/rh-php73/register.content/var/opt/rh/rh-php73/lib/php/session
# maybe you need to configure parameters below if users want to upload large files
php_value[max_execution_time] = 3600
php_value[memory_limit] = 2G
php_value[post_max_size] = 2G
php_value[upload_max_filesize] = 2G
php_value[max_input_time] = 3600
php_value[max_input_vars] = 2000
php_value[date.timezone] = Asia/Tokyo
php_value[opcache.enable] = 1
php_value[opcache.memory_consumption] = 128
php_value[opcache.interned_strings_buffer] = 8
php_value[opcache.max_accelerated_files] = 10000
php_value[opcache.revalidate_freq] = 1
php_value[opcache.save_comments] = 1
systemctl enable --now rh-php73-php-fpm |
[4] | Install MariaDB 10.3. |
# install from SCLo [root@dlp ~]# yum --enablerepo=centos-sclo-rh -y install rh-mariadb103-mariadb-server
[root@dlp ~]#
vi /etc/opt/rh/rh-mariadb103/my.cnf.d/charset.cnf # create new # set default charset [mysqld] character-set-server = utf8mb4 [client] default-character-set = utf8mb4
[root@dlp ~]#
systemctl enable --now rh-mariadb103-mariadb
# initial setup [root@dlp ~]# /opt/rh/rh-mariadb103/root/usr/bin/mysql_secure_installation
|
[5] | Create a User and Database on MariaDB for NextCloud. |
[root@dlp ~]# /opt/rh/rh-mariadb103/root/usr/bin/mysql -u root -p Enter password: Welcome to the MariaDB monitor. Commands end with ; or \g. Your MariaDB connection id is 17 Server version: 10.3.27-MariaDB MariaDB Server 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 database nextcloud; Query OK, 1 row affected (0.00 sec) MariaDB [(none)]> grant all privileges on nextcloud.* to nextcloud@'localhost' identified by 'password'; Query OK, 0 rows affected (0.00 sec) MariaDB [(none)]> flush privileges; Query OK, 0 rows affected (0.00 sec) MariaDB [(none)]> exit Bye |
[6] | Configure Apache httpd for NextCloud. |
[root@dlp ~]#
vi /etc/httpd/conf.d/nextcloud.conf Timeout 3600 ProxyTimeout 3600 Alias /nextcloud "/var/www/nextcloud/" <Directory "/var/www/nextcloud"> Options FollowSymLinks AllowOverride All Require all granted <FilesMatch \.(php|phar)$> SetHandler "proxy:unix:/opt/rh/rh-php73/root/run/nextcloud.sock|fcgi://localhost" </FilesMatch> </Directory> wget https://download.nextcloud.com/server/releases/nextcloud-20.0.0.zip -P /var/www/ [root@dlp ~]# unzip /var/www/nextcloud-20.0.0.zip -d /var/www/ [root@dlp ~]# chown -R apache. /var/www/nextcloud [root@dlp ~]# systemctl restart httpd |
[7] | If SELinux is enabled, change policy. |
[root@dlp ~]# setsebool -P httpd_can_network_connect on [root@dlp ~]# setsebool -P httpd_unified on [root@dlp ~]# setsebool -P httpd_execmem on
[root@dlp ~]#
vi nextcloud.te # create new module nextcloud 1.0; require { type configfs_t; type httpd_t; type httpd_sys_script_t; type fuse_device_t; type httpd_sys_rw_content_t; type kernel_t; type lib_t; type init_t; class file { create unlink write execute execute_no_trans }; class dir getattr; class dir { add_name write read remove_name rmdir getattr setattr mounton }; class lnk_file unlink; class chr_file { open read write }; class process setrlimit; class system module_request; } #============= httpd_t ============== allow httpd_t configfs_t:dir getattr; allow httpd_t lib_t:dir { add_name remove_name setattr write }; allow httpd_t lib_t:file { create unlink write }; #============= httpd_sys_script_t ============== allow httpd_sys_script_t fuse_device_t:chr_file { open read write }; allow httpd_sys_script_t httpd_sys_rw_content_t:dir mounton; allow httpd_sys_script_t httpd_sys_rw_content_t:file { execute execute_no_trans }; allow httpd_sys_script_t lib_t:dir setattr; allow httpd_sys_script_t self:process setrlimit; allow httpd_sys_script_t kernel_t:system module_request; #============= init_t ============== allow init_t httpd_sys_rw_content_t:dir { read remove_name rmdir write }; allow init_t httpd_sys_rw_content_t:file unlink; allow init_t httpd_sys_rw_content_t:lnk_file unlink; checkmodule -m -M -o nextcloud.mod nextcloud.te [root@dlp ~]# semodule_package --outfile nextcloud.pp --module nextcloud.mod [root@dlp ~]# semodule -i nextcloud.pp |
[8] | Access to the URL [https://(Server's Hostname or IP address)/nextcloud/] with Web browser on any Client, then following screen is displayed. Configure Administrative user account and Database connection infomation. Input any admin user name and password. For Database, specify MariaDB user and database you added on [5]. That's OK, Click [Finish Setup]. |
[9] | By default, recommended applications are installed. |
[10] | After recommended apps successfully installed, NextCloud start page is displayed. |
[11] | After finishing Setup, it's possible to access to NextCloud to the URL [https://(Server's Hostname or IP address)/nextcloud/]. |
[12] | After initial setup, configure memory cache which is the NextCloud recommended requirements. |
[root@dlp ~]#
vi /var/www/nextcloud/config/config.php ..... ..... # add a line in the section 'installed' => true, 'memcache.local' => '\OC\Memcache\APCu', );[root@dlp ~]# systemctl restart httpd rh-php73-php-fpm |