FreeBSD 14
Sponsored Link

NextCloud : Install2024/07/30

 

Install NextCloud which is the Cloud Storage System.

[1]

Install Apache httpd, refer to here.

[2]

Configure SSL/TLS for Apache httpd.
HTTPS connection is required when using Chat, Camera, Screen Sharing features and so on.

[3]

Install PHP + PHP-FPM for Apache httpd, refer to here.

[4]

Install MariaDB Server, refer to here.

[5] Install other required PHP modules.
root@dlp:~ #
pkg install -y php83-mbstring php83-intl php83-gd php83-zip php83-bz2 php83-pdo php83-pdo_mysql php83-fileinfo php83-exif php83-sodium php83-sysvsem php83-bcmath php83-gmp php83-posix php83-dom php83-zlib php83-xml php83-xmlreader php83-xmlwriter php83-simplexml php83-opcache php83-pecl-imagick php83-curl php83-soap php83-pecl-redis php83-pecl-json_post php83-pecl-APCu php83-composer redis70 unzip sudo

root@dlp:~ #
vi /usr/local/etc/php-fpm.d/nextcloud.conf
;; create new

[nextcloud]
user = www
group = www

listen.owner = www
listen.group = www
listen = /var/run/nextcloud.sock
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

env[HOSTNAME] = $HOSTNAME
env[PATH] = /usr/local/bin:/usr/bin:/bin
env[TMP] = /tmp
env[TMPDIR] = /tmp
env[TEMP] = /tmp

php_value[session.save_handler] = files
php_value[session.save_path]    = /usr/local/lib/php/sessions

;; 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.memory_consumption] = 128
php_value[opcache.interned_strings_buffer] = 32
php_value[opcache.max_accelerated_files] = 10000
php_value[opcache.revalidate_freq] = 1
php_value[opcache.save_comments] = 1
php_value[opcache.jit] = 1255
php_value[opcache.jit_buffer_size] = 128M

root@dlp:~ #
mkdir /usr/local/lib/php/sessions

root@dlp:~ #
chown www:www /usr/local/lib/php/sessions

root@dlp:~ #
service php-fpm reload

[6] Create a User and Database on MariaDB for NextCloud.
root@dlp:~ #
mysql

Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 9
Server version: 10.11.8-MariaDB FreeBSD Ports

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)]> exit 
Bye
[7] Configure Apache2 for NextCloud.
You can check which version of NextCloud to download below.
⇒ https://download.nextcloud.com/server/releases/
root@dlp:~ #
curl -o /usr/local/www/apache24/latest.zip https://download.nextcloud.com/server/releases/latest.zip

root@dlp:~ #
unzip /usr/local/www/apache24/latest.zip -d /usr/local/www/apache24/

root@dlp:~ #
chown -R www:www /usr/local/www/apache24/nextcloud

root@dlp:~ #
vi /usr/local/etc/apache24/Includes/nextcloud.conf
# create new file
# change the server name and SSL/TLS certificate path to suit your environment

Timeout 3600
ProxyTimeout 3600
DirectoryIndex index.php index.html
Header set Strict-Transport-Security "max-age=15768000; includeSubDomains; preload"

<VirtualHost *:80>
    DocumentRoot /usr/local/www/apache24/nextcloud
    ServerName dlp.srv.world
</VirtualHost>

<VirtualHost *:443>
    DocumentRoot /usr/local/www/apache24/nextcloud
    ServerName dlp.srv.world
    SSLEngine on
    SSLCertificateFile      /usr/local/etc/letsencrypt/live/dlp.srv.world/cert.pem
    SSLCertificateKeyFile   /usr/local/etc/letsencrypt/live/dlp.srv.world/privkey.pem
    SSLCertificateChainFile /usr/local/etc/letsencrypt/live/dlp.srv.world/chain.pem
</VirtualHost>

<Directory "/usr/local/www/apache24/nextcloud">
    Options FollowSymLinks MultiViews
    AllowOverride All
    Require all granted

    <FilesMatch \.(php|phar)$>
        SetHandler "proxy:unix:/var/run/nextcloud.sock|fcgi://localhost"
    </FilesMatch>
</Directory>

root@dlp:~ #
vi /usr/local/etc/apache24/httpd.conf
# line 181 : uncomment

LoadModule rewrite_module libexec/apache24/mod_rewrite.so
root@dlp:~ #
service apache24 restart

root@dlp:~ #
service redis enable

redis enabled in /etc/rc.conf
root@dlp:~ #
service redis start

Starting redis.
[8] Access to the URL [https://(Servers Hostname)/] with Web browser on any Client, then following screen is displayed. Configure Administrative user account and Database connection information. Input any admin user name and password. For Database, specify MariaDB user and database you added on [6].
And also change [Database host] from [localhost] to [127.0.0.1].
Once you have entered all, click the [Install] button.
[9] Select whether to install NextCloud recommended applications.
On thid example, install them.
[10] The start page will be displayed.
[11] After finishing Setup, it's possible to access to NextCloud to the URL [https://(Servers Hostname)/].
[12] This is the Nextcloud start page.
[13] After initial setup, configure memory cache and others that are the NextCloud recommended requirements.
root@dlp:~ #
vi /usr/local/www/apache24/nextcloud/config/config.php
.....
.....
  // add a line in the section
  // replace [default_phone_region] value to your own region (ISO 3166-1) 
  'installed' => true,
  'memcache.local' => '\OC\Memcache\APCu',
  'default_phone_region' => 'JP',
  'maintenance_window_start' => 1,
  'memcache.locking' => '\OC\Memcache\Redis',
  'memcache.distributed' => '\OC\Memcache\Redis',
  'redis' => array(
    'host' => '127.0.0.1',
    'port' => 6379,
    'timeout' => 0.0,
  ),
);

root@dlp:~ #
sudo -u www php --define apc.enable_cli=1 /usr/local/www/apache24/nextcloud/occ db:add-missing-indices

Additionally the function 'pcntl_signal' and 'pcntl_signal_dispatch' need to be enabled in your php.ini.
The current PHP memory limit is below the recommended value of 512MB.
Adding additional mail_messages_strucanalyz_idx index to the oc_mail_messages table, this can take some time...
oc_mail_messages table updated successfully.
Adding additional mail_class_creat_idx index to the oc_mail_classifiers table, this can take some time...
oc_mail_classifiers table updated successfully.
Adding additional mail_acc_prov_idx index to the oc_mail_accounts table, this can take some time...
oc_mail_accounts table updated successfully.
Adding additional mail_alias_accid_idx index to the oc_mail_aliases table, this can take some time...
oc_mail_aliases table updated successfully.
Adding additional mail_messages_mb_id_uid_uidx index to the oc_mail_messages table, this can take some time...
Removing mail_messages_mb_id_uid index from the oc_mail_messages table
oc_mail_messages table updated successfully.
Adding additional mail_smime_certs_uid_email_idx index to the oc_mail_smime_certificates table, this can take some time...
Removing mail_smime_certs_uid_idx index from the oc_mail_smime_certificates table
oc_mail_smime_certificates table updated successfully.
Adding additional mail_trusted_senders_idx index to the oc_mail_trusted_senders table, this can take some time...
Removing mail_trusted_senders_type index from the oc_mail_trusted_senders table
oc_mail_trusted_senders table updated successfully.
Adding additional mail_coll_idx index to the oc_mail_coll_addresses table, this can take some time...
Removing mail_coll_addr_userid_index index from the oc_mail_coll_addresses table
Removing mail_coll_addr_email_index index from the oc_mail_coll_addresses table
oc_mail_coll_addresses table updated successfully.

root@dlp:~ #
service apache24 reload

Matched Content