ksaitoの日記

日々試したことの覚え書き

MacPortsに必要なCommand Line for XCode

移転しました。

自動的にリダイレクトします。

MacPorts 2.1.1をiMacにインストールしました。
パッケージをインストールしようとするとmakeコマンドが見つからずエラーになります。

$ sudo port install git-core
Warning: The Command Line Tools for Xcode don't appear to be installed; most ports will likely fail to build.
Warning: See http://guide.macports.org/chunked/installing.xcode.html for more information.
--->  Computing dependencies for git-coreError: Unable to execute port: can't read "build.cmd": Failed to locate 'make' in path: '/opt/local/bin:/opt/local/sbin:/bin:/sbin:/usr/bin:/usr/sbin' or at its MacPorts configuration time location, did you move it?
$

確かにmakeコマンドは使えません。

$ make
-bash: make: command not found
$

エラーメッセージに指定されたURLを見るとCommand Line for XCodeというツールをインストールする必要があります。

Apple Developer ConnectionにID登録が必要なのと、2バージョンが見つかりましたがスペックは満たしているようなので最新版を入れてみます。

インストールするとmakeコマンドが使えるようになります。

$ make -v
GNU Make 3.81
Copyright (C) 2006  Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.

This program built for i386-apple-darwin11.3.0
$ type make
make is hashed (/usr/bin/make)
$

インストールしようと思っていたgitも入っていました。

$ git --version
git version 1.7.7.5 (Apple Git-26)
$

仕方ないのでzabbixのエージェントをインストールしたところ無事インストールできました。
前にMacBookにインストールした時も、こんなメッセージでたっけ?

$ sudo port install zabbix +agent_only
--->  Fetching archive for zabbix
--->  Attempting to fetch zabbix-1.8.2_0+agent_only.darwin_11.x86_64.tbz2 from http://packages.macports.org/zabbix
--->  Fetching distfiles for zabbix
--->  Verifying checksum(s) for zabbix
--->  Extracting zabbix
--->  Applying patches to zabbix
--->  Configuring zabbix
--->  Building zabbix
--->  Staging zabbix into destroot
--->  Creating launchd control script
###########################################################
# A startup item has been generated that will aid in
# starting zabbix with launchd. It is disabled
# by default. Execute the following command to start it,
# and to cause it to launch at startup:
#
# sudo port load zabbix
###########################################################
--->  Installing zabbix @1.8.2_0+agent_only
--->  Activating zabbix @1.8.2_0+agent_only

#### ZABBIX agent installation section (steps 1 - 3 only) ####

1) Edit the sample .conf file /opt/local/etc/zabbix/zabbix_agentd.conf (rename & omit .sample)

   Set the following variable to the ip address of your ZABBIX server to allow it access to the agent.

	Server=x.x.x.x


2) Set zabbix_agentd to run at system boot

	sudo launchctl load -w /Library/LaunchDaemons/org.macports.zabbix.plist

   To start Zabbix manually, use: /opt/local/share/zabbix/zabbix_agentd.init start (stop|status)


3) A Win32 agent is in /opt/local/share/zabbix/zabbix_agent_win32 for installation on Windows NT 4.0, Windows 2000, and Windows
XP.


#### End ZABBIX agent installation section ####
####                                       ####


####                                          ####
#### Begin ZABBIX server installation section ####


1) Setup MySQL, i.e. via MacPorts:

	sudo port install mysql5-server


2) Setup the ZABBIX MySQL database

-Create the ZABBIX database
	mysql5 -u root -p (enter password at prompt)
	mysql> create database zabbix character set utf8;
	mysql> quit;

-Import the ZABBIX Schema
	cd /opt/local/share/zabbix/schema
	cat mysql.sql | mysql5 -u root -p zabbix
	cd /opt/local/share/zabbix/data
	cat data.sql | mysql5 -u root -p zabbix
	cat images_mysql.sql | mysql5 -u root -p zabbix

-Create a MySQL 'zabbix' user and password
	mysql5 -u root -p
	mysql> grant all privileges on zabbix.* to zabbix@localhost identified by '<zabbix-mysql-password>';
	mysql> grant all privileges on zabbix.* to zabbix identified by '<zabbix-mysql-password>';
	mysql> quit;


3) Edit the sample .conf file /opt/local/etc/zabbix/zabbix_server.conf (rename & omit .sample)

   Modify these variables at the very least:

	DBName=zabbix
	DBUser=zabbix
	DBPassword=<zabbix-mysql-password>


4) Install PHP 5, i.e. via MacPorts:

	sudo port install php5 php5-gd php5-mbstring php5-mysql php5-sockets


5) Set a symbolic link in your Apache document root pointing to the PHP frontend files

	sudo ln -s /opt/local/share/zabbix/frontends/php <Apache-docroot>/zabbix


6) Set zabbix_server to run at system boot, then start it

	sudo launchctl load -w /Library/LaunchDaemons/org.macports.zabbix.plist

   To start Zabbix manually, use: /opt/local/share/zabbix/zabbix_server.init start (stop|status)

	Note: Eventually your shared memory has to be increased (see http://www.zabbix.org/forum/showthread.php?p=64232)!


7) A Win32 agent is in /opt/local/share/zabbix/zabbix_agent_win32 for installation on Windows NT 4.0, Windows 2000, and Windows
XP.  See the ReadMe.txt for instructions.


8) Open http://localhost/zabbix/ in your browser and walk through the setup, then login with default user 'Admin' and password
'zabbix'.


9) Read the fine manual at http://www.zabbix.com/documentation/

--->  Cleaning zabbix
--->  Updating database of binaries: 100.0%
--->  Scanning binaries for linking errors: 100.0%
--->  No broken files found.
$