Home / How To / How to install NextCloud on Debian 10

How to install NextCloud on Debian 10



NextCloud is a free and open source server for file management and file sharing served from ownCloud projects. It is very similar to other file sharing services like Google Drive, Dropbox and iCloud. NextCloud lets you store files, documents, images, videos and videos from the central location. With NextCloud you can share files, contacts and all other media with your friends and clients. NextCloud integrates with email, calendar, contacts and other features to help your team make their work faster and easier. You can install the NextCloud client on a desktop machine to synchronize files with your Nextcloud server. Desktop clients are available for most operating systems including Windows, macOS, FreeBSD and Linux.

In this tutorial we will explain how to install NextCloud and secure it with Let & # 39; s Encrypt SSL on Debian 1

0.

Prerequisites [19659004] A server running Debian 10.
  • A valid domain name pointed to your server IP. in this tutorial we will use the nextcloud.example.com domain.
  • A root password is configured on your server.
  • Installing Apache, MariaDB and PHP

    NextCloud runs on the web server, written in PHP and uses MariaDB to store its data. So you need to install Apache, MariaDB, PHP and other necessary packages on your system. You can install all of them by running the following command:

      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 

    Once all packages are installed, open the php.ini file and adjust some recommended settings:

      nano /etc/php/7.3/apache2/php.iniebrit19659010??Change the following settings: [19659011] memory_limit = 512M
    upload_max_filesize = 500M
    post_max_size = 500M
    max_execution_time = 300
    date.timezone = Asia / Kolkata
    

    Save and close the file when done. Then start the Apache and MariaDB service and enable them to start after system startup with the following command:

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

    you can move on to the next step.

    Configuring NextCloud Database

    Next, you must create a NextCloud database and database user. To do so, log in to the MariaDB shell with the following command:

      mysql -u root -p 

    Enter your root password when prompted and create a database and user with the following command:

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

    Then you give all privileges to nextclouddb with the following command:

      MariaDB [(none)]> GIVE ALL ON nextclouddb. * ON & # 39; nextclouduser & # 39; @ & # 39; localhost & # 39 ;; 

    Then flush the privileges and exit from the MariaDB shell with the following command:

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

    When you're done, you can move on to the next step.

    Download NextCloud

    First visit the NextCloud download page and download the latest version of NextCloud on your system. At the time of writing this article, the latest version of NextCloud is 17.0.1. You can download it with the following command:

      wget https://download.nextcloud.com/server/releases/nextcloud-17.0.1.zipebrit19659010??When the download is complete, extract the downloaded file with the following command: 

      unzip nextcloud-17.0.1.zip 

    Then move the extracted directory to the Apache root directory:

      etc. nextcloud / var / www / html / 

    Then you give the correct permissions to the next directory with the following command :

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

    Once done you can go on to the next step.

    Configuring Apache for NextCloud

    Next, you must create an Apache virtual host configuration file to serve NextCloud. You can create it with the following command:

      nano /etc/apache2/sites-available/nextcloud.confebrit19659010??Add the following lines: 

      
    ServerAdmin [email protected]
    DocumentRoot / var / www / html / nextcloud /
    Server name nextcloud.example.com
    
    Aliases / nextcloud "/ var / www / html / nextcloud /"
    
    
    Option + Follow symbol links
    AllowOrrride All
    Require everyone 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
    
    
    

    Save and close the file when done. Then enable the Apache virtual host file and other necessary modules with the following commands:

      a2ensite nextcloud.conf 
    a2enmod rewrite
    a2enmod headers
    a2enmod env
    a2enmod dir
    19659010] Finally, restart the Apache service to apply the new configuration:

      systemctl restart apache2 

    Secure NextCloud with Let & # 39; s Encrypt Free SSL

    NextCloud is now installed and configured. Then it is recommended to secure it with Let & # 39; s Encrypt free SSL. To do so, first install the Certbot client with the following command:

      apt-get install install python-certbot-apache -y 

    Once installed, you can run the following command to install Let & # 39; s Encrypt Certificate for your domain nextcloud. exempel.com.

      certbot --apache -d nextcloud.example.com 

    During installation, you will be asked to enter your email address and accept the service shown below:

      Save debug log to / var / log / letsencrypt / letsencrypt.log
    Selected plugins: Authenticator apache, Install apache
    Enter Email Address (Used for Emergency Renewal and Security Messages) (Enter & # 39; c & # 39; to
    cancel): [email protected]
    
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Read the terms of use at
    https://letsencrypt.org/documents/LE-SA-v1.2-November-15-2017.pdf. You must
    agree to register on the ACME server at
    https://acme-v02.api.letsencrypt.org/directory
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    (A) gree / (C) ancel: A
    
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Should you be willing to share your email address with Electronic Frontier
    Foundation, a founding partner of Let & # 39; s Encrypt project and the nonprofit
    organization developing Certbot? We want to send an e-mail about our work
    web encryption, EFF news, campaigns and ways to support digital freedom.
    
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    (Y) es / (N) o: Y
    Get a new certificate
    Perform the following challenges:
    http-01 challenge for nextcloud.example.com
    Activated module for rewriting Apache
    Waiting for verification ...
    Cleaning of challenges
    Created an SSL vhost at /etc/apache2/sites-available/nextcloud-le-ssl.conf
    Distribute certificates to VirtualHost /etc/apache2/sites-available/nextcloud-le-ssl.conf
    Activate available site: /etc/apache2/sites-available/nextcloud-le-ssl.conf
    
    Choose whether to redirect HTTP traffic to HTTPS or remove HTTP access.
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    1: No Redirect - Make no further changes to the web server configuration.
    2: Redirect - Makes all requests redirect to secure HTTPS access. Select this for
    new websites, or if you are sure your site is working on HTTPS. You can undo this
    change by editing your web server configuration.
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Select the appropriate number [1-2] and then [enter] (press & # 39; c & # 39; to cancel): 2
    

    Then type 2 and press Enter to download and install a free SSL certificate for your domain. When the installation is complete. You should get the following output:

      Enabled Apache rewrite module
    Redirect vhost in /etc/apache2/sites-enabled/nextcloud.conf to ssl vhost in / etc / apache2 / sites-available /
    Next cloud-le-ssl.conf
    
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Congratulations! You have enabled https://nextcloud.example.com
    
    You should test your configuration on:
    https://www.ssllabs.com/ssltest/analyze.html?d=nextcloud.example.com
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
    IMPORTANT NOTES:
    - Congratulations ! Your certificate and chain have been saved to:
    /etc/letsencrypt/live/example.com/fullchain.pem
    Your key file has been saved to:
    /etc/letsencrypt/live/example.com / privkey. pemebrit19459017 ?? Your certificate will expire 2019-10-22. To get a new or fine-tuned
    version of this certificate in the future, simply run certbot again
    with the "certonly" option. To not interactively renew * all * of your
    certificates, run "certbot renew"
    - Your account information has been saved in your Certbot
    configuration directory at / etc / letsencrypt. You should make a secure
    safe 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 of:
    Donate to ISRG / Let's Encrypt: https://letsencrypt.org/donateebrit19459017??Donate to EFF: https://eff.org / donate-leebrit19459017 ???? 19659014 When you're done, you can move on to the next step.

    Access NextCloud Web Interface

    Your NextCloud is now configured and secured with Let & # 39; s Encrypt SSL. Then open your browser and type the URL https://nextcloud.example.com . You will be redirected to the following page:

     NextCloud login

     Configure the database

    Now, enter your admin username and password, data folder, Correct database references and click on the Finish button. You will be redirected to the NextCloud dashboard on the following page:

     NextCloud Dashboard

    That's it for now.

    Conclusion

    Congratulations! you have successfully installed and secured NextCloud with Let & # 39; s Encrypt Free SSL on Debian 10. Now you can easily share files, documents and media with other users using the NextCloud web interface.


    Source link