データベースの設定
[root@server1 ~]# mysql -u root -p ← データベースサーバーにrootでログインします。
Enter password: ← データベースサーバーのrootのパスワードを入力します。
MariaDB [(none)]> CREATE DATABASE nextcloud; ← nextcloudのデータベースを作成します。
Query OK, 1 row affected (0.02 sec)
MariaDB [(none)]> GRANT ALL PRIVILEGES ON nextcloud.* TO nextcloud@localhost IDENTIFIED BY ‘任意のパスワード’; ← nextcloudのデータベースアクセスユーザーのnextcloudを作成します。
Query OK, 0 rows affected (0.01 sec)
PHP-FPM設定
[root@server1 ~]# vi /etc/php-fpm.d/www.conf ← PHP-FPMの設定ファイルを編集します。
env[HOSTNAME] = $HOSTNAME ← 行頭の;を削除してコメントを解除します。
env[PATH] = /usr/local/bin:/usr/bin:/bin ← 行頭の;を削除してコメントを解除します。
env[TMP] = /tmp ← 行頭の;を削除してコメントを解除します。
env[TMPDIR] = /tmp ← 行頭の;を削除してコメントを解除します。
env[TEMP] = /tmp ← 行頭の;を削除してコメントを解除します。
[root@server1 ~]# systemctl restart php-fpm ← PHP-FPMを再起動します。
[root@server1 ~]# systemctl enable php-fpm ← PHP-FPMを自動起動するよう設定します。
[root@server1 ~]# systemctl restart httpd ← Apacheを再起動します。
Nextcloudインストール
[root@server1 ~]# dnf install -y php php-gd php-mbstring php-intl php-pecl-apcu php-mysqlnd php-opcache php-json php-zip php-process ← Nextcloudインストールに必要なパッケージをインストールします。
[root@server1 ~]# wget https://download.nextcloud.com/server/releases/latest.tar.bz2 ← Nextcloudをダウンロードします。
[root@server1 ~]# tar -jxvf latest.tar.bz2 ← Nextcloudを展開します。
[root@server1 ~]# mv nextcloud/ /var/www/www.zoah.net/ ← Nextcloud展開先ディレクトリを移動します。
[root@server1 ~]# mkdir /var/www/www.zoah.net/nextcloud/data ← Nextcloud展開先ディレクトリにdataディレクトリを作成します。
[root@server1 ~]# chown -R apache:apache /var/www/www.zoah.net/nextcloud ← Nextcloud展開先ディレクトリ所有者をapacheに変更します。
[root@server1 ~]# rm -f latest.tar.bz2 ← ダウンロードしたファイルを削除します。
Apacheの設定
[root@server1 ~]# vi /etc/httpd/conf.d/nextcloud.conf ← Nextcloud用Apache設定ファイルを作成します。
Alias /nextcloud /var/www/www.zoah.net/nextcloud
<Directory /var/www/www.zoah.net/nextcloud/>
Require all granted
AllowOverride All
Options FollowSymLinks MultiViews
<IfModule mod_dav.c>
Dav off
</IfModule>
</Directory>
Redirect 301 /.well-known/carddav /nextcloud/remote.php/dav
Redirect 301 /.well-known/caldav /nextcloud/remote.php/dav
Redirect 301 /.well-known/webfinger /nextcloud/index.php/.well-known/webfinger
Redirect 301 /.well-known/nodeinfo /nextcloud/index.php/.well-known/nodeinfo
[root@server1 ~]# systemctl restart httpd ← Apacheを再起動します。
Nextcloudの確認
Webブラウザでhttps://サーバー名/nextcloud/へアクセスします。
・管理者アカウントを作成してください
任意のユーザー名/パスワードを入力します。
ストレージとデータベースをクリックします。
MySQL/MariaDBを選択します。
データベースのユーザー名を入力します。
データベースのパスワードを入力します。
データベース名を入力します。
データベースのホスト名を入力します。
インストールをクリックします。
Nextcloudの設定
[root@server1 ~]# vi /var/www/www.zoah.net/nextcloud/3rdparty/deepdiver/zipstreamer/src/ZipStreamer.php ← ZipStreamer.phpを編集します。
private static function normalizeFilePath($filePath) {
//return trim(str_replace('\\', '/', $filePath), '/'); ← 行頭に//を追加してコメントアウトします。
return mb_convert_encoding(trim(str_replace('\\', '/', $filePath), '/'),"SJIS","UTF-8"); ← 追加します。(すべてのファイルを一括ダウンロード時のファイル名文字化け対処)
}
[root@server1 ~]# crontab -u apache -e ← CRONを設定します。
[root@server1 ~]# */5 * * * * php -f /var/www/www.zoah.net/nextcloud/cron.php ← 追加します。(CRONを有効化します。)
[root@server1 ~]# vi /etc/php.d/10-opcache.ini ← OPcache設定ファイルを編集します。
; The OPcache shared memory storage size.
opcache.memory_consumption=128 ← 行頭の;を削除してコメントを解除します。
; The amount of memory for interned strings in Mbytes.
opcache.interned_strings_buffer=16 ← 行頭の;を削除してコメントを解除&値を変更します。
; The maximum number of keys (scripts) in the OPcache hash table.
; Only numbers between 200 and 1000000 are allowed.
opcache.max_accelerated_files=10000 ← 行頭の;を削除してコメントを解除します。
; How often (in seconds) to check file timestamps for changes to the shared
; memory storage allocation. ("1" means validate once per second, but only
; once per request. "0" means always validate)
opcache.revalidate_freq=2 ← 行頭の;を削除してコメントを解除します。
; If disabled, all PHPDoc comments are dropped from the code to reduce the
; size of the optimized code.
opcache.save_comments=1 ← 行頭の;を削除してコメントを解除します。
[root@server1 ~]# vi /var/www/www.zoah.net/nextcloud/config/config.php ← Nextcloud設定ファイルを編集します。
'installed' => true,
'memcache.local' => '\OC\Memcache\APCu', ← 追加します。(APCu有効化)
'default_language' => 'ja', ← 追加します。(日本対応)
'default_locale' => 'ja', ← 追加します。(日本対応)
'default_phone_region' => 'JP', ← 追加します。(日本対応)
);
[root@server1 ~]# vi /etc/php.ini ← PHP設定ファイルを編集します。
; Maximum amount of memory a script may consume (128MB)
; http://php.net/memory-limit
memory_limit = 2G ← PHP使用可能メモリ量を指定(例:2G)※512M以上の指定を推奨します。
apc.enable_cli=1 ← 追加(CRONジョブによるAPCuの有効化)
[root@server1 ~]# rm -rf /var/www/www.zoah.net/nextcloud/core/skeleton/* ← ユーザー追加時のテスト用初期ファイルを削除します。
[root@server1 ~]# systemctl restart httpd ← Apacheを再起動します。(PHP設定ファイルの変更を反映します。)
[root@server1 ~]# systemctl restart php-fpm ← PHP-FPMを再起動します。
Nextcloudのアプリ追加
[root@server1 ~]# wget https://github.com/nextcloud-releases/groupfolders/releases/download/v18.0.4/groupfolders-v18.0.4.tar.gz ← Group foldersアプリをダウンロードします。
[root@server1 ~]# tar -zxvf groupfolders-v18.0.4.tar.gz ← Group foldersアプリを展開します。
[root@server1 ~]# mv groupfolders/ /var/www/www.zoah.net/nextcloud/apps/ ← 展開先ディレクトリを所定のディレクトリへ移動します。
[root@server1 ~]# rm -f groupfolders-v18.0.4.tar.gz ← ダウンロードしたファイルを削除します。
[root@server1 ~]# chown -R apache:apache /var/www/www.zoah.net/nextcloud ← Nextcloud展開先ディレクトリ所有者をapacheに変更します。
Nextcloudのアップデート
[root@server1 ~]# su -s /bin/bash apache -c "php /var/www/www.zoah.net/nextcloud/occ maintenance:mode --on" ← メンテナンスモードを開始します。 Maintenance mode enabled
[root@server1 ~]# su -s /bin/bash apache -c "php /var/www/www.zoah.net/nextcloud/updater/updater.phar" ← アップデートを実行します。
Steps that will be executed:
[ ] Check for expected files
[ ] Check for write permissions
[ ] Create backup
[ ] Downloading
[ ] Verify integrity
[ ] Extracting
[ ] Enable maintenance mode
[ ] Replace entry points
[ ] Delete old files
[ ] Move new files in place
[ ] Done
Start update? [y/N] y ← y応答(アップデートを開始します。)
Info: Pressing Ctrl-C will finish the currently running step and then stops the updater.
[?] Check for expected files
[?] Check for write permissions
[?] Create backup
[?] Downloading
[?] Verify integrity
[?] Extracting
[?] Enable maintenance mode
[?] Replace entry points
[?] Delete old files
[?] Move new files in place
[?] Done
Update of code successful.
Should the “occ upgrade” command be executed? [Y/n] ← 空ENTER(アップグレード実行)
Nextcloud or one of the apps require upgrade – only a limited number of commands are available
You may use your browser or the occ upgrade command to do the upgrade
Setting log level to debug
Repair step: Repair MySQL collation
Repair info: All tables already have the correct collation -> nothing to do
Repair step: Repair SQLite autoincrement
Repair step: Copy data from accounts table when migrating from ownCloud
Repair step: Drop account terms table when migrating from ownCloud
Updating database schema
Updated database
Updating …
Updated to 2.0.1
Update app groupfolders from App Store
Repair step: Repair MySQL collation
Repair info: All tables already have the correct collation -> nothing to do
Repair step: Repair mime types
Repair step: Clean tags and favorites
Repair info: 0 tags of deleted users have been removed.
Repair info: 0 tags for delete files have been removed.
Repair info: 0 tag entries for deleted tags have been removed.
Repair info: 0 tags with no entries have been removed.
Repair step: Repair invalid shares
Repair step: Move .step file of updater to backup location
Repair info: .step file exists
Repair info: .step-previous-update removed
Repair info: .step file moved to .step-previous-update
Repair step: Add move avatar background job
Repair info: Repair step already executed
Repair step: Add preview cleanup background jobs
Repair step: Migrate oauth2_clients table to nextcloud schema
Repair info: Update the oauth2_access_tokens table schema.
Repair info: Update the oauth2_clients table schema.
Repair step: Fix potential broken mount points
Repair info: No mounts updated
Repair step: Repair language codes
Repair step: Add log rotate job
Repair step: Clear frontend caches
Repair info: Image cache cleared
Repair info: JS cache cleared
Repair step: Clear every generated avatar on major updates
Repair step: Add preview background cleanup job
Repair step: Queue a one-time job to cleanup old backups of the updater
Repair step: Cleanup invalid photocache files for carddav
Repair step: Add background job to cleanup login flow v2 tokens
Repair step: Remove potentially over exposing share links
Repair info: No need to remove link shares.
Repair step: Clear access cache of projects
Repair step: Reset generated avatar flag
Repair step: Keep legacy encryption enabled
Repair step: Check encryption key format
Repair step: Remove old dashboard app config data
Repair step: Add job to cleanup the bruteforce entries
Repair step: Queue a one-time job to check for user uploaded certificates
Repair step: Repair DAV shares
Repair step: Add background job to set the lookup server share state for users
Repair step: Add token cleanup job
Repair step: Clean up abandoned apps
Repair step: Add possibly missing system config
Starting code integrity check…
Finished code integrity check
Update successful
Maintenance mode is kept active
Resetting log level
Keep maintenance mode active? [y/N] ← 空ENTER(メンテナンスモードを終了します。)
Maintenance mode disabled
Maintenance mode is disabled
[root@server1 ~]# vi /var/www/www.zoah.net/nextcloud/3rdparty/deepdiver/zipstreamer/src/ZipStreamer.php ← ZipStreamer.phpを編集します。
private static function normalizeFilePath($filePath) {
//return trim(str_replace('\\', '/', $filePath), '/'); ← 行頭に//を追加してコメントアウトします。
return mb_convert_encoding(trim(str_replace('\\', '/', $filePath), '/'),"SJIS","UTF-8"); ← 追加します。(すべてのファイルを一括ダウンロード時のファイル名文字化け対処)
}
[root@server1 ~]# rm -rf /var/www/www.zoah.net/nextcloud/core/skeleton/* ← ユーザー追加時のテスト用初期ファイルを削除します。