How to Install NextCloud on Linux Mint 18.3

To Install NextCloud on Linux Mint 18.3

NextCloud is a free and open source file sharing platform that can be installed on a private server. It' s a self-hosted file sync and share application forked from ownCloud. It eliminates the need for using a third-party cloud hosting platform for storing and using the information such as files, calendars, contacts etc.

Being a fork of OwnCloud, the main difference of NextCloud from OwnCloud is that the software is completely open source. We will be going through the installation and configuration procedure without taking much time to explain the features of next cloud. To know more about NextCloud, just check out the official next cloud website

Requirement

The complete installation and configuration of next cloud on Linux Mint includes the following steps

  • Installing PHP modules
  • Download NextCloud to Server
  • Installing NextCloud Files on Server
  • Configuring Apache for NextCloud
  • Create Database for NextCloud
  • NextCloud Final Configuration

Installing NextCloud

First, you need to update your system by making use of the following command.

linuxhelp user # apt-get update
Hit:1 http://archive.canonical.com/ubuntu xenial InRelease
Hit:2 http://archive.ubuntu.com/ubuntu xenial InRelease                                                            
Ign:3 http://packages.linuxmint.com sylvia InRelease                                                                 
Hit:4 http://packages.linuxmint.com sylvia Release                                                                  
.
.
Get:12 http://archive.ubuntu.com/ubuntu xenial-updates/main i386 Packages [674 kB]
Get:13 http://archive.ubuntu.com/ubuntu xenial-updates/universe amd64 Packages [587 kB]
Get:14 http://archive.ubuntu.com/ubuntu xenial-updates/universe i386 Packages [545 kB]                                          
Fetched 3,678 kB in 9s (407 kB/s)                                                                                                                          
Reading package lists... Done

Once it is done, you need to install Apache by making use of the following command.

linuxhelp user #  apt-get install apache2
Reading package lists... Done
Building dependency tree      
Reading state information... Done
The following additional packages will be installed:
  apache2-bin apache2-data apache2-utils libapr1 libaprutil1 libaprutil1-dbd-sqlite3 libaprutil1-ldap liblua5.1-0
Suggested packages:
  apache2-doc apache2-suexec-pristine | apache2-suexec-custom
The following NEW packages will be installed:
  apache2 apache2-bin apache2-data apache2-utils libapr1 libaprutil1 libaprutil1-dbd-sqlite3 libaprutil1-ldap
  liblua5.1-0
0 upgraded, 9 newly installed, 0 to remove and 210 not upgraded.
Need to get 1,540 kB of archives.
.
.
Enabling conf security.
Enabling conf serve-cgi-bin.
Enabling site 000-default.
Processing triggers for libc-bin (2.23-0ubuntu9) ...
Processing triggers for systemd (229-4ubuntu21) ...
Processing triggers for ureadahead (0.100.0-19) ...
Processing triggers for ufw (0.35-0ubuntu2) ...

Once it is done, you need to install MySQL by making use of the following command.

linuxhelp user #  apt-get install mysql-server mysql-client
Reading package lists... Done
Building dependency tree      
Reading state information... Done
The following additional packages will be installed:
  libaio1 libevent-core-2.0-5 mysql-client-5.7 mysql-client-core-5.7 mysql-common mysql-server-5.7
  mysql-server-core-5.7
Suggested packages:
  mailx tinyca
Recommended packages:
Need to get 18.7 MB of archives.
After this operation, 161 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
.
.
Setting up libevent-core-2.0-5:amd64 (2.0.21-stable-2ubuntu0.16.04.1) ...
Setting up mysql-server-5.7 (5.7.21-0ubuntu0.16.04.1) ...
update-alternatives: using /etc/mysql/mysql.cnf to provide /etc/mysql/my.cnf (my.cnf) in auto mode
Renaming removed key_buffer and myisam-recover options (if present)
Setting up mysql-client (5.7.21-0ubuntu0.16.04.1) ...
Setting up mysql-server (5.7.21-0ubuntu0.16.04.1) ...
Processing triggers for libc-bin (2.23-0ubuntu9) ...
Processing triggers for systemd (229-4ubuntu21) ...
Processing triggers for ureadahead (0.100.0-19) ...

Once it is done, you need to make the MySQL configuration by making use of the following command.

linuxhelp user # mysql -u root -p
Enter password:
Welcome to the MySQL monitor.  Commands end with   or g.
Your MySQL connection id is 4
Server version: 5.7.21-0ubuntu0.16.04.1 (Ubuntu)

Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type ' help '  or ' h'  for help. Type ' c'  to clear the current input statement.

mysql>  CREATE DATABASE Nextcloud 
Query OK, 1 row affected (0.00 sec)

mysql>  GRANT ALL PRIVILEGES ON Nextcloud.* TO ' clouduser' @' localhost'  IDENTIFIED BY ' 123'  
Query OK, 0 rows affected, 1 warning (0.00 sec)

mysql>  FLUSH PRIVILEGES 
Query OK, 0 rows affected (0.00 sec)

mysql>  EXIT

Once it is done, you need to install PHP by making use of the following command.

linuxhelp user # apt-get install php libapache2-mod-php php-mcrypt php-mysql
Reading package lists... Done
Building dependency tree      
Reading state information... Done
The following additional packages will be installed:
  libapache2-mod-php7.0 libmcrypt4 php-common php7.0 php7.0-cli php7.0-common php7.0-json php7.0-mcrypt
  php7.0-mysql php7.0-opcache php7.0-readline
Suggested packages:
  php7.0-common php7.0-json php7.0-mcrypt php7.0-mysql php7.0-opcache php7.0-readline
0 upgraded, 15 newly installed, 0 to remove and 210 not upgraded.
Need to get 3,686 kB of archives.
.
.
Creating config file /etc/php/7.0/mods-available/mysqlnd.ini with new version

Creating config file /etc/php/7.0/mods-available/mysqli.ini with new version

Creating config file /etc/php/7.0/mods-available/pdo_mysql.ini with new version
Setting up php-mysql (1:7.0+35ubuntu6.1) ...
Processing triggers for libc-bin (2.23-0ubuntu9) ...
Processing triggers for libapache2-mod-php7.0 (7.0.25-0ubuntu0.16.04.1) ...

Once it is done, make sure you configure the PHP by making use of the following command.

linuxhelp ~ # vim /etc/php/7.0/apache2/php.ini

[..]
memory_limit=512M
data.timezone = Asia/Kolakata
upload_max_filesize = 200M
post_max_size = 200M
[..]

Once all the preparation is done, you can download the latest and stable version of Nextcloud by making use of the following command.

linuxhelp opt # wget https://download.nextcloud.com/server/releases/nextcloud-12.0.0.zip
--2018-02-16 17:27:03--  http://wget/
Resolving wget (wget)... failed: Name or service not known.
wget: unable to resolve host address ‘ wget’ 
--2018-02-16 17:27:03--  https://download.nextcloud.com/server/releases/nextcloud-12.0.0.zip
Resolving download.nextcloud.com (download.nextcloud.com)... 88.198.160.133
Connecting to download.nextcloud.com (download.nextcloud.com)|88.198.160.133|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 54566140 (52M) [application/zip]
Saving to: ‘ nextcloud-12.0.0.zip’ 

nextcloud-12.0.0.zip         100%[=============================================> ]  52.04M   578KB/s    in 79s    

2018-02-16 17:28:22 (678 KB/s) - ‘ nextcloud-12.0.0.zip’  saved [54566140/54566140]

FINISHED --2018-02-16 17:28:22--
Total wall clock time: 1m 20s
Downloaded: 1 files, 52M in 1m 19s (678 KB/s)

Once it is done, you need to unzip the NextCloud package by making use of the following command.

linuxhelp opt # unzip nextcloud-12.0.0.zip
Archive:  nextcloud-12.0.0.zip
   creating: nextcloud/
   creating: nextcloud/ocs/
  inflating: nextcloud/ocs/routes.php 
  inflating: nextcloud/ocs/v2.php   
  inflating: nextcloud/ocs/v1.php   
  inflating: nextcloud/ocs/providers.php 
  inflating: nextcloud/console.php  
   creating: nextcloud/ocs-provider/
  inflating: nextcloud/ocs-provider/index.php 
  inflating: nextcloud/version.php  
   creating: nextcloud/core/
.
.
   creating: nextcloud/apps/files_videoplayer/appinfo/
  inflating: nextcloud/apps/files_videoplayer/appinfo/info.xml 
  inflating: nextcloud/apps/files_videoplayer/appinfo/app.php 
  inflating: nextcloud/apps/files_videoplayer/appinfo/signature.json 
   creating: nextcloud/resources/
   creating: nextcloud/resources/config/
  inflating: nextcloud/resources/config/mimetypemapping.dist.json 
  inflating: nextcloud/resources/config/ca-bundle.crt 
  inflating: nextcloud/resources/config/mimetypealiases.dist.json 
   creating: nextcloud/resources/codesigning/
  inflating: nextcloud/resources/codesigning/root.crt 
  inflating: nextcloud/resources/codesigning/root.crl 
  inflating: nextcloud/resources/codesigning/core.crt 

After that, move into NextCloud.

linuxhelp opt # mv nextcloud /var/www/html/

And switch directory.

linuxhelp opt # cd /var/www/html/nextcloud/

And then change ownership with the help of the following command.

linuxhelp nextcloud # chown -R www-data.www-data /var/www/html/nextcloud/
linuxhelp nextcloud # ls -ld .
drwxr-xr-x 14 www-data www-data 4096 May 22  2017 .
linuxhelp next cloud # cd ../
linuxhelp html # cd

Once it is done, you need to create a .conf file to configure the VirtualHost.

linuxhelp ~ # vim /etc/apache2/sites-available/nextcloud.conf

Add the following lines in the file.

< virtualhost *:80> 
ServerName  linuxhelp.nextcloud.io
Documentroot /var/www/html/nextcloud
< /virtualhost> 

Once it is done, you need to restart Apache service

linuxhelp ~ # systemctl restart apache2

And then, you need to create a link for virtual host

linuxhelp ~ # ln -s /etc/apache2/sites-available/nextcloud.conf /etc/apache2/sites-enabled/nextcloud.conf

After which you need to enable VirtualHost site

linuxhelp ~ # a2enmod rewrite
Enabling module rewrite.

Once all of the above processes are done, open your browser and proceed to NextCloud.

And in the page that appears, enter the user details to create an admin account.

And configure the database and proceed.

The dashboard of NextCloud looks like the one in the following image.

With this, the installation of on Linux Mint comes to an end.NextCloud 12.

Comment
ghostv22
Sep 03 2019
get apache error :( failed to start
ghostv22
Sep 03 2019
How to set t so that files are stored in a folder of home directory as hdd for home partition
Add a comment
FAQ
Q
How to access from outside your network in nextcloud?
A
Navigate to nc-forward-ports in the TUI or the WebUI.

Set the ports your Nextcloud runs on.
Q
What are pre-set users/passwords on NextCloudPi?
A
There are no pre-set passwords, the following are randomly generated upon first access during activation.



For terminal pi/raspberry (root/1234 on Armbian)

For SSH: generated on demand on ncp-web SSH section.
Q
How do I login as another user in mysql?
A
Replace the username "root" with the username you have
Q
How do I set up Let's Encrypt with blocked ports?
A
If you only have port 443 available, you can use the following workaround: copy that code and after that try again from the web interface or nextcloudpi-config
Q
How do I connect with SSH to NextCloudPi?
A
refer the following link, https://www.linuxhelp.com/how-to-install-nextcloud-12-03-on-opensuse-leap-42-3/