6 C
Texas
angeloma
Senior Writer and partner

How to install Nextcloud on Ubuntu 20.04?

Having a private cloud may, at first sight, be unnecessary, but when you are in a company and decide that it is best to take care of your files yourself, then the matter changes. That’s why, in this post, I’ll show you how to install Nextcloud on Ubuntu 20.04

A private Cloud with Nextcloud

There are many data storage services in clouds. Technological giants like Apple, Google, and Microsoft have them. However, there are people or companies that want to have absolute control over their own data. Nextcloud is there for that.

Nextcloud is an open-source web application that allows us to create our own private cloud. It was created with the primary objective that it is the user who has absolute control of the files.

Many companies install Nextcloud on their servers to create their private clouds. This way they can rely on their own data management. It is even of great help in educational or personal projects.

Making a private cloud with Nextcloud on Ubuntu 20.04

1.- Install LAMP stack

- Advertisement -

On the server-side, Nextcloud works as a web application that requires a web server to work properly. In addition to this, to correctly manage the data generated in it, an RDBMS such as MySQL or MariaDB is needed.

So, the first step is to install the LAMP stack on our computer. This is quite easy to do and more with our post:

How to install LAMP on Ubuntu 20.04?

Also, you have to install these modules so you can run it without any problem.

php7.4 libapache2-mod-php7.4 php7.4-mysql php7.4-intl php7.4-curl php7.4-json php7.4-gd php7.4-xml php7.4-mb php7.4-zip

By correctly configuring all LAMP components, you can proceed to the next step.

2.- Create the database for Nextcloud

Having finished with LAMP, it remains to create a new database that will be used by Nextcloud. For security reasons, it is also convenient to create a new user to manage it.

So, access the MariaDB shell:

:~$ sudo mysql -u root -p

And then, create the database, the user and assign the corresponding permissions.

> CREATE DATABASE nextcloud;
> GRANT ALL PRIVILEGES ON nextcloud.* TO 'nextclouduser'@'localhost' IDENTIFIED BY 'nextcloudpss';
> FLUSH PRIVILEGES;

Then get out of the console.

> exit;
1.- Creating a new database and user for Nextcloud
1.- Creating a new database and user for Nextcloud

Creating a dedicated MariaDB Nextcloud user helps prevent irregularities and security issues.

3.- Downloading Nextcloud on Ubuntu 20.04

To download Nextcloud, I will use the wget command and download the latest stable version which at the time of writing is 18.0.4

:~$ cd /tmp/
:~$ wget -c https://download.nextcloud.com/server/releases/nextcloud-18.0.4.zip

Once downloaded, simply unzip the file with the unzip command. If you don’t have it, just install it.

:~$ unzip nextcloud-18.0.4.zip

This will generate a folder called nextcloud which we then have to move to the Apache root directory.

:~$ sudo mv nextcloud /var/www/html/

Then, you have to assign the appropriate execution permissions, and make the folder belong to Apache.

:~$ sudo chown -R www-data:www-data /var/www/html/
:~$ sudo chmod 755 -R /var/www/html/
2.- Set the right permissions to the Nextcloud folder
2.- Set the right permissions to the Nextcloud folder

The next step is to create a new Virtualhost to process the Nextcloud site.

:~$ sudo nano /etc/apache2/sites-available/nextcloud.conf

And add the following content:

<VirtualHost *:80>
    ServerAdmin admin@your_domain.com
    DocumentRoot /var/www/html/nextcloud
    ServerName your-domain.com

    <Directory /var/www/html/nextcloud> 
        Options FollowSymlinks
        AllowOverride All
        Require all granted 
    </Directory> 
ErrorLog ${APACHE_LOG_DIR}/your-domain.com_error.log
CustomLog ${APACHE_LOG_DIR}/your-domain.com_access.log combined
</VirtualHost>
3.- Creating a new Virtualhost for Nextcloud
3.- Creating a new Virtualhost for Nextcloud

As you can see in the image, I have defined a server name called nextcloud.osradar.test that you have to replace. However, that should leave the file.

Then, enable the new Virtualhost, the Apache rewrite module and finally restart Apache to apply the changes.

:~$ sudo ln -s /etc/apache2/sites-available/nextcloud.conf /etc/apache2/sites-enabled/nextcloud.conf
:~$ sudo a2enmod rewrite
:~$ sudo systemctl restart apache2

Now, complete the installation using the web interface.

4.- Install Nextcloud on Ubuntu 20.04

Open your web browser and go to http://yourservename and you will see the following:

4.- Nextcloud on Ubuntu 20.04
4.- Nextcloud on Ubuntu 20.04

There, you have to create the new admin user with its password.

Then, below, set the previously created database parameters. And start the installation.

5.- Database credentials
5.- Database credentials

If everything went well, in the end, you will see this screen.

6.- Nextcloud installed
6.- Nextcloud installed

And finally the dashboard.

7.- Nextcloud runnning on Ubuntu 20.04
7.- Nextcloud runnning on Ubuntu 20.04

So, enjoy it.

Conclusion

Nextcloud is a very useful tool for small and medium businesses that want to create a private cloud quickly and secure.

Please share this post, join our Telegram Channel. And Buy us a coffee.

- Advertisement -
Everything Linux, A.I, IT News, DataOps, Open Source and more delivered right to you.
Subscribe
"The best Linux newsletter on the web"

2 COMMENTS

  1. So I followed your instructions (On Ubuntu 20.04) and got the following when connecting to Nextcloud:

    PHP module zip not installed.

    Please ask your server administrator to install the module.

    PHP module dom not installed.

    Please ask your server administrator to install the module.

    PHP module XMLWriter not installed.

    Please ask your server administrator to install the module.

    PHP module XMLReader not installed.

    Please ask your server administrator to install the module.

    PHP module libxml not installed.

    Please ask your server administrator to install the module.

    PHP module mbstring not installed.

    Please ask your server administrator to install the module.

    PHP module GD not installed.

    Please ask your server administrator to install the module.

    PHP module SimpleXML not installed.

    Please ask your server administrator to install the module.

    PHP module cURL not installed.

    Please ask your server administrator to install the module.

    PHP modules have been installed, but they are still listed as missing?

    Please ask your server administrator to restart the web server.

    I have restarted apache, I have restarted the entire machine. Still no luck.

    Any ideas?

  2. OK, figured it out, had to also do this:

    sudo apt install php-dev libmcrypt-dev php-pear php-zip php-mbstring php-gd php-curl

    sudo systemctl restart apache2

LEAVE A REPLY

Please enter your comment!
Please enter your name here



Latest article