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

ElchQ

Dabbler
Joined
Oct 18, 2015
Messages
13
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?
 
Last edited by a moderator:

Ceetan

Contributor
Joined
Apr 29, 2016
Messages
139
This is probably a really dumb question but what does "Freenas user space" mean ?


Also, could my hardware run nextcloud?
 

Kuro Houou

Contributor
Joined
Jun 17, 2014
Messages
193
I ran into the same problem, using FreeNAS 11.1 u4.. Trying now with the new interface creating a new jail in there.. will see how that goes. Wish this worked with the old jails, was just about done with all these configuration steps!
 
Last edited by a moderator:

Kuro Houou

Contributor
Joined
Jun 17, 2014
Messages
193
So I got this working today in iocage (the new jail system). I think with FreeNAS 11.1 that is the only option now if you want Nextcloud > v11. I modified a few parts as they don’t work.. I’ll try and post my stripped down instructions later but feel free to ask any questions. One big thing was all the cache options don’t work. Redis doesn’t work at all, from what I read it doesn’t support PHP 7.1 with FreeBSD, another site mentioned compiling it manually. But it’s not critical and honestly I don’t need it as only a couple people will use this. Also one thing I really want to know is how to get a real cert for a domain name hosted by a free dms service.. is that even possible? I couldn’t get it to work with the dns service afraid :(. Any other ideas there?
 
Last edited:

dureal99d

Contributor
Joined
Aug 3, 2017
Messages
156
i get a commnad not found error when copy pastig this in the nextcloud shell
That's because you're doing it inside of the next Cloud user space. That command is meant to be pasted or entered in the freenas user space

Sent from my HUAWEI NXT-AL10 using Tapatalk
 

Ceetan

Contributor
Joined
Apr 29, 2016
Messages
139
So I got this working today in iocage (the new jail system). I think with FreeNAS 11.1 that is the only option now if you want Nextcloud > v11. I modified a few parts as they don’t work.. I’ll try and post my stripped down instructions later but feel free to ask any questions. One big thing was all the cache options don’t work. Redis doesn’t work at all, from what I read it doesn’t support PHP 7.1 with FreeBSD, another site mentioned compiling it manually. But it’s not critical and honestly I don’t need it as only a couple people will use this. Also one thing I really want to know is how to get a real cert for a domain name hosted by a free dms service.. is that even possible? I couldn’t get it to work with the dns service afraid :(. Any other ideas there?

I'd be really interested in seeing how this is done. Iocage seems a bit different from warden in how you do stuff and i could not get this to work with just the instruction that are available as is, though I to agree this guide is really good.
 
Last edited by a moderator:

Beep

Dabbler
Joined
Dec 28, 2017
Messages
21
I also would be very interested in a full instruction with iocage.
 

LotLits

Dabbler
Joined
Apr 10, 2015
Messages
30
Really, the iocage and warden steps aren't much different. To setup the iocage, you can run basically the following to get the jail going. Once inside the jail, the steps are pretty much the same as they are for warden.

Below is an example of this (there are differences for DHCP and I believe you need to configure a few tuneables for bridged interfaces)

Create the jail
iocage create --name "nextcloud" -r 11.1-RELEASE ip4_addr="vnet0|<ip>/<cidr>" vnet="on" allow_raw_sockets="1" defaultrouter="<gw-ip>" boot="on" host_hostname="nextcloud"

Mount the datasets
iocage fstab -a nextcloud "/mnt/tank/nextcloud/files /mnt/files nullfs rw 0 0"
iocage fstab -a nextcloud "/mnt/tank/nextcloud/db /var/db/mysql nullfs rw 0 0"

Console into the jail
iocage console nextcloud

After the above is performed from the FreeNAS, the steps are basically the same. I was able to get nextcloud working in iocage with pretty much the same steps for warden as iocage.

The following I found in another thread but haven't had to perform myself.

Tuneables
FreeNAS Changes, System->Tunables -> Add Tunable:
  • Variable "linux_enable", Value "YES", type "rc.conf".1
  • Variable "ifconfig_bridge0", Value "addm [NET_INTERFACE_NAME] up", type "rc.conf".2
  • Variable "net.inet.ip.forwarding", Value "1", type "Sysctl".2
  • Variable "net.link.bridge.pfil_onlyip", Value "0", type "Sysctl".2
  • Variable "net.link.bridge.pfil_bridge", Value "0", type "Sysctl".2
  • Variable "net.link.bridge.pfil_member", Value "0", type "Sysctl".2
 
Last edited by a moderator:

Ceetan

Contributor
Joined
Apr 29, 2016
Messages
139
Cheers! That seems to have worked fairly well, though I ran into this problem:
Code:
root@Darwin:~ # jls
   JID  IP Address	  Hostname					  Path
	 1				  nextcloud					 /mnt/iocage/jails/nextcloud/root
root@Darwin:~ #  jexec 1
root@nextcloud:/ # portsnap fetch extract
Looking up portsnap.FreeBSD.org mirrors... none found.
Fetching public key from portsnap.FreeBSD.org... failed.
No mirrors remaining, giving up.
root@nextcloud:/ # pkg install nano wget sudo
The package management tool is not yet installed on your system.
Do you want to fetch and install it now? [y/N]:
root@nextcloud:/ # pkg install nano wget sudo
The package management tool is not yet installed on your system.
Do you want to fetch and install it now? [y/N]: y
Bootstrapping pkg from pkg+http://pkg.FreeBSD.org/FreeBSD:11:amd64/quarterly, please wait...
pkg: Error fetching http://pkg.FreeBSD.org/FreeBSD:11:amd64/quarterly/Latest/pkg.txz: No address record
A pre-built version of pkg could not be found for your system.
Consider changing PACKAGESITE or installing it from ports: 'ports-mgmt/pkg'.


I suspect this could be fairly easy to fix, but I am kind of new at non-freenas BSD (In the sense that I mostly operated via GUI) so i don't know how to go about it. Any help would be appreciated. Is this, perhaps, similar to the installing from ports issue that other have mentioned?
 
Last edited by a moderator:

Maxobus

Dabbler
Joined
Dec 9, 2017
Messages
15
Cheers! That seems to have worked fairly well, though I ran into this problem:
Looks like your iocage jail network didn't set up properly and there is no internet connection.
Check the following post:
https://forums.freenas.org/index.php?threads/freenas-11-1-iocage-pkg-missing.59656/

In the new GUI you need to edit Jail properties:
1. Basic Properties: Edit IPv4 Address. In my case I wrote bridge0|192.168.1.21/24
2. Jail Properties: Enable allow_raw_sockets checkbox

Next you'll probably want to mount storage to the Jail.
Check this https://forums.freenas.org/index.php?threads/add-storage-to-iocage-jails.59812/
 

Beep

Dabbler
Joined
Dec 28, 2017
Messages
21
My Nextcloud installation with iocage is running, only issue http://jailip is not working but http://jailip/nextcloud how to change web root to /nextcloud ?


Do I really have to edit /usr/local/etc/apache24/httpd.conf => line 256 & 257 /usr/local/www/apach24/data => /usr/local/www/apach24/data/nextcloud ? Or shouldn't /usr/local/etc/apache24/Includes/IP overwrite these values?
 
Last edited:

Ceetan

Contributor
Joined
Apr 29, 2016
Messages
139
So, my nextcloud instalation was running fine for about a day, but when I rebooted the server, the jail would not start, and can not be started.

Code:
mount_nullfs: /mnt/iocage/jails/nextcloud/root/mnt/files: Resource deadlock avoided
jail: /sbin/mount -t nullfs -o rw /mnt/tank/nextcloud/files /mnt/iocage/jails/nextcloud/root/mnt/files: failed


Any ideas what could be wrong?
 

AfroUSA

Dabbler
Joined
Mar 27, 2017
Messages
28
So I made some progress with the SQL-topic, also noticed some changes in the apache config as per below. However, nextcloud ist just presenting a screen:

PHP module GD not installed.

Please ask your server administrator to install the module.

php information showing me the following error:

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:

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/

I have exactly the same problem, on FreeNAS-11.1-RELEASE this is my php -m information:

Code:
# 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
ftp
gmp
hash
iconv
imap
intl
json
ldap
libxml
mbstring
mcrypt
memcache
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


And here I'm stuck on Nextcloud 12.0.4 on my web asking:
Code:
PHP module GD 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.

Any help how to sort this out??
 

AfroUSA

Dabbler
Joined
Mar 27, 2017
Messages
28
Any help how to sort this out??

Hi, problem solved!

Actually I had two problem following instruction on page firs, one involved MariaDB 'fdatasync' second PHP Module GD.so
After trying to start mariadb service, I got this error:
Code:
# service mysql-server start
Installing MariaDB/MySQL system tables in '/var/db/mysql' ...
2018-01-13 18:40:16 34422743040 [Note] /usr/local/libexec/mysqld (mysqld 10.1.30-MariaDB) starting as process 84046 ...
/usr/local/libexec/mysqld: Undefined symbol "fdatasync"

Problem fixed by installing mariaDB from ports
ssh into that jail and:
Code:
portsnap fetch
portsnap extract
cd /usr/ports/databases/mariadb102-server/
make deinstall
make install clean ALLOW_UNSUPPORTED_SYSTEM=true

After I deleted all files in /var/db/mysql, then reboot the jail from FreeNAS and starting mysql service, all went OK.

Second problem with PHP and login to Nextcloud WebUI - PHP module GD not installed
Code:
# 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


To fix this, I removed png-1.6.34 and php71-gd-7.1.13 by
Code:
pkg remove png
cd /usr/ports/graphics/png
make install clean ALLOW_UNSUPPORTED_SYSTEM=true
pkg install php71-gd

Than you can check if module GD is loaded by
Code:
php -m

It should give you this:
Code:
# php -m
[PHP Modules]
bz2
Core
ctype
curl
date
dom
exif
fileinfo
filter
ftp
gd
gmp
hash
iconv
imap
intl
json
ldap
libxml
mbstring
mcrypt
memcache
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

All info from this two posts on forum:
"fdatasync" post by junior
"GD module not installed" post by JeremyBaker

Regarding problem with .htaccess
Code:
Your data directory and your files are probably accessible from the Internet. The .htaccess file is not working. It is strongly recommended that you configure your web server in a way that the data directory is no longer accessible or you move the data directory outside the web server document root.

I had to edit config.conf in /usr/local/www/apache24/data/nextcloud/config/ and change
Code:
'datadirectory' => '/usr/local/www/apache24/data/nextcloud/data',
to this
Code:
'datadirectory' => '/mnt/files',


Thanks for help!
 
Last edited by a moderator:

atoddvr6

Cadet
Joined
Jan 21, 2018
Messages
4
Great guide and thank you from someone very new to this.

I am having trouble with the section below.
From FreeNAS user space run command:
jls
you will then see your jails, the run commander jexec "And the number of you jail" (example) "jexec 2"

jls works fine but when I type in jexec 1 I get this:
Code:
jexec: execlp: /usr/local/bin/bash: No such file or directory


So I moved on and ran the next command:
portsnap fetch extract
Which worked fine.

Then I ran the next command:
pkg install nano wget sudo

But I got this:
Code:
[root@freenas ~]# pkg install nano wget sudo																					  
Updating local repository catalogue...																							
pkg: file:///usr/ports/packages/meta.txz: No such file or directory																
repository local has no meta file, using default settings																		 
pkg: file:///usr/ports/packages/packagesite.txz: No such file or directory														
Unable to update repository local																								 
Error updating repositories!


So I tried to install Apache but it failed as well:
Code:
[root@freenas ~]# pkg install apache24																							
Updating local repository catalogue...																							
pkg: Repository local load error: access repo file(/var/db/pkg/repo-local.sqlite) failed: No such file or directory				
pkg: file:///usr/ports/packages/meta.txz: No such file or directory																
repository local has no meta file, using default settings																		 
pkg: file:///usr/ports/packages/packagesite.txz: No such file or directory														
Unable to update repository local																								 
Error updating repositories!


What am I missing? Any help would be greatly appreciated!
 
Last edited by a moderator:

Jailer

Not strong, but bad
Joined
Sep 12, 2014
Messages
4,977

atoddvr6

Cadet
Joined
Jan 21, 2018
Messages
4
You don't run these commands on the base system, you run them in the jail.

Ok. So what am I missing? Is there supposed to be something after jexec 1?

Like:
jexec 1 portsnap fetch extract

I was able to get here:
Code:
[root@freenas ~]# jexec 1 /bin/tcsh																								 
root@nextcloud_1:/ #


Is this where I need to be to run the rest of the commands?
 

GLaDER

Dabbler
Joined
Dec 1, 2017
Messages
14
I do not intend to be condescending, but you do not seem to be very well versed in command line riding.

First, yes, jexec expects a shell after the jail or it will default to bash (which is why you got the error message: jexec: execlp: /usr/local/bin/bash: No such file or directory). You could for instance run: jexec <number> csh to enter jail <number> and launch the C Shell.

After you have entered the jail, you perform most of the commands found in the original guide. However, the guide in its current form does not work well with FreeNAS 11.1 due to some incompatibilities between ports/pkgs and the current jail images (IIRC).

I would advice you to either:
  1. Try the Nextcloud plugin
  2. Install a Ubuntu VM and install Nextcloud there
  3. Look for another solution to your storage
And mostly, spend some time with the command line before you attempt to do anything more CLI-related :)
 
Last edited by a moderator:
Top