2011年8月19日金曜日

VNCSERVERの設定(備忘録)

再インストールになってしまったため、VNCもまた設定しなければならない。 しかし、年に何度も設定する訳ではないのでどうしても忘れてしまう。('ヘ`;まいったなぁ..\ 年のせいかなぁ。

なので、いつも行う設定はブログに書き留めておくことにした。

設定する内容
  1. VNCSERVERのインストール
  2. /etc/services にvncを追加
  3. /etc/xinetd.d/vncserver を作成
  4. xinetd を再起動
  5. セキュリティレベルとファイアウォールの設定
    (iptableの設定)/li>

VNCSERVERのインストール

CENTOSでも最新版では、通常のインストール時に選択しておけばインストールされる。仮りに、インストールされていなかったとしても、インストールすれば良い。

yum install vnc vnc-server


/etc/services にvncを追加

# Local services
vnc 5901/tcp # VNC SERVER


/etc/xinetd.d/vncserver を作成

service vnc
{
   socket_type     = stream
   wait            = no
   user            = nobody
   server          = /usr/bin/Xvnc
   server_args     = -inetd -query localhost -once -geometry 1024x640 -depth 16 -SecurityTypes None
   log_on_failure  += USERID
   disable         = no
}


設定したら、xinetd(スーパーサーバ)を再起動する。

[root@hoge ~]# service xinetd restart
xinetd を停止中:                                           [  OK  ]
xinetd を起動中:                                           [  OK  ]
[root@ora02 ~]# 


セキュリティレベルとファイアウォールの設定
(iptableの設定)
下記の画面でVNCで利用するポート番号を設定する。

コマンドでiptablesを設定する場合は、vncserverのポートを開ける。例えば、192.168.1.0/24にアクセスを許可する場合は次のようにする。

■設定する内容。
[root@hoge ~]# iptables -A RH-Firewall-1-INPUT -s 192.168.1.0/24 -p tcp -m state --state NEW -m tcp --dport 5901 -j ACCEPT 
  ↓(実際は、定義に挿入するので -I(insert)オプションで設定
[root@hoge ~]# iptables -I RH-Firewall-1-INPUT 18 -s 192.168.1.0/24 -p tcp -m state --state NEW -m tcp --dport 5901 -j ACCEPT 

■ -I オプションを行うために事前に下記のコマンドで行番号を確認する
[root@hoge ~]# iptables -L --line-bumber

■設定後下記のコマンドで確認。
[root@hoge ~]# iptables-save 

■設定ファイルに反映さえる。(事前に変更前のバックアップを取ることを勧めます)
[root@hoge ~]# iptables-save > /etc/sysconfig/iptables
 または、
[root@hoge ~]# service iptables save

■iptablesを再起動する。
[root@hoge ~]# service iptables restart

2011年8月16日火曜日

Apple Magic Mouse 交換してもらえた!

昨日、Apple Magic Mouse を修理に持ち込もうと一応購入元の修理受付(ヨドバシの修理)に電話したら、「購入店舗に持って行けば修理受付してくれる」との事。しかし、ネットだとアップルストアに持ち込むような感じがしたが、とりあえずヨドバシアキバへ GO!

ヨドバシに着き、早速店員さんにお願いするとなんと「Apple製品の修理受付はヨドバシでは行っていないので、お近くのアップルストアへ」と言われ愕然 ◇\(;_;)/◇ 

一応、なぜここに来たかの経緯(電話でヨドバシの修理センタで言われた)を説明したところ、少し待たされてから...

なんと、新品に交換してもらえた。

「修理センターの担当者の間違いなので交換でお許し下さい。」と...

流石 ヨドバシ やるなぁ〜 と思わず感心してしまった。

ここの中では、はてさて どこのアップルストアへ向かうかと考えていたところだった。(そう言えば、家の近所のケーズデンキの中にアップルストアが出来た事を思い出し、なんてアホな! と自己嫌悪に陥りそうになっていたところだった)

以前も似たような対応を受けた事があり、益々ヨドバシが気に入ってしまった。

ヨドバシはサービスが良いぞ!

2011年8月11日木曜日

Apple Magic Mouse 故障 ?!

昨日、突然マウス(Apple Magic Mouse)が動かなくなった。
いつものように、電池が切れたのか(またかよ)と思いながら電池を交換したが...
なんで〜... 動かないじゃないか?
電池がおかしいのか? と思い別の新品の電池と交換してもやはり動かない。

なんか変だな〜、と思いマウスの設定や動作確認をすると Bluetooth にもしっかりと認識されており、マウスのクリックやスワイプも動作するが、マウスカーソルだけが動かない状況だった。

ネットで同様の現象がないか検索すると早速発見!。
やはり、Magic Mouse のレンズ部分が汚れもしくは故障のようだ。
汚れの場合は、エアーやレンズクリーナー用の布で清掃することで解消されるとのようだが、我輩の Magic Mouse のカーソルは一向に動いてくれなかった。

修理に出すしかないようだ...
週末にでも修理にだすか... (/_;)

2011年7月26日火曜日

VirtualHostの設定ミス

httpd.conf を変更(書き直し)していたら、apache の起動時に下記のエラーが発生。(オヨヨ)

[root@hogehoge ~]# service httpd restart
httpd を停止中:                                            [  OK  ]
httpd を起動中: [Tue Jul xx hh:mm:ss YYYY] [warn] _default_ VirtualHost overlap on port 80, the first has precedence
 
httpd.conf に設定ミス(漏れ)があった。
NameVirtualHost *:80
設定を追加(コメントを解除)して完了!(OK!)

CAKEPHP でそのまま実行すると下記のようにエラーになる。(いつも事だな。)

Release Notes for CakePHP 1.3.10.
Read the changelog

Notice (1024): Please change the value of 'Security.salt' in app/config/core.php to a salt value specific to your application [CORE/cake/libs/debugger.php, line 684]

Warning: touch() [http://php.net/function.touch]: Utime failed: Permission denied in /var/www/cakephp-1.3.10/cake/libs/file.php on line 125

Notice (1024): Please change the value of 'Security.cipherSeed' in app/config/core.php to a numeric (digits only) seed value specific to your application [CORE/cake/libs/debugger.php, line 688]

URL rewriting is not properly configured on your server.

    Help me configure it
    I don't / can't use URL rewriting

Your tmp directory is writable.

The FileEngine is being used for caching. To change the config edit APP/config/core.php

Your database configuration file is NOT present.
Rename config/database.php.default to config/database.php
saltの変更を促す警告
Notice (1024): Please change the value of 'Security.salt' in app/config/core.php to a salt value specific to your application [CORE/cake/libs/debugger.php, line 684]
(変更箇所)
/**
 * A random string used in security hashing methods.
 */
 Configure::write('Security.salt', '****************************************');
Security.saltに設定する値は、mkpasswd で作成するのが便利。
mkpasswd -l 40
※mkpasswd は、ecpectパッケージに含まれています。


cipherSeed 値の変更を促される。
セキュリティ強化のため、今回の cakephp-1.3.10 あたりで追加されたらしい。
Notice (1024): Please change the value of 'Security.cipherSeed' in app/config/core.php to a numeric (digits only) seed value specific to your application [CORE/cake/libs/debugger.php, line 688]
(変更箇所)
/**
 * A random numeric string (digits only) used to encrypt/decrypt strings.
 */
 Configure::write('Security.cipherSeed', '******************************');

Security.cipherSeedに設定する値も mkpasswd で作成するのが便利。
mkpasswd -l 30 -c 0 -d 30 -C 0 -s 0


mod_rewiteの設定に問題あり?
URL rewriting is not properly configured on your server.
バーチャルホストの設定で、下記のディレクティブを設定。
    
        Options FollowSymLinks
        AllowOverride All
    
ようやく無事に初期画面が表示されたぜ。
※データベースの設定はまだだけどね。

PHP5.3 タイムゾーン エラー?

ディスクがクラッシュして再インストールしているが、CAKEPHP(1.3.10)を実行しようとすると下記のエラーが発生。

Warning (2): strtotime() [http://php.net/function.strtotime]: It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'Asia/Tokyo' for 'JST/9.0/no DST' instead [CORE/cake/libs/cache.php, line 597]

Notice: Trying to get property of non-object in /var/www/html/cakephp/cake/libs/cache/file.php on line 248 Fatal error: Call to a member function cd() on a non-object in /var/www/html/cakephp/cake/libs/cache/file.php on line 248 
今回は PHP5.3 をインストールしてしたが、PHPの設定タイムゾーンの設定が必要なようだ。(いつの間に r(?_?);)
変更前 PHP.ini
[Date]
; Defines the default timezone used by the date functions
; http://www.php.net/manual/en/datetime.configuration.php#ini.date.timezone
;date.timezone =
変更後 PHP.ini
[Date]
; Defines the default timezone used by the date functions
; http://www.php.net/manual/en/datetime.configuration.php#ini.date.timezone
date.timezone = Asia/Tokyo

2011年7月23日土曜日

SELinux でつまずく

ファイルおよびフォルダに設定されいるタイプの詳細を確認しようと考え、seedit-gui をインストールして seed-init を実行する。しかし、これがいけなかったようだ。seed-init 実行後に再起動をしたら起動できなかった。

とりあえず、boot時にselinuxを無効にして起動をさせた。

boot時に selinuxを無効にする。
起動時に F2 を押し boot オプションを選択する。

title Turbolinux
kernel (hd0,0)/boot/vmlinuz root=0802 selinux=0
initrd (hd0,0)/boot/initrd