Nextcloud · 4 min read · Nov 26, 2025

Debian 10にNextCloudをインストールする方法

NextCloudは、ownCloudプロジェクトからフォークされた無料でオープンソースのファイルホスティングおよびファイル共有サーバーです。Google Drive、Dropbox、iCloudなどの他のファイル共有サービスに非常に似ています。NextCloudを使用すると、中央の場所からファイル、文書、画像、映画、ビデオを保存できます。NextCloudを使用すると、ファイル、連絡先、その他のメディアを友人やクライアントと共有できます。NextCloudは、メール、カレンダー、連絡先などの機能と統合されており、チームが作業をより迅速かつ簡単に完了できるようにします。デスクトップマシンにNextCloudクライアントをインストールして、Nextcloudサーバーとファイルを同期できます。デスクトップクライアントは、Windows、macOS、FreeBSD、Linuxなどのほとんどのオペレーティングシステムで利用可能です。

このチュートリアルでは、NextCloudをインストールし、Debian 10でLet’s Encrypt SSLで保護する方法を説明します。

前提条件

  • Debian 10を実行しているサーバー。
  • サーバーIPにポイントされた有効なドメイン名。このチュートリアルでは、nextcloud.example.comドメインを使用します。
  • サーバーに設定されたrootパスワード。

Apache、MariaDB、PHPのインストール

NextCloudは、PHPで書かれたWebサーバー上で動作し、データを保存するためにMariaDBを使用します。したがって、システムにApache、MariaDB、PHPおよびその他の必要なパッケージをインストールする必要があります。次のコマンドを実行して、すべてをインストールできます。

apt-get install apache2 libapache2-mod-php mariadb-server php-xml php-cli php-cgi php-mysql php-mbstring php-gd php-curl php-zip wget unzip -y

すべてのパッケージがインストールされたら、php.iniファイルを開いて、いくつかの推奨設定を調整します。

nano /etc/php/7.3/apache2/php.ini

次の設定を変更します。

memory_limit = 512M
upload_max_filesize = 500M
post_max_size = 500M
max_execution_time = 300
date.timezone = Asia/Kolkata

完了したら、ファイルを保存して閉じます。次に、ApacheおよびMariaDBサービスを開始し、次のコマンドでシステム再起動後に自動的に開始するように設定します。

systemctl start apache2  
systemctl start mariadb  
systemctl enable apache2  
systemctl enable mariadb

完了したら、次のステップに進むことができます。

NextCloudのためのデータベースの構成

次に、NextCloudのためのデータベースとデータベースユーザーを作成する必要があります。そのためには、次のコマンドでMariaDBシェルにログインします。

mysql -u root -p

求められたらrootパスワードを入力し、次のコマンドでデータベースとユーザーを作成します。

MariaDB [(none)]> CREATE DATABASE nextclouddb;  
MariaDB [(none)]> CREATE USER 'nextclouduser'@'localhost' IDENTIFIED BY 'password';

次に、次のコマンドでnextclouddbにすべての権限を付与します。

MariaDB [(none)]> GRANT ALL ON nextclouddb.* TO 'nextclouduser'@'localhost';

次に、権限をフラッシュし、次のコマンドでMariaDBシェルから退出します。

MariaDB [(none)]> FLUSH PRIVILEGES;  
MariaDB [(none)]> EXIT;

完了したら、次のステップに進むことができます。

NextCloudのダウンロード

まず、NextCloudのダウンロードページにアクセスし、システムに最新バージョンのNextCloudをダウンロードします。この記事を書いている時点で、NextCloudの最新バージョンは17.0.1です。次のコマンドでダウンロードできます。

wget https://download.nextcloud.com/server/releases/nextcloud-17.0.1.zip

ダウンロードが完了したら、次のコマンドでダウンロードしたファイルを解凍します。

unzip nextcloud-17.0.1.zip

次に、抽出したディレクトリをApacheのWebルートディレクトリに移動します。

mv nextcloud /var/www/html/

次に、次のコマンドでnextcloudディレクトリに適切な権限を付与します。

chown -R www-data:www-data /var/www/html/nextcloud/  
chmod -R 755 /var/www/html/nextcloud/

完了したら、次のステップに進むことができます。

NextCloudのためのApacheの構成

次に、NextCloudを提供するためのApache仮想ホスト構成ファイルを作成する必要があります。次のコマンドで作成できます。

nano /etc/apache2/sites-available/nextcloud.conf

次の行を追加します。


     ServerAdmin [email protected]
     DocumentRoot /var/www/html/nextcloud/
     ServerName nextcloud.example.com

     Alias /nextcloud "/var/www/html/nextcloud/"

     
        Options +FollowSymlinks
        AllowOverride All
        Require all granted
          
            Dav off
          
        SetEnv HOME /var/www/html/nextcloud
        SetEnv HTTP_HOME /var/www/html/nextcloud
     

     ErrorLog ${APACHE_LOG_DIR}/error.log
     CustomLog ${APACHE_LOG_DIR}/access.log combined

完了したら、ファイルを保存して閉じます。次に、次のコマンドを使用してApache仮想ホストファイルとその他の必要なモジュールを有効にします。

a2ensite nextcloud.conf  
a2enmod rewrite  
a2enmod headers  
a2enmod env  
a2enmod dir  
a2enmod mime

最後に、次のコマンドでApacheサービスを再起動して新しい構成を適用します。

systemctl restart apache2

Let’s Encrypt無料SSLでNextCloudを保護する

NextCloudは現在インストールされ、構成されています。次に、Let’s Encryptの無料SSLで保護することをお勧めします。そのためには、次のコマンドでCertbotクライアントをインストールします。

apt-get install python-certbot-apache -y

インストールが完了したら、次のコマンドを実行して、ドメインnextcloud.example.comのLet’s Encrypt証明書をインストールできます。

certbot --apache -d nextcloud.example.com

インストール中に、メールアドレスを提供し、以下のように利用規約に同意するよう求められます。

Saving debug log to /var/log/letsencrypt/letsencrypt.log
Plugins selected: Authenticator apache, Installer apache
Enter email address (used for urgent renewal and security notices) (Enter 'c' to
cancel): [email protected]

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Please read the Terms of Service at
https://letsencrypt.org/documents/LE-SA-v1.2-November-15-2017.pdf. You must
agree in order to register with the ACME server at
https://acme-v02.api.letsencrypt.org/directory
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
(A)gree/(C)ancel: A

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Would you be willing to share your email address with the Electronic Frontier
Foundation, a founding partner of the Let's Encrypt project and the non-profit
organization that develops Certbot? We'd like to send you email about our work
encrypting the web, EFF news, campaigns, and ways to support digital freedom.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
(Y)es/(N)o: Y
Obtaining a new certificate
Performing the following challenges:
http-01 challenge for nextcloud.example.com
Enabled Apache rewrite module
Waiting for verification...
Cleaning up challenges
Created an SSL vhost at /etc/apache2/sites-available/nextcloud-le-ssl.conf
Deploying Certificate to VirtualHost /etc/apache2/sites-available/nextcloud-le-ssl.conf
Enabling available site: /etc/apache2/sites-available/nextcloud-le-ssl.conf

Please choose whether or not to redirect HTTP traffic to HTTPS, removing HTTP access.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1: No redirect - Make no further changes to the webserver configuration.
2: Redirect - Make all requests redirect to secure HTTPS access. Choose this for
new sites, or if you're confident your site works on HTTPS. You can undo this
change by editing your web server's configuration.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Select the appropriate number [1-2] then [enter] (press 'c' to cancel): 2

次に、2を入力してEnterを押すと、ドメインの無料SSL証明書がダウンロードおよびインストールされます。インストールが正常に完了すると、次の出力が表示されます。

Enabled Apache rewrite module
Redirecting vhost in /etc/apache2/sites-enabled/nextcloud.conf to ssl vhost in /etc/apache2/sites-available/
nextcloud-le-ssl.conf

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Congratulations! You have successfully enabled https://nextcloud.example.com

You should test your configuration at:
https://www.ssllabs.com/ssltest/analyze.html?d=nextcloud.example.com
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
IMPORTANT NOTES:  
 - Congratulations! Your certificate and chain have been saved at:  
 /etc/letsencrypt/live/example.com/fullchain.pem  
 Your key file has been saved at:  
 /etc/letsencrypt/live/example.com/privkey.pem  
 Your cert will expire on 2019-10-22. To obtain a new or tweaked  
 version of this certificate in the future, simply run certbot again  
 with the "certonly" option. To non-interactively renew *all* of  
 your certificates, run "certbot renew"  
 - Your account credentials have been saved in your Certbot  
 configuration directory at /etc/letsencrypt. You should make a  
 secure backup of this folder now. This configuration directory will  
 also contain certificates and private keys obtained by Certbot so  
 making regular backups of this folder is ideal.  
 - If you like Certbot, please consider supporting our work by:  
 Donating to ISRG / Let's Encrypt: https://letsencrypt.org/donate  
 Donating to EFF: https://eff.org/donate-le  

完了したら、次のステップに進むことができます。

NextCloud Webインターフェースにアクセスする

あなたのNextCloudは現在構成され、Let’s Encrypt SSLで保護されています。次に、Webブラウザを開き、URL https://nextcloud.example.comを入力します。次のページにリダイレクトされます。

NextCloudログイン

データベースの構成

今、管理者のユーザー名とパスワード、データフォルダー、正しいデータベースの資格情報を提供し、セットアップを完了ボタンをクリックします。次のページにリダイレクトされ、NextCloudダッシュボードが表示されます。

NextCloudダッシュボード

これで完了です。

結論

おめでとうございます!あなたはDebian 10にNextCloudを正常にインストールし、Let’s Encrypt無料SSLで保護しました。これで、NextCloudのWebインターフェースを使用して、他のユーザーとファイル、文書、メディアを簡単に共有できます。

Share: X/Twitter LinkedIn

新しい投稿を受信箱で受け取る

スパムはありません。いつでも購読を解除できます。