How to install Nextcloud in Ubuntu

How to install Nextcloud in Ubuntu

We are back with a new Ubuntu tutorial. In this article, we are going to learn you how to install Nextcloud in Ubuntu. To get familiar with a safe, secure, and flexible solution that allows users to share one or more files and directories on their computer, we will show you how to install this open-source, powerful, and secure PHP-based content collaboration platform.

You can use this solution on a Linux system, client applications for Linux, Microsoft Windows, and macOS, as well as mobile clients for Android and Apple iOS.

Nextcloud is suitable for both small and large enterprises and also service providers. please be aware that you need to install a LAMP stack (LinuxApacheMySQL/MariaDBPHP) on your server to set up a Nextcloud.



How to install Nextcloud in Ubuntu

Let’s see how to install the Nextcloud server on the Ubuntu Linux server with Apache and MariaDB as the web server and database software respectively.

Recommended Article: Tutorial MariaDB installation on Debian 10

Installing LAMP on Ubuntu

Open a terminal window and connect to your Ubuntu server via SSH, to install a LAMP stack. Then use the below command.

sudo apt-get update  sudo apt-get install apache2 mariadb-server libapache2-mod-php7.2 php7.2-gd php7.2-json php7.2-mysql php7.2-curl php7.2-mbstring php7.2-intl php-imagick php7.2-xml php7.2-zip  
If you need to check are two services started and enabled type:
systemctl status apache2  systemctl status mariadb  systemctl is-enabled apache2  systemctl is-enabled mariadb

In case you see the services are not working, use the following command.

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

Then, use the security script that ships with the package, to secure the MariaDB server installation.

sudo mysql_secure_installation

Now, It is time to answer some questions like the below guidance.

Note: Do not forget to set a strong and secure root password.

  • Enter current password for root (enter for none): enter
  • Set a root password? [Y/n] y
  • Remove anonymous users? [Y/n] y
  • Disallow root login remotely? [Y/n] y
  • Remove test database and access to it? [Y/n] y
  • Reload privilege tables now? [Y/n] y



Install Nextcloud in Ubuntu

You should create a database and database user for Nextcloud, after securing the database installation. To do this, log into the MariaDB server to access the MySQL shell.

sudo mysql -u root -p

Next, run the following sql commands.

Note: Do not forget to replace “=@!#@%$lab” with your secure password.

MariaDB [(none)]> CREATE DATABASE nextcloud;   MariaDB [(none)]> CREATE USER ncadmin@localhost IDENTIFIED BY '=@!#@%$lab';   MariaDB [(none)]> GRANT ALL PRIVILEGES ON nextcloud.*  TO ncadmin@localhost IDENTIFIED BY '=@!#@%$lab';   MariaDB [(none)]> FLUSH PRIVILEGES;   MariaDB [(none)]> EXIT;

Now, Download the Nextcloud from the Nextcloud Download Page, by clicking on Download Nextcloud Server => Download Nextcloud to grab a .zip archive or run the following commands to download it from the command-line using wget command.

sudo wget -c  

Then, extract the archive contents and copy the extracted nextcloud directory/folder into your web server’s document root

sudo unzip  sudo cp -r nextcloud /var/www/html/  sudo chown -R www-data:www-data /var/www/html/nextcloud    

Buy Ubuntu VPS


Configure Apache to serve Nextcloud

As you see, you need to create an Apache configuration file for Nextcloud under the /etc/apache2/sites-available directory.

sudo vim /etc/apache2/sites-available/nextcloud.conf

Copy and paste the following lines in the file.

Note: Do not forget to replace /var/www/html/nextcloud/ if your installation directory is different.

Alias /nextcloud "/var/www/html/nextcloud/"    <Directory /var/www/html/nextcloud/>    Require all granted    Options FollowSymlinks MultiViews    AllowOverride All     <IfModule mod_dav.c>    Dav off   </IfModule>     SetEnv HOME /var/www//html/nextcloud   SetEnv HTTP_HOME /var/www/html/nextcloud  </Directory>

You can save and close it now.

To continue, enable the newly created site and other Apache modules in the Apache configuration structure.

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

Now, you are able to restart the Apache2 service for the recent changes to take effect.

sudo systemctl restart apache2      

Complete Nextcloud installation via Graphical wizard

In this step,  you need to complete the installation via the graphical installation wizard from a web browser. so open your browser and point it to the following address:

http://SERVR_IP/nextcloud/ OR http://SERVER_ADDRESS/nextcloud/

After loading the wizard installation, you need to create a nextcloud superuser/admin user account. So enter the username and password. Besides, click on the Storage and Database link to access additional installation configuration options for your Nextcloud data directory and database.

Click Finish Setup, when you filled in the database connection details.


Nextcloud Setup Wizard


If you complete the installation, you will see the following window. So to proceed and follow the prompts, click on the forward arrow that will appear at the right side of the blue window.


Nextcloud Installation Wizard


Now, to start using your new Nextcloud server, click Finish Setup in the below window.


Nextcloud Setup Finished


And finally, you can see the Nextcloud web browser client’s main dashboard.


Nextcloud Dashboard

Recommended Article: Revolutionize Your Website with Russia VPS

Dear user, we wish this tutorial on how to install Nextcloud in Ubuntu would be helpful for you, to ask any question or review the conversation of our users about this article, please visit Ask page. Also to improve your knowledge, there are so many useful tutorials ready for Eldernode training.

How useful was this post?

Click on a star to rate it!

Average rating 0 / 5. Vote count: 0

No votes so far! Be the first to rate this post.

View More Posts
Marilyn Bisson
Content Writer
Eldernode Writer
We Are Waiting for your valuable comments and you can be sure that it will be answered in the shortest possible time.

Leave a Reply

Your email address will not be published. Required fields are marked *

We are by your side every step of the way

Think about developing your online business; We will protect it compassionately

We are by your side every step of the way


7 days a week, 24 hours a day