2012年7月29日日曜日

remi, epelリポジトリの追加

epelを追加
rpm -ivh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
http://dl.fedoraproject.org/pub/epel/6/からepel-release-6xxx.rpm をインストール
時々数字が上がってアップデートされるので、目視確認。

remiを追加
rpm -ivh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm


PHP5.4 を入れてみる
yum install php-mbstring php-devel php-common php-cli php-mysql php-pear php php-pdo --enablerepo=remi-test,remi

MySQL5.5
yum --enablerepo=remi install mysql-server mysql-devel mysql mysql-libs


とうとう、PHPをやることになった。
2012年夏

2012年5月21日月曜日

cross join

いままで、cross joinなんて何のためにあるのかと思っていました。
しかし、その威力に驚いた。 (半年前の気持ち)


inner joinってのは、cross joinの特例であるということ。

普通は、idでjoin して、正規化されたテーブルをくっつけていく。
これはこれで、全うな、意味のある結果を取り出せる。

たとえば、日付ごとのデータがある場合、日付でcross joinした物をサブクエリで
利用すると、日付ごとの累積データが出せたり、特定の日付までの最大値が
出せたりと、かなり使える。

join の後に、onを付けなければ、世界が広がる。
(いや、corss joinも条件を付けなきゃただの直積でおわる)

ただし、PostgreSQLでは、結構なパフォーマンスで使えるが、
MySQLでは、あるレコード数になると、極端に遅くなる。

インデックスのせいなのか、joinのパフォーマンスが悪いのか?
自力では特定できず、あきらめた。
MySQLもそこそこ自信があったけど、ダメだった。

よくわからない、エントリーでどうしようもないので、とりあえず終わり。

2011年11月17日木曜日

logrotateの設定


■ アスタリスクでのパス指定
アスタリスクでサブディレクトリも含めて記述でき、
空白で区切ることによって、複数のパスを記述できる。

/var/log/basedir/*.log /var/log/basedir/*/*.log {
    daily
    rotate 5
}

logrotating files in a directories and its subdirectories

バーチャルホストをいくつか追加するときに。


■ 設定の確認
logrotate -dv /etc/logrotate.d/httpd

2011年8月2日火曜日

apacheの情報露出を減らす

以下の項目でwebサーバーの情報表示を最小限に。

ServerTokens Prod

ServerSignature Off

2011年7月4日月曜日

mod_wsgi 3.3 のインストール



mod_wsgi

apacheのライブラリ

yum install httpd-devel.x86_64


インストール

./configure --with-python=/usr/local/bin/python2.7
make
make install


mod_wsgiのログ

cp .libs/mod_wsgi.so /usr/lib64/httpd/modules/mod_wsgi.so
cp .libs/mod_wsgi.lai /usr/lib64/httpd/modules/mod_wsgi.la
cp .libs/mod_wsgi.a /usr/lib64/httpd/modules/mod_wsgi.a
chmod 644 /usr/lib64/httpd/modules/mod_wsgi.a
ranlib /usr/lib64/httpd/modules/mod_wsgi.a
PATH="$PATH:/sbin" ldconfig -n /usr/lib64/httpd/modules
----------------------------------------------------------------------
Libraries have been installed in:
   /usr/lib64/httpd/modules

If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the `-LLIBDIR'
flag during linking and do at least one of the following:
   - add LIBDIR to the `LD_LIBRARY_PATH' environment variable
     during execution
   - add LIBDIR to the `LD_RUN_PATH' environment variable
     during linking
   - use the `-Wl,--rpath -Wl,LIBDIR' linker flag
   - have your system administrator add LIBDIR to `/etc/ld.so.conf'

See any operating system documentation about shared libraries for
more information, such as the ld(1) and ld.so(8) manual pages.
----------------------------------------------------------------------
chmod 755 /usr/lib64/httpd/modules/mod_wsgi.so

2011年7月3日日曜日

Python2.7 のインストール


2.6の時と同じ。

必要なライブラリ

とりあえず、以下のものは入れておく。
yum install sqlite-devel.x86_64 zlib-devel
yum install gdbm-devel.x86_64 readline-devel.x86_64 readline-devel.x86_64 freetype-devel.x86_64
yum install bzip2-devel.x86_64 yum install db4-devel.x86_64 openssl-devel.x86_64 gdbm-devel.x86_64 ncurses-devel.x86_64

zlib-develはPILで必要なので32bit版も入れる
dl, imageop はなくなるモジュールなので無視
ここで入れ忘れても、make, make install で、追加したものだけインストールできる。

インストール

./configure --enable-shared
make
make install

/usr/local/bin の検索順位が /usr/bin より前なので、
rm /usr/local/bin/python
で、消しておく。

ライブラリ検索の登録


方法1
ln -s /usr/local/lib/libpython2.7.so.1.0 /usr/lib64/

方法2
rootになって、
echo "/usr/local/lib" > /etc/ld.so.conf.d/local.conf
ldconfig

方法3
やったこと無いけど、
LD_LIBRARY_PATH を使う。



モジュールインストール

setuptoolsのインストール
wget http://peak.telecommunity.com/dist/ez_setup.py
python2.7 ez_setup.py

easy_install pip

とりあえず、これは入れておく。
yum install mysql-devel.x86_64
pip install MySQL-python
yum install libxml2-devel.x86_64
yum install libxslt-devel.x86_64
pip install lxml
pip install zenhan
pip install feedparser
pip install django
pip install Werkzeug