welcome: please sign in

Diff for "MemberManual/WebApplications/Nextcloud"

Differences between revisions 2 and 24 (spanning 22 versions)
Revision 2 as of 2019-01-01 14:26:22
Size: 2043
Comment: Additional information
Revision 24 as of 2019-01-03 11:10:35
Size: 5019
Comment: Disposition
Deletions are marked like this. Additions are marked like this.
Line 1: Line 1:
Guide for installation of Nextcloud. Guide for installation of [[https://nextcloud.com|Nextcloud]].
Line 3: Line 3:
Tested with Nextcloud 15.0.0. == Create database ==

Postgresql should work, but Nextcloud recommends MySQL. See [[MemberManual/Databases#Create_a_Database]]. We'll assume you name the database `${USER}_cloud`.
Line 6: Line 8:

=== Unpack ===
Line 10: Line 14:

Also pick a directory for data, for example `$HOME/var/nextcloud`. We'll call it `$NEXTDATA`.
Line 17: Line 23:
We move the content of the archive so that it's in the root of your new directory. We don't need the `.htaccess` and `.user.ini` files. Move the resulting `nextcloud` directory to where you decided to have the document root.
Line 20: Line 26:
mv nextcloud/* $NEXTDIR/ mv nextcloud $NEXTDIR
Line 30: Line 36:
=== Permissions ===
Line 35: Line 43:
fsr sa config $USER.daemon write
fsr sa data $USER.daemon write
fsr sa apps $USER.daemon write
fsr sa config $USER.daemon rlidwk
fsr sa data $USER.daemon rlidwk
fsr sa apps $USER.daemon rlidwk
Line 39: Line 47:

=== Patch ===
Line 57: Line 67:
=== Create real data directory ===

Create the data directory and give it correct permissions:

{{{
mkdir $NEXTDATA
cd $NEXTDATA
fsr setacl . system:anyuser none
fsr sa . $USER.daemon rlidwk
}}}


== Nextcloud installation wizard ==

Open up the web site, which should now show you the installation wizard. Fill it out like so:

{{{
Data folder: $NEXTDATA
Database: MySQL/MariaDB
Username: whatever you like
Password: likewise
DB hostname: mysql
}}}

== Post-installation configuration ==

=== Set DB charset ===

In the MySQL CLI, run:

{{{
ALTER DATABASE nextcloud CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;
}}}

Add this line to `$NEXDIR/config/config.php`:

{{{
'mysql.utf8mb4' => true,
}}}

=== Update some column types ===

Run this command to convert a couple of column types that are not handled by the installer:

{{{
cd $NEXTDIR
php7.2 occ db:convert-filecache-bigint
}}}

=== Cache ===

Add this line to `$NEXDIR/config/config.php`, to enable the APCu cache:

{{{
'memcache.local' => '\OC\Memcache\APCu',
}}}

=== Cron ===

Add a [[MemberManual/UsingCron|cron job]] like this replacing the variables with your username/path:

{{{
*/5 * * * * k5start -qtUf /etc/keytabs/user.daemon/$USER -- /usr/bin/php7.2 -f $NEXTDIR/cron.php
}}}
Line 58: Line 133:

{{{
web "cloud" where
    PhpVersion = php72;
    DocumentRoot = home "$NEXTDIR";
with
    rewriteRule "/.well-known/carddav" "/remote.php/dav" [redirectWith temp];
    rewriteRule "/.well-known/caldav" "/remote.php/dav" [redirectWith temp];
end;
}}}

'''TODO: Translate additional settings from `.htaccess` and `.user.ini`'''

== Login ==

You should now be able to log in and look around Nextcloud. You may want to have a look at `Settings → Overview` for any warnings. You will see a bunch of warnings like this:

{{{
Some app directories are owned by a different user than the web server one. This may be the case if apps have been installed manually. Check the permissions of the following app directories:

    /afs/hcoop.net/user/…
}}}

These can be ignored.

== Configuration in Nextcloud UI ==

=== cron ===

Go to ''Settings → Basic Settings'' and select the option ''Cron'' under ''Background jobs'' (since we set that up earlier).

You can check this page to ensure your cronjob is working.

=== Mail notifications ===

In ''Settings → Basic Settings, set:

Send mode: Sendmail
Sendmail mode: pipe (-t)
From address: whatever you like (under your domain).;

'''TODO: Update with instructions on using SMTP when that's working.'''
Line 79: Line 196:

'''TODO: This didn't work for me, fix the instructions on dropping tables.'''

Guide for installation of Nextcloud.

1. Create database

Postgresql should work, but Nextcloud recommends MySQL. See MemberManual/Databases#Create_a_Database. We'll assume you name the database ${USER}_cloud.

2. Software installation

2.1. Unpack

Get the Nextcloud tarball from Nextcloud.

Pick a directory where you'll host Nextcloud, for example $HOME/www/next.your.domain. We'll call it $NEXTDIR.

Also pick a directory for data, for example $HOME/var/nextcloud. We'll call it $NEXTDATA.

Unpack the source.

unzip nextcloud-15.0.0.zip

Move the resulting nextcloud directory to where you decided to have the document root.

mv nextcloud $NEXTDIR

Create an empty data directory in the document root. This is necessary for the duration of the installation, we'll delete it later.

cd $NEXTDIR
mkdir data

2.2. Permissions

Adjust directory permissions:

fsr setacl . system:anyuser none
fsr sa . $USER.daemon rlk
fsr sa config $USER.daemon rlidwk
fsr sa data $USER.daemon rlidwk
fsr sa apps $USER.daemon rlidwk

2.3. Patch

Delete some lines in the file core/Migrations/Version14000Date20180129121024.php. This doesn't play well with the HCoop default of not granting DROP on tables. The easiest fix seems to be to manually drop these later.

@@ -49,11 +49,6 @@
                /** @var ISchemaWrapper $schema */
                $schema = $schemaClosure();

-               $schema->dropTable('admin_sections');
-               $schema->dropTable('admin_settings');
-               $schema->dropTable('personal_sections');
-               $schema->dropTable('personal_settings');
-
                return $schema;
        }
 }

2.4. Create real data directory

Create the data directory and give it correct permissions:

mkdir $NEXTDATA
cd $NEXTDATA
fsr setacl . system:anyuser none
fsr sa . $USER.daemon rlidwk

3. Nextcloud installation wizard

Open up the web site, which should now show you the installation wizard. Fill it out like so:

Data folder: $NEXTDATA
Database: MySQL/MariaDB
Username: whatever you like
Password: likewise
DB hostname: mysql

4. Post-installation configuration

4.1. Set DB charset

In the MySQL CLI, run:

ALTER DATABASE nextcloud CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;

Add this line to $NEXDIR/config/config.php:

'mysql.utf8mb4' => true,

4.2. Update some column types

Run this command to convert a couple of column types that are not handled by the installer:

cd $NEXTDIR
php7.2 occ db:convert-filecache-bigint

4.3. Cache

Add this line to $NEXDIR/config/config.php, to enable the APCu cache:

'memcache.local' => '\OC\Memcache\APCu',

4.4. Cron

Add a cron job like this replacing the variables with your username/path:

*/5 * * * * k5start -qtUf /etc/keytabs/user.daemon/$USER -- /usr/bin/php7.2 -f $NEXTDIR/cron.php

5. Domtool

web "cloud" where
    PhpVersion = php72;
    DocumentRoot = home "$NEXTDIR";
with
    rewriteRule "/.well-known/carddav" "/remote.php/dav" [redirectWith temp];
    rewriteRule "/.well-known/caldav" "/remote.php/dav" [redirectWith temp];
end;

TODO: Translate additional settings from .htaccess and .user.ini

6. Login

You should now be able to log in and look around Nextcloud. You may want to have a look at Settings → Overview for any warnings. You will see a bunch of warnings like this:

Some app directories are owned by a different user than the web server one. This may be the case if apps have been installed manually. Check the permissions of the following app directories:

    /afs/hcoop.net/user/…

These can be ignored.

7. Configuration in Nextcloud UI

7.1. cron

Go to Settings → Basic Settings and select the option Cron under Background jobs (since we set that up earlier).

You can check this page to ensure your cronjob is working.

7.2. Mail notifications

In Settings → Basic Settings, set:

Send mode: Sendmail Sendmail mode: pipe (-t) From address: whatever you like (under your domain).;

TODO: Update with instructions on using SMTP when that's working.

8. Cleanup

Since we use a new data directory we can delete the one in the document root:

cd $NEXTDIR
rm -r data

We should drop those deprecated tables from before (this wasn't actually working for me, will look into how to drop tables in MySQL later).

mysql-fixperms
mysql -h mysql -p ${USER}_cloud

DROP TABLE admin_sections;
DROP TABLE admin_settings);
DROP TABLE personal_sections;
DROP TABLE 'personal_settings;

TODO: This didn't work for me, fix the instructions on dropping tables.

MemberManual/WebApplications/Nextcloud (last edited 2019-01-27 11:26:28 by BjörnLindström)