## Please edit system and help pages ONLY in the master wiki! ## For more information, please see MoinMoin:MoinDev/Translation. ##master-page:HelpOnInstalling/ApacheOnWin32 ##master-date:2006-06-21 118:25:00 #acl -All:write Default #format wiki #language zh '''索引''' <> == 安装要求 == 安装Moin``Moin之前,需要安装一些必需的软件。这一部分内容说明安装必需软件的步骤,以及Moin``Moin的详细安装建议。 下载和安装所有必需软件需要大约100MB磁盘空间。 许多用户喜欢自定义软件安装位置。Python默认的安装目录名含有其版本号,Apache2默认的安装目录名也含有其版本号。在这里,我们不会列举出所有可能情况,整个安装过程将使用下面表格中给出的'''参考'''名表示各软件的安装位置。请用你真正的安装位置代替这个参考位置。 ||参考位置||软件||默认安装位置|| ||'''C:\Apache'''|| Apache||C:\Program Files\Apache Group\Apache2|| ||'''C:\Python'''||Python||C:\Python22|| ||'''C:\Moin'''||维基实例||C:\My Documents\Moin|| 这个安装过程已经在 Windows ME, Python 2.3, Apache 1.3.26 / 2.0.44 Windows版上测试通过。 == 准备 == === MSI Installer === Apache和一种Python发行版的安装需要微软公司的'''MSI Installer'''。最新版本是2.0,发布于2001年9月。如果双击以 ''msi'' 为后缀的文件名得到错误提示,那表明你还没有安装正确的版本。可以到 http://www.microsoft.com/, 搜索 '''msi installer''', 安装正确版本。MSI Installer有两个版本,一个用于Windows ME, 98, 95,另一个用于 Windows 2000, NT。Windows XP 自带2.0版,不需要升级。 === 安装Apache === 请到 http://www.apache.org/, 下载最新版的Apache。阅读Apache文档,确定正确安装过程。安装过程中的问题可以通过Apache组织提供的资料得到解决。继续下一步操作之前请确认网络服务器运行正常。 '''警告:''' 上述安装过程看起来很繁琐,实际上Apache的安装可以在几分钟内完成。Before you undertake the installation of any web server that can be accessed through the internet, you should exercise a controlled level of paranoia and assess the potential damage that may be caused by hackers accessing or destroying sensitive data. This should include not only the all data which resides on the PC which will host the Apache web server, but all other PCs on the local LAN which participate in any form of file sharing. Windows ME, 98SE, 98, 95, 以及NT一般不适用于作为Apache服务器。请使用Windows 2000或者XP,并且安装所有系统安全补丁。 不要让上面的警告吓倒你了。Most of the internet activity probing your system for weaknesses will be from virus infected Windows NT systems running IIS whose owners have neglected to apply available security patches. The starting Apache configuration is secure and you will not have a problem provided you: * Regularly review and apply security patches for your installed software. * Understand the ramifications of any changes you make to the Apache config files. * Regularly review the Apache logs for suspicious activity. * Regularly take backups of your data. === Installing Python === There are currently two different distributions of Python available for Windows. The normal Python distribution is available from http://www.python.org. This is distributed as a windows executable (.exe) file. An alternative distribution called '''Active``Python''' is available from http://www.activestate.com/. This distribution uses the MSI Installer and contains some tools specific to the Windows operating system and a popular Windows IDE called Pythonwin. Active``Python is available for free; an email address is requested (but not required) before downloading. Moin``Moin will work with either distribution, but requires Python release 2.3 or later. Download and install the distribution of your choice. Questions and problems dealing with the Python installation process should be resolved through the use of resources provided by Python.org or Active``State. Be sure your Python installation is correct before proceeding. == Installing MoinMoin == Download the current version of Moin``Moin from http://moinmoin.wikiwikiweb.de/ into `C:\TEMP` or an alternative location. To extract the ''.tar.gz''-format archive, you may use Win``Zip. You should then have a folder such as `C:\TEMP\moin-x.x` where "x.x" is the current release number. This folder will contain a `setup.py` file in addition to several other files and subfolders. Open an MS-DOS or console window and enter the commands: {{{ C: cd \TEMP\moin-x.x C:\Python\python setup.py install --record=install.log }}} The above commands will add Moin``Moin to your `C:\Python` installation and create an `install.log` file in {{{C:\temp\moin-x.x}}} listing all the copied files. You may use Windows Explorer to examine the newly created folders within `C:\Python`. You should find a `C:\Python\share\moin` folder. With Python 2.3 and later you will also find a `C:\Python\Lib\site-packages\MoinMoin` folder. The `MoinMoin` folder contains many Python scripts and several subfolders. You are now ready to create a wiki instance. == Creating a Wiki Instance == It is a good practice to try to keep all of your personal or site specific data under a few root folders. This way you can easily backup your important data on a regular basis without having to waste time either backing up static files or picking out dozens of important folders scattered throughout your folder structure. You should avoid placing your wiki data under the `C:\Python` folder so that you can later upgrade Python or Moin``Moin without accidentally overwriting or deleting your wiki data. For the same reason, you probably don't want to place your wiki data within the `C:\Apache` folder. The default personal folder under many Windows versions is called `C:\My Documents`. Choose a location appropriate for you; the following instructions assume you will be creating one or more wiki instances in `C:\Moin\` and the first wiki instance will be named `mywiki`. You may replace the name `mywiki` with almost any name you wish, but do not use `wiki` because that is used by Moin``Moin for loading standard images and style sheets. Although this can be changed later, the plan is that the name you choose for `mywiki` will become part of the url used to access your site, e.g. `http://myorganization.org/mywiki/FrontPage`. Start an MS-DOS or console window and enter the commands below. This will create a clone of the Moin``Moin wiki in the mywiki folder. {{{ cd C:\ md Moin md Moin\mywiki md Moin\mywiki\data md Moin\mywiki\underlay cd \Python\share\moin xcopy data C:\Moin\mywiki\data /E xcopy underlay C:\Moin\mywiki\underlay /E copy config\*.* C:\Moin\mywiki\*.* copy server\*.* C:\Moin\mywiki\*.* }}} If your server is going to run multiple wikis, you need to create additional clones. Do the same commands again, but use mywiki2 instead of mywiki. Edit `C:\Moin\mywiki\wikiconfig.py` and at least change `sitename` to the name of your wiki: {{{ sitename = 'My Wiki' }}} Additionally, set `data_dir` and `data_underlay_dir` to the absolute paths of the particular directories. Like here: {{{ data_dir = r'C:\Moin\mywiki\data' data_underlay_dir = r'C:\Moin\mywiki\underlay' }}} For a personal or intranet installation, you'll normally also add this line to `wikiconfig.py`: {{{ allowed_actions = ['DeletePage', 'AttachFile', 'RenamePage', ] }}} If you will '''''not''''' be running a Wiki farm (if you're not sure what this means, then you probably won't be), make sure to delete the `farmconfig.py` file from the `C:\Moin\mywiki` directory, or else `moin.cgi` will most likely give off various errors (including one about not being able to find a configuration file) and will ultimately fail to start up properly. Additional configuration details can be found in HelpOnConfiguration. == Integrating MoinMoin into Apache == Use your editor to edit the file `C:\Moin\mywiki\moin.cgi`. Change the first line (the shebang statement) to point to your local Python executable program. Note the forward slashes -- Apache uses the Unix convention for folder separators. This tells Apache the `moin.cgi` file is an executable script that will be interpreted by a program to be loaded from `C:/Python/python`. {{{#! #! C:/Python/python }}} After that, you may need to activate the lines which add a folder to the sys.path and enter your path to MoinMoin there if you have '''not''' installed MoinMoin to the site-packages dir: {{{#! python import sys sys.path.insert(0, r'C:\Moin\...') }}} The next step is to tell Apache that is has more work to do. Use your editor to append the following lines to `C:\Apache\conf\httpd.conf`. Note the presence and absence of trailing slashes, it is important to enter the lines exactly as shown below. {{{ Alias /wiki/ "C:/Python/share/moin/htdocs/" ScriptAlias /mywiki "C:/Moin/mywiki/moin.cgi" }}} The '''Alias''' lines for `wiki` above instructs Apache to serve images, style sheets, etc. from the specified folders and subfolders. The '''Script``Alias''' line is needed once for each wiki instance, so if you have multiple wikis, repeat the statement using mywiki2, mywiki3, etc. The Script``Alias statement instructs Apache to execute scripts from the specified folder. See the Apache docs for a complete explanation. Test your changes by restarting your Apache server and try to access your newborn wiki with the URL `http://127.0.0.1/mywiki`. You should see the Front``Page, try to edit and save it, and if that works, verify your edit is reflected on the Recent``Changes page. And now, it is up to you and your user community to transform your wiki into an informative and useful tool. You will probably want to retain most of the Help``On~ pages dealing with editing, delete those pages with irrelevant information (like this page, don't let your users or boss know how easy it was to install Moin``Moin ;) ), and rewrite the Front``Page to introduce your wiki topic. == Troubleshooting == The first place to look for clues when the unexpected happens is to try changing your url to: `http://127.0.0.1/mywiki?action=test`. If Apache can find and execute the module `C:/Moin/mywiki/moin.cgi`, a page of diagnostics titled '''Moin``Moin CGI Diagnosis''' will be displayed. Check the output for error messages. The second place to look for is `C:\Apache\logs\error.log`. The following are common errors grouped by the message displayed by your browser. === Internal Server Error === If the Apache log shows a message "The system cannot find the file specified." then a possibility is the shebang statement in `moin.cgi` is incorrect. If the Apache log shows a different error message, then the Moin``Moin Python scripts may be abending. To determine the cause, you could try temporarily renaming `moin.cgi` to `moin.py`, loading `moin.py` with the Python '''idle''' IDE and executing it to determine if there are any error messages. === Not Found === If the Apache error log shows the message "File does not exist: C:/Apache/htdocs/mywiki", the '''Script``Alias''' statement in `httpd.conf` may be incorrect. === The Page Cannot be found === If the Apache error log shows the message "File does not exist: C:/Apache/htdocs/????", you may have mistyped the url "http://127.0.0.1/mywiki" into your browser. === FrontPage Loads Without Icons === If the Apache Error log shows many error messages "File does not exist: C:/Apache/htdocs/wiki", then the '''Alias''' statement in `httpd.conf` may be incorrect.