By Stefan Hinker-Oracle on Jul 22, 2016
I recently had this private little project to try out Owncloud and Nextcloud for personal use. But since I tried it on Solaris, I thought I might as well share a short summary here for whoever might find it useful.
To deploy either Owncloud or Nextcloud on Solaris, you generally follow the commandline installation instructions. They are very short and straightforward. In general, use the Linux manual installation for guidance. However, there are a few Solaris specifics like package dependencies, which are not documented. Here's what you'll need to do:
- I installed in a non-global zone (targeting to make it immutable once it's all up and running). To resolve all the dependencies, you'll need to install these packages right after deploying the empty zone (not sure I need all those apache packages...):
mysql-56 mysql-56/client mysql-56/library library/python-2/python-mysql-27 web/server/apache-24/module/apache-wsgi-34 web/server/apache-24/module/apache-ssl web/server/apache-24/module/apache-securit web/server/apache-24/module/apache-jk web/server/apache-24/module/apache-fcgid web/server/apache-24/module/apache-dbd web/php-56
- Make sure your zone has internet access and DNS resolution. It will need it to use the Owncloud/Nextcloud appstore.
- It is easiest to install and run Owncloud/Nextcloud as webservd, since then you don't have to bother with tweaking apache into using a different user.
- You'll need to enable a few extensions for php. You do this in
/ec/php/5.6/conf.d/extensions.ini Here are the ones I enabled, I'm not
sure I need them all...
extension=bcmath.so extension=bz2.so extension=calendar.so extension=c url.so extension=gd.so extension=mbstring.so extension=mysql.so extension=mysqli.so extension=openssl.so extension=pcntl.so extension=pdo_mysql.so extension=readline.so extension=snmp.so extension=sockets.so extension=sysvmsg.so extension=sysvsem.so extension=sysvshm.so extension=tidy.so extension=zip.so
- Create a config file for the mysql extension in /etc/php/5.6/conf.d/mysql.ini. I took the example from the Admin Guide.
- I wanted to have a separate ZFS dataset for the software, the
data and the mysql database. This would give me snapshot capability as
well as write access to the data once the zone is immutable.
- Delegate a ZFS dataset to the zone.
zonecfg -z nextcloud info dataset dataset: name: datapool/nextcloud alias: nextcloud
- Create some filesystems in the dataset to host software, data and database
root@nextcloud:~# zfs list -r nextcloud NAME USED AVAIL REFER MOUNTPOINT nextcloud 243M 2.52T 38.6K /nextcloud nextcloud/apache 38.0K 2.52T 38.0K /nextcloud/apache nextcloud/data 17.5M 2.52T 17.5M /nextcloud/server/nextcloud/data nextcloud/mysql 146M 2.52T 146M /nextcloud/mysql nextcloud/server 79.2M 2.52T 79.2M /nextcloud/server
- Change the mysql default to point to the new location:
svccfg -s mysql:version_56 setprop mysql/data=/nextcloud/mysql/data svccfg -s mysql:version_56 refresh
- Delegate a ZFS dataset to the zone.
- Now just follow the Admin Guide to create the mysql database:
svcadm enable mysql mysqladmin -u root password "secret" mysql -u root -p mysql> create user 'admin'@'localhost' identified by 'secret'; Query OK, 0 rows affected (0.25 sec) mysql> create database if not exists nextcloud ; Query OK, 1 row affected (0.00 sec) mysql> GRANT ALL PRIVILEGES ON nextcloud.* TO 'admin'@'localhost' identified by 'secret'; Query OK, 0 rows affected (0.00 sec)
- And finally, perform the installation:
php occ maintenance:install --database "mysql" --database-name "nextcloud" --database-user "root" --database-pass "secret"\ --admin-user "admin" --admin-pass "secret"
- The rest is no different to the Linux installation. You'll need to configure apache to serve the application. Don't forget to do this with SSL if you're actually running this on the internet!
- Don't forget to tighten file security as described in the Admin Guide!
- Once done, I turned my zone immutable for additional security. For this to work, I had to redirect the apache logs to a writable directory, so I created another zfs dataset in the nextcloud pool and had apache send it's logs there. To turn immutability on, just do
zoneadm -z nextcloud halt zonecfg -z nextcloud set file-mac-profile=fixed-configuration zoneadm -z nextcloud boot