centos 搭建 darwin calendar 服務器

方法一(官網方法):python

useradd caluser ----爲日曆服務器創建一個新用戶,方便管理sql

passwd caluser -----新用戶更改密碼bash

su caluser服務器

mkdir ~/CalendarServer ---- 建立一個專門存放安裝包的文件夾session

cd ~/CalendarServerpython2.7

svn co http://svn.calendarserver.org/repository/calendarserver/CalendarServer/trunk/ CalendarServer-------下載源代碼tcp

./run -s # 什麼也沒發生。。。ide

./run # 什麼也沒發生svn

感受多是python版本版本不對,目前是2.4. 只是感受不對,沒有依據。放棄此方法。ui

 

 

 

方法二(自強方法):

出處: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

相關文章
相關標籤/搜索