Install NextCloud on Ubuntu

29/12/2020
Chưa phân loại
NextCloud is a free self-hosted file sharing software. It can be accessed from the web browser. Next cloud has apps for Android, iPhone and Desktop operating systems (Windows, Mac and Linux). It is really user friendly and easy to use.

In this article, I will show you how to install NextCloud on Ubuntu. So, let’s get started.

Installing NextCloud On Ubuntu:

On Ubuntu 16.04 LTS and later, NextCloud is available as a snap package. So, it is very easy to install.

To install NextCloud snap package on Ubuntu 16.04 LTS and later, run the following command:

$ sudo snap install nextcloud

As you can see, NextCloud snap package is being installed.

NextCloud snap package is installed at this point.

Creating NextCloud Administrator User:

Now, you have to create an administrator user for managing NextCloud. To do that, you have to access NextCloud from a web browser.

First, find out the IP address of your NextCloud server with the following command:

$ ip a

As you can see, the IP address of my NextCloud server is 192.168.21.128. It will be different for you. Make sure you replace it with yours from now on.

Now, from any web browser, visit the IP address 192.168.21.128.  Now, type in your Administrator username and password and click on Finish setup.

As you can see, you’re logged in. As you’re using NextCloud for the first time, you are prompted to download the Next Cloud app for your desktop or smart phone. If you don’t wish to download the NextCloud app right now, just click on the x button at the top right corner.

This is the NextCloud dashboard. Now, you can manage your files from the web browser using NextCloud.

Using Dedicated Storage for NextCloud:

By default, NextCloud stores files in your root partition where the Ubuntu operating system is installed. Most of the time, this is not what you want. Using a dedicated hard drive or SSD is always better.

In this section, I will show you how to use a dedicated hard drive or SSD as a data drive for NextCloud. So, let’s get started.

Let’s say, you have a dedicated hard drive on your Ubuntu NextCloud server which is recognized as /dev/sdb. You should use the whole hard drive for NextCloud for simplicity.

First, open the hard drive /dev/sdb with fdisk as follows:

$ sudo fdisk /dev/sdb

/dev/sdb should be opened with fdisk partitioning utility. Now, press o and then press <Enter> to create a new partition table.

NOTE: This will remove all your partitions along with data from the hard drive.

As you can see, a new partition table is created. Now, press n and then press <Enter> to create a new partition.

Now, press <Enter>.

Now, press <Enter> again.

Press <Enter>.

Press <Enter>.

A new partition should be created. Now, press w and press <Enter>.

The changes should be saved.

Now, format the partition /dev/sdb1 with the following command:

$ sudo mkfs.ext4 /dev/sdb1

The partition should be formatted.

Now, run the following command to mount /dev/sdb1 partition to /mnt mount point:

$ sudo mount /dev/sdb1 /mnt

Now, copy everything (including the dot/hidden files) from the /var/snap/nextcloud/common/nextcloud/data directory to /mnt directory with the following command:

$ sudo cp -rT /var/snap/nextcloud/common/nextcloud/data /mnt

Now, unmount the /dev/sdb1 partition from the /mnt mount point with the following command:

$ sudo umount /dev/sdb1

Now, you will have to add an entry for the /dev/sdb1 in your /etc/fstab file, so it will be mounted automatically on the /var/snap/nextcloud/common/nextcloud/data mount point on system boot.

First, run the following command to find out the UUID of your /dev/sdb1 partition:

$ sudo blkid /dev/sdb1

As you can see, the UUID in my case is fa69f48a-1309-46f0-9790-99978e4ad863

It will be different for you. So, replace it with yours from now on.

Now, open the /etc/fstab file with the following command:

$ sudo nano /etc/fstab

Now, add the line as marked in the screenshot below at the end of the /etc/fstab file. Once you’re done, press <Ctrl> + x, then press y followed by <Enter> to save the file.

Now, reboot your NextCloud server with the following command:

$ sudo reboot

Once your computer boots, run the following command to check whether the /dev/sdb1 partition is mounted to the correct location.

$ sudo df -h | grep nextcloud

As you can see, /dev/sdb1 is mounted in the correct location. Only 70MB of it is used.

As you can see I uploaded some files to NextCloud.

As you can see, the data is saved on the hard drive that I just mounted. Now, 826 MB is used. It was 70MB before I uploaded these new files. So, it worked.

That’s how you install NextCloud on Ubuntu. Thanks for reading this article.

Sandclock IDC thành lập vào năm 2012, là công ty chuyên nghiệp tại Việt Nam trong lĩnh vực cung cấp dịch vụ Hosting, VPS, máy chủ vật lý, dịch vụ Firewall Anti DDoS, SSL… Với 10 năm xây dựng và phát triển, ứng dụng nhiều công nghệ hiện đại, Sandclock IDC đã giúp hàng ngàn khách hàng tin tưởng lựa chọn, mang lại sự ổn định tuyệt đối cho website của khách hàng để thúc đẩy việc kinh doanh đạt được hiệu quả và thành công.
Bài viết liên quan

Enabling IP-Forwarding for IPv4 in Debian GNU/Linux

Setting up a computer network can be tricky sometimes. Enabling IPv4 Forwarding on a Linux machine is a rather simple task,...
29/12/2020

Get List of Installed packages on Ubuntu 20.10

Ubuntu is a Linux based distribution that comes with many packages installed. Packages are a collection of files that require...
28/12/2020

Install KDE Plasma on Arch Linux

KDE Plasma Desktop Environment is one of the cleanest, fastest, and polished desktop environments on Linux. KDE 5 desktop...
28/12/2020
Bài Viết

Bài Viết Mới Cập Nhật

Hướng dẫn chuyển đổi windows server windows evaluation to standard và active windows server 2008 + 2012 + 2016 + 2019
26/10/2021

How to Update Ubuntu Linux
24/10/2021

Squid Proxy Manager cài đặt và quản lý Proxy Squid tự động trên ubuntu
20/10/2021

Hướng dẫn cài đặt Apache CloudStack 4.15.2.0
19/10/2021

Hướng dẫn ký file PDF bằng chữ ký số (chữ ký điện tử) và sửa lỗi mới nhất 2021 foxit reader
19/10/2021