Gallery: Mac OS X 10.4 Tiger上的安装:修订间差异

来自站长百科
跳转至: 导航、​ 搜索
无编辑摘要
无编辑摘要
第1行: 第1行:
[[Category:Gallery 2:Installation|MacOSX]]
[[Category:Gallery 2:Installation|MacOSX]]


<b>注:</b> 如果你在找Gallery2在<b>Mac OS X 10.5 Leopard</b>上的安装指导,请参看[[Gallery:在Mac OS X 10.5 Leopard上的安装]]页面。
<b>注:</b> 如果你在找Gallery2在<b>Mac OS X 10.5 Leopard</b>上的安装指导,请参看[[Gallery:Mac OS X 10.5 Leopard上的安装]]页面。




第37行: 第37行:
==第一步:安装Mac OS X 10.4 Tiger==
==第一步:安装Mac OS X 10.4 Tiger==


This step is fairly obvious. Why Tiger? Because it's known to work, and is well-supported. If you're considering using Leopard, take into account the strong possibility that tools like MySQL, MacPorts, and even Gallery2 may not work out-of-the-box, as they do in Tiger. It can take several months to a year for software packages to be updated so that they run seamlessly on a new operating system version.
需要此步骤是显而易见的。为什么要Tiger?因为它能够运行并且具有很好的支持。如果你考虑使用Leopard,请注意类似MySQL,MacPorts甚至是Gallery2都很可能无法正常工作,但在Tiger中就行。可能需要数月或一载的时间软件包才能得到更新,然后才能在新的操作系统版本中运行。


To create or view instructions for Mac OS X 10.5 Leopard, see the [[Gallery2:Installation on Mac OS X 10.5 Leopard]] page.
要创建或查看Mac OS X 10.5 Leopard的相关指导,请见[[Gallery:Mac OS X 10.5 Leopard上的安装]]页面。




==第二步:安装Apple的Xcode ==
==第二步:安装Apple的Xcode ==


Apple's Xcode (formerly Developer Tools) is required by MacPorts to compile and install the graphics package toolkits used by Gallery2. If you purchased your Mac recently, you should have an Xcode installation DVD. Xcode can also be downloaded from [http://developer.apple.com/ Apple's Developer Connection] web site.
Apple的Xcode曾被称为开发者工具)为MacPorts所需以便对Gallery2所使用的图形工具包进行编译和安装。如果你是最近才购买的Mac,就应该有一个Xcode安装用DVD盘。也可以从 [http://developer.apple.com/ Apple’s Developer Connection]网站下载Xcode。


At the time of writing, Xcode was at version 2.4.1.
值写此文时,Xcode的版本是2.4.1。


  xcode_2.4.1_8m1910_6936315.dmg (930 MB)
  xcode_2.4.1_8m1910_6936315.dmg (930 MB)


Unpack and perform a basic install of Xcode. The Xcode install is simple and straightforward, but may take awhile to complete.
解压并执行Xcode的基本安装。Xcode的安装简单易懂,但需要一些时间。


==第三步:安装MySQL==
==第三步:安装MySQL==


The most common database used in Gallery 2 installations is MySQL. MySQL is free, powerful, and widely supported. The PostgreSQL database is also and option and is freely available for Mac OS X.
Gallery2中最常用的数据库是MySQL。MySQL是免费的,而且功能强大且具有广泛的支持。PostgreSQL数据库也是一个选择,而且对Mac OS X是免费的。


You can download MySQL appropriate for your system (PPC or Intel) from the [http://dev.mysql.com/downloads/mysql/ MySQL web site]. You may also want to download and install the [http://dev.mysql.com/downloads/gui-tools/5.0.html GUI Tools for MySQL], as they provide a nice front-end interface to your database. Install MySQL, as well as the StartupItem package, and MySQL.prefPane. The latter items will allow you to start and stop MySQL from the OS X System Preferences.
你可以从[http://dev.mysql.com/downloads/mysql/ MySQL网站]下载适用于你使用系统(PPC或Intel)的MySQL 。你可能还需要下载并安装[http://dev.mysql.com/downloads/gui-tools/5.0.html MySQL的GUI工具],因为他们提供为你的数据库一个美观的前端界面。安装MySQL还有StartupItem整合包及MySQL.prefPane。后面二者将允许你从OS X的系统偏好(System Preferences)中启动和停止MySQL。


IMPORTANT: You should secure your MySQL installation immediately after installation. To do so, start the server from the System Preferences or the command line with the following:
重要:你应在安装完成后立刻对MySQL采取安全保障措施。使用如下命令行或从系统偏好(System Preferences)启动服务器即可:


   sudo /usr/local/mysql/bin/mysqld_safe --user=mysql &
   sudo /usr/local/mysql/bin/mysqld_safe --user=mysql &


Then set the MySQL root user's password with
接着设定MySQL根用户的密码


   /usr/local/mysql/bin/mysqladmin -u root password MYSQL-ROOT-USER-PASSWORD
   /usr/local/mysql/bin/mysqladmin -u root password MYSQL-ROOT-USER-PASSWORD


If you are new to MySQL, you are strongly encouraged to review [http://dev.mysql.com/doc/refman/5.0/en/security.html MySQL security guidelines].
如果你是刚接触MySQL的话,最好看一看[http://dev.mysql.com/doc/refman/5.0/en/security.html MySQL安全性指南]


After you've secured your MySQL installation, you need to create a new database. You can do this from the command line or through the MySQL GUI Tools, if you installed them. Decide on a name for the database, perhaps "gallery2". From the command line, enter the following:
在保证了MySQL的安全之后,就需要新建数据库了。你可以使用命令行或通过MySQL GUI工具来达到目的,当然你得安装了它们才行。为数据库起个名字,比如"gallery2"。在命令行中输入以下内容:


   mysqladmin -u root -p create gallery2  
   mysqladmin -u root -p create gallery2  
   Password: MYSQL-ROOT-USER-PASSWORD
   Password: MYSQL-ROOT-USER-PASSWORD


If you don't get an error message, a database named gallery2 has been created. Now you need to create and assign a user to connect to the database. This username and password will be used by Gallery 2 to connect to the database. In the following example, the username is "myusername", the password is "mypassword", and the database remains "gallery2" (edit accordingly):
如果没有产生错误提示的话,名为gallery2的数据库就算创建完成了。现在你需要创建并制定一个用户来连接到数据库。该用户名和密码会被Gallery2用与数据库的连接。在下面的例子中,用户名是"myusername",密码是"mypassword"而数据库仍是"gallery2"(请按照实际情况进行修改):


   mysql gallery2 -u root -p -e "GRANT ALL ON gallery2.* TO myusername@localhost IDENTIFIED BY 'GALLERY-MYSQL-USER-PASSWORD'"  
   mysql gallery2 -u root -p -e "GRANT ALL ON gallery2.* TO myusername@localhost IDENTIFIED BY 'GALLERY-MYSQL-USER-PASSWORD'"  


Note the single quotes around the password, and the double-quotes after the -e parameter.
注意密码使用的是单引号,而-e参量后用的是双引号。


==第四步:在/etc/httpd/httpd.conf 中启用PHP ==
==第四步:在/etc/httpd/httpd.conf 中启用PHP ==


If you haven't already turned on Apache in Mac OS X, do that now. You can turn it on by going to the System Preferences, choosing the Sharing panel, then adding a tick beside "Personal Web Sharing". This activates the Apache daemon on your Mac.
如果你在Mac OS X中已经开启了Apache的话,现在就可以进行了。你可以通过打开系统偏好,选择共享面板,然后在"个人Web共享(Personal Web Sharing)"旁边打勾就可以了。这回在你的Mac上启用Apache daemon程序。


By default, Mac OS X 10.4's Apache configuration has PHP turned off. You need to enable it in the Apache configuration file, /etc/httpd/httpd.conf. Use a text editor to uncomment line 240, so the line looks like this:
默认情况下,Mac OS X 10.4的Apache配置是将PHP关闭的。你需要在Apache配置文件中将其启用才行,即/etc/httpd/httpd.conf。使用文本编辑器将第240行取消批注,这样这一行看起来就是下面的样子了:


   LoadModule php4_module        libexec/httpd/libphp4.so
   LoadModule php4_module        libexec/httpd/libphp4.so


Then uncomment like 284, so the line looks like this:
接着是第284行,看起来如下:


   AddModule mod_php4.c
   AddModule mod_php4.c


If you have a slightly different version of Mac OS X or Apache, just look for "php4" to find the two lines above, and uncomment them. Uncommenting these lines enables PHP in Apache.
如果你的Mac OS X或Apache版本略有不同的话,就搜索"php4"来找到上面的两行,并为它们取消批注。之后就能在Apache中启用PHP了。


Once you've saved your changes, then restart Apache with the following command:
修改完成并保存之后,使用下面的命令重启Apache:


  sudo /System/Library/StartupItems/Apache/Apache restart
  sudo /System/Library/StartupItems/Apache/Apache restart
第100行: 第100行:
==第五步:安装Gallery2==
==第五步:安装Gallery2==


Download and install Gallery2. Installation consists of extracting the files from the Gallery2 archive into a folder in the document root folder on your system. A likely candidate for that folder is:
下载并安装Gallery2。安装过程包括将Gallery2压缩文件解压到系统中的文档根目录下。这种文档目录就像是:


   /Library/WebServer/Documents/gallery2
   /Library/WebServer/Documents/gallery2


/Library/WebServer/Documents is the default document root folder for your Mac, and as you can see, the gallery2 folder lies just beneath the root. To access Gallery2, you'd type the following URL into a web browser (assuming that your computer is named MyLovelyMac):
/Library/WebServer/Documents是Mac默认的文档根目录,而正如你所见gallery2文件夹就在该根目录之下。要访问Gallery2,就需要在web浏览器中输入如下的URL(这里假定你的计算机名是MyLovelyMac):


   http://MyLovelyMac.local/gallery2
   http://MyLovelyMac.local/gallery2


If you're serving Gallery2 to the internet, and not just your local network, you'll need to set up your router, DNS, and/or IP information appropriately.
如果你的Gallery2是在互联网上而不仅仅是本地网络的话,就需要合理设置路由器,DNS和/或IP信息。


Go through the Gallery2 installation. Remember to give Gallery2 the username, password, and tablespace information you created in MySQL for step three, above.
继续Gallery2安装时,请记住为Gallery2设置用户名,密码以及上面第三步中你在MySQL中创建的tablespace信息。


If you're installing a fresh Gallery2 system, you're done for this step. If you're migrating your Gallery2 data from a previous installation, such as a Linux server or another Mac, things can get more complex here. You should probably ensure that the version of Gallery2 on your previous server is the same version as the one you're installing. If it's not the same version, Gallery2 will probably offer to upgrade the database for you, if the version of Gallery2 on your previous server is older than the version of Gallery2 on your new Mac installation.
如果你是首次安装Gallery2系统的话,到这里就完成了。如果你是在进行Gallery2数据转移的话,比如从Linux服务器或另一个Mac上,就比较麻烦了。你应当保证之前服务器上的Gallery2版本与你正安装的版本相同。如果版本不同的话,Gallery2很可能会为你升级数据库,此情况是,前一个服务器上的Gallery2版本低于新Mac上的Gallery2版本。


Essentially, you need to dump the Gallery2 database tablespace from your old server, import it into your new Gallery2 tablespace on your server, and then copy over all the files from your g2data directory.
你还得从旧服务器上转储Gallery2数据库tablespace,将其导入服务器上的新Gallery2 tablespace中,并将g2data目录中的所有文件都复制过来。


To dump the data from your previous install, log on to your previous system and run the following command (the username is "username"; the tablespace is "old_gallery2"):
要转储旧的数据,登入旧系统,并运行下面的命令(用户名为"username"; tablespace是"old_gallery2"):


   mysqldump -uusername -p old_gallery2 > old_gallery2_dump.sql
   mysqldump -uusername -p old_gallery2 > old_gallery2_dump.sql


That command creates a file named old_gallery2_dump.sql that you can copy to your new server. Once on your new server, run a command like this to import the dump into your newly created tablespace:
该命令会创建一个名为old_gallery2_dump.sql 的文件,你可以将其复制到新服务器上。之后在新服务器上运行如下命令来转储到新建的tablespace中:


   mysql -uusername -p gallery2 < old_gallery2_dump.sql
   mysql -uusername -p gallery2 < old_gallery2_dump.sql


Now copy the contents of your g2data folder from your old server to the g2data folder on your new server. You may need to chmod the contents so that the web server can read and write the contents. For example, if your g2data directory was /Library/WebServer/g2data, you could run:
现在将旧服务器的g2data 文件夹内容复制到新服务器的g2data文件夹中。你可能需要对内容进行chmod,这样web服务器就可以对内容进行读写了。,例如你的g2data目录是/Library/WebServer/g2data,你可以运行:


   sudo chmod -R 777 /Library/WebServer/g2data
   sudo chmod -R 777 /Library/WebServer/g2data
第131行: 第131行:
==第六步:安装MacPorts==
==第六步:安装MacPorts==


MacPorts is a project that makes it very easy to install Unix tools and libraries on your Mac. It is utterly brilliant, and it makes installing the libraries that Gallery2 requires very easy. Remember, you must have Xcode installed before installing MacPorts.
MacPorts使得Unix工具和库在Mac上的安装变得相当简单。它很强大,它能让Gallery2所需库的安装变得十分轻松。当然你得记住先安装Xcode后才能安装MacPorts。


MacPorts is available at http://macports.org. Once installed, read through the [http://trac.macosforge.org/projects/macports/wiki online documentation] so you understand what's required. Once you have a basic understanding, the process is very simple.
MacPorts可以在http://macports.org上找到。安装完成后,请通读[http://trac.macosforge.org/projects/macports/wiki 在线资料],这样你就能明确所需。一旦你能大概理解,过程将变得非常简单。


Note that the MacPorts documentation says that you need to update your .bashrc or .bash_profile file so that your environment has the DISPLAY variable set and two MacPort directories in the PATH variable. You may have to do that manually, as the MacPorts installer did not do that on the G4 machine used when writing the instructions on this Gallery 2 installation guide.
注意MacPorts资料说你需要更新.bashrc或.bash_profile文件,这样你的环境具有DISPLAY变量集并在PATH变量中有2个MacPort目录。你可能需要手动完成此操作,因为正值于Gallery安装指导中写此文时,MacPorts安装程序无法在G4机上完成此操作。


Once you have MacPorts installed and your bash environment set, update MacPorts with the following command:
MacPorts安装完成而bash环境设定好后,使用如下命令更新MacPorts:


   sudo port -d selfupdate
   sudo port -d selfupdate


If all went well, you now have everything you need to install the graphics libraries for Gallery2. If you'd prefer a GUI interface to MacPorts, try [http://porticus.alittledrop.com/ Porticus], or run the following from the command line:
如果一切顺利的话,现在你就有了安装Gallery2图形库所需的所有东西了。如果你想为MacPorts使用GUI界面,可以试试[http://porticus.alittledrop.com/ Porticus],或从命令行中运行如下内容:


   sudo port install dcraw
   sudo port install dcraw
第151行: 第151行:
==第七步:配置Gallery2以使用图形插件==
==第七步:配置Gallery2以使用图形插件==


Once they're all done, the graphic libraries are located on your Mac in /opt/local/bin. This means that when you enable the graphic plug-ins in the Gallery2 administrator pages, you enter the following values for the plug-ins:
全部完成后,图形库就位于Mac的/opt/local/bin中了。这就意味着当你在Gallery2管理页面中启用图形插件时,就为插件输入如下值:


Dcraw:
Dcraw:
   Path to Dcraw binary: /opt/local/bin/dcraw
   Path to Dcraw binary: /opt/local/bin/dcraw


Ffmpeg:
Ffmpeg:
   Path to FFMPEG: /opt/local/bin/ffmpeg
   Path to FFMPEG: /opt/local/bin/ffmpeg


ImageMagick:
ImageMagick:
   Directory to ImageMagick/GraphicsMagick binaries: /opt/local/bin/
   Directory to ImageMagick/GraphicsMagick binaries: /opt/local/bin/


NetPBM:
NetPBM:
   NetPBM directory: /opt/local/bin/
   NetPBM directory: /opt/local/bin/
   jhead directory: /opt/local/bin/
   jhead directory: /opt/local/bin/


Save and test all the plug-ins. If things have gone well, they should all work. You can now use Gallery2 to upload photos and movies (use a tool like iPhotoToGallery):
保存并对所有插件进行测试。如果没有问题的话,它们就都能很好地工作了。你现在就可以使用Gallery2上传相片和视频了(使用类似iPhotoToGallery的工具):


   http://zwily.com/iphoto
   http://zwily.com/iphoto
第173行: 第173行:
==第八步:使用php.ini配置==
==第八步:使用php.ini配置==


Your Gallery2 installation works fine now, but you'll notice that you can't upload full resolution files from your nice six megapixel camera. That's because Mac OS X uses the default settings for PHP, and PHP's default settings limit the amount of memory consumed by a PHP program to eight megabytes, and the maximum size for an upload to be two megabytes.
Gallery2现在就能正常运行了,但你还会注意到你无法上传来自数码相机6MB大小的全分辨率文件。这是因为Mac OS X对PHP使用默认的设定,而PHP默认设定将PGP程序的内存消耗设为8MB,而最大的单次上传限制为2MB。


To change these settings, you'll need to copy /etc/php.ini.default to /etc/php.ini and change the following default values (you'll need to use the sudo command again, because these are system files):
要对这些设定进行修改的话,就需要将/etc/php.ini.default复制到/etc/php.ini并修改下面的默认值(你需要再次使用sudo命令了,因为这些是系统文件):


Line 232 (up the memory limit from eight megabytes to something more like sixteen):
232行(将内存限制提升,比如16MB):


   memory_limit = 8M
   memory_limit = 8M


Line 373 (up the maximum post file size to something more like sixteen megabytes):
373行(将post文件最大尺寸提升,比如16MB):


   post_max_size = 8M
   post_max_size = 8M


Line 489 (up the maximum uploadable file size from two to something like sixteen):
489行(将可上传文件的最大尺寸提升,比如从2MB提示到16MB):


   upload_max_filesize = 2M
   upload_max_filesize = 2M


Now that you've made the change, restart Apache and you will be able to upload larger file sizes. Awesome!
现在修改就完成了,重启Apache后就可以上传更大的文件了。


   sudo /System/Library/StartupItems/Apache/Apache restart
   sudo /System/Library/StartupItems/Apache/Apache restart
第196行: 第196行:
==完成==
==完成==


If all went well, you should now have the world's best photo sharing tool running on the best operating system in the world and the best hardware.
如果一切顺利的话,那么你现在就在世界上最好的操作系统和硬件上使用世界上最棒的相片共享工具啦。


The author of this page hopes that this guide has been of some use to you. As time goes on, this information will become more and more obsolete and things won't work as well as they did when the guide was written. Please feel free to add your own changes where you feel they are necessary.
该页面的编写者希望此文能对你有所帮助。随着时间的推移,这篇文章会变得过时,而有些内容可能变得没有效果了。因此,如果你觉得有必要,可以对此页面进行修改。


When Mac OS X 10.5 (Leopard) is released, the [[Gallery2:Installation on Mac OS X 10.5 Leopard]] page can be completed. That way, the known-to-be-working instructions for Mac OS X 10.4 Tiger are preserved here, while the brave souls who venture forth into the unknown territory of Leopard can forge ahead while the more conservative Gallery2 users can stick with what is known to work.
当Mac OS X 10.5 (Leopard)发布时,[[Gallery:Mac OS X 10.5 Leopard上的安装]]页面就能完成了。已知可行的Mac OS X 10.4 Tiger相关指导会保留在这里。更具探索精神的用户可以大胆开化Leopard的未知领域,而其他较保守的Gallery2用户则可以吃现成的。


[[Category:Gallery 2:Installation|MacOSX]]
[[Category:Gallery 2:Installation|MacOSX]]

2008年11月22日 (六) 15:11的版本


注: 如果你在找Gallery2在Mac OS X 10.5 Leopard上的安装指导,请参看Gallery:Mac OS X 10.5 Leopard上的安装页面。


在Mac OSX 10.4.9 ("Tiger")上安装Gallery2相对简单些,但需掌握一些有关Mac OS X的Unix under-pinnings知识:该指导并不会手把手地教你进行安装,因此需要具备一点知识。

Mac OS X 10.4已带有Apache和PHP。你所需要做的只是安装数据库,Gallery2和图形库插件。如果我点到即止而你能自行处理的话,那么请往下看。

以下为该页面之前所含有的指导,相当地简略。你也可以按照它行事:

    看看http://maczealots.com 上的wordpress教程,直到进行到第六步之前`sed s/wordpress/gallery2/g`。此时你只要在浏览器中打开gallery2即可,相当地简单。

那么还犹豫什么,快开始吧。


概览

要让Gallery2在Tiger中运行,我们需要完成下面的步骤:

  1. 安装Mac OS X 10.4 Tiger
  2. 从Apple(曾被称为开发者工具)安装Xcode
  3. 安装数据库(MySQL就很不错)
  4. 在/etc/httpd/httpd.conf中启用PHP
  5. 安装Gallery2(并用以前的Gallery2复制到database/files之上)
  6. 安装MacPorts(曾被称为DarwinPorts)以安装下列的图形整合包
    • 安装dcraw
    • 安装ffmpeg
    • 安装imagemagick
    • 安装netpbm
    • 安装jhead
  7. 对Gallery2进行配置以使用图形插件
  8. 使用/etc/php.ini 对PHP进行配置

注:Mac OS X 10.5 ("Leopard")计划在2007年秋季发布(此文写于2007年6月),而beta版本以为开发者所使用了。如果你读到这里,并且在自己Mac上运行的也是Mac OS X 10.5的话,就需要对这些指导进行修改以符合新操作系统的需要。

第一步:安装Mac OS X 10.4 Tiger

需要此步骤是显而易见的。为什么要Tiger?因为它能够运行并且具有很好的支持。如果你考虑使用Leopard,请注意类似MySQL,MacPorts甚至是Gallery2都很可能无法正常工作,但在Tiger中就行。可能需要数月或一载的时间软件包才能得到更新,然后才能在新的操作系统版本中运行。

要创建或查看Mac OS X 10.5 Leopard的相关指导,请见Gallery:Mac OS X 10.5 Leopard上的安装页面。


第二步:安装Apple的Xcode

Apple的Xcode曾被称为开发者工具)为MacPorts所需以便对Gallery2所使用的图形工具包进行编译和安装。如果你是最近才购买的Mac,就应该有一个Xcode安装用DVD盘。也可以从 Apple’s Developer Connection网站下载Xcode。

值写此文时,Xcode的版本是2.4.1。

xcode_2.4.1_8m1910_6936315.dmg (930 MB)

解压并执行Xcode的基本安装。Xcode的安装简单易懂,但需要一些时间。

第三步:安装MySQL

Gallery2中最常用的数据库是MySQL。MySQL是免费的,而且功能强大且具有广泛的支持。PostgreSQL数据库也是一个选择,而且对Mac OS X是免费的。

你可以从MySQL网站下载适用于你使用系统(PPC或Intel)的MySQL 。你可能还需要下载并安装MySQL的GUI工具,因为他们提供为你的数据库一个美观的前端界面。安装MySQL还有StartupItem整合包及MySQL.prefPane。后面二者将允许你从OS X的系统偏好(System Preferences)中启动和停止MySQL。

重要:你应在安装完成后立刻对MySQL采取安全保障措施。使用如下命令行或从系统偏好(System Preferences)启动服务器即可:

 sudo /usr/local/mysql/bin/mysqld_safe --user=mysql &

接着设定MySQL根用户的密码

 /usr/local/mysql/bin/mysqladmin -u root password MYSQL-ROOT-USER-PASSWORD

如果你是刚接触MySQL的话,最好看一看MySQL安全性指南

在保证了MySQL的安全之后,就需要新建数据库了。你可以使用命令行或通过MySQL GUI工具来达到目的,当然你得安装了它们才行。为数据库起个名字,比如"gallery2"。在命令行中输入以下内容:

 mysqladmin -u root -p create gallery2 
 Password: MYSQL-ROOT-USER-PASSWORD

如果没有产生错误提示的话,名为gallery2的数据库就算创建完成了。现在你需要创建并制定一个用户来连接到数据库。该用户名和密码会被Gallery2用与数据库的连接。在下面的例子中,用户名是"myusername",密码是"mypassword"而数据库仍是"gallery2"(请按照实际情况进行修改):

 mysql gallery2 -u root -p -e "GRANT ALL ON gallery2.* TO myusername@localhost IDENTIFIED BY 'GALLERY-MYSQL-USER-PASSWORD'" 

注意密码使用的是单引号,而-e参量后用的是双引号。

第四步:在/etc/httpd/httpd.conf 中启用PHP

如果你在Mac OS X中已经开启了Apache的话,现在就可以进行了。你可以通过打开系统偏好,选择共享面板,然后在"个人Web共享(Personal Web Sharing)"旁边打勾就可以了。这回在你的Mac上启用Apache daemon程序。

默认情况下,Mac OS X 10.4的Apache配置是将PHP关闭的。你需要在Apache配置文件中将其启用才行,即/etc/httpd/httpd.conf。使用文本编辑器将第240行取消批注,这样这一行看起来就是下面的样子了:

 LoadModule php4_module        libexec/httpd/libphp4.so

接着是第284行,看起来如下:

 AddModule mod_php4.c

如果你的Mac OS X或Apache版本略有不同的话,就搜索"php4"来找到上面的两行,并为它们取消批注。之后就能在Apache中启用PHP了。

修改完成并保存之后,使用下面的命令重启Apache:

sudo /System/Library/StartupItems/Apache/Apache restart


第五步:安装Gallery2

下载并安装Gallery2。安装过程包括将Gallery2压缩文件解压到系统中的文档根目录下。这种文档目录就像是:

 /Library/WebServer/Documents/gallery2

/Library/WebServer/Documents是Mac默认的文档根目录,而正如你所见gallery2文件夹就在该根目录之下。要访问Gallery2,就需要在web浏览器中输入如下的URL(这里假定你的计算机名是MyLovelyMac):

 http://MyLovelyMac.local/gallery2

如果你的Gallery2是在互联网上而不仅仅是本地网络的话,就需要合理设置路由器,DNS和/或IP信息。

继续Gallery2安装时,请记住为Gallery2设置用户名,密码以及上面第三步中你在MySQL中创建的tablespace信息。

如果你是首次安装Gallery2系统的话,到这里就完成了。如果你是在进行Gallery2数据转移的话,比如从Linux服务器或另一个Mac上,就比较麻烦了。你应当保证之前服务器上的Gallery2版本与你正安装的版本相同。如果版本不同的话,Gallery2很可能会为你升级数据库,此情况是,前一个服务器上的Gallery2版本低于新Mac上的Gallery2版本。

你还得从旧服务器上转储Gallery2数据库tablespace,将其导入服务器上的新Gallery2 tablespace中,并将g2data目录中的所有文件都复制过来。

要转储旧的数据,登入旧系统,并运行下面的命令(用户名为"username"; tablespace是"old_gallery2"):

 mysqldump -uusername -p old_gallery2 > old_gallery2_dump.sql

该命令会创建一个名为old_gallery2_dump.sql 的文件,你可以将其复制到新服务器上。之后在新服务器上运行如下命令来转储到新建的tablespace中:

 mysql -uusername -p gallery2 < old_gallery2_dump.sql

现在将旧服务器的g2data 文件夹内容复制到新服务器的g2data文件夹中。你可能需要对内容进行chmod,这样web服务器就可以对内容进行读写了。,例如你的g2data目录是/Library/WebServer/g2data,你可以运行:

 sudo chmod -R 777 /Library/WebServer/g2data


第六步:安装MacPorts

MacPorts使得Unix工具和库在Mac上的安装变得相当简单。它很强大,它能让Gallery2所需库的安装变得十分轻松。当然你得记住先安装Xcode后才能安装MacPorts。

MacPorts可以在http://macports.org上找到。安装完成后,请通读在线资料,这样你就能明确所需。一旦你能大概理解,过程将变得非常简单。

注意MacPorts资料说你需要更新.bashrc或.bash_profile文件,这样你的环境具有DISPLAY变量集并在PATH变量中有2个MacPort目录。你可能需要手动完成此操作,因为正值于Gallery安装指导中写此文时,MacPorts安装程序无法在G4机上完成此操作。

MacPorts安装完成而bash环境设定好后,使用如下命令更新MacPorts:

 sudo port -d selfupdate

如果一切顺利的话,现在你就有了安装Gallery2图形库所需的所有东西了。如果你想为MacPorts使用GUI界面,可以试试Porticus,或从命令行中运行如下内容:

 sudo port install dcraw
 sudo port install imagemagick
 sudo port install ffmpeg
 sudo port install netpbm
 sudo port install jhead

第七步:配置Gallery2以使用图形插件

全部完成后,图形库就位于Mac的/opt/local/bin中了。这就意味着当你在Gallery2管理页面中启用图形插件时,就为插件输入如下值:

Dcraw:

 Path to Dcraw binary: /opt/local/bin/dcraw

Ffmpeg:

 Path to FFMPEG: /opt/local/bin/ffmpeg

ImageMagick:

 Directory to ImageMagick/GraphicsMagick binaries: /opt/local/bin/

NetPBM:

 NetPBM directory: /opt/local/bin/
 jhead directory: /opt/local/bin/

保存并对所有插件进行测试。如果没有问题的话,它们就都能很好地工作了。你现在就可以使用Gallery2上传相片和视频了(使用类似iPhotoToGallery的工具):

 http://zwily.com/iphoto


第八步:使用php.ini配置

Gallery2现在就能正常运行了,但你还会注意到你无法上传来自数码相机6MB大小的全分辨率文件。这是因为Mac OS X对PHP使用默认的设定,而PHP默认设定将PGP程序的内存消耗设为8MB,而最大的单次上传限制为2MB。

要对这些设定进行修改的话,就需要将/etc/php.ini.default复制到/etc/php.ini并修改下面的默认值(你需要再次使用sudo命令了,因为这些是系统文件):

232行(将内存限制提升,比如16MB):

  memory_limit = 8M

373行(将post文件最大尺寸提升,比如16MB):

  post_max_size = 8M

489行(将可上传文件的最大尺寸提升,比如从2MB提示到16MB):

  upload_max_filesize = 2M

现在修改就完成了,重启Apache后就可以上传更大的文件了。

  sudo /System/Library/StartupItems/Apache/Apache restart


完成

如果一切顺利的话,那么你现在就在世界上最好的操作系统和硬件上使用世界上最棒的相片共享工具啦。

该页面的编写者希望此文能对你有所帮助。随着时间的推移,这篇文章会变得过时,而有些内容可能变得没有效果了。因此,如果你觉得有必要,可以对此页面进行修改。

当Mac OS X 10.5 (Leopard)发布时,Gallery:Mac OS X 10.5 Leopard上的安装页面就能完成了。已知可行的Mac OS X 10.4 Tiger相关指导会保留在这里。更具探索精神的用户可以大胆开化Leopard的未知领域,而其他较保守的Gallery2用户则可以吃现成的。