Gallery: 如何安装Gallery2:修订间差异

来自站长百科
跳转至: 导航、​ 搜索
无编辑摘要
 
(未显示同一用户的20个中间版本)
第3行: 第3行:
* [http://www.softwarelibre.net/instalacion_de_gallery_2_2_1_paso_a_paso 手把手教你安装Gallery 2.2.1] (西班牙语)
* [http://www.softwarelibre.net/instalacion_de_gallery_2_2_1_paso_a_paso 手把手教你安装Gallery 2.2.1] (西班牙语)
有关特定安装或平台的指南:
有关特定安装或平台的指南:
* [[Gallery2:Installation_on_MacOSX|Mac OS X操作系统下的安装指导]]
* [[Gallery:Installation_on_MacOSX|Mac OS X操作系统下的安装指导]]
* [http://www.iis.net/articles/view.aspx/IIS7/Hosting-Web-Applications/PHP/PHP-Applications-on-IIS--- IIS和FastCGI下Gallery2的安装]
* [http://www.iis.net/articles/view.aspx/IIS7/Hosting-Web-Applications/PHP/PHP-Applications-on-IIS--- IIS和FastCGI下Gallery2的安装]
* [[Gallery2:Installation on Debian|Installation on Debian]]
* [[Gallery:Installation on Debian|Debian上的安装]]


== 先决条件 ==
== 先决条件 ==
第12行: 第12行:


=== 虚拟主机用户 ===
=== 虚拟主机用户 ===
如果你像大多数用户一样是在托管的WEB服务器上安装Gallery2的话,就没必要操心建立一个WEB服务器了,因为这些都是现成的。你应当有一个控制面板或其他的管理工具进行空数据库的创建。那么就可以跳过这一步直接[[Gallery:How_do_I_Install_Gallery2#Preparing to install|准备安装]]吧。
如果你像大多数用户一样是在托管的WEB服务器上安装Gallery2的话,就没必要操心建立一个WEB服务器了,因为这些都是现成的。你应当有一个控制面板或其他的管理工具进行空数据库的创建。那么就可以跳过这一步直接[[Gallery:How_do_I_Install_Gallery2#准备安装|准备安装]]吧。


'''注意:''' 有些虚拟主机供应商提供Gallery2的一键安装。直接通过网站里的管理面板进行一键安装,将省去你不少的麻烦。目前已知以下的自动安装程序:
'''注意:''' 有些虚拟主机供应商提供Gallery2的一键安装。直接通过网站里的管理面板进行一键安装,将省去你不少的麻烦。目前已知以下的自动安装程序:
* [http://www.swsoft.com/plesk Plesk] Application Vault / Application Pack
* [http://www.swsoft.com/plesk Plesk] Application Vault / Application Pack
* [http://netenberg.com/fantastico.php Fantastico Deluxe] ([[Gallery2:Fantastico|Fantastico Gallery 2 Installation Explained]])
* [http://netenberg.com/fantastico.php Fantastico Deluxe] ([[Gallery:Fantastico|Fantastico的Gallery2安装详解]])
* [http://www.installatron.com Installatron]
* [http://www.installatron.com Installatron]
* [http://www.4psa.com/products/4psaintegrator.php 4PSA-Integrator]
* [http://www.4psa.com/products/4psaintegrator.php 4PSA-Integrator]
第29行: 第29行:
自己建立WEB服务器并非易事。但有一些可供免费下载的带有PHP和MySQL服务器的WEB服务器安装包。尽管点几下鼠标就能完成安装,但一旦出了问题而且不具备相关经验的话,事情就会很难办了。
自己建立WEB服务器并非易事。但有一些可供免费下载的带有PHP和MySQL服务器的WEB服务器安装包。尽管点几下鼠标就能完成安装,但一旦出了问题而且不具备相关经验的话,事情就会很难办了。


你可以参考这个手把手[[Gallery:Setting_Up_A_Mac_as_Webserver|安装向导]]来看看如何将Apple Mac建成一个WEB服务器。
你可以参考这个手把手[[Gallery:将Mac建立为WEB服务器|安装向导]]来看看如何将Apple Mac建成一个WEB服务器。


==== 网络连接 ====
==== 网络连接 ====
第54行: 第54行:




== Preparing to install ==
== 准备安装==


1. Latest Version - There are four ways to get the code.
1. 最新版本 – 有四种获取代码的方法。
:* Tarball - You can download a prepackaged file as a tarball or a zip file from [http://sourceforge.net/projects/gallery/ SourceForge].
:* Tarball – 你可以从[http://sourceforge.net/projects/gallery/ SourceForge]下载tarball或zip格式的文件包。
:* Pre-Installer - If you only have FTP access to your webserver and don't have the option to extract zip or tar files directly on the server, you should give the [[Gallery2:Preinstaller|Gallery 2 Pre-Installer]] a try. It transfers the archive directly to your webserver and extracts it for you.
:* Pre-Installer(预安装程序) - 如果你只能通过FTP访问WEB服务器而且没有办法直接在服务器上解压zip或tar文件的话,你就需要试试[[Gallery:Preinstaller|Gallery 2 预安装
:* Nightly Snapshot - You can download a tarball or zip file with a snapshot of the most recent code. Find links to these on the [http://gallery.menalto.com/wiki/Download Gallery Download Page].
程序]]。它会直接将归档传输到WEB服务器上并为你解压。
:* Subversion - This is a better way to get the latest code, but it’s for advanced users. Follow the [http://codex.gallery2.org/index.php/Gallery:Using_Subversion Subversion instructions] to obtain the latest Gallery 2 code. It’s easier to stay up to date with this method since you can run one command and get the latest code at any time.
:* Nightly Snapshot – 你可以下载最新的tarball或zip文件格式的快照版(snapshot)代码。可以参见[http://gallery.menalto.com/wiki/Download Gallery下载页面]查找这些代码。
2. Storage - Create a directory for gallery to store photos. This must be writeable by the web server, but for security reasons we suggest that you do not put it in the web root. If you put it in the web root, then anybody can get directly to your images with their web browser which circumvents Gallery 2’s security.
:* Subversion – 获取最新代码的更好的办法,但仅限于高级用户。请遵照[http://codex.gallery2.org/index.php/Gallery:Using_Subversion Subversion指导]来获得最新的Gallery2代码。你可以随时获取最新的代码,因此这无疑是保证代码“入时”的好办法。
2. 存储 – 为Gallery创建一个目录用以相片的存储。WEB服务器必须享有写入的权限,但为了安全起见,我们建议不要将其置入web根目录下。如果你将其置入web根目录中,任何人都可以通过WEB浏览器绕过Gallery2的安全防线直接访问你的图片。


'''Unix Example'''
 
'''Unix的例子'''
<pre>
<pre>
$ cd $HOME
$ cd $HOME
第69行: 第71行:
$ chmod 777 g2data
$ chmod 777 g2data
</pre>
</pre>
'''Windows Example'''
'''Windows 的例子'''
<pre>
<pre>
C:\> mkdir g2data
C:\> mkdir g2data
</pre>
</pre>


In the Unix example, you may note that modes of 777 on your g2data directory are not all that secure. However, making it more secure depends on how your system is configured. Talk with your system administrator about ways to change the permissions on that directory to make it so that Gallery can still write to the files but that others can’t.
在Unix的例子中,你可能注意到了777模式在g2data目录中并非那么安全。然而,提升安全性取决于你的系统配置方式。你可以与系统管理者讨论一下如何修改权限以使得Gallery仍可写入文件而其他人则不可以。


3. Database - Right now we support [http://dev.mysql.com/downloads/ MySQL], [http://www.postgresql.org/mirrors-ftp.html PostgreSQL],
3. 数据库- 目前我们支持[http://dev.mysql.com/downloads/ MySQL],[http://www.postgresql.org/mirrors-ftp.html PostgreSQL]
[http://www.ibm.com/software/data/db2/ DB2], [http://www.oracle.com/technology/software/index.html Oracle] and [http://www.microsoft.com/sql/ MS SQL Server]. MySQL is generally faster than PostgreSQL. We require you to create the database yourself. In our examples below, we’ll be creating a database called gallery2. You can use any database name that you choose.
[http://www.ibm.com/software/data/db2/ DB2][http://www.oracle.com/technology/software/index.html Oracle][http://www.microsoft.com/sql/ MS SQL Server]。 MySQL的速度一般来讲比PostgreSQL要快。我们要求你自己创建数据库。在下面的例子中,我们会创建一个名为gallery2的数据库。你则可以选择其他任何名称来命名你的数据库。


Grant all required privileges to your database user. This includes but is not confined to: '''CREATE TABLE, ALTER TABLE, DROP TABLE''' in the gallery2 database; '''SELECT, INSERT, UPDATE, DELETE''' on all (gallery2) tables in the gallery2 database; '''CREATE INDEX''' and some other privileges that are specific to the different database management systems. '''CREATE/DROP DATABASE''' and the ability to '''GRANT''' privileges to other database users are not required.
为你的数据库用户开启所有必须的权限。在Gallery2数据库中,这包括但不局限于:'''创建表格,修改表格,放下表格''';以及所有的(gallery2)表格的'''选择,插入,更新,删除''''''创建索引'''和其他的一些权限则取决于所使用的数据库管理系统。'''创建/放下数据库'''以及'''给予'''其他数据库用户权限则并非必须的。


'''MySQL Instructions'''
'''MySQL指导'''
<pre>
<pre>
$ mysqladmin -uroot create gallery2
$ mysqladmin -uroot create gallery2
$ mysql gallery2 -uroot -e"GRANT ALL ON gallery2.* TO username@localhost IDENTIFIED BY 'password'"
$ mysql gallery2 -uroot -e"GRANT ALL ON gallery2.* TO username@localhost IDENTIFIED BY 'password'"
</pre>
</pre>
* Choose your own username and password
* 设置用户名和密码
* If MySQL denies you access, try adding "-p" right after "-uroot" in each command
* 如果MySQL拒绝访问,请尝试在每个命令行中的"-uroot"之后添加"-p"
   
   
'''PostgreSQL Instructions'''
'''PostgreSQL 指导'''
<pre>
<pre>
$ createdb gallery2 -E UNICODE
$ createdb gallery2 -E UNICODE
</pre>
</pre>


If it complains that UNICODE is not a valid encoding name, then try:
如果它陈述UNICODE不是有效的编码名称,请尝试:
<pre>
<pre>
$ createdb gallery2 -E SQL_ASCII
$ createdb gallery2 -E SQL_ASCII
</pre>
</pre>
If it complains about that, too then try:
如果仍然无效的话,请尝试:
<pre>
<pre>
$ createdb gallery2
$ createdb gallery2
</pre>
</pre>
On Windows 2003 Server (and maybe on other versions too) you have to write the database name at the end of the command:
Windows 2003 Server(或者是其他的版本)中你必须在命令结尾写进数据库的名称:
<pre>
<pre>
C:\> createdb -E UNICODE gallery2
C:\> createdb -E UNICODE gallery2
</pre>
</pre>
'''Oracle Instructions'''
'''Oracle 指导'''
<pre>
<pre>
$ create database gallery2 {additional parameters};
$ create database gallery2 {additional parameters};
</pre>
</pre>


'''DB2 Instructions'''
'''DB2 指导'''


See http://codex.gallery2.org/index.php/Gallery2:DB2
参见 [http://codex.gallery2.org/index.php/Gallery2 DB2]


4. Graphics Toolkits - Gallery 2 works with [http://netpbm.sourceforge.net/ NetPBM], [http://www.imagemagick.org/ ImageMagick], [http://php.net/gd GD] or [http://www.graphicsmagick.org/ GraphicsMagick]. They’re all almost equally good, though some say that NetPBM has slightly better quality and that ImageMagick is slightly faster than NetPBM. GD cannot do image rotation. GraphicsMagick and ImageMagick are very similar. GD can be very fast, but it will also use a lot of memory so it may cause you to run into predefined server limits. It is also compiled into PHP by default if your PHP is 4.3.0 or more recent, however it may not have support for all image types (e.g. it might not have JPEG support). If the binaries for NetPBM and ImageMagick are installed in default, or standard, locations then Gallery 2 will auto-detect them during installation. It won’t cause any harm to enable all of these toolkits—in fact you’ll get the widest file type support if you do so.
4. 图像工具包 - Gallery2可以兼容[http://netpbm.sourceforge.net/ NetPBM][http://www.imagemagick.org/ ImageMagick][http://php.net/gd GD][http://www.graphicsmagick.org/ GraphicsMagick]。它们的性能都很不错。但有人说NetPBM效能上略胜一筹。而ImageMagick较之NetPBM则更为快速。GD无法完成图片旋转操作。GraphicsMagick与ImageMagick则非常相似。GD可以达到很快的速度,与此同时就要消耗更多的内存。因此可能会招致预定义服务器局限。默认情况下,它也被编译进了PHP4.3.0或更新的版本中,但它不见得支持所有的图片格式(比如它可能不支持JPEG格式)。如果NetPBM和ImageMagick的二进制安装到默认的或标准的位置的话,那么在安装过程中Gallery2会自动检测到。启用所有的这些工具没有什么害处—但是你可能需要更为广泛的文件格式支持机制。


== Installing Gallery 2 ==
== 安装Gallery 2 ==


Gallery 2 is a web application and must be installed on your web server in order for you to use it. If you've unpacked it on your desktop, you will have to upload it to your server as part of the install process. Then you can configure it using your web browser.
作为一个WEB应用程序,Gallery2必须安装在WEB服务器中才能使用。如果你是解压到桌面上了,你就必须在安装过程中将其上传到服务器中。然后你才能使用WEB浏览器对其进行配置。


1. Upload - Copy the Gallery 2 files to a directory on your webserver. There are several alternatives for this step:
1. 上传 – 将Gallery2的文件复制到WEB服务器上的目录中。有若干种办法进行此步骤:
* Fastest way: Upload the gallery package to your web server archive via FTP or another method, then unpack it using an interactive shell session (eg. ssh or telnet). Example unpacking commands (choose the appropriate one):
* 最快的办法:使用FTP或其它方法将Gallery整合包上传到WEB服务器的归档中,接着使用交互式会话外壳将其解压(SSH或telnet)。解压命令例举(请选择合适的一个):


'''For .tar.gz archives'''
'''.tar.gz归档文件'''
<pre>
<pre>
$ tar xzf gallery2.tar.gz
$ tar xzf gallery2.tar.gz
</pre>
</pre>


'''For zip archives'''
'''对zip归档文件'''
<pre>
<pre>
$ unzip gallery2.zip
$ unzip gallery2.zip
</pre>
</pre>


If you do not have shell access, you can ask your provider to do it for you, or you can make a miniature PHP script containing one of the above commands like this:
如果没有Shell权限,你可以要求供应商为你解决;或者你可以建立一个含有如下命令的PHP脚本:


'''PHP code for opening .tar.gz archive'''
'''打开.tar.gz归档文件的PHP代码'''
<pre>
<pre>
<?
<?
第143行: 第145行:
</pre>
</pre>


Some webhosting companies offer a control panel with a web file-browser which is capable of extracting / unarchiving archive files. It’s worth a try to check if this option is available.
有些网站托管公司提供的控制面板包含有WEB文件浏览器,可以用于归档文件的解压。值得尝试一下此方式。
* Easiest (but slowest) way: If you don't have shell access, you can upload the complete contents of the Gallery 2 archive to the webserver with an FTP program. This may take a lot of time and be error-prone. In this case, pay special attention to the ’System Checks’ step of the installer and make sure that there are no missing or modified files. Consider using a smart FTP program like FileZilla to make sure that your transfer goes smoothly.
* 最简单但也是最慢的办法:如果你不具有Shell权限,你可以使用FTP软件将整个Gallery2的内容归档文件上传到WEB服务器上。这是很花时间的而且有错误倾向。这就需要对安装程序中的“系统检查”步骤尤其关注了,而且要确保没有任何丢失的或被篡改的文件。可以考虑使用类似FileZilla的FTP程序以确保传送过程一切顺利。
* Advanced way: [[Gallery:Using Subversion|Subversion]]
* 高级方式: [[Gallery:Using Subversion|Subversion]]
    
    
Note: After uploading, you should close this version of the README and browse to the version that you just uploaded.  
注:上传之后,你应当关闭该版本的README并浏览刚刚上传的版本。
这样该文檔中的所有链接都将正确定位到Gallery2安装中。
 
2. 开始安装 – 打开WEB浏览器并浏览安装目录。Gallery2将引导你进行系统配置安装并为你打理好一切。
 
[[{{ns:image}}:12903.jpg]]
 
3. 验证 – 你会被要求创建并保存一小段文本来进行验证,否则无法继续。Gallery2以此种方式来确认你可以使用安装程序。
 
[[{{ns:image}}:12908.jpg]]
 
4. 系统检查 – 安装程序对你的系统进行检查以确保能够支持Gallery2。请保证所有的检查都被成功执行!
 
[[{{ns:image}}:12914.jpg]]
 
5. 安装方式 – Gallery可以通过单个的代码安装来支持多个独立站点。在此你可以选择一个标准的单个安装或一个新的多站点安装。在Gallery Codex中有更详细有关多站点(multisite)的信息。
 
[[{{ns:image}}:12917.jpg]]
 
6. 建立存储位置 – 参读安装程序的指导来为Gallery2建立一个存储位置。这样Gallery2就可以有地方存储你的图片了,当然还包括其它缓存信息。
 
[[{{ns:image}}:12920.jpg]]
 
7. 数据库安装 – 选择数据库类型并输入数据库验证信息。如果你不是第一次安装Gallery2的话,就意味着有旧的安装残留,那么它就会检查安装过的版本并提供一个简洁的安装方式。它会清楚存储目录和数据库中所有的数据。如果安装过的版本没有问题的话,它还会重新使用已有的数据库表格。如果你没有从暂存中启动安装程序的意思,就选择此项。


That way all the links in this document will point to the right places in your Gallery 2 install.
[[{{ns:image}}:12926.jpg]]


2. Begin Installing - Open up your web browser and browse to the install directory. Gallery 2 will walk you through the process of validating that your system is properly configured and will set everything up for you.
8. 建立管理员账户 – 你会被提示输入一个管理员用户名和密码。输入密码后需要再输入相同的密码以进行确认。姓名和Email地址是可选的。但强烈建议输入Email地址。一旦完成了此步骤,点击“创建”来为此次Gallery2安装创建管理员账户。
[[img:12903]]


3. Authenticate - You will be asked to create and save a small text file in order to authenticate. You may not proceed until you do this. That’s how Gallery 2 knows that you’re authorized to use the installer.
[[{{ns:image}}:12932.jpg]]
[[img:12908]]


4. System Checks - The installer checks your system to make sure that it will support Gallery 2. Make sure that all checks are successful!
9. 创建配置文件 - Gallery2会在Gallery2目录下创建config.php文件。它包括安装程序中你所提供的所有应答并且这是Gallery2正常运行所必须的。现在还会有一个完整性测试以防止因启动升级向导而破坏Gallery安装。
[[img:12914]]


5. Installation Type - Gallery can support multiple independent sites with a single installation of the code. Here you will select a standard single install or the location of a new multisite install. There is more information about multisite in the Gallery Codex.
[[{{ns:image}}:12938.jpg]]
[[img:12917]]


6. Storage Setup - Read the instructions on the installer to set up a storage location for Gallery 2. This is where Gallery 2 will store all of your images, as well as other cache information.
10. 安装核心模块 – 在此我们创建所有的数据库表格,初始化用户和相册作为开始。除非发生了错误,不然你真的可以“袖手旁观”了。
[[img:12920]]


7. Database Setup - Select your database type and enter your database authentication information. If this is not your first Gallery 2 installation and there are still some remains of the old installation, it will check the state of the installed version and offer a clean install option which will delete all your data in the storage directory and in the database. If the installed version seems to be fine, it will also offer to reuse the existing database tables. Select this option if you did not start the installer with the intent to start from scratch.
[[{{ns:image}}:12944.jpg]]
[[img:12926]]


8. Admin User Setup - You are prompted for an administrator username and password. Type in a password and type it again to validate it. The full name and the email address are optional. But entering an email address is highly recommended. Once you’re finished, click ’Create’ to create the admin user for this installation of Gallery 2.
11. 安装其它模块 - Gallery2有各种各样的模块能够提供各种有用的功能。因此选择你所需要的来使用。你可以稍后访问网站管理页面来安装,激活,禁用或卸载模块。因此在此做些试验无妨。
[[img:12932]]


9. Create Config File - Gallery 2 will create the config.php file in your Gallery 2 directory. This contains all the answers you’ve provided in the installer and is necessary for Gallery 2 to function properly. At this point, there’s also a sanity check to prevent you from damaging your Gallery install by running the installer when you should rather have started the upgrader.
[[{{ns:image}}:12947.jpg]]
[[img:12938]]


10. Install the Core module - Here’s where we create all the database tables and initial users and albums to get you started. Unless something goes wrong, there’s nothing for you to do here.
12. 检查安全性 - Gallery2将会引导你对新的config.php进行监视。
[[img:12944]]


11. Install other modules - Gallery 2 has lots of different modules that provide useful functionality. Choose which ones you want to use. You can always go to the Site Admin page later on to install, activate, deactivate or uninstall modules, so it’s ok to experiment here.
[[{{ns:image}}:12959.jpg]]
[[img:12947]]


12. Check Security - Gallery 2 walks you through the process of locking down your new config.php.
13. 完成! - 祝贺你!现在已经成功安装了Gallery 2!
[[img:12959]]


13. Finished! - Congratulations! You have successfully installed Gallery 2!
[[{{ns:image}}:12965.jpg]]
[[img:12965]]


== Get Notified About Updates ==
== 关注版本更新动向 ==
It is highly recommended to subscribe to the '''[[Mailing Lists|announcements mailing list]]''' to get notified about Gallery updates. We keep this mailing list very low volume to ensure that you only get notified about important announcements like security patch releases.
推荐你订阅'''[[Gallery:邮件联系表|邮件联系表]]'''以获悉Gallery更新的动向。我们保证此联系表的内容保持一个较低的量,以保证你只获得重要的告知信息,比如安全性补丁。


== Installing Modules with External Dependencies ==
== 使用外部依赖安装模块 ==
Gallery 2 has also modules that depend on external binaries. These modules won't work if the binaries they depend upon are not installed on the webserver. Under this category of modules fall the ''imagemagick'' and the ''netpbm'' module which are responsible for generating small preview images (so called ''thumbnails'') and resized versions of your images.
Gallery2中有的模块依赖于外部二进制。如果所依赖的二进制没有在WEB服务器中安装,这些模块就不会运作。此分类下的模块有''imagemagick''''netpbm''模块,它们负责生成较小的预览图片(也称为“缩略图”)并重设图片的尺寸。


If Gallery 2 failed to install and activate modules like ''imagemagick'', ''netpbm'', or ''zipcart'', then it failed to automatically detect the presence and location of the required external binaries. Most probably, this means that your server doesn't provide the necessary binaries to use these Gallery 2 modules.
如果Gallery2安装激活类似''imagemagick''''netpbm''''zipcart''的模块失败了,那它对外部二进制的自动检测和定位也会失败。绝大多数情况下,这意味着你的服务器不支持这些所需的二进制,从而无使用这些Gallery2的模块。


See [[Gallery2:Installing_Modules_With_External_Dependencies|Installing Modules With External Dependencies]] for further information.
参见[[Gallery:Installing_Modules_With_External_Dependencies|使用外部依赖安装模块]]获取更多相关信息。


[[Category:Gallery 2:Installation|How do I Install Gallery2]]
[[Category:Gallery 2:Installation|How do I Install Gallery2]]

2008年10月21日 (二) 15:31的最新版本

安装Gallery2[ ]

其他语言的安装指南:

有关特定安装或平台的指南:

先决条件[ ]

安装Gallery2之前,你需要一个具有PHP支持的web服务器以及一个数据库服务器。可以参看安装配置要求来获取完整的配置要求清单。

虚拟主机用户[ ]

如果你像大多数用户一样是在托管的WEB服务器上安装Gallery2的话,就没必要操心建立一个WEB服务器了,因为这些都是现成的。你应当有一个控制面板或其他的管理工具进行空数据库的创建。那么就可以跳过这一步直接准备安装吧。

注意: 有些虚拟主机供应商提供Gallery2的一键安装。直接通过网站里的管理面板进行一键安装,将省去你不少的麻烦。目前已知以下的自动安装程序:

以下的BLOG和网站链接含有网站空间中Gallery的安装指导:

建立你自己的WEB服务器[ ]

自己建立WEB服务器并非易事。但有一些可供免费下载的带有PHP和MySQL服务器的WEB服务器安装包。尽管点几下鼠标就能完成安装,但一旦出了问题而且不具备相关经验的话,事情就会很难办了。

你可以参考这个手把手安装向导来看看如何将Apple Mac建成一个WEB服务器。

网络连接[ ]

如果你没有一个固定的IP地址或是动态DNS (dnydns)账户的话,那么只有你自己和你所在局域网内的计算机用户可以访问你的Gallery,而任何使用Internet的计算机用户则无法访问你的Gallery。我们假设你具有一个固定的IP地址/dyndns账户或者你只希望通过局域网访问Gallery2。

安装简便的整合包[ ]

如果你没有安装任何配置要求中的组件而且你不想过问技术细节的话,可以选择这些安装简便的整合包。只需点几下鼠标就能安装apache,MySQL和PHP。

操作系统[ ]

如果你希望在你的电脑或服务器中安装Gallery2的话,我们推荐linux / *BSD作为操作系统。因为这些就是我们所使用的开发平台,而大多数的专业虚拟主机供应商都使用它们作为平台。其他的操作系统当然也是支持的。Linux则有很多发布版本。极度推荐DebianGentoo,因为这二者很完善并且稳定,很适合服务器应用程序;不止如此,它们还包括有不俗的整合包管理器,可以帮助你解决依赖性方面的问题。在这样的linux发布版本中安装一个WEB服务器不会难过于输入"emerge apache2"或"apt-get install apache"这样的命令。

Web服务器[ ]

Apache2是我们选择的WEB服务器。某些Gallery2的特点,如短URL,仅仅适用于apache(短URLs自Gallery2.1以后也适用于其他WEB服务器)。


数据库[ ]

Gallery 2主要是由MySQL发展而来的,但在PostgreSQLDB2中也能很好地运行。Gallery2没有在Oracle下经过很好的测试。你可以在MySQL中看到很好的性能表现,这也是因为我们使用MySQL的内置函数,从而我们可以在其它的数据库中使用用户定义的函数进行模仿。

PHP[ ]

可从php.net获取预编译的PHP二进制代码或完整的源代码。如果你自己进行编译,记得将数据库支持编译到PHP中(比如如果你使用MySQL就是--with-mysql= ... and --with-mysql-sock=... )。 如果需要翻译/多语言支持的话,你就需要gettext。还有更多的PHP编译选项/扩展(如PCRE)为Gallery2所必须的,或者在其它方面也有用处。如果你依赖于GD(一个内置于PHP的图像工具包)而非外部工具的话(imagemagick,netpbm和graphicsmagick),那么请记住在PHP编译选项中添加所有的图片格式(--with-jpeg=... , --with-png=...等)。编译PHP是其自身的话题。Gentoo,Debian...将会使用单个命令来为你进行配置和编译。你能找到有关此话题的很多教程和指导,以及有关webserver,mysql和PHP的话题。


准备安装[ ]

1. 最新版本 – 有四种获取代码的方法。

  • Tarball – 你可以从SourceForge下载tarball或zip格式的文件包。
  • Pre-Installer(预安装程序) - 如果你只能通过FTP访问WEB服务器而且没有办法直接在服务器上解压zip或tar文件的话,你就需要试试Gallery 2 预安装 程序。它会直接将归档传输到WEB服务器上并为你解压。
  • Nightly Snapshot – 你可以下载最新的tarball或zip文件格式的快照版(snapshot)代码。可以参见Gallery下载页面查找这些代码。
  • Subversion – 获取最新代码的更好的办法,但仅限于高级用户。请遵照Subversion指导来获得最新的Gallery2代码。你可以随时获取最新的代码,因此这无疑是保证代码“入时”的好办法。

2. 存储 – 为Gallery创建一个目录用以相片的存储。WEB服务器必须享有写入的权限,但为了安全起见,我们建议不要将其置入web根目录下。如果你将其置入web根目录中,任何人都可以通过WEB浏览器绕过Gallery2的安全防线直接访问你的图片。


Unix的例子

$ cd $HOME
$ mkdir g2data
$ chmod 777 g2data

Windows 的例子

C:\> mkdir g2data

在Unix的例子中,你可能注意到了777模式在g2data目录中并非那么安全。然而,提升安全性取决于你的系统配置方式。你可以与系统管理者讨论一下如何修改权限以使得Gallery仍可写入文件而其他人则不可以。

3. 数据库- 目前我们支持MySQL,,PostgreSQLDB2OracleMS SQL Server。 MySQL的速度一般来讲比PostgreSQL要快。我们要求你自己创建数据库。在下面的例子中,我们会创建一个名为gallery2的数据库。你则可以选择其他任何名称来命名你的数据库。

为你的数据库用户开启所有必须的权限。在Gallery2数据库中,这包括但不局限于:创建表格,修改表格,放下表格;以及所有的(gallery2)表格的选择,插入,更新,删除创建索引和其他的一些权限则取决于所使用的数据库管理系统。创建/放下数据库以及给予其他数据库用户权限则并非必须的。

MySQL指导

$ mysqladmin -uroot create gallery2
$ mysql gallery2 -uroot -e"GRANT ALL ON gallery2.* TO username@localhost IDENTIFIED BY 'password'"
  • 设置用户名和密码
  • 如果MySQL拒绝访问,请尝试在每个命令行中的"-uroot"之后添加"-p"

PostgreSQL 指导

$ createdb gallery2 -E UNICODE

如果它陈述UNICODE不是有效的编码名称,请尝试:

$ createdb gallery2 -E SQL_ASCII

如果仍然无效的话,请尝试:

$ createdb gallery2

Windows 2003 Server(或者是其他的版本)中你必须在命令结尾写进数据库的名称:

C:\> createdb -E UNICODE gallery2

Oracle 指导

$ create database gallery2 {additional parameters};

DB2 指导

参见 DB2

4. 图像工具包 - Gallery2可以兼容NetPBMImageMagickGDGraphicsMagick。它们的性能都很不错。但有人说NetPBM效能上略胜一筹。而ImageMagick较之NetPBM则更为快速。GD无法完成图片旋转操作。GraphicsMagick与ImageMagick则非常相似。GD可以达到很快的速度,与此同时就要消耗更多的内存。因此可能会招致预定义服务器局限。默认情况下,它也被编译进了PHP4.3.0或更新的版本中,但它不见得支持所有的图片格式(比如它可能不支持JPEG格式)。如果NetPBM和ImageMagick的二进制安装到默认的或标准的位置的话,那么在安装过程中Gallery2会自动检测到。启用所有的这些工具没有什么害处—但是你可能需要更为广泛的文件格式支持机制。

安装Gallery 2[ ]

作为一个WEB应用程序,Gallery2必须安装在WEB服务器中才能使用。如果你是解压到桌面上了,你就必须在安装过程中将其上传到服务器中。然后你才能使用WEB浏览器对其进行配置。

1. 上传 – 将Gallery2的文件复制到WEB服务器上的目录中。有若干种办法进行此步骤:

  • 最快的办法:使用FTP或其它方法将Gallery整合包上传到WEB服务器的归档中,接着使用交互式会话外壳将其解压(SSH或telnet)。解压命令例举(请选择合适的一个):

对.tar.gz归档文件

$ tar xzf gallery2.tar.gz

对zip归档文件

$ unzip gallery2.zip

如果没有Shell权限,你可以要求供应商为你解决;或者你可以建立一个含有如下命令的PHP脚本:

打开.tar.gz归档文件的PHP代码

<?
$output = shell_exec('tar xzf gallery-2.0.2-full.tar.gz');
?>

有些网站托管公司提供的控制面板包含有WEB文件浏览器,可以用于归档文件的解压。值得尝试一下此方式。

  • 最简单但也是最慢的办法:如果你不具有Shell权限,你可以使用FTP软件将整个Gallery2的内容归档文件上传到WEB服务器上。这是很花时间的而且有错误倾向。这就需要对安装程序中的“系统检查”步骤尤其关注了,而且要确保没有任何丢失的或被篡改的文件。可以考虑使用类似FileZilla的FTP程序以确保传送过程一切顺利。
  • 高级方式: Subversion

注:上传之后,你应当关闭该版本的README并浏览刚刚上传的版本。 这样该文檔中的所有链接都将正确定位到Gallery2安装中。

2. 开始安装 – 打开WEB浏览器并浏览安装目录。Gallery2将引导你进行系统配置安装并为你打理好一切。

12903.jpg

3. 验证 – 你会被要求创建并保存一小段文本来进行验证,否则无法继续。Gallery2以此种方式来确认你可以使用安装程序。

12908.jpg

4. 系统检查 – 安装程序对你的系统进行检查以确保能够支持Gallery2。请保证所有的检查都被成功执行!

12914.jpg

5. 安装方式 – Gallery可以通过单个的代码安装来支持多个独立站点。在此你可以选择一个标准的单个安装或一个新的多站点安装。在Gallery Codex中有更详细有关多站点(multisite)的信息。

12917.jpg

6. 建立存储位置 – 参读安装程序的指导来为Gallery2建立一个存储位置。这样Gallery2就可以有地方存储你的图片了,当然还包括其它缓存信息。

12920.jpg

7. 数据库安装 – 选择数据库类型并输入数据库验证信息。如果你不是第一次安装Gallery2的话,就意味着有旧的安装残留,那么它就会检查安装过的版本并提供一个简洁的安装方式。它会清楚存储目录和数据库中所有的数据。如果安装过的版本没有问题的话,它还会重新使用已有的数据库表格。如果你没有从暂存中启动安装程序的意思,就选择此项。

12926.jpg

8. 建立管理员账户 – 你会被提示输入一个管理员用户名和密码。输入密码后需要再输入相同的密码以进行确认。姓名和Email地址是可选的。但强烈建议输入Email地址。一旦完成了此步骤,点击“创建”来为此次Gallery2安装创建管理员账户。

12932.jpg

9. 创建配置文件 - Gallery2会在Gallery2目录下创建config.php文件。它包括安装程序中你所提供的所有应答并且这是Gallery2正常运行所必须的。现在还会有一个完整性测试以防止因启动升级向导而破坏Gallery安装。

12938.jpg

10. 安装核心模块 – 在此我们创建所有的数据库表格,初始化用户和相册作为开始。除非发生了错误,不然你真的可以“袖手旁观”了。

12944.jpg

11. 安装其它模块 - Gallery2有各种各样的模块能够提供各种有用的功能。因此选择你所需要的来使用。你可以稍后访问网站管理页面来安装,激活,禁用或卸载模块。因此在此做些试验无妨。

12947.jpg

12. 检查安全性 - Gallery2将会引导你对新的config.php进行监视。

12959.jpg

13. 完成! - 祝贺你!现在已经成功安装了Gallery 2!

12965.jpg

关注版本更新动向[ ]

推荐你订阅邮件联系表以获悉Gallery更新的动向。我们保证此联系表的内容保持一个较低的量,以保证你只获得重要的告知信息,比如安全性补丁。

使用外部依赖安装模块[ ]

Gallery2中有的模块依赖于外部二进制。如果所依赖的二进制没有在WEB服务器中安装,这些模块就不会运作。此分类下的模块有imagemagicknetpbm模块,它们负责生成较小的预览图片(也称为“缩略图”)并重设图片的尺寸。

如果Gallery2安装激活类似imagemagicknetpbmzipcart的模块失败了,那它对外部二进制的自动检测和定位也会失败。绝大多数情况下,这意味着你的服务器不支持这些所需的二进制,从而无使用这些Gallery2的模块。

参见使用外部依赖安装模块获取更多相关信息。