Baikal and CalDavZAPでスケジュール管理

2014/10/25
久しぶりにCalDavZapのサイトをのぞいたら、いつの間にか日本語化されてた。作ってくれた人ありがとー。
ということでインスコしていきます。CalDAVサーバはいろいろありますが、GUIのきれーなBaïkalをチョイス。
最近開発止まってるけど大丈夫なのか!?

CalDAV + CardDAV lightweight server: Baïkal
Baikal/INSTALL.md
# wget http://baikal-server.com/get/baikal-regular-0.2.7.tgz
# wget http://baikal-server.com/get/baikal-regular-0.2.7.tgz
 
# tar zxf baikal-regular-0.2.7.tgz
# mv baikal-regular /usr/share/.
# yum install php-sabredav-Sabre_CalDAV php-sabredav-Sabre_CardDAV
 

SELinuxの設定
# yum install policycoreutils-python
# yum install policycoreutils-python
# chown -R apache:apache /usr/share/baikal-regular
# semanage fcontext -a -t httpd_sys_content_t "/usr/share/baikal(.*/)?(.*)?"
# semanage fcontext -a -t httpd_sys_rw_content_t "/usr/share/baikal(.*/)?Specific(/.*)?"
# restorecon -RFv /usr/share/baikal-regular
 
# touch /usr/share/baikal-regular/Specific/ENABLE_INSTALL
 

SQLiteでいいという人は以下のmariaDBのインストールはいらない。
# yum install mariadb-server
# yum install mariadb-server
# vi /etc/my.cnf
[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
# Settings user and group are ignored when systemd is used.
# If you need to run mysqld under a different user or group,
# customize your systemd unit file for mysqld/mariadb according to the
# instructions in http://fedoraproject.org/wiki/Systemd
 
character-set-server=utf8
    :
    :
# systemctl start mariadb
# systemctl enable mariadb
ln -s '/usr/lib/systemd/system/mariadb.service' '/etc/systemd/system/multi-user.target.wants/mariadb.service'
# mysql_secure_installation
# mysql -u root -p
MariaDB [(none)]> CREATE DATABASE baikal;
MariaDB [(none)]> GRANT ALL ON baikal.* TO 'baikal'@'localhost' IDENTIFIED BY '********';
MariaDB [(none)]> exit;
# mysql -u root -p -D baikal < /usr/share/baikal-regular/Core/Resources/Db/MySQL/db.sql
 

PDO(PHP Data Object)
# yum install php-pdo php-mysqlnd
# yum install php-pdo php-mysqlnd
# vi /etc/php.ini
    :
    :
; Default socket name for local MySQL connects.  If empty, uses the built-in
; MySQL defaults.
; http://php.net/pdo_mysql.default-socket
pdo_mysql.default_socket=/var/lib/mysql/mysql.sock
    :
    :
 

firewallに穴を開ける。認証があるのでsslを使う必要があるが、設定がうまくいかなかったので平文で勘弁して下さい。
# firewall-cmd --add-service=http
# firewall-cmd --add-service=http
# firewall-cmd --permanent --add-service=http
 

次にWebベースのCalDAVクラアントCalDavZapをインスコ。
自分はThunderbirdなのでWebベースのCalDAVクラアントなんて使わなくていいのですが、世の中(会社)にはWindows Live メールとかCalDAV使えない糞メーラを使い続ける人がいるのでなんとかしないといけません。
CalDavZAP - the open source CalDAV web client
# wget http://www.inf-it.com/CalDavZAP_0.11.1.zip
# wget http://www.inf-it.com/CalDavZAP_0.11.1.zip
# unzip CalDavZAP_0.11.1.zip
# mv caldavzap /usr/share/.
# chown -R apache:apache /usr/share/caldavzap
# semanage fcontext -a -t httpd_sys_content_t "/usr/share/caldavzap(/.*)?"
# restorecon -RFv /usr/share/caldavzap
 

BaïkalとCalDavZAPで別々にVirtualHost作りたかったけど、cross-domainの設定がどうにもこうにも動かないのでギブアップ。
# vi /etc/httpd/conf.d/baikal.conf
#
# Baikal and CalDavZAP
#
<virtualhost *:80>
        DocumentRoot /usr/share/baikal-regular/html
        ServerName caldav.sample.jp
 
        RewriteEngine On
        RewriteCond %{HTTP:Access-Control-Request-Method} !^$
        RewriteCond %{REQUEST_METHOD} OPTIONS
        RewriteRule ^(.*)$ $1 [R=200,L]
        RewriteRule /.well-known/carddav /card.php [R,L]
        RewriteRule /.well-known/caldav /cal.php [R,L]
 
        <directory "/usr/share/baikal-regular/html">
                <ifmodule mod_authz_core.c>
                        # Apache 2.4
                        Require local
                        Require ip 192.168.1
                </IfModule>
                <ifmodule !mod_authz_core.c>
                        # Apache 2.2
                        Order Deny,Allow
                        Deny from all
                        Allow from 127.0.0.1
                        Allow from 192.168.1
                </IfModule>
        </Directory>
 
        Alias /zap /usr/share/caldavzap
 
        <directory "/usr/share/caldavzap">
                <ifmodule mod_authz_core.c>
                        # Apache 2.4
                        Require local
                        Require ip 192.168.1
                </IfModule>
                <ifmodule !mod_authz_core.c>
                        # Apache 2.2
                        Order Deny,Allow
                        Deny from all
                        Allow from 127.0.0.1
                        Allow from 192.168.1
                </IfModule>
 
                Options None
                Options +FollowSymlinks
                AllowOverride All
        </Directory>
</VirtualHost>
 
# vi /usr/share/caldavzap/config.js
    :
    :
var globalNetworkCheckSettings={href: 'http://caldav.sample.jp/cal.php/calendars/', hrefLabel: null, additionalResources: [], forceReadOnly: null, settingsAccount: true, timeOut: 30000, lockTimeOut: 10000, delegation: true, backgroundCalendars: [], ignoreAlarms: false}
    :
    :
var globalUseJqueryAuth=true;
    :
    :
var globalInterfaceLanguage='ja_JP';
    :
    :
 

apacheを起動
# systemctl start httpd
# systemctl start httpd
# systemctl enable httpd
ln -s '/usr/lib/systemd/system/httpd.service' '/etc/systemd/system/multi-user.target.wants/httpd.service'
 

http://caldav.sample.jp/にアクセスするとインスコが始まる。

なんかエラーが出てるけど見なかったことに。

インスコ完了後にログインした管理画面。

カレンダーには、http://caldav.sample.jp/zap/でアクセスする。

0 件のコメント:

コメントを投稿