How To Install Nextcloud on Ubuntu 18.04 LTS
Nextcloud is an open source file synchronization and sharing solution. It is like a Google Drive / Dropbox that permits you to store and share your documents, pictures, and videos in a centralized location.
Apache 2.4 with mod_php
Nextcloud Enterprise is also available with full enterprise support, including phone and email access to Nextcloud developers.
- Access your files anywhere.
- Share your files with the others and protect the public links with a password.
- Supports Two-factor authentication
- Tracking changes to your files.
- Access files stored in external cloud storage service providers like as Amazon, Google, and Dropbox.
Install Nextcloud on Ubuntu 18.04
You can set up Nextcloud on Ubuntu using Snap or LAMP stack (Official archive).
1: Install Nextcloud using snap
You can easily install Nextcloud using the Snap command.
sudo snap install nextcloud
nextcloud 15.0.8snap2 from 'nextcloud' installed
The Nextcloud installation may take a few minutes to complete. Verify the Nextcloud installation using the below command.
sudo snap list nextcloud
Name Version Rev Tracking Publisher Notes nextcloud 15.0.8snap2 13453 stable nextcloud* -
Open a browser and navigate it to Nextcloud URL.
Create an admin account then click Finish setup.
Close the popup.
You will now get the home page of Nextcloud where you can upload or download your documents.
2: Install Nextcloud using Offical Archive
We will install the necessary PHP extension for NextCloud.
sudo apt update sudo apt install -y php-gd php-json php-mysql php-curl php-mbstring php-intl php-imagick php-xml php-zip php-sqlite3
Now, we will install the Apache web server and MariaDB server for Nextcloud.
sudo apt install -y apache2 mariadb-server libapache2-mod-php bzip2
You need to enable a few modules to get NextCloud work properly.
sudo a2enmod rewrite
You can also enable additional Apache modules.
sudo a2enmod headers sudo a2enmod dir sudo a2enmod env sudo a2enmod mime
Restart the Apache service.
sudo systemctl restart apache2
NextCloud offers you the zipped archives for server admin’s to download and manually set it up on top of a LAMP stack.
cd /tmp/ wget https://download.nextcloud.com/server/releases/latest.tar.bz2 tar -jxvf latest.tar.bz2 sudo mv nextcloud /var/www/html/ sudo mkdir /var/www/html/nextcloud/data
Update the ownership of files inside the NextCloud root directory so that web server can write data into it.
sudo chown -R www-data:www-data /var/www/html/nextcloud/
If you are setting up a MariaDB server for the first time, then
Ensure MariaDB server service is running.
Log in to MariaDB server using the root user to create a database.
sudo mysql -u root -p
Create a database called “nextclouddb”
create database nextclouddb;
Grant “nextclouduser” to access the “nextclouddb” database on localhost with a password “password“.
grant all on nextclouddb.* to 'nextclouduser'@'localhost' identified by 'password';
Exit from the MariaDB prompt.
Open a web browser and navigate to it Nextcloud setup.
Fill up the setup page with username and password for creating an admin account, the location of the data folder and the database details.
You can choose either SQLite or MariaDB. If you decided to use the SQLite database, then you do not have to enter database details. Using SQLite server in a production environment is not recommended, so, we will use MariaDB here.
Click close to close the popup.
You will now get the home page of NextCloud. Click the “+ sign” button and then Upload File to begin uploading files.