centos 搭建 darwin calendar 服务器

方法一(官网方法):

useradd caluser ----为日历服务器建立一个新用户,方便管理

passwd caluser -----新用户更改密码

su caluser

mkdir ~/CalendarServer ---- 创建一个专门存放安装包的文件夹

cd ~/CalendarServer

svn co http://svn.calendarserver.org/repository/calendarserver/CalendarServer/trunk/ CalendarServer-------下载源代码

./run -s # 什么也没发生。。。

./run # 什么也没发生

感觉可能是python版本版本不对,目前是2.4. 只是感觉不对,没有依据。放弃此方法。

 

 

 

方法二(自强方法):

出处:http://www.productionmonkeys.net/guides/calendar-server/darwin-calendar-and-contact-server

1 修改文件系统格式

/etc/fstab

/dev/sda1 /                       ext3    defaults,user_xattr        1 1 
 
2 创建数据存放目录 (这些目录在第15步的xml配置文件中会用到)
mkdir -p /var/calData/documents
mkdir -p /var/calData/data
chown daemon:daemon /var/calData/documents
chown daemon:daemon /var/calData/data
 
3 安装依赖库
yum install libevent libevent-devel openssl-devel krb5-server krb5-workstation readline-devel python-devel openldap-devel
包含如下:
libevent
libevent-devel
openssl-devel
krb5-server
krb5-workstation
readline-devel
python-devel
openldap-devel
 
 
4 安装sqlite
cd /extra/src
wget http://www.sqlite.org/sqlite-autoconf-3071200.tar.gz  
tar zxf sqlite-autoconf-3071200.tar.gz
cd sqlite-autoconf-3071200
./configure
make
make install
 
 
5 提高python版本,从2.4到2.7
cd /extra/src
wget http://python.org/ftp/python/2.7.3/Python-2.7.3.tgz 
tar zxf Python-2.7.3.tgz
cd Python-2.7.3
./configure --prefix=/usr
make
make install
echo '/usr/lib/python2.7' >> /etc/ld.so.conf.d/python2.7.conf
ldconfig
 
5.1 将yum的配置改回来,因为yum依赖于python2.4.否则会造成yum无法使用
/usr/bin/yum 首行改为 #!/usr/bin/python2.4
 
6 安装easyinstall
cd /extra/src
wget http://peak.telecommunity.com/dist/ez_setup.py 
python ez_setup.py
 
 
7 安装PyKerneros
cd /extra/src
svn co http://svn.calendarserver.org/repository/calendarserver/PyKerberos/trunk PyKerneros
cd PyKerneros
export PATH=$PATH:/usr/kerberos/bin
python setup.py build
python setup.py install
 
8 安装PyOpenDirectory
cd /extra/src
svn co http://svn.calendarserver.org/repository/calendarserver/PyOpenDirectory/trunk PyOpenDirectory
cd PyOpenDirectory
python setup.py build
python setup.py install
 
 
9 创建一个新用户
useradd -d /home/calendaruser -m -s /bin/bash calendaruser
passwd calendaruser
su calendaruser
 
10 下载源码
mkdir ~/calendar
cd ~/calendar
svn co http://svn.calendarserver.org/repository/calendarserver/CalendarServer/trunk CalendarServer
svn co http://svn.calendarserver.org/repository/calendarserver/CalDAVClientLibrary/trunk CalDAVClientLibrary
 
 
11 编译server
cd ~/calendar/CalendarServer
./run -s
 
12 运行 server
cd ~/calendar/CalendarServer
su calendaruser
./run
 
如果运行失败,可能会报找不到pysqlite2错误。
yum install sqlite-devel -y
wget peak.telecommunity.com/dist/ez_setup.py
python2.6 ez_setup.py
easy_install pysqlite
 
 
13.1 配置运行所需文件
su -
# setup installation root
mkdir -p /opt/CalendarServer/etc/caldavd
mkdir -p /opt/CalendarServer/var/run/caldavd
mkdir -p /opt/CalendarServer/var/log/caldavd
cd /home/calendaruser/calendar/CalendarServer
./run -v -i /opt/CalendarServer
 
13.2 拷贝运行配置
rm -rf /opt/CalendarServer/usr/caldavd/caldavd.plist
cp conf/servertoserver-test.xml /opt/CalendarServer/etc/caldavd/servertoserver.xml
cp conf/auth/accounts.xml /opt/CalendarServer/etc/caldavd/accounts.xml
cp conf/caldavd-test.plist /opt/CalendarServer/etc/caldavd/caldavd.plist
cp conf/sudoers.plist /opt/CalendarServer/etc/caldavd/sudoers.plist
 
13.3 更改权限,让新用户可以访问
chmod 600 /opt/CalendarServer/etc/caldavd/*
 
14 做一个简单的链接
ln -s  /opt/CalendarServer/etc/caldavd /etc/caldavd
 
15 初始化配置文件 /etc/caldavd/caldavd.plist
<!-- Data root -->
    <key>DataRoot</key>
    <string>/var/calData/data</string>
    <!-- Document root -->
    <key>DocumentRoot</key>
    <string>/var/calData/documents</string>

    <!-- XML File Directory Service -->
    <key>DirectoryService</key>
    <dict>
      <key>type</key>
      <string>twistedcaldav.directory.xmlfile.XMLDirectoryService</string>

      <key>params</key>
      <dict>
        <key>xmlFile</key>
        <string>/opt/CalendarServer/etc/caldavd/accounts.xml</string>
      </dict>
    </dict>

    <!-- Principals that can pose as other principals -->
    <key>SudoersFile</key>
    <string>/opt/CalendarServer/etc/caldavd/sudoers.plist</string>

      <!-- Wikiserver authentication (Mac OS X) -->
      <!-- COMMENT THIS SECTION OUT
      <key>Wiki</key>
      <dict>
        <key>Enabled</key>
        <true/>
        <key>Cookie</key>
        <string>sessionID</string>
        <key>URL</key>
        <string>http://127.0.0.1/RPC2</string>
        <key>UserMethod</key>
        <string>userForSession</string>
        <key>WikiMethod</key>
        <string>accessLevelForUserWikiCalendar</string>
      </dict>
      -->

    <key>LogRoot</key>
    <string>Logs</string>

    <!-- Apache-style access log -->
    <key>AccessLogFile</key>
    <string>/opt/CalendarServer/var/log/caldavd/access.log</string>
    <key>RotateAccessLog</key>
    <false/>

    <!-- Server activity log -->
    <key>ErrorLogFile</key>
    <string>/opt/CalendarServer/var/log/caldavd/error.log</string>

    <!-- Server process ID file -->
    <key>PIDFile</key>
    <string>/opt/CalendarServer/var/run/caldavd/caldavd.pid</string>

    <!--
        Process management
      -->

    <key>UserName</key>
    <string>daemon</string>

    <key>GroupName</key>
    <string>daemon</string>

      <!-- iSchedule protocol options -->
      <key>iSchedule</key>
      <dict>
        <key>Enabled</key>
        <false/>
        <key>AddressPatterns</key>
        <array>
        </array>
        <key>Servers</key>
        <string>/opt/CalendarServer/etc/caldavd/servertoserver.xml</string>
      </dict>

    <!-- For child-master IPC. [empty = use tcp] -->
    <key>ControlSocket</key>
    <string>/opt/CalendarServer/var/run/caldavd/caldavd.sock</string>

    <!--
        Twisted
      -->

    <key>Twisted</key>
    <dict>
      <key>twistd</key>
      <string>/opt/CalendarServer/usr/bin/twistd</string>
    </dict>

16 启动!

/opt/CalendarServer/usr/bin/caldavd -T /opt/CalendarServer/usr/bin/twistd -f /etc/caldavd/caldavd.plist -X

 

17 运行时

.....CalendarServer/run -n

 

可能遇到的问题是

1 python2.7.3  ImportError: No module named twisted.scripts.twistd————安装twisted,或者指定twisted路径

2 python2.7.3 找不到_sqlite3模块——重装安装sqlite-devel之后,重新编译安装python2.7.3

posted on 2014-01-16 16:31  jogger  阅读(1107)  评论(0编辑  收藏  举报

导航