2
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

AlmaLinux 9.5 に Nextcloud を構築する(Docker)

Last updated at Posted at 2025-04-15

AlmaLinux 9.5 をインストールします

AlmaLinux 9.5 minimal

cat /etc/redhat-release
実行結果
AlmaLinux release 9.5 (Teal Serval)
grep -A1 %packages /root/anaconda-ks.cfg
実行結果
%packages
@^minimal-environment

selinux 無効化した後、再起動します

sed -i.orig 's/^SELINUX=enforcing/SELINUX=disabled/' /etc/selinux/config
shutdown -r now

レポジトリを登録します

dnf config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
実行結果
Adding repo from: https://download.docker.com/linux/centos/docker-ce.repo

登録したレポジトリを確認します

dnf repolist | grep docker
実行結果
docker-ce-stable                    Docker CE Stable - x86_64

docker インストールします

dnf -y install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin

docker サービスを起動します

systemctl start docker
systemctl enable docker
実行結果
Created symlink /etc/systemd/system/multi-user.target.wants/docker.service → /usr/lib/systemd/system/docker.service.

docker compose ファイルを作成します

mkdir /root/nextcloud
cd /root/nextcloud
vi docker-compose.yml

ファイルの内容

docker-compose.yml
volumes:
  nextcloud:
  db:

services:
  db:
    image: mariadb:10.6
    restart: always
    command: --transaction-isolation=READ-COMMITTED --log-bin=binlog --binlog-format=ROW
    volumes:
      - db:/var/lib/mysql
    environment:
      - MYSQL_ROOT_PASSWORD=nextcloud
      - MYSQL_PASSWORD=nextcloud
      - MYSQL_DATABASE=nextcloud
      - MYSQL_USER=nextcloud

  app:
    image: nextcloud
    restart: always
    ports:
      - 8080:80
    links:
      - db
    volumes:
      - nextcloud:/var/www/html
    environment:
      - MYSQL_PASSWORD=nextcloud
      - MYSQL_DATABASE=nextcloud
      - MYSQL_USER=nextcloud
      - MYSQL_HOST=db

Nextcloud を起動します

docker compose up -d
実行結果
[+] Running 32/32
 ✔ db Pulled                                                   12.7s 
   ✔ 13b7e930469f Pull complete                                 3.0s 
   ✔ 881648095bb7 Pull complete                                 3.0s 
   ✔ 9ca9e81fc565 Pull complete                                 3.7s 
   ✔ adcd6b89c9a0 Pull complete                                 3.7s 
   ✔ 29a010271ea1 Pull complete                                 3.7s 
   ✔ d6581f151a89 Pull complete                                 9.7s 
   ✔ f81f431ea216 Pull complete                                 9.7s 
   ✔ 44814159b4a8 Pull complete                                 9.7s 
 ✔ app Pulled                                                  37.2s 
   ✔ 8a628cdd7ccc Pull complete                                 8.0s 
   ✔ 3c380393612c Pull complete                                 8.0s 
   ✔ b572e7d435eb Pull complete                                13.6s 
   ✔ 2bf4c896a41f Pull complete                                13.7s 
   ✔ f908a498d7f2 Pull complete                                14.5s 
   ✔ b85bb09a2508 Pull complete                                14.6s 
   ✔ 1c16674b4944 Pull complete                                14.6s 
   ✔ 43e388f23402 Pull complete                                14.8s 
   ✔ a79fe010e10f Pull complete                                14.8s 
   ✔ deee30f05366 Pull complete                                15.8s 
   ✔ 0033f758335d Pull complete                                15.9s 
   ✔ 8b7fde42057c Pull complete                                15.9s 
   ✔ 3a45e2270887 Pull complete                                15.9s 
   ✔ 4f4fb700ef54 Pull complete                                15.9s 
   ✔ f1621ae60f0e Pull complete                                16.9s 
   ✔ aed27ae2a0eb Pull complete                                18.2s 
   ✔ b448beef1319 Pull complete                                18.2s 
   ✔ 33a59160127a Pull complete                                18.2s 
   ✔ 4c33b40c75f4 Pull complete                                18.2s 
   ✔ 0085fded0b51 Pull complete                                34.2s 
   ✔ 790950a5f387 Pull complete                                34.2s 
   ✔ 4f9c9e2a9d06 Pull complete                                34.2s 
[+] Running 5/5
 ✔ Network nextcloud_default     Created                        0.2s 
 ✔ Volume "nextcloud_nextcloud"  Created                        0.0s 
 ✔ Volume "nextcloud_db"  Created                               0.0s 
 ✔ Container nextcloud-db-1      Started                        1.2s 
 ✔ Container nextcloud-app-1     Started 

Nextcloud の起動を確認します

docker compose ps
実行結果
NAME              IMAGE          COMMAND                  SERVICE   CREATED         STATUS         PORTS
nextcloud-app-1   nextcloud      "/entrypoint.sh apac…"   app       3 minutes ago   Up 3 minutes   0.0.0.0:8080->80/tcp, [::]:8080->80/tcp
nextcloud-db-1    mariadb:10.6   "docker-entrypoint.s…"   db        3 minutes ago   Up 3 minutes   3306/tcp

Nextcloud へ接続します

ウェブブラウザで http://Nextcloudのアドレス:8080/ へ接続

管理者アカウントを作成します

Nextcloud_管理者アカウント作成.png

推奨アプリインストールします

推奨アプリをインストールしない場合は[スキップ]をクリックします

Nextcloud_推奨アプリインストール.png

Nextcloud が利用可能な状態になりました

Nextcloud_こんにちは.png

ユーザ追加時にユーザの言語設定が英語になる問題の対応

設定ファイルをバックアップします

cd /var/lib/docker/volumes/nextcloud_nextcloud/_data/config
cp config.php config.php.orig

設定ファイルを開きます

vi config.php

設定ファイルに以下の項目を追加します

'default_language' => 'ja',
'default_locale' => 'ja',
'default_phone_region' => 'JP'
変更前
    
   省略
    
  'dbuser' => 'nextcloud',
  'dbpassword' => 'nextcloud',
  'installed' => true,
);
変更後
    
   省略
    
  'dbuser' => 'nextcloud',
  'dbpassword' => 'nextcloud',
  'installed' => true,
  'default_language' => 'ja',
  'default_locale' => 'ja',
  'default_phone_region' => 'JP'
);
  • サービスの再起動は不要です
  • 設定変更後に追加されたユーザから、言語設定が日本語になります
2
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?