How to install NextCloud 12.3 on FreeNAS 11 with all checks passed

atoddvr6

Cadet
Joined
Jan 21, 2018
Messages
4
The obvious doesn't always need to be pointed out, does it?

Anyway, I am willing to learn and try to get this to work and will find another guide if I have to.

To answer your advice:

1. I tried the plugin but it's not compatible with the mobile app because it's so old it's unsupported. (I want to create a personal cloud backup for mobile photos/videos. That is the reason for all of this)
2. I know less about Ubuntu than I do command line writing if that tells you anything but I'm willing to learn.
3. Other solutions:
a. I've tried to utilize our Plex server but the app won't backup to the server.
b. Tried Resilio. Nope.

If Ubuntu is the only other solution besides learning more about command line then I will go that route.
 
Last edited by a moderator:

GLaDER

Dabbler
Joined
Dec 1, 2017
Messages
14
Then I have the perfect solution for you. Plex Pass allows you to upload your media. If you're already a Plex user, this is probably the easiest way to go.

On the other hand; if you really want to get Nextcloud going, I have no more help to give than what is already present in this thread.
 
Last edited by a moderator:

atoddvr6

Cadet
Joined
Jan 21, 2018
Messages
4
I'm not paying for a monthly service to be able to send photos from my phone to my own server. No offense.

I will keep on then.
 
Last edited by a moderator:

dnilgreb

Contributor
Joined
Mar 29, 2016
Messages
168
First off, thank you for this guide. It really is very helpful. I went through it all, and now have my NextCloud up and running, SSL and all. In a jail on FreeNAS 9.10.2-U6.
I had a couple of hiccups along the way, and I thought I´d outline them, in case anyone else has the same issues, or if you want to add to the guide.

My first problem came after I finished the installation av NextCloud. What I wanted to do then was add my FreeNAS shares as SMB External Storage. NextCloud does not come with SMB support, and I actually had a little problem (couple of days on google) to find this. Very simple solution, though. You just have to install the pecl-smbclient using ports.
Code:
make config-recursive install -C /usr/ports/net/pecl-smbclient

After this, I restarted the web server:
Code:
service apache24 restart


Ok, so that´s that. The real challenge (at least for me) was the SSL bit.
As I added the second VirtualHost(443), Nextcloud went inaccessible.
I tried to run this:
Code:
certbot certonly --webroot -w /usr/local/www/apache24/data/nextcloud -d YOURSITE.COM

but it complains about not being able to contact the server.
What happened here was, in the first VirtualHost(80), we have these lines:
Code:
RewriteEngine on
RewriteCond %{SERVER_NAME} =YOURSITE.com
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,QSA,R=permanent]



So every call to http gets redirected to https. And we don´t have certs installed yet, so https won´t work.
I simply commented out these lines, restarted apache, and successfully ran the certbot command.
Then, just change it back, becausse once you have SSL functional you don´t want to use http...

BUT, when I restart apache I get a WARNING saying it can´t start.
This took me a day, but I found this:
In the second VirtualHost(443), there´s this line:
Code:
SSLCipherSuite  ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-DSS-AES128-GCM-SHA256:kEDH+AESGCM:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-DSS-AES128-SHA256:DHE-RSA-AES256-SHA256:DHE-DSS-AES256-SHA:DHE-RSA-AES256-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:AES:CAMELLIA:DES-CBC3-SHA:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!MD5:!PSK:!aECDH:!EDH-DSS-DES-CBC3-SHA:!EDH-RSA-DES-CBC3-SHA:!KRB5-DES-CBC3-SHA


There is actually a double space right after the word SSLCipherSuite. I changed to a single space, and then it worked!
Hope someone finds this useful
 
Last edited:

LeoSum

Dabbler
Joined
Dec 13, 2015
Messages
36
Hi and thanks for this guide. It was really easy to follow and saved me tons of research work!

I would like to point out another soloution to the problem with mariadb when installing this in a 11.0 jail on the 11.1 host:

in this redit https://www.reddit.com/r/freenas/comments/7jtowb/111_jails/ the answer from sammy2398 explains how to create a 11.1 template and kick of a jail with that:

Basically all you need to do is ssh to the FreeNAS host and issue the following commands:
Code:
fetch http://ftp-archive.freebsd.org/pub/FreeBSD/releases/amd64/11.1-RELEASE/base.txz
warden template create -tar base.txz -nick templateFreeBSD11-1_jail
warden create nextcloud --ipv4 <insert IPv4 address> --template templateFreeBSD11-1_jail
warden start nextcloud


After this, the jail shows up in the FreeNAS webgui and you can modify VIMAGE and continue the rest of this guide.
 
Last edited by a moderator:

onur

Dabbler
Joined
Feb 16, 2016
Messages
14
Thank you very much for this guide. Nextcloud successfully upgraded to 13. Now it supports php 7.2
Should I update 7.1 to 7.2 by changing 71 to 72 in the code below, or is there a faster way?
Code:
pkg install redis php71-ctype php71-dom php71-gd php71-iconv php71-json php71-mbstring php71-posix php71-simplexml  php71-xmlreader php71-xmlwriter php71-zip php71-zlib php71-pdo_mysql php71-hash php71-xml php71-session php71-mysqli php71-wddx php71-xsl php71-filter php71-curl php71-fileinfo php71-bz2 php71-intl php71-mcrypt php71-openssl php71-ldap php71-ftp php71-imap php71-exif php71-gmp php71-memcache php71-opcache php71-pcntl php71 mod_php71
 

utzachaka

Cadet
Joined
Feb 6, 2018
Messages
5
I tried it several times now.
Everytime when I try to secure install mysql it says:
Code:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2 "No such file or directory")


I am following every single step. Any advices?
 

Beep

Dabbler
Joined
Dec 28, 2017
Messages
21
I tried it several times now.
Everytime when I try to secure install mysql it says:
Code:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2 "No such file or directory")


I am following every single step. Any advices?
Have you also tried the ports alternative?
 

utzachaka

Cadet
Joined
Feb 6, 2018
Messages
5
There you go!
I found some posts saying that the jails version of freenas (using the webUI to create the jail) is 11.0. My freenas host system is 11.1. This constellation is causing the trouble.
Someone already opened a ticket for this issue.

Long story short: I fixed my problems using iocage to create my nextcloud jail. Everything works just fine and I was able to get Nextcloud 13 running by following the rest of this guide.
 

cunningorb

Explorer
Joined
Feb 5, 2018
Messages
58
So I made some progress with the SQL-topic, also noticed some changes in the apache config as per below. However, nextcloud is just presenting a screen:
Code:
PHP module GD not installed.

Please ask your server administrator to install the module.


php information showing me the following error:
Code:
root@NextCloud:~ #php -m
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/lib/php/20160303/gd.so' - /lib/libz.so.6: version ZLIB_1.2.9 required by /usr/local/lib/libpng16.so.16 not found in Unknown on line 0
[PHP Modules]
bz2
Core
ctype
curl
date
dom
exif
fileinfo
filter
hash
iconv
intl
json
libxml
mbstring
mcrypt
mysqli
mysqlnd
openssl
pcntl
pcre
PDO
pdo_mysql
posix
Reflection
session
SimpleXML
SPL
standard
wddx
xml
xmlreader
xmlwriter
xsl
Zend OPcache
zip
zlib

[Zend Modules]
Zend OPcache

=> GD library is not there, also it is installed:
Code:
root@NextCloud:~ # pkg install php71-gd
Updating FreeBSD repository catalogue...
FreeBSD repository is up to date.
All repositories are up to date.
Checking integrity... done (0 conflicting)
The following 1 package(s) will be affected (of 0 checked):

New packages to be INSTALLED:
		php71-gd: 7.1.12_2

Number of packages to be installed: 1

Proceed with this action? [y/N]: y
[NextCloud] [1/1] Installing php71-gd-7.1.12_2...
[NextCloud] [1/1] Extracting php71-gd-7.1.12_2: 100%

I went through google and seems its a common problem, however, anyone might have solved it in here?

https://forums.freenas.org/index.php?threads/new-jail-that-requires-zlib_1-2-9.59734/

SQL-Server:
I installed MySQL56
Code:
pkg install -y mysql56-server
sysrc mysql_enable=YES
service mysql-server start
mysql_secure_installation

works....

also re apache config; virtual hosts needs to be enabled:
Code:
cd /usr/local/etc/apache24
nano httpd.conf

change / uncomment:
Code:
# Virtual hosts
Include etc/apache24/extra/httpd-vhosts.conf

than edit httpd-vhosts.conf:
Code:
cd /usr/local/etc/apache24/extra
nano httpd-vhosts.conf

and add (NOTE: Change YOURSITEHERE.com), add # to all the rest of the lines
Code:
<VirtualHost *:80>
DocumentRoot "/usr/local/www/apache24/data/nextcloud"
ServerName YOURSITEHERE.com
RewriteEngine on
RewriteCond %{SERVER_NAME} =YOURSITEHERE.com
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,QSA,R=permanent]
#ErrorLog ${APACHE_LOG_DIR}/error.log
#CustomLog ${APACHE_LOG_DIR}/access.log combined
<Directory /usr/local/www/apache24/data/nextcloud/>
Options +FollowSymlinks
AllowOverride All
<IfModule mod_dav.c>
Dav off
</IfModule>
SetEnv HOME /usr/local/www/apache24/data/nextcloud
SetEnv HTTP_HOME /usr/local/www/apache24/data/nextcloud
Satisfy Any
</Directory>
</VirtualHost>


Hope that helps?

Did we ever solve this?

I ask because my nextcloud installation is working fine over http from local network or with wifi off on my phone. I followed exactly the steps for creating a cert and no errors were presented. Yet my nextclouxd site is inaccessible internally or externally via https. In chrome I just receive this error: "ERR_SSL_PROTOCOL_ERROR." I tried turning on virtual hosts using the quoted post's instructions. It's also interesting to note that the forced redirect from http to https is not working.
 

Beep

Dabbler
Joined
Dec 28, 2017
Messages
21
There you go!
I found some posts saying that the jails version of freenas (using the webUI to create the jail) is 11.0. My freenas host system is 11.1. This constellation is causing the trouble.
Someone already opened a ticket for this issue.

Long story short: I fixed my problems using iocage to create my nextcloud jail. Everything works just fine and I was able to get Nextcloud 13 running by following the rest of this guide.
Sorry I forgot I'm also using iocage. Did you use the ports mysql version with iocage or the normal pkg version?
 

utzachaka

Cadet
Joined
Feb 6, 2018
Messages
5
Sorry I forgot I'm also using iocage. Did you use the ports mysql version with iocage or the normal pkg version?
I used the normal pkg version. Works good so far.
On my LAN everything seems okay. Next problem to solve for me, is to make my owncloud accessible from the internet. I forwarded tcp port 80 to my jail.
I need to configure vnet/vimage, I guess. But so far everytime I change the jails interface config to vnet0, I completely lose network access.
Dont know what's wrong. Maybe you got some hints on that too?
 

cunningorb

Explorer
Joined
Feb 5, 2018
Messages
58
My nextcloud is mostly working. I can reach it via http over the internet.

How do I resolve the ssl issue I'm having or what troubleshooting must I try? I've rerun certbot command with no errors. Apache restart has no errors. The guide had me add a "Listen 443" below "Listen 80" which I've verified is there. I added all the text in httpd.conf and .htaccess that was suggested by the guide and made sure my domain was correctly spelled.

When attempting to access over https I just get "ERR_SSL_PROTOCOL_ERROR" in chrome. Also, the forced redirect from http to https is not working as I can still type the http and be sent to the http site.

Edit: cert test said this:
  • No secure protocols supported - if you get this message, but you know that the site supports SSL, wait until the cache expires on its own, then try again, making sure the hostname you enter uses the "www" prefix (e.g., "www.ssllabs.com", not just "ssllabs.com").
 
Last edited:

dnilgreb

Contributor
Joined
Mar 29, 2016
Messages
168
I have it all up and running now, thanks to this guide. I am now down to the small details to make it look even more awesome :)
I´d like to clean up the url field in the browser when logged in. Currently it looks something like this:
Code:
https://cloud.mydomain.com/index.php/apps/files/?dir=/&fileid=31361


Instead, I would like it to just display this:
Code:
https://cloud.mydomain.com/


How is that done? Can it be done?
 

cunningorb

Explorer
Joined
Feb 5, 2018
Messages
58
I have it all up and running now, thanks to this guide. I am now down to the small details to make it look even more awesome :)
I´d like to clean up the url field in the browser when logged in. Currently it looks something like this:
Code:
https://cloud.mydomain.com/index.php/apps/files/?dir=/&fileid=31361


Instead, I would like it to just display this:
Code:
https://cloud.mydomain.com/


How is that done? Can it be done?

I came across the answer once when looking through nextcloud's docs. Search on google for "nextcloud pretty URLs" and you should get a good head start. Post back if you run into issues.
 

dnilgreb

Contributor
Joined
Mar 29, 2016
Messages
168
Ok, tried it and got a very little bit closer, but not all the way.

In this file:
Code:
/usr/local/www/apache24/data/nextcloud/config/config.php

I added these lines:
Code:
'overwrite.cli.url' => 'https://cloud.mydomain.com',
'htaccess.RewriteBase' => '/',


So now the URL looks like this:

Code:
https://cloud.mydomain.com/apps/files/?dir=/&fileid=31361


So index.php went away. But how do I get rid of index.php and everything after it?
 
Top