Mac OS X Mountain Lion の ファイル共有機能を Samba3に入れ替え

Mac OS X Mountaion Lionでは、ビルトインのSMBファイル共有機能があるが、
Sambaでは無くアップルの独自ソフトウェアが採用されている。
Sambaを取り去ったOS X Lion、その影響は…… - builder

ビルトインのSMBファイル共有機能で
・外付けHDDが書き込み可能な状態で共有できない
Windowsクライアントからアクセスした際に、シンボリックリンクがたどれない
などが解決できなかった*1ため、Samba3を導入する。

手順

1.MacPortsを導入
2.Samba3をインストール

port install samba3

3.MacPortsのバイナリ置き場にパスを通す

echo "export PATH=/opt/local/bin:$PATH" > ~/.profile

4.設定ファイルの編集

vi /opt/local/etc/samba3/smb.conf
#ワークグループ名
workgroup = WORKGROUP
#ログファイルのパス
log file = /opt/local/var/log.%m
#許可するホスト
hosts allow = 192.168.1. 192.168.2. 127.
#共有するディレクトリの設定(外付けHDDのボリューム「ExFAT1TB」の「books」ディレクトリ)
[Books]
comment=Books
path=/Volumes/ExFAT1TB/books
available=yes
guest ok=yes
create mask=644
directory mask=755
writable=yes

5.デーモンを管理するlaunchdのSMBD用設定ファイルを作成

vi /Library/LaunchDaemons/org.samba.smbd.plist

        • -



Label
org.samba.smbd
OnDemand

ProgramArguments

/opt/local/sbin/smbd
-F

RunAtLoad

ServiceDescription
samba

        • -

6.launchdのNMBD用設定ファイルを作成

vi /Library/LaunchDaemons/org.samba.nmbd.plist

        • -



Label
org.samba.nmbd
OnDemand

ProgramArguments

/opt/local/sbin/nmbd
-F

RunAtLoad

ServiceDescription
netbios

        • -

7.ビルトインのNETBIOSサーバー機能を停止

sudo launchctl stop com.apple.netbiosd
sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.netbiosd.plist

8.SMBD、NMBDをロード

sudo launchctl load /Library/LaunchDaemons/org.samba.smbd.plist
sudo launchctl load /Library/LaunchDaemons/org.samba.nmbd.plist

※設定ファイルを編集したら、ロードし直す。

launchctl unload /Library/LaunchDaemons/org.samba.nmbd.plist
launchctl load /Library/LaunchDaemons/org.samba.nmbd.plist
launchctl unload /Library/LaunchDaemons/org.samba.smbd.plist
launchctl load /Library/LaunchDaemons/org.samba.smbd.plist

*1:※ビルトインのSMBファイル共有機能でも設定で解決できるのかもしれないが、見つけられなかった

パフォーマンス計測

Apache JMeter

http://jmeter.apache.org/

プロキシを立ててブラウザの操作を記録して、再現させる
  1. 起動
  2. 「テスト計画」右クリック [追加] > [Threads (Users)] > [スレッドグループ]
  3. 「スレッドグループ」右クリック [追加] > [リスナー] > [結果を表で表示]
  4. 「ワークベンチ」右クリック [追加] > [Non-Testエレメント] > [HTTP プロキシ サーバー]
  5. 「HTTP プロキシサーバー」の画面下部「開始」
  6. ブラウザにプロキシサーバーを設定して、再現させたい操作をブラウザで実行
  7. 操作を終えたら「HTTP プロキシサーバー」の画面下部「停止」
  8. 「スレッドグループ」の中に操作が記録されるので、不要な項目は削除
  9. 「スレッドグループ」を選択して、ツールバーの再生ボタン「開始」をクリック」
  10. 「はい」を選択し設定を保存する。
  11. 「結果を表示で表示」を選択して進捗状況を確認

その他:「スレッドグループ」右クリック[Duplicate]で、どんどん増やせる

以上

クラウドサービス

GMOクラウドに作成した仮想サーバーでパケット転送(ip forward)ができなくなった

2013.4.16
以下の構成でSERVER1にip forwardの設定。
以前は動作していたが、仕様変更によりパケットが転送されなくなった。

■構成図
----------------
インターネット
----------------
|
| (eth0) 203.0.113.10
----------------
SERVER1 (CentOS 6.2 x64 kvm)
----------------
| (eth1) 192.168.1.10
|
| (eth0) 192.168.1.20
----------------
SERVER(CentOS 6.0 x64 xen)
----------------

■SERVER1への設定
・IPフォワードを有効にする
vi /etc/sysctl.conf
net.ipv4.ip_foward = 1 # 0から1に変更
/etc/init.d/network restart

・iptablesにマスカレードの設定
iptables -t nat -F
iptables -t mangle -F
iptables -t filter -F
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE

■SERVER2への設定
デフォルトゲートウェイを「192.168.1.10」に設定

サポートからの回答

仮想サーバー内ネットワークインターフェイス間におけるパケット転送
につきまして、KVM環境では従来仕様上可能となっていましたが、
下記メンテナンスにより現在は転送されるパケットを弊社システム側でDROPする
仕様に変更されておりました。

■緊急メンテナンス実施のお知らせ(ネットワーク機器/クラウドポータル/03月22日)
http://support.gmocloud.com/public/info/detail.php?no=1363154388

上記仕様について将来変更の予定は現時点ではございませんので、
誠に恐れ入りますが、Publicクラウドにてご要望の構成をとることはできないと
ご理解くださいますようお願いいたします。
なお、Xen環境は従来よりパケット転送をDROPする仕様でございます。

VMWare

VMware Player 5.0.0 build-812388

仮想マシンのバージョアップ

新しいバージョンのVMware Playerで、古いバージョンの仮想マシンを起動すると
一部の機能が使用できない場合がある(サスペンド機能、ユニティなど)
VMware Converter を使用して、仮想マシンをバージョンアップする事ができる。
VMware vCenter Converter Standalone のダウンロード: 物理マシンから仮想マシンへ変換 (P2V)

仮想イメージをコピーした後、eth0が起動しない (CentOS6.0)

vi /etc/udev/rules.d/70-persistent-net.rules
 →eth0のMacアドレスを修正。不要ならeth1を削除する。
vi /etc/sysconfig/network-scripts/ifcfg-eth0
 →HWADDRを修正
/etc/init.d/network restart

VMWare Toolsのインストール(CentOS6.0)

VMWare Playerのメニュー > 管理 > VMWare Toolsのインストール
「ダウンロードしてインストール」

mkdir /mnt/cdrom
mount /dev/cdrom  /mnt/cdrom
cp  /mnt/cdrom/VMwareTools-9.2.0-799703.tar.gz /usr/local/src/
umount /mnt/cdrom/
cd /usr/local/src/
tar -xvzf VMwareTools-9.2.0-799703.tar.gz
cd vmware-tools-distrib/
#(perlが無ければ導入する) yum install perl
./vmware-install.pl

#以下、インストーラーの設問に回答する。ここでは全て未入力。
In which directory do you want to install the binary files?
[/usr/bin]

What is the directory that contains the init directories (rc0.d/ to rc6.d/)?
[/etc/rc.d]

What is the directory that contains the init scripts?
[/etc/rc.d/init.d]

In which directory do you want to install the daemon files?
[/usr/sbin]

In which directory do you want to install the library files?
[/usr/lib/vmware-tools]

The path "/usr/lib/vmware-tools" does not exist currently. This program is
going to create it, including needed parent directories. Is this what you want?
[yes]

In which directory do you want to install the documentation files?
[/usr/share/doc/vmware-tools]

The path "/usr/share/doc/vmware-tools" does not exist currently. This program
is going to create it, including needed parent directories. Is this what you
want? [yes]

Before running VMware Tools for the first time, you need to configure it by
invoking the following command: "/usr/bin/vmware-config-tools.pl". Do you want
this program to invoke the command for you now? [yes]

Initializing...

Making sure services for VMware Tools are stopped.
The VMware FileSystem Sync Driver (vmsync) allows external third-party backup
software that is integrated with vSphere to create backups of the virtual
machine. Do you wish to enable this feature? [no]

Found a compatible pre-built module for vmci.  Installing it...

Found a compatible pre-built module for vsock.  Installing it...

The module vmxnet3 has already been installed on this system by another
installer or package and will not be modified by this installer.  Use the flag
--clobber-kernel-modules=vmxnet3 to override.

The module pvscsi has already been installed on this system by another
installer or package and will not be modified by this installer.  Use the flag
--clobber-kernel-modules=pvscsi to override.

The module vmmemctl has already been installed on this system by another
installer or package and will not be modified by this installer.  Use the flag
--clobber-kernel-modules=vmmemctl to override.

The VMware Host-Guest Filesystem allows for shared folders between the host OS
and the guest OS in a Fusion or Workstation virtual environment.  Do you wish
to enable this feature? [yes]
Found a compatible pre-built module for vmhgfs.  Installing it...

Found a compatible pre-built module for vmxnet.  Installing it...

The vmblock enables dragging or copying files between host and guest in a
Fusion or Workstation virtual environment.  Do you wish to enable this feature?
[yes]
NOTICE:  It appears your system does not have the required fuse packages
installed.  The VMware blocking filesystem requires the fuse packages and its
libraries to function properly.  Please install the fuse or fuse-utils package
using your systems package management utility and re-run this script in order
to enable the VMware blocking filesystem.

!!! [EXPERIMENTAL] !!!
VMware automatic kernel modules enables automatic building and installation of
VMware kernel modules at boot that are not already present.  By selecting yes,
you will be enabling this experimental feature.  You can always disable this
feature by re-running vmware-config-tools.pl.

Would you like to enable VMware automatic kernel modules?
[no]

No X install found.

Creating a new initrd boot image for the kernel.
vmware-tools-thinprint start/running
vmware-tools start/running
The configuration of VMware Tools 9.2.0 build-799703 for Linux for this running
kernel completed successfully.

You must restart your X session before any mouse or graphics changes take
effect.

You can now run VMware Tools by invoking "/usr/bin/vmware-toolbox-cmd" from the
command line.

To enable advanced X features (e.g., guest resolution fit, drag and drop, and
file and text copy/paste), you will need to do one (or more) of the following:
1. Manually start /usr/bin/vmware-user
2. Log out and log back into your desktop session; and,
3. Restart your X session.

Enjoy,

--the VMware team
#インストール完了

Mac OS X

環境は OS X Mountain Lion (Mac mini late 2012)

Mac OS X で「ルート」ユーザを有効にして使用する

http://support.apple.com/kb/ht1528?viewlocale=ja_JP

Windows環境でのCapsLock → Ctrl 置き換えと同様の設定

アップルメニュー > システム環境設定 > キーボード > 修飾キー
[CapsLock] に [Command]を割り当てる

[Alt]+[Tab]でタスク切り替え

上記置き換えのあとKeyRemap4MacBookで「Swap Command + Tab and Option + Tab」を有効にする

[CapsLock] に [Command] が割り当ててあるが、ターミナルの時は[Control] にしたい

KeyRemap4MacBookで「Command_L to Control_L (only in Terminal)」を有効にする

make, configure などの開発用コマンドラインツールを導入

Xcodeを起動し、メニューから
Xcode > Preferences > Downloadsタブ > Command Line Tools で Install

Apache2.2.4のコンパイル

mkdir /usr/local/src
cd /usr/local/src
curl -O http://ftp.tsukuba.wide.ad.jp/software/apache//httpd/httpd-2.4.4.tar.gz
tar -xvzf httpd-2.4.4.tar.gz
cd httpd-2.4.4
./configure --prefix=/usr/local/httpd-2.4.4
...
checking for gcc... /Applications/Xcode.app/Contents/Developer/Toolchains/OSX10.8.xctoolchain/usr/bin/cc
checking whether the C compiler works... no
configure: error: in `/usr/local/src/httpd-2.4.4':
configure: error: C compiler cannot create executables
....
# エラー対応 シンボリックリンク作成 c - Problems with compiling apache2 on Mac OS X Mountain Lion - Stack Overflow
sudo ln -s /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain /Applications/Xcode.app/Contents/Developer/Toolchains/OSX10.8.xctoolchain
# リトライ
./configure --prefix=/usr/local/httpd-2.4.4
...
checking for pcre-config... false
configure: error: pcre-config for libpcre not found. PCRE is required and available from http://pcre.org/
...
#エラー対応 PCREインストール
cd /usr/local/src/
curl -O http://jaist.dl.sourceforge.net/project/pcre/pcre/8.32/pcre-8.32.tar.gz
tar -xvzf pcre-8.32.tar.gz
cd pcre-8.32
./configuire
make
make install
# リトライ
cd /usr/local/src/httpd-2.4.4
./configure --prefix=/usr/local/httpd-2.4.4
make
make install
# 起動
/usr/local/httpd-2.4.4/bin/apachectl -k start

メール送信

/var/log/maillog

stat=Deferred: local mailer (/usr/bin/procmail) exited with EX_TEMPFAIL

rootなど普段POPされていないメールのスプールがいっぱいでないか?
→ディスク容量が開いていても2GBまでのファイルしか作成されない環境がある
spoolがいっぱいだったら、バックアップを取得したあとnullで上書きして削除する

cat /dev/null > /var/spool/mail/root

CentOS5.5でPHPをソースからコンパイルしたが、libphp5.soが生成されなかった時の対応

一度コンパイルした後、apacheに付属しているlibtoolを使用して再度コンパイルする。

cd /hogehoge/php-5.1.6 # ソースを展開したフォルダ

# まず一旦コンパイル(--with-apxs2 と --with-apx2の違いに注意)
./configure --prefix=/usr/local/php5 --with-apxs2=/usr/sbin/apxs
make
make install

# apacheのlibtoolをPHPのソースを展開したフォルダへコピー
cp /usr/lib/apr-1/build/libtool .

# 掃除
make clean
make distclean

# 実運用に必要なオプションを付けて、再度コンパイル
./configure --prefix=/usr/local/php5 --with-apxs2=/usr/sbin/apxs --enable-mbstring --enable-module=so
make
make install

# libphp5.soが作成されている(作成される場所は環境によって異なる)
ls /usr/lib/httpd/modules/libphp5.so
/usr/lib/httpd/modules/libphp5.so


via. http://www.oklab.org/language_c/php5_0_2_install_bug.htm