2009/02/27

CentOS 5.2 の vsftpd

www.centos.org - The Community ENTerprise Operating System

CentOS 5.2 標準の FTPサーバ vsftpd ですが、設定は間違ってないはずなのになぜかログインできません。


FTP クライアントのログには次のように出力されています。


500 OOPS: cannot change directory:/home/xxx
500 OOPS: child died
ログインできません.


サーバのログを見ると・・・


setroubleshoot: SELinux は ftp デーモンによるユーザーのホームディレ クトリ (./home) の読み込みを阻止しています。 For complete SELinux messages.


どうやら、OS のセキュリティを高める機能である、SELinux が vsftp によるホームディレクトリへのアクセスを拒否していたようです。


次のようにすることで、解除できます。


$ sudo /usr/sbin/setsebool -P ftp_home_dir 1

これで問題なくアクセスできます。

2009/02/26

MySQL 3.23.58 を CentOS 5.2 にインストールする

MySQL ::  世界でもっとも普及している、オープン ソース データベース
[10.09.15 update]ソースファイルのリンクを修正

自社サーバを一台新調することになったのですが、とある事情から MySQL は Ver 3.23.58 を使用しなければならず、でも Apache は 2.2 系を使いたい!

というわけで、OS やその他の環境は最新の CentOS 5.2 を使用し、MySQL 3.23.58 はソースからインストールすることにしました。

しかしながら、最新の環境にきわめて古いソフトをインストールすると、ほぼ間違いなく躓くもので。


ダウンロード


まずはダウンロードですが、もはや公式サイトのアーカイブにも見当たりません・・・

ので、MySQL日本正規代理店の SoftAgency 様から拝借いたします。

既に SoftAgency 様にも見当たらなくなってしまいました。
ですので、ソースファイルはこちらにアップしておきます。

>> Download MySQL-3.23.58

$ wget http://download.softagency.net/MySQL/Downloads/MySQL-3.23/mysql-3.23.58.tar.gz
$ tar -zxvf mysql-3.23.58.tar.gz
$ cd mysql-3.23.58/


Configure


Makefile ファイルを作成するために、configure を実行します。

$ ./configure \
 --prefix=/usr/local/mysql \
 --with-charset=sjis \
 --with-extra-charsets=all \
 --with-mysqld-user=mysql \
 --without-bench \
 --localstatedir=/home/mysql/data

checking "LinuxThreads"... "Not found"
configure: error: This is a linux system and Linuxthreads was not
found. On linux Linuxthreads should be used.  Please install Linuxthreads
(or a new glibc) and try again.  See the Installation chapter in the
Reference Manual for more information.

やっぱりエラーが。

どうやら CentOS 5 では Linuxthreads はサポートされなくなったようで(CentOS 4 まではサポートされていたようです)、configure のオプションで thread の方法を指定します。

$ ./configure \
 --prefix=/usr/local/mysql \
 --with-charset=sjis \
 --with-extra-charsets=all \
 --with-mysqld-user=mysql \
 --without-bench \
 --localstatedir=/home/mysql/data \
 --with-named-thread-libs="-lpthread"

checking for termcap functions library... configure: error: No curses/termcap library found

今度は、curses library がないとおっしゃいます。インストールし、再チャレンジ。

$ yum search ncurses
ncurses.i386 : A terminal handling library
ncurses-devel.i386 : Development files for the ncurses library

$ sudo yum install ncurses.i386
Package ncurses - 5.5-24.20060715.i386 is already installed.

$ sudo yum install ncurses-devel.i386
Installed: ncurses-devel.i386 0:5.5-24.20060715
Complete!

$ ./configure \
 --prefix=/usr/local/mysql \
 --with-charset=sjis \
 --with-extra-charsets=all \
 --with-mysqld-user=mysql \
 --without-bench \
 --localstatedir=/home/mysql/data \
 --with-named-thread-libs="-lpthread"

MySQL has a Web site at http://www.mysql.com/ which carries details on the
latest release, upcoming features, and other information to make your
work or play with MySQL more productive. There you can also find
information about mailing lists for MySQL discussion.

Remember to check the platform specific part of the reference manual for
hints about installing MySQL on your platform. Also have a look at the
files in the Docs directory.

Thank you for choosing MySQL!

OK! うまくいきました!


Make


さて、お次はコンパイルです。

$ make
mysqld.o: In function `main':
mysqld.cc:(.text+0x3450): undefined reference to `my_fast_mutexattr'
mysqld.cc:(.text+0x3464): undefined reference to `my_fast_mutexattr'
mysqld.cc:(.text+0x3478): undefined reference to `my_fast_mutexattr'
mysqld.o:mysqld.cc:(.text+0x34a0): more undefined references to `my_fast_mutexattr' follow
collect2: ld returned 1 exit status
make[4]: *** [mysqld] エラー 1

my_fast_mutexattr が定義されてないと。

そこで、定義を強制するように修正します。

$ vi mysys/my_thr_init.c
/my_fast_mutexattr

#ifdef PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP
pthread_mutexattr_t my_fast_mutexattr;
#endif

これを、下記のようにします。

//#ifdef PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP
pthread_mutexattr_t my_fast_mutexattr;
//#endif

これでなんとかコンパイルができました。


Maike Install


最後にインストールです。ここまでくればOKでしょう。

$ sudo make install

お疲れ様です!

2009/01/23

[GAE]Google App Engine を使ってみる Hello, webapp World!

前回は、単純な CGI を試してみましたが、今回は、Google App Engine に提供されている webapp というフレームワークを使ってみます。



Hello, webapp!


webapp は次の3つのパートからなります。



  • リクエストの処理と、レスポンスを生成する、RequestHandler クラス

  • URL に従ってリクエストをルーティングする、WSGIApplication インスタンス

  • WSGIApplication を起動する、メインルーチン


さっそく、helloworld.py を書き換えてみます。


helloworld/helloworld.py
from google.appengine.ext import webapp
from google.appengine.ext.webapp.util import run_wsgi_app

class MainPage(webapp.RequestHandler):
def get(self):
self.response.headers['Content-Type'] = 'text/plain'
self.response.out.write('Hello, webapp World!')

application = webapp.WSGIApplication(
[('/', MainPage)],
debug=True)

def main():
run_wsgi_app(application)

if __name__ == "__main__":
main()


開発サーバを起動し、http://localhost:8080 にアクセスします。

ブラウザに Hello, webapp World! が表示されれば成功です!




参考:


2009/01/22

[GAE]Google App Engine を使ってみる Hello, World!


昨年の4月にリリースされた、Google App Engine ですが、アカウントを申請したままずっと放置していました。


「一年の計は元旦にあり」ということで、今後ますますクラウド化していく世の中に備え、Google App Engine、Amazon Web Services は押さえておかなければなりません。


そこで、まずは Google App Engine を使ってみました。



使い始めるのは簡単で、



  1. Python のインストール

  2. Google App Engine SDK のインストール


これですぐにローカルで開発が始められます。


Hello, World!


なにはともあれ、まずは Hello, World! ですね。


シンプルな Request Handler を作成

helloworld ディレクトリを作成し、その中に helloworld.py を作成します。


helloworld/helloworld.py
print 'Content-Type: text/plain'
print ''
print 'Hello, World!'

設定ファイルを作成

helloworld ディレクトリに、app.yml を作成します。


helloworld/app.yml
application: helloworld
version: 1
runtime: python
api_version: 1

handlers:
- url: /.*
script: helloworld.py

アプリケーションのテスト

dev_appserver.py を実行し、ウェブサーバを起動します。実行するアプリケーションディレクトリのパスを渡します。


google_appengine/dev_appserver.py helloworld/

開発サーバが起動したら、http://localhost:8080 にアクセスします。

ブラウザに Hello, World! が表示されれば成功です!



参考:


2008/12/27

End Of 2008年

本年はお世話になりました。来年も変わらぬご愛顧のほど、よろしくお願い申しあげます。

本年お世話になったお客様、誠にありがとうございます。

来年も変わらぬご愛顧のほど、よろしくお願い申しあげます。



さてさて、はやくも2008年が終わろうとしています。

昨年の反省から、情報に埋もれることなく、的確に情報をさばくことを一つの目標としてきまして、相変わらず Google Reaser の未読フィード数は 1000+ ですが、未読を気にせず、Mark all as read する勇気を持つことができました(w)


今年は、Twitter, OpenSocial, Facebook, iPhone, Android と、ますますソーシャルになっていくインターネットですが、この流れはしばらく衰えそうにありませんね。


来年には、docomo, KDDI あたりから、Android 携帯が発表されるらしいので、日本でもすごいことになるのではないでしょうか。


幸い弊社では、iPhone, Android と、実機がそろっていますので、なにか面白いものをつくれるといいなと思います。


そろそろ「破」の段階にきた「守破離」ですが、まだまだ覚えることはたくさんあります。

常に初心を忘れず、さらなる精進を重ねていこうと思う次第です。


守破離とは

「守」とは、


師匠の教えを正確かつ忠実に守り、剣道における基本の作法、礼法、技法を身に付ける、いわば「学び」の段階をいいます。


「破」とは、


それまで身に付けた技や形をさらに洗練させ、自己の個性を創造する段階をいい、


「離」とは、


さらに前進させ、自らの新しい独自の道を確立させる最終段階のことをいいます。自己を常に発展させるべく修行、精進を重ねていく終わりのない道です。



それでは、皆様、よいお年を!