-- Leo's gemini proxy
-- Connecting to gmi.noulin.net:1965...
-- Connected
-- Sending request
-- Meta line: 20 text/gemini
date: 2020-06-28 12:22:13
categories: nextcloud
firstPublishDate: 2020-06-28 12:22:13
I recently decided to use the calendar feature in nextcloud to replace Google Calendar.
In this post, I show how to:
install nextcloud (v19) on a clean Ubuntu 18.04 install. I followed nextcloud's documentation and added missing commands I had to execute to get a working setup
setup the calendar in the iPhone, MacOS and Thunderbird in Linux
backup
# as root add-apt-repository "deb http://archive.ubuntu.com/ubuntu $(lsb_release -sc) universe" apt-get install -y apache2 mariadb-server libapache2-mod-php7.2 apt-get install -y php7.2-gd php7.2-json php7.2-mysql php7.2-curl php7.2-mbstring apt-get install -y php7.2-intl php-imagick php7.2-xml php7.2-zip apt-get install -y unzip
In Ubuntu 20.04, install php 7.4 packages instead.
cd /var/www/ wget https://download.nextcloud.com/server/releases/nextcloud-19.0.0.zip unzip nextcloud-19.0.0.zip mv nextcloud-19.0.0.zip ~/ chown -R www-data:www-data /var/www/nextcloud/
vim /etc/apache2/sites-available/nextcloud.conf # add this text: Alias /nextcloud "/var/www/nextcloud/" <Directory /var/www/nextcloud/> Require all granted AllowOverride All Options FollowSymLinks MultiViews <IfModule mod_dav.c> Dav off </IfModule> </Directory>
Enable site and modules:
a2ensite nextcloud.conf a2enmod rewrite a2enmod headers a2enmod env a2enmod dir a2enmod mime a2enmod ssl a2ensite default-ssl systemctl reload apache2
vim /etc/mysql/mariadb.conf.d/50-server.cnf # add in section [mysqld]: transaction_isolation = READ-COMMITTED binlog_format = ROW
Start MariaDB shell:
mysql -uroot -p # Press enter at `Enter password`
Create a database user and a database:
CREATE USER 'dbusername'@'localhost' IDENTIFIED BY 'dbpassword'; CREATE DATABASE IF NOT EXISTS nextcloud CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci; GRANT ALL PRIVILEGES on nextcloud.* to 'dbusername'@'localhost'; FLUSH privileges; quit;
A valid certificate is mandatory to be able to use the calendar from Apple devices.
First, setup a dns record to point to your nextcloud server, for example: `nc.example.com`. You will access nextcloud with the url: `https://nc.example.com/nextcloud/`
Install Letsencrypt certbot:
add-apt-repository ppa:certbot/certbot apt-get install certbot python3-certbot-apache certbot --apache
A systemd timer is already setup so the certificate is renewed regularly:
systemctl list-timers
Add your domain in nextcloud's configuration:
vim /var/www/nextcloud/config/config.php <?php $CONFIG = array ( ... 'trusted_domains' => array ( 0 => 'public ip', 1 => 'nc.example.com', ), ...
If you already have a calendar, export it in `ics` format and import it in nextcloud:
On the lower left corner, click `Settings & Import`
Click `Import Calendar`
In the iPhone:
Open the settings application.
Select `Passwords and Accounts`.
Select `Add Account`.
Select `Other as account type`.
Select `Add CalDAV account`.
For server, type the domain name of your server i.e. `https://nc.example.com/nextcloud/remote.php/dav/principals/users/username/`. You can get the link by clicking `Settings & Import` and then `Copy iOS/macOS CalDAV address`
Enter your user name and password.
Select `Next`.
Open `Calendar` menu
Select `Add Account`.
Select `Other CalDAV account`.
Select Account Type `Advanced`.
For `Server Address`, type the domain name of your server i.e. `https://nc.example.com`. You can get the link by clicking `Settings & Import` and then `Copy iOS/macOS CalDAV address`
For `Server Path`, type: `/nextcloud/remote.php/dav/principals/users/username/`
For port, type `443`
Enter your user name and password.
Select `Sign In`.
The CalDAV url for thunderbird is different from the url for macOS and iOS, so get the calendar address by doing this:
In nextcloud calendar, click `...` next to the calendar name
Select `Copy private link`
The url looks like: `https://nc.example.com/nextcloud/remote.php/dav/calendars/username/calendarname/`
In thunderbird:
In the calendar list, right click and select `New Calendar`
Select `On the Network`
Select Format `CalDAV`
In `Username`, enter your nextcloud username
In `Location`, enter the calendar url
Select `Next`
Enter calendar name
Choose color
Select `Next`
Select `Finish`
In Firefox:
Open `https://nc.example.com/nextcloud/remote.php/dav/calendars/username/calendarname?export`
Save ics file
From command line, for automated backup:
wget --user nextcloudUsername --password nextcloudPassword -O calendarName-`date +"%Y%m%d"`.ics https://nc.example.com/nextcloud/remote.php/dav/calendars/nextcloudUsername/calendarName?export
vim /var/www/nextcloud/config/config.php <?php "maintenance" => true,
Set `maintenance` to `false` when finished.
Folders:
rsync -Aavx nextcloud/ nextcloud-dirbkp_`date +"%Y%m%d"`/
MariaDB:
mysqldump --single-transaction -h [server] -u [username] -p[password] [db_name] > nextcloud-sqlbkp_`date +"%Y%m%d"`.bak
Folders:
rsync -Aax nextcloud-dirbkp/ nextcloud/
MariaDB:
Before restoring a backup you need to make sure to delete all existing database tables.
mysql -h [server] -u [username] -p[password] -e "DROP DATABASE nextcloud" mysql -h [server] -u [username] -p[password] -e "CREATE DATABASE nextcloud" mysql -h [server] -u [username] -p[password] [db_name] < nextcloud-sqlbkp.bak
hashtags: #nextcloud
-- Response ended
-- Page fetched on Tue May 21 20:22:50 2024