Back
EL 8/9
// Disable selinux, update & reboot
# sed -i-e "s|^SELINUX=.*$|SELINUX=disabled|" /etc/selinux/config
# cat /etc/selinux/config
# setenforce 0
# getenforce
# yum -y update
// Install PostgreSQL and dependencies
# yum -y install httpd git php php-pgsql php-gettext postgresql-server perl-DBD-Pg perl-YAML
// Install DAViCal calendar and contacts server
# cd /usr/share
# git clone https://gitlab.com/davical-project/davical.git && \
git clone https://gitlab.com/davical-project/awl.git && \
rm -rf ./davical/.git/ && rm -rf ./awl/.git/
// PostgreSQL initialization
# /usr/bin/postgresql-setup initdb
// PostgreSQL user database configuration
# file=/var/lib/pgsql/data/pg_hba.conf
# mv $file $file.bak
# num=`grep -n "# TYPE DATABASE USER ADDRESS METHOD" $file.bak \
| awk -F: '{print $1}'` && ((num++))
# awk -v n=$num -v s="local davical davical_app trust\nlocal davical davical_dba trust" \
'NR == n {print s} {print}' $file.bak > $file
# cat $file
// PostgreSQL service enable and start
# systemctl enable --now postgresql && systemctl status postgresql
// Create PostgreSQL DAViCal database (Save password which is output after database creation)
# sudo -u postgres /usr/share/davical/dba/create-database.sh
// If this is a migration import database from old server
(On old server)
# pg_dump davical > davical.psql
# scp davical.psql root@'new server ip':/root
(On new server)
# sudo -u postgres dropdb davical
# sudo -u postgres createdb davical
# sudo -u postgres psql davical < /root/davical.psql
// Create Apache and DAViCal configuration directories
# mkdir /etc/httpd/sites-available && mkdir /etc/httpd/sites-enabled && mkdir /etc/davical
// Create DAViCal virtual host in Apache, enable the site, and start Apache
# tee -a /etc/httpd/sites-available/davical2.whitehorsetc.com.conf <<END
<VirtualHost *:80>
DocumentRoot /usr/share/davical/htdocs
DirectoryIndex index.php index.html
ServerName davical2.whitehorsetc.com
ServerAlias davical2.whitehorsetc.com
Alias /images/ /usr/share/davical/htdocs/images/
<Directory /usr/share/davical/htdocs/>
AllowOverride None
Require all granted
</Directory>
php_value include_path /usr/share/awl/inc
php_value magic_quotes_gpc 0
php_value register_globals 0
php_value error_reporting "E_ALL & ~E_NOTICE"
php_value default_charset "utf-8"
</VirtualHost>
END
# cat /etc/httpd/sites-available/davical2.whitehorsetc.com.conf
# ln -s /etc/httpd/sites-available/davical2.whitehorsetc.com.conf \
/etc/httpd/sites-enabled/davical2.whitehorsetc.com.conf
# ls -l /etc/httpd/sites-enabled
# cp -p /etc/httpd/conf/httpd.conf /etc/httpd/conf/httpd.conf.bak
# tee -a /etc/httpd/conf/httpd.conf <<END
# Include the virtual host configurations:
IncludeOptional sites-enabled/*.conf
END
# cat /etc/httpd/conf/httpd.conf
# systemctl enable --now httpd && systemctl status httpd
// Configure DAViCal to connect to database
# tee -a /etc/davical/davical2.whitehorsetc.com-conf.php <<END
<?php
\$c->domain_name = "davical2.whitehorsetc.com";
\$c->sysabbr = 'DAViCal';
\$c->admin_email = 'postmaster@whitehorsetc.com';
\$c->system_name = "Example DAViCal Server";
\$c->pg_connect[] = 'dbname=davical port=5432 user=davical_app';
?>
END
# cat /etc/davical/davical2.whitehorsetc.com-conf.php
Create DNS entry for your DAViCal Calendar & Contact server,
browse to it, and enter users and groups: http://davical2.whitehorsetc.com/
Use 'admin' and password output at database creation (noted above in red font) to log in
*Note: 1) Replace 'davical2.whitehorsetc.com' wherever found with your hostname
2) Select items in red (tee to END), paste in terminal, and return
3) DAViCal CalDav Store
4) Https security should be implemented over the internet
Text version of this outline...possibly, for a script
Clients:
1) Outlook (CalDav plugin necessary. CalDav Synchronizer)
2) Thunderbird (Lightning)
3) One Calendar
// List databases (Linux command line)
# sudo -u postgres psql -l
// Database commands from psql
# sudo -u postgres psql
postgres=# help
You are using psql, the command-line interface to PostgreSQL.
Type: \copyright for distribution terms
\h for help with SQL commands
\? for help with psql commands
\g or terminate with semicolon to execute query
\q to quit
// List databases
postgres=# \l
// Access database for manipulation
postgres=# \c 'database'