CentOS/ScientificLinux6でMyNETSを動かす

■CentOS/ScientificLinux6でMyNETSを動かす

ということで、試行錯誤してなんとか動かせたのでメモっておきます。

使ったのはScientificLinux6.7です。
標準ではphp5.3.3、mysql5.1.6ですが、不具合の問題で以下の対応をしました。

・全文検索用にmroongaを使う都合でoracle版mysql5.6導入
・MyNETSで日記投稿時エラーのためphpをius版5.3.29導入

■mroonga&oracle版mysqlインストール

$ yum install -y http://packages.groonga.org/centos/groonga-release-1.1.0-1.noarch.rpm
$vi /etc/yum/yum.repos.d/groonga.repo
以下修正
/centos/$releasever/ → /centos/6/
$ yum install -y http://repo.mysql.com/mysql-community-release-el6-5.noarch.rpm
$ yum makecache
$ yum install -y mysql-community-server
$ /sbin/service mysqld start
$ yum install -y mysql-community-mroonga
$ yum install -y groonga-tokenizer-mecab

$mysql -uroot
mysql> show engines;
mroongaを確認

# vi /etc/my.cnf
互換性のため以下を追記
character-set-server = utf8
skip-host-cache
skip-name-resolve
sql_mode=”
old_passwords=0

以下の設定はエラーになるので廃止
default-character-set=
table_cache=
log-slow-querie=
log=

■ius版php導入

# vi /etc/yum.repos.d/ius.repo
以下の内容で作成
[ius]
name=IUS Community Packages for Enterprise Linux 6 – $basearch
baseurl=http://dl.iuscommunity.org/pub/ius/archive/CentOS/6/$basearch
#mirrorlist=http://dmirr.iuscommunity.org/mirrorlist?repo=ius-el6&arch=$basearch
failovermethod=priority
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/IUS-COMMUNITY-GPG-KEY

# cd /etc/pki/rpm-gpg/
# wget http://dl.iuscommunity.org/pub/ius/IUS-COMMUNITY-GPG-KEY

# yum update
# yum install yum-plugin-replace
# yum replace php –replace-with php53u

# vi /etc/php.ini
error_reporting = E_ALL & ~E_NOTICE & ~E_DEPRECATED

■全文検索用データ修正
mysqlのダンプデータを以下のように書き換え

 FULLTEXT KEY `fullindex` (`body`) /*!50100 WITH PARSER `mecab` */
) ENGINE=MyISAM AUTO_INCREMENT=100 DEFAULT CHARSET=utf8;
 ↓
 FULLTEXT INDEX (`body`)
) ENGINE=mroonga AUTO_INCREMENT=100 DEFAULT CHARSET=utf8;

たぶん、これでOK

, , ,
とりあえず付けておく無駄ではなかったなまぁまぁ読めたちょっと役に立ったかなかなり良かったかも (まだ評価されていません)
Loading...

wordpressの管理ページの一部が開けない対処

■wordpressの管理ページの一部が開けない対処
wordpressのコンテンツをSL5.9からSL6.5のサーバに移行したら、通常ページは問題なく動作するのに、管理ページの一部のみが表示できない(真っ白になる)問題が発生した。

WP_DEBUGにもmessegaeにもapacheのerror.logにも何もでないのでおかしいなぁと思っていろいろ調べてみると、どうやらphpのcache系でそういう現象が起きることがあるらしい。eAcceleratorを入れていたので.htaccessでキャッシュを無効化したところ適切に表示できるようになった。

やったのは以下。

  1. # vi /var/www/<wordpresspath>/wp-admin/.htaccess
  2. php_flag eaccelerator.enable 0
  3. php_flag eaccelerator.optimizer 0

エラーがうまく出てこない時にはとりあえず試してみるといいかもしれない。

, , , ,
とりあえず付けておく無駄ではなかったなまぁまぁ読めたちょっと役に立ったかなかなり良かったかも (まだ評価されていません)
Loading...

CommuniGateProのIPアドレスブロックの解除

■CommuniGateProのIPアドレスブロックの解除
 CommuniGate Proで意図しないIPアドレスブロックが発生した場合に、サービスの再起動をしないでIPアドレスブロックを解除する方法。PWDのアクセスがクローズされていないことが条件。「←」がついているところがユーザの入力部分。

1)PWDコマンドでアクセスする

  1. # telnet 127.0.0.1 106 ←
  2. Trying 127.0.0.1...
  3. Connected to localhost.localdomain (127.0.0.1).
  4. Escape character is '^]'.

2)管理者でログイン

  1. 200 CommuniGate Pro PWD Server 5.4.x ready <1.1366768425@localhost.localdomain>
  2. user postmaster ←
  3. 300 please send the PASS
  4. pass userpassword ←
  5. 200 login OK, proceed

3)現在一時的にブロックされているIPアドレスを表示する(IPアドレスの後ろは残秒数)

  1. GETTEMPBLACKLISTEDIPS ←
  2. 200 data follow
  3. "[192.168.1.1]-2669"

4)ブロック解除したいIPアドレスの時間(秒数)を書き換えで対処する

  1. SETTEMPBLACKLISTEDIPS "[192.168.1.1]-10" ←
  2. 200 OK

5)秒数が書き換わったことを確認する

  1. GETTEMPBLACKLISTEDIPS ←
  2. 200 data follow
  3. "[192.168.1.1]-6"

6)指定時間経過後リストから消えたことが確認できる

  1. GETTEMPBLACKLISTEDIPS ←
  2. 200 data follow
  3. ""
,
とりあえず付けておく無駄ではなかったなまぁまぁ読めたちょっと役に立ったかなかなり良かったかも (まだ評価されていません)
Loading...

■Debian v7 でCommuniGateProのdebパッケージを調べる
 CommuniGate Proのdebパッケージが非公式ながら作成されていたので、どんな構成になっているのか調べてみたメモ。ちなみにCommuniGate ProとしてはLinuxではrpmでパッケージされたものが公式ということらしい。

■パッケージ情報を取得

  1. # dpkg-deb --info cgatepro-linux_6.0-5a_i386.deb
  2. 新形式 debian パッケージ、バージョン 2.0。
  3. サイズ 51972190 バイト: コントロールアーカイブ = 709 バイト。
  4.      24 バイト、    1 行      conffiles
  5.     293 バイト、    9 行      control
  6.     511 バイト、   22 行   *  postinst             #!/bin/sh
  7.      77 バイト、    5 行   *  postrm               #!/bin/sh
  8.     156 バイト、    7 行   *  prerm                #!/bin/sh
  9. Package:cgatepro-linux
  10. Version: 6.0-5a
  11. Priority: optional
  12. Architecture: i386
  13. Depends:
  14. Section: non-free/comm
  15. Maintainer: CommuniGate Systems <support@communigate.com>
  16. Description: THE Integrated Communication Server.
  17.  SIP, XMPP, ESMTP, POP3, IMAP4, MAPI, List, Web Email, poppwd, LDAP, ACAP.

■パッケージ内のdata部分を表示

  1. # dpkg-deb -c cgatepro-linux_6.0-5a_i386.deb
  2. drwxr-xr-x root/root         0 2013-04-05 21:54 ./
  3. drwxr-xr-x root/root         0 2013-04-05 21:54 ./etc/
  4. drwxr-xr-x root/root         0 2013-04-05 21:54 ./etc/init.d/
  5. -rwxr-xr-x root/root      2806 2013-04-05 21:54 ./etc/init.d/CommuniGate
  6. drwxr-xr-x root/root         0 2013-04-05 21:54 ./usr/
  7. drwxr-xr-x root/root         0 2013-04-05 21:54 ./usr/share/
  8. drwxr-xr-x root/root         0 2013-04-05 21:54 ./usr/share/doc/
  9. drwxr-xr-x root/root         0 2013-04-05 21:54 ./usr/share/doc/cgatepro-linux/
  10. -rw-r--r-- root/root      2738 2013-04-05 21:54 ./usr/share/doc/cgatepro-linux/copyright
  11. drwxr-xr-x root/root         0 2013-04-05 21:54 ./opt/
  12. drwxr-xr-x root/root         0 2013-04-05 21:54 ./opt/CommuniGate/
  13. ...以下略

■パッケージのコントロール情報を展開して中身を確認する

  1. # dpkg-deb -e cgatepro-linux_6.0-5a_i386.deb
  2. # cd DEBIAN (DEBIANというディレクトリが生成される)
  3. # ls -al
  4. 合計 28
  5. drwxr-xr-x 2 root root 4096  4月  5 21:54 .
  6. drwx------ 5 root root 4096  5月 22 14:12 ..
  7. -rw-r--r-- 1 root root   24  4月  5 21:54 conffiles
  8. -rw-r--r-- 1 root root  293  4月  5 21:54 control
  9. -rwxr-xr-x 1 root root  511  4月  5 21:54 postinst
  10. -rwxr-xr-x 1 root root   77  4月  5 21:54 postrm
  11. -rwxr-xr-x 1 root root  156  4月  5 21:54 prerm
  12. # less でそれぞれ確認

■パッケージ内のdata部分を展開して確認する

  1. # mkdir test
  2. # dpkg-deb --extract cgatepro-linux_6.0-5a_i386.deb test
  3. # cd test
  4. # ls -al (などして確認)
,
とりあえず付けておく無駄ではなかったなまぁまぁ読めたちょっと役に立ったかなかなり良かったかも (まだ評価されていません)
Loading...

■Debian v7 に sipp v3.3 を導入したメモ
 Debianにはsippがsip-testerとして用意されているが、aptで導入できるバージョンがv3.2なので、v3.3を導入したメモ。

■依存性解決のためv3.2を先に導入しておく
# apt-get install sip-tester
# sipp -v
3.2-PCAP

■v3.3を導入する(RTP再生できるようにpcapplayオプション付きでmake)
# wget http://downloads.sourceforge.net/project/sipp/sipp/3.3/sipp-3.3.tar.gz
# tar zxvf sipp-3.3.tar.gz
# cd sipp-3.3
# apt-get install automake gcc g++ libpcap-dev libncurses5-dev libncursesw5-dev
# make pcapplay
# ./sipp -v
3.3-PCAP

, ,
とりあえず付けておく無駄ではなかったなまぁまぁ読めたちょっと役に立ったかなかなり良かったかも (1 投票, 平均値/最大値: 4.00 / 5)
Loading...

■Debian環境でネットワークI/Fを追加するメモ
 VirtualBoxで後からホストオンリーネットワークI/Fを固定IPで追加した時のメモ。重要なのはauto行を正しく追加すること。

  1. # vi /etc/network/interfaces
  2. ーー
  3. # This file describes the network interfaces available on your system
  4. # and how to activate them. For more information, see interfaces(5).
  5.  
  6. # The loopback network interface
  7. auto lo
  8. iface lo inet loopback
  9.  
  10. # The primary network interface
  11. auto eth0 eth1
  12. allow-hotplug eth0
  13. iface eth0 inet dhcp
  14.  
  15. iface eth1 inet static
  16. address 192.168.56.xxx
  17. netmask 255.255.255.0
,
とりあえず付けておく無駄ではなかったなまぁまぁ読めたちょっと役に立ったかなかなり良かったかも (まだ評価されていません)
Loading...

■Debian v6 squeezeからv7 wheezyへのアップグレード
 Debian v6(6.0.7)からDebian v7へのアップグレードしたメモ。アップグレード手順はほぼDebianのドキュメント通り。(バックアップ等の手順は今回無視)

■環境の最新化
# apt-get update
# apt-get upgrade

■アップグレード準備
# vi /etc/apt/sources.list
squeeze を全て wheezy に置き換え

■アップグレードする
# apt-get update
# apt-get dist-upgrade

※注意
マシン再起動後はPAE必須のKernel3.2ベースで起動するので、CPUはPAE対応であることを必ず確認しておくこと。
PAE無しかkernel2.6系を引き続き使用する場合には
# vi /boot/grub/grub.cfg
を編集。

, ,
とりあえず付けておく無駄ではなかったなまぁまぁ読めたちょっと役に立ったかなかなり良かったかも (まだ評価されていません)
Loading...

■Debian wheezy にCommuniGateProをインストールしたメモ
 Debian v7 wheezyでのCGPのインストール方法をチェック。6.xも手順は同様。rpmでもdeb化でも以下の手順で5.4.xが適切に動作することを確認。

■パッケージの入手
# wget http://www.communigate.com/pub/CGatePro/5.4/CGatePro-Linux_5.4-10.i386.rpm

■rpmでインストール場合
# apt-get install rpm
# rpm -ivh –nodeps CGatePro-Linux_5.4-10.i386.rpm

起動scriptを修正
# vi /etc/init.d/CommuniGate
・ulimit -u から始まる1行を削除する
・touch /var/lock/subsys/CommuniGate
  ↓
 mkdir /var/lock/subsys
 touch /var/lock/subsys/CommuniGate

起動
# /etc/init.d/CommuniGate start
停止
# /etc/init.d/CommuniGate stop
アンインストール
# rpm -e –nodeps CGAtePro-Linux

■debでインストールする場合(alienで変換する)
# apt-get install alien
# alien -d –scripts CGatePro-Linux_5.4-10.i386.rpm
# dpkg -i cgatepro-linux_5.4-11_i386.deb

起動scriptを修正
# vi /etc/init.d/CommuniGate
・ulimit -u から始まる1行を削除する
・touch /var/lock/subsys/CommuniGate
  ↓
 mkdir /var/lock/subsys
 touch /var/lock/subsys/CommuniGate

起動
# /etc/init.d/CommuniGate start
停止
# /etc/init.d/CommuniGate stop
アンインストール
# dpkg -r cgatepro-linux

,
とりあえず付けておく無駄ではなかったなまぁまぁ読めたちょっと役に立ったかなかなり良かったかも (まだ評価されていません)
Loading...

■侵入改竄検知システム AIDE を使うメモ
 長くIDSとしてOsirisを使ってきたが時勢に合わなくなってしまったので、CentOS/ScientificLinuxに標準装備されているAIDEを使ってみたメモ。

■インストールと簡単な使い方

  1. # yum install aide
  2.  
  3. 設定編集(コメント充実)
  4. # vi /etc/aide.conf
  5. R = p+l+i+n+u+g+s+m+acl+selinux+xattrs+md5
  6.  
  7. 初期化
  8. # aide -i
  9.  
  10. 比較用DB作成
  11. # cp /var/lib/aide/aide.db.new.gz /var/lib/aide/aide.db.gz
  12.  
  13. 比較
  14. # aide -C
  15.  
  16. 通常用途
  17. # aide -u

■CentOS5系でselinuxで問題が出るケースの設定変更例

  1. # vi /etc/aide.conf
  2.  
  3. R = p+l+i+n+u+g+s+m+acl+xattrs+md5
  4. L = p+l+i+n+u+g+acl+xattrs
  5. > = p+l+u+g+i+n+S+acl+xattrs
  6.  
  7. DIR = p+l+i+n+u+g+acl+xattrs
  8.  
  9. PERMS = p+l+i+u+g+acl
  10.  
  11. DATAONLY =  p+l+n+u+g+s+acl+xattrs+md5+sha256+rmd160+tiger

■Prelink関連のエラーが出る場合の設定変更例

  1. # sed -i '/^PRELINKING=yes$/s/yes/no/' /etc/sysconfig/prelink
  2. # /usr/sbin/prelink -ua

■cron用script例

  1. # vi /root/script/aide.sh
  2. #!/bin/bash
  3.  
  4. /usr/sbin/aide -u
  5. /bin/cp -fr /var/lib/aide/aide.db.new.gz /var/lib/aide/aide.db.gz

■MyNETS用改竄検知設定例(/var/www/sns/wwwをSNS rootとする)

  1. # vi /etc/aide.conf
  2. # MyNETS SNS DIR
  3. /var/www/sns/www NORMAL
  4. !/var/www/sns/www/img
  5. !/var/www/sns/www/var

■参考リンク
http://pooh.gr.jp/?p=9633
http://blog.cecily.jp/kotou/51/
http://aikotobaha.blogspot.jp/2011/11/rhel-aide.html

, , , ,
とりあえず付けておく無駄ではなかったなまぁまぁ読めたちょっと役に立ったかなかなり良かったかも (まだ評価されていません)
Loading...

■CentOS6/ScientificLinux6にmroongaを導入する
 CentOS6/ScientificLinux6にはmysql5.1.xが導入されていて、日本語全文検索にtritonnが利用できないので、後継プロジェクトになっているmroongaを導入し、日本語全文検索を可能にする。実際の手順はほぼmroongaの公式HPの通り。

 mroonga
 http://mroonga.github.io/ja/

■インストール(mysqlは導入済み)

  1. # rpm -ivh http://packages.groonga.org/centos/groonga-release-1.1.0-1.noarch.rpm
  2.  
  3. ※ScientificLinux6は以下のbaseurl修正を行う
  4. # vi /etc/yum.repos.d/groonga.repo
  5. baseurl=http://packages.groonga.org/centos/6/$basearch/
  6.  
  7. # yum makecache
  8. # yum install -y mysql-mroonga groonga-tokenizer-mecab
  9.  
  10. # mysql -u root -p
  11. mysql> show engines;
  12. mysql> INSTALL PLUGIN mroonga SONAME 'ha_mroonga.so';

■動作確認方法

  1. # mysql -u root -p
  2. mysql> show engines;
  3. mysql> use test;
  4. mysql> create table diaries ( id INT primary key auto_increment, content varchar(255), fulltext index (content) ) engine = mroonga default charset utf8;
  5. mysql> INSERT INTO diaries (content) VALUES ("明日の天気は晴れでしょう。");
  6. mysql> INSERT INTO diaries (content) VALUES ("明日の天気は雨でしょう。");
  7. mysql> SELECT * FROM diaries WHERE MATCH(content) AGAINST("晴れ");

検索できればOK。
検索スコアでソートは以下で確認。

  1. mysql> INSERT INTO diaries (content) VALUES ("今日は晴れました。明日も晴れるでしょう。");
  2. mysql> INSERT INTO diaries (content) VALUES ("今日は晴れましたが、明日は雨でしょう。");
  3. mysql> SELECT *, MATCH (content) AGAINST ("晴れ") FROM diaries WHERE MATCH (content) AGAINST ("晴れ") ORDER BY MATCH (content) AGAINST ("晴れ") DESC;

■tritonnデータからの移行
 tritonnでダンプしたデータのうち以下の部分を修正する(ストレージモードで利用)

  1.  FULLTEXT KEY `fullindex` (`body`) /*!50100 WITH PARSER `mecab` */
  2. ) ENGINE=MyISAM AUTO_INCREMENT=100 DEFAULT CHARSET=utf8;
  3.  ↓
  4.  FULLTEXT INDEX (`body`)
  5. ) ENGINE=mroonga AUTO_INCREMENT=100 DEFAULT CHARSET=utf8;

これで新しいDBへインポートすればOK。

, , , ,
とりあえず付けておく無駄ではなかったなまぁまぁ読めたちょっと役に立ったかなかなり良かったかも (まだ評価されていません)
Loading...