Install Nextcloud on Linux

  • Views Views: 239
  • Last updated Last updated:
    1. If you havn't already done so, download the program "PuTTY".

    2. Connect to your root server or VPS/vServer via SSH using PuTTY. To do this, open PuTTY and enter the domain or IP address of your server in the text box named "Host Name (or IP address)". Then click the "OK" button below.

    3. Update your package lists with the command apt update

    4. Now install any available updates of the packages already installed on your server using the command apt upgrade -y
    5. The installation of Nextcloud requires a web server as well as PHP and a database server. If you haven't already done these installations yet, install the Apache2 web server, PHP 7 and the MariaDB server.

    6. Go to the web directory to install Nextcloud there. By default, the web directory is located at "/var/www/html", so the command is cd /var/www/html

    7. Now use the command wget to download Nextcloud.

    8. After the download is completed, you should see the downloaded .tar.bz2 archive using the command ls Extract this archive you just downloaded by executing the command tar xfvj latest.tar.bz2

    9. After unpacking this archive, you can delete it using the command rm latest.tar.bz2

    10. For Nextcloud to work properly, the Apache2 module "mod_rewrite" must be activated. To do this, use the command a2enmod rewrite

    11. Restart the Apache2 web server by executing the command systemctl restart apache2

    12. Now assign the required owner permissions for the Nextcloud directory to the web server user with the command chown -R www-data:www-data /var/www/html/nextcloud/

    13. After that you have to create the database needed for Nextcloud. To do this, visit phpMyAdmin in the web browser by appending "/phpmyadmin" to the IP address or domain of your server and log in to the MySQL server

    14. Click on the "User accounts" tab on top of the page and then click on "Add user account".

    15. Now set a username (e.g. "nextcloud") and a password for the database user.

    16. After you've done that, you have to tick the checkbox for "Create database with same name and grant all privileges" so that the database user is created as well as the database itself. The database name will be the same as the username you specified.

    17. Then click on the "OK" button at the bottom of the page. Thus, you have created the database as well as the database user.

    18. Now go to Nextcloud in your web browser. The URL is the IP address or domain of your server, followed by "/nextcloud". The setup page appears.

    19. Create an administrator account for Nextcloud with which you can log in later. To do this, enter your desired username and password in the text fields "Username" and "Password".

    20. After that you have to enter the database username (e.g. "nextcloud"), the password for this user and the name of your Nextcloud database you previously created using phpMyAdmin (the same as the database username).

    21. Click on "Finish setup", to complete the installation.

    22. Now enable the use of ".htaccess" files by editing your Apache2 vHost configuration file. If you haven't created your own vHost and use it, the default vHost is used ("/etc/apache2/sites-available/000-default.conf"). Edit this file using the following command: nano /etc/apache2/sites-available/000-default.conf

    23. In this configuration file, add the following content below the "DocumentRoot" line and replace "/var/www/html" with your DocumentRoot directory, if you use a directory other than the default one:

      <Directory /var/www/html>
      AllowOverride All

    24. Save your changes to the configuration by pressing CTRL + X, then hit the "Y" key followed by enter.

    25. Then run the command systemctl reload apache2 to reload the Apache2 web server.

    26. The installation and setup of your Nextcloud is now completed and you can start using it.
  • Loading…