plone高级安装与设置

1. ZEO Cluster

  • PIL (Python Imaging Library)
  • libjpeg (JPEG library, usually installed to target/Python2.4/lib)
  • libz (compression, usually installed to target/Python2.4/lib)
  • libxml2-python (required for Marshall support)
  • Cheetah, Paste, PasteDeploy, PasteScript, ZopeSkel
  • The buildout recipe also installs elementtree

The Python installed by the Unified Installer should not interfere with any other Python on your system. The Installer bundles Python 2.4.5, placing it at /opt/Plone-3.1/Python-2.4 or $HOME/Plone-3.1/Python-2.4 .

开发大型Plone 系统时,可以同时执行多个Zope instance 并设定成「线上系统」(production server) 与「开发环境」(development server) 两种模式,前者可以在系统线上运作,同时进行备份或小规模的测试,后者可以即时反应程式修改的结果,加速开发流程。

编译时可使用管理员权限(Root Install) 或一般使用者权限(Root-less Install),不论哪一种,都建议选择ZEO Cluster 方式,它能发挥多处理器的效益,适于开发环境或大型线上系统的场合,其执行的指令与参数如下:

./install.sh zeo

另一种standalone 方式,则适于个人桌面环境的场合,其执行的指令与参数如下:

./install.sh standalone

关于编译时的使用者权限,可考虑在开发初期(alpha development) 采用Root-less Install,在开发末期(beta development) 采用Root Install,主要差别在于Root Install 会建立plone 使用者帐号及目录,这在开发初期通常是项没必要的系统成本。

Starting ZEO server... . daemon process started, pid=32054 This is the first start of this instance. Creating Data.fs and a Plone site. We only need to do this once, but it takes some time. Creating Plone site at /Plone in ZODB... Added Plone Finished adding Plone site . daemon process started, pid=17658 Starting ZEO client2... . daemon process started, pid=17663

首次执行zopectl start 时,在启动ZEO server 后,会在zeocluster/server/var 目录建立Data.fs 档案,并在ZODB 里新增名为/Plone 的Plone site 物件,最后再启动ZEO client2。

目录架构概况

在Root-less Install 成功后,会在$HOME/Plone-3.xy 目录里建立Plone 系统,采用Root Install 则在/opt/Plone-3.xy 目录里建立系统。 以Plone 3.1.1 为例,它的第一层目录项目如下所示:

Top-level Directory Outline for Plone 3.1.4 Plone-3.1.4 |-- Python-2.4 |-- buildout-cache `-- zeocluster

作业系统里如果存在多个Python版本,复杂的相依问题可能会干扰使用者,Unified Installer为了避免这项困扰,使用独立自有的Python版本,以Plone 3.1.1为例,搭配的是Python 2.4. 4,如果想要新增模组(例如Python对MySQL函式库3rd party package)的支援,预设应安装到Python-2.4/lib/python2.4/site-packages目录里,而预设已安装的3rd party package有 PIL  setuptools  ZopeSkel 等。

Note

从Plone 3.1.1 开始,能透过buildout 机制来建置Zope 与Plone,附上的开发工具包括Paster 和ZopeSkel 等。 完整的编译参数说明,可参考README.txt 内容。

更详细的目录架构概况整理如下:

Top-level Directory Outline for Plone 3.1.1 Plone-3.1 |-- Python-2.4 | |-- bin | | |-- cheetah | | |-- easy_install | | |-- paster | | |-- python | | `-- ... | |-- include | | `-- python2.4 | | |-- Python.h | | |-- codecs.h | | |-- datetime.h | | `-- .. . | |-- lib | | `-- python2.4 | | |-- HTMLParser.py | | |-- SimpleHTTPServer.py | | |-- cgi.py | | |-- config | | | |-- Makefile | | | |-- Setup | | | `-- ... | | |-- site-packages | | |-- site.py | | |-- xml | | |-- ... | | ` -- zipfile.py | `-- man |-- buildout-cache | |-- downloads | | |-- ATContentTypes-1.2.5.tgz | | |-- Archetypes-1.5.8-2.tar.gz | | |-- CMF-2.1.1.tar.gz | | |-- PloneBase-3.1.1.tar.gz | | |-- Zope-2.10.5-final.tgz | | `-- ... | `-- eggs | |-- archetypes.kss-1.4-py2.4.egg | | |-- EGG-INFO | | | |-- PKG-INFO | | | |-- SOURCES.txt | | | |- - dependency_links.txt | | | |-- entry_points.txt | | | |-- namespace_packages.txt | | | |-- not-zip-safe | | | |-- requires.txt | | | `-- top_level. txt | | `-- archetypes | |-- borg.localrole-2.0.0-py2.4.egg | `-- ... `-- zeocluster |-- adminPassword.txt |-- bin | |-- buildout | |-- client1 | |-- client2 | |-- ... | `-- zopepy |-- buildout.cfg |-- develop-eggs |-- parts | |-- client1 | | |-- Products | | |-- bin | | | |-- runzope | | | |-- zopectl | | | `-- ... | | |-- etc | | | |-- package-includes | | | |-- site .zcml | | | `-- zope.conf | | |-- import | | |-- inituser | | |-- lib | | | `-- python | | |-- log | | `-- var | | -- client2 | | |-- Products | | |-- bin | | | |-- runzope | | | |-- zopectl | | | `-- ... | | |-- etc | | | |-- package-includes | | | |-- site.zcml | | | `-- zope.conf | | |-- import | | |-- inituser | | |-- lib | | | `-- python | | |- - log | | `-- var | |-- plone | | |-- ATContentTypes | | |-- Archetypes | | |-- CMFCore | | |-- CMFDefault | | |-- CMFPlone | | |-- PlonePAS | | |-- PloneTranslations | | |-- PluggableAuthService | | |-- ZopeVersionControl | | `-- ... | |-- productdistros | |-- zeoserver | | |-- bin | | | |-- runzeo | | | `-- zeoctl | | |-- etc | | | `-- zeo.conf | | |-- log | | `-- var | `-- zope2 | |-- Extensions | |-- configure | |- - doc | |-- inst | | |-- Makefile.in | | |-- WinBuilders | | |-- compilezpy.py | | |-- configure.py | | |-- install.py | | `-- ... | |-- lib | | |-- Components | | `-- python | | |-- AccessControl | | |-- Acquisition | | |-- App | | |-- ... | | |- - Products | | | |-- ExternalMethod | | | |-- Five | | | `-- ... | | |-- ZEO | | |-- ZODB | | |-- ZServer | | |-- Zope2 | | `-- ... | |-- log.ini | |-- setup.py | |-- skel | | |-- Extensions | | |-- Products | | |-- README.txt | | |- - bin | | |-- etc | | |-- import | | |-- lib | | |-- log | | `-- var | `-- utilities |-- products |-- src `-- var | -- README.txt |-- client1 |-- client2 |-- filestorage `-- log `-- zeoserver.log 2071 directories, 19947 files

2. 管理者帐号密码

重新设定管理员帐号密码

如果忘了管理员的帐号或密码,可利用zpasswd.py

$ cd Plone-3.0.6 $ bin/zpasswd.py -u manager -p mypasswd inituser

把inituser 移到zeocluster/client1 目录里,重新执行zeocluster/bin/startcluster.sh 后,会载入inituser 内容,最后删除inituser 档案。

启动埠号的调整

常见的系统设定值,位在下列三个档案里,须视需求加以调整,最关键者,就是执行埠号的设定值:

  1. server/etc/zeo.conf
第6 行的内容address 8100 设定zeo server 执行的埠号,如果想要调整,可以改成address 9100 之类的设定值。
  1. client1/etc/zope.conf

第969 行address 8080 设定zeo client1 的http server 执行埠号,如果想要调整,可以改成address 9080 之类的设定值。

第1038 行server localhost:8100 设定zeo server 的执行埠号,如果server/etc/zeo.conf 的第6 行有调整,此处也要跟着调整。

  1. client2/etc/zope.conf

第969 行address 8081 设定zeo client2 的http server 执行埠号,如果想要调整,可以改成address 9081 之类的设定值。

第1038 行server localhost:8100 设定zeo server 的执行埠号,如果server/etc/zeo.conf 的第6 行有调整,此处也要跟着调整。

Note

如果Linux 系统启用了firewall 设定,要把上述的执行埠号都打开,例如8080、8081、8100 等。

启动Plone 的注意事项

  • Plone 预设的执行埠号是8080,启动Plone 前,要先确认埠号未被占用,或是修改为9080 之类的埠号。
  • client1 和client2 都具备etc/zope.conf 档案,功能一样,差别只在client1 预设执行在8080,而client2 预设执行在8081。
  • Root-Install 的场合,要先确认effective-user 是否设定正确。
  • 如果发现执行bin/startcluster.sh 后,画面一直出现. . . 符号,请检查目录权限是否正常,例如/home/username 的权限为755。
  • 启动Plone 时会载入po 档,把不必要的档案删除,能够节省启动时间。 主要的po 档位于zeocluster/Products/PloneTranslations/i18n 目录里,可用find Plone-3.0.6 -name "*.po" 找到完整档案清单。
  • 采用Root Install 情况时,若遇有root restaring too frequently: quit 讯息,请检查zeocluster/server/var 目录里档案的权限,如果Data.fs 相关的档案拥有人是root,试着chown 为plone 后重新启动。
  • 若有系统错误讯息,请优先查询zeocluster/client1/log/event.log 内容,其他的讯息记录位置在zeocluster/server/log 及zeocluster/client2/log 目录。
  • inituser 内含紧急管理员的登入帐号资料,忘掉管理员帐号密码的场合,可以透过它来设定临时的帐号密码。

zeocluster/client1/etc/zope.conf 设定要点

通常要改的设定值有四项:

  • rest-input-encoding
  • rest-output-encoding
  • port-base
  • http-server address
$ diff Plone-2.5/zeocluster/server/etc/zeo.conf Plone-3.0.6/zeocluster/server/etc/zeo.conf 3c3 < %define INSTANCE /home/marr/Plone-2.5/zeocluster/server --- > %define INSTANCE /home/marr/Plone-3.0.6/zeocluster/server 6c6 < address 8100 --- > address 9100 27c27 < socket-name $INSTANCE/etc/zeo.zdsock --- > socket-name $INSTANCE /var/zeo.zdsock 34,36c34,36 < user marr < python /home/marr/Plone-2.5/Python-2.4.3/bin/python < zdrun /home/marr/Plone-2.5/lib/python/zdaemon /zdrun.py --- > # user zope > python /home/marr/Plone-3.0.6/Python-2.4.4/bin/python > zdrun /home/marr/Plone-3.0.6/lib/python/ zdaemon/zdrun.py $ diff Plone-2.5/zeocluster/client1/etc/zope.conf Plone-3.0.6/zeocluster/client1/etc/zope.conf 25,26c25,26 < %define INSTANCE /home/marr/Plone -2.5/zeocluster/client1 < %define ZOPE /home/marr/Plone-2.5 --- > %define INSTANCE /home/marr/Plone-3.0.6/zeocluster/client1 > %define ZOPE /home/marr/Plone- 3.0.6 446a447,510 > # Directive: enable-ms-author-via > # > # Description: > # Set this directive to 'true' to enable the "MS-Author-Via" header > # in response to an OPTIONS WebDAV request. Early versions of > # Microsoft Web Folders and Microsoft Office require this header to > # be present to be able to connect to Zope via WebDAV. > # > # This is disabled by default since it makes a lot of standards-compliant > # things unhappy AND it tricks Microsoft Office into trying to edit Office > # files stored in Zope via WebDAV even when the user isn't allowed to edit > # them and is only trying to download them. > # > # Check this collector entry for more information: > # http://www.zope.org/Collectors/Zope/1441 > # > # Recent versions of Microsoft Web Folders, updated after January > # 2005, do not require this header anymore, and instead require a > # "Public" header to be present in reply to the OPTIONS WebDAV > # request. > # (http://www.redmountainsw.com/wordpress/archives/webfolders-zope) > # > # To get a recent Microsoft Web Folders implementation, refer to > # Microsoft KB Article 907306. > # (Software Update for Web Folders: May 18, 2007). > # > # Default: off > # > # Example: > # > # enable-ms-author -via on > > # Directive: enable-ms-public-header > # > # Description: > # Set this directive to 'on' to enable sending the "Public" header > # in response to an WebDAV OPTIONS request. > # > # Though recent WebDAV drafts mention this header, the original > # WebDAV RFC did not mention it as part of the standard. Very few > # web servers out there include this header in their replies, most > # notably IIS and Netscape Enterprise 3.6 . > # > # Since many best practices documents out in the web mention > # turning off this header with the subject of "Mask Your Web Server > # For Enhanced Security", this setting is off by > # default. Presumably malicious people might take the presence of > # this header as indication of an IIS Web Server and try to attack > # your site, so be careful when turning it on. > # > # Recent versions of Microsoft Web Folders, updated after January > # 2005, *do* require this header to be present in reply to the > # OPTIONS WebDAV request. > # (http://www.redmountainsw.com/wordpress/archives/webfolders-zope) > # > # To get a recent Microsoft Web Folders implementation, refer to > # Microsoft KB Article 907306. > # (Software Update for Web Folders: May 18, 2007). > # > # Default: off > # > # Example: > # > # enable-ms-public- header on 886c950 < # ZServer servers. 7 different server types may be defined: --- > # ZServer servers. 8 different server types may be defined: 888,889c952,953 < # fast-cgi, monitor-server, and icp-server . If no servers are < # defined, the default servers are used. --- > # fast-cgi, monitor-server, icp-server, and clock-server. If no servers > # are defined, the default servers are used . 906c970 < address 18080 --- > address 9080 907a972,973 > # You can also use the WSGI interface between ZServer and ZPublisher: > # use-wsgi on 942a1009,1023 > # > # <clock-server> > # # starts a clock which calls /foo/bar every 30 seconds > # method /foo/bar > # period 30 > # user admin > # password 123 > # </clock-server> > # > # <server> > # # This uses Twisted as the web-server. You must install Twisted > # # separately. You can't run Twisted and ZServer at same time. > # address 8080 > # type Zope2-HTTP > # </server> 958c1039 < server localhost:18100 --- > server localhost:9100

停止Plone 的注意事项

  • 在ZMI 里的Control_Panel 执行shutdown 指令,会把ZEO client1 停掉,但ZEO server 与ZEO client2 似乎继续运行,执行bin/shutdowncluster.sh 才会依序把ZEO server client1 client2 都停掉。

移除Plone

img/uninstall-info.png

其他进阶资讯

编译环境的准备

编译时需要的基本工具包括:

  • gcc : GNU C Compiler (libbinutils2, binutils, kernel-headers, glibc-devel, manbo-mandriva-files-gcc)
  • gcc-c++ : GNU C++ Compiler (libstdc++-devel, manbo-mandriva-files-gcc-c++)
  • make : GNU make
  • tar : GNU tar
  • bash : GNU bash

Note

其他建议的函式库,及其相对应的Linux [1] 包装档案惯例名称(以Mandriva 2008.0为例),包括:

  • zlib : zlib1, zlib1-devel
  • jpeglib : libjpeg62, libjpeg62-devel
  • libxml2 : libxml2, libxml2-devel, libxml2-python, libxml2-utils, multiarch-utils
  • readline : libreadline5, libreadline5-devel, libncurses-devel [2]
  • libssl : openssl, libopenssl0.9.8, libopenssl0.9.8-devel
  • wv : wv, libwv, libwv-devel
  • xpdf : xpdf
  • odbc : libunixODBC1-devel, pyodbc, ZPyODBCDA

引入libxml2目的是让Plone结合marshall [3] 功能,借以使用XML格式来存取内容资料。 引入readline是让Python直译器提供命令列历史及指令补齐(completion)的功能,执行dir()指令后,如果有发现'readline'与'rlcompleter'两个内建模组,即表示安装成功。 引入libssl是提供SSL加密传输能力,而wv与xpdf则是提供Microsoft Word与Adobe PDF档案的索引功能。

[1]Linux rpm操作可参考 http://www.iis.sinica.edu.tw/~marr/rpm/ 文件。
[2]如果缺少ncurses 函式库,执行Python 会发现ImportError: /lib/libreadline.so.5: undefined symbol: PC 的讯息。
[3]http://plone.org/documentation/tutorial/xml-in-plone-with-marshall

编译时需要的更多资讯,可阅读README.txt 内容。

Note

如果发现Python安装资讯没有被注册到Windows registry里,想要设定registry的话,可参考 http://effbot.org/zone/python-register.htm 的说明。

Plone 3.0.6 的安装资讯

Plone-3.0.6/zeocluster/adminPassword.txt 内容范例

Use the account information below to log into the Zope Management Interface The account has full 'Manager' privileges. Username: admin Password: ooxx!123 Before you start Plone, you should review the settings in: /opt/Plone-3.0.6/ zeocluster/server/etc/zeo.conf and /opt/Plone-3.0.6/zeocluster/client1/etc/zope.conf and /opt/Plone-3.0.6/zeocluster/client2/etc/zope.conf Adjust the ports Plone uses before starting the site, if necessary To start Plone, issue the following command in a Terminal window: sudo /opt/Plone-3.0.6/zeocluster/bin/startcluster.sh To stop Plone, issue the following command in a Terminal window: sudo /opt/Plone-3.0.6/zeocluster/bin/shutdowncluster.sh Plone successfully installed at /opt/Plone-3.0.6 See /opt/Plone-3.0.6/zeocluster/adminPassword.txt for password and startup instructions
Top-level Directory Outline for Plone 3.0.6 Plone-3.0.6 |-- Python-2.4.4 |-- bin |-- doc |-- lib |-- receipts |-- skel `-- zeocluster

除了Python-2.xy 目录之外,其他目录属于Zope 系统的架构,简介如下:

  • bin : 内含Zope 的工具程式,例如遗忘管理员帐号密码时,可使用bin/zpasswd.py 来建立紧急管理员帐号密码。
  • doc : Zope 系统管理及开发的说明文件。
  • lib : Zope 的核心模组所在。
  • receipts : 记录整个Plone 系统编译成功的时间。
  • skel : skeleton 之意,内含Zope instance home 的建立样版。
  • zeocluster : Zope instance 的运作环境,包括CMF 与Plone 的模组。

Plone 3.0.6 详细的目录架构概况整理如下:

Directory Outline for Plone 3.0.6 Plone-3.0.6 |-- Python-2.4.4 | |-- bin | | |-- easy_install | | |-- ... | | |-- pydoc | | |-- python | | `-- python2.4 | |-- include | | `-- python2.4 | | |-- Python-ast.h | | |-- Python.h | | `-- ... | | -- lib | | `-- python2.4 | | |-- BaseHTTPServer.py | | |-- BaseHTTPServer.pyc | | |-- BaseHTTPServer.pyo | | |-- ... | | |-- site- packages | | | |-- PIL | | | | `-- ... | | | |-- PIL.pth | | | |-- ... | | | |-- setuptools.pth | | | `- - zope.pth | | `-- ... | `-- man |-- bin | |-- mkzeoinstance.py | |-- mkzopeinstance.py | |-- zpasswd.py | `-- ... | -- doc |-- lib | `-- python | |-- AccessControl | |-- Acquisition | |-- App | |-- Interface | |-- Persistence | |-- Products | | |-- BTreeFolder2 | | |-- ExternalMethod | | |-- Five | | |-- MailHost | | |-- PageTemplates | | |-- PythonScripts | | |-- Sessions | | |-- ZCatalog | | |-- ... | | `-- ZSQLMethods | |-- RestrictedPython | |-- TAL | |-- Testing | |-- ZEO | |-- ZODB | |-- ZPublisher | |-- ZServer | |-- ZTUtils | |-- Zope2 | |-- ZopeUndo | |-- docutils | |-- persistent | |-- reStructuredText | |-- transaction | |-- webdav | |-- zope | `-- ... |-- receipts | `-- installReceipt -3-0.txt |-- skel `-- zeocluster |-- Extensions |-- Products | |-- ATContentTypes | |-- Archetypes | |-- CMFCalendar | |-- CMFCore | |-- CMFDefault | |- - CMFPlacefulWorkflow | |-- CMFPlone | |-- CMFQuickInstallerTool | |-- CMFTestCase | |-- CMFTopic | |-- CMFUid | |-- Marshall | |-- NuPlone | |-- PlacelessTranslationService | |-- PloneLanguageTool | |- - PlonePAS | |-- PloneTranslations | `-- ... |-- adminPassword.txt |-- bin | |-- clusterstatus.sh | |-- empty.py | |-- mkPloneSite.py | |-- restartcluster .sh | |-- shutdowncluster.sh | `-- startcluster.sh |-- client1 | |-- Extensions -> /home/marr/Plone-3.0.6/zeocluster/Extensions | |-- Products -> /home /marr/Plone-3.0.6/zeocluster/Products | |-- README.txt | |-- bin | | |-- runzope | | |-- runzope.bat | | |-- zopectl | | `-- zopeservice .py | |-- etc | | |-- package-includes | | |-- site.zcml | | `-- zope.conf | |-- import | |-- inituser | |-- lib -> /home /marr/Plone-3.0.6/zeocluster/lib | |-- log | `-- var |-- client2 | |-- Extensions -> /home/marr/Plone-3.0.6/zeocluster/Extensions | |- - Products -> /home/marr/Plone-3.0.6/zeocluster/Products | |-- README.txt | |-- bin | | |-- runzope | | |-- runzope.bat | | |-- zopectl | | `-- zopeservice.py | |-- etc | | |-- package-includes | | |-- site.zcml | | `-- zope.conf | |-- import | |-- inituser | |- - lib -> /home/marr/Plone-3.0.6/zeocluster/lib | |-- log | `-- var |-- lib | `-- python | |-- archetypes | |-- five | |- - kss | |-- plone | `-- wicked `-- server |-- bin | |-- runzeo | `-- zeoctl |-- etc | `-- zeo.conf |-- log | `-- zeo .log `-- var 1578 directories, 19414 files

Plone 2.5 的安装技巧

Plone 2.5.x 版本也提供UnifiedInstaller 和install.sh 安装程式,但预设只能采用Root Install 方式,改用这个修过的plone25install.sh 程式,再比对server/etc/zeo.conf client1/etc/ zope.conf client2/etc/zope.conf 后,同样可以使用Root-less Install 了。

Five

程式员可以阅读 Five Tutorial for Plone developers 文件,了解架构全貌。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值