macにSphinx & Blockdiag環境を整える
そろそろドキュメント書きながら開発できる人間になりたい(´・ω・`)
ということで、SphinxとBlockdiagを使える環境を作る。
Sphinxはドキュメント生成ツールで、reST記法?で書くとhtmlとかpdfとかに簡単に出力できる。
ソースコードのdocstringも読み込んでドキュメントを作ってくれる便利ツール。
BlockdiagはPython製のブロックダイアグラムを生成してくれるツール。
ドキュメントプロジェクト作成
sphinx-quickstart
と打って質問に答えていく。
conf.py
生成されたconf.pyにblockdiagを使うための設定を追加。
blockdiagで日本語を使いたかったら.ttfが必要らしい。IPAのサイトからフォントをDLして設定。
extensions = ['sphinx.ext.autodoc', 'sphinx.ext.doctest', 'sphinx.ext.todo', 'sphinx.ext.viewcode', 'sphinxcontrib.blockdiag'] # これ追加 blockdiag_fontpath = '/path/to/ipag.ttf'
サンプル
index.rstにBlockdiagのサンプルを書いてみる。
sphinx-quickstart on Wed Jun 20 17:32:10 2012. You can adapt this file completely to your liking, but it should at least contain the root `toctree` directive. Welcome to TestSystem's documentation! ======================================== Contents: .. toctree:: :maxdepth: 2 てすとー Indices and tables ================== * :ref:`genindex` * :ref:`modindex` * :ref:`search` .. blockdiag:: :desctable: blockdiag { 'あ' -> 'い' -> 'てすと' ; }
ビルド
➜ docs make html sphinx-build -b html -d build/doctrees source build/html Running Sphinx v1.1.3 loading pickled environment... done building [html]: targets for 1 source files that are out of date updating environment: 0 added, 1 changed, 0 removed reading sources... [100%] index looking for now-outdated files... none found pickling environment... done checking consistency... done preparing documents... done writing output... [100%] index Exception occurred: File "/Users/ogata/.pythonbrew/pythons/Python-2.6.7/lib/python2.6/site-packages/PIL/ImageFont.py", line 34, in __getattr__ raise ImportError("The _imagingft C module is not installed") ImportError: The _imagingft C module is not installed The full traceback has been saved in /var/folders/mx/jx26pzv53tx7dgw_ftg_vyk00000gn/T/sphinx-err-FClZmw.log, if you want to report the issue to the developers. Please also report this if it was a user error, so that a better error message can be provided next time. Either send bugs to the mailing list at <http://groups.google.com/group/sphinx-dev/>, or report them in the tracker at <http://bitbucket.org/birkenfeld/sphinx/issues/>. Thanks! make: *** [html] Error 1
あれー?
と思ったら、ここ(http://blockdiag.com/ja/blockdiag/introduction.html)にこう書いてあった。
~MacOSX (homebrew) の環境でインストールされる PIL パッケージは freetype2 に対応していないためそのままでは blockdiag を利用することはできません。また、freetype2 用の Foluma (パッケージ)は提供されていないため、 以下の内容で /usr/local/Library/Formula/freetype2.rb ファイルを作成します。
ということで手順どおりにやってPILをインストールしなおし!
$brew install freetype2 ... $pip install PIL -I ... -------------------------------------------------------------------- PIL 1.1.7 SETUP SUMMARY -------------------------------------------------------------------- version 1.1.7 platform darwin 2.6.7 (r267:88850, Jan 17 2012, 20:23:21) [GCC 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2335.15.00)] -------------------------------------------------------------------- --- TKINTER support available --- JPEG support available --- ZLIB (PNG/ZIP) support available --- FREETYPE2 support available <== これでOk *** LITTLECMS support not available --------------------------------------------------------------------
よっしゃ!
再びmake
make html
うごいたー!
ライブラリのドキュメントでよく見るスタイルになっとる
これで快適ドキュメント生活ができるかもしれない( ・∀・)
Ember.jsの外部templateファイル読み込み
忘れないうちにメモ。
これでいいのかはわからないけど、一応動いた。templateファイルを合体してひとつのファイルにすればいいんだけど、なんかやってみたかったのでやってみた。
ファイル構成
こんな感じ
app/ index.html js/ app.js libs/ jquery.js ember.js templates/ hello.handlebars
app.js
読み込みファイルの追加は、templatesにtemplateのファイル名を書いていく。
$ajaxのasyncをfalseにしないと、templateを読み込む前にjsが実行されてしまってエラーになる。
なんかもっといい解決策があるかもしれない。
function fetchResources(url, callback) { $.ajax( { type: "GET", url: url, async: false, dataType: "text", success: function(data) { console.log("fetch template:", data); callback(null, data); }, error: function(XMLHttpRequest, textStatus, errorThrown) { console.error(XMLHttpRequest, textStatus, errorThrown); var err = { message: textStatus, error: errorThrown }; callback(err, null); } }); } function fetchTemplate(templateName) { var url = 'templates/' + templateName + '.handlebars'; fetchResources(url, function(err, data) { if(err) { console.error(err); return; } if (Ember.TEMPLATES[templateName]) { console.log(url + 'is already fetched'); return; } Em.TEMPLATES[templateName] = Em.Handlebars.compile(data); }); } var App = Em.Application.create(); App.ready = function() { console.log('App.ready()'); }; var templates = ['hello']; templates.forEach(function(tmpName) { fetchTemplate(tmpName); }); App.HelloView = Em.View.extend( { templateName: 'hello', name: "World!" });
hello.handlebars
<h1>hello, {{name}}</h1>
index.htmlのぼでー
<body> <script type="text/x-handlebars"> {{view App.HelloView}} </script> <script src="//ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script> <script>window.jQuery || document.write('<script src="js/libs/jquery-1.7.2.min.js"><\/script>')</script> <script src="js/libs/ember-0.9.8.1.min.js"></script> <script src="js/app.js"></script> </body>
templateNameのところにtemplateのurlを書くだけで出来ればいいのに(´・ω・`)
CentOSにmongodbインストール&設定
メモメモ
yumレポジトリ追加
/etc/yum.repos.d/10gen.repo を下記の内容で作成
[10gen] name=10gen Repository baseurl=http://downloads-distro.mongodb.org/repo/redhat/os/x86_64 gpgcheck=0 enabled=1
インストール
yum install mongo-10gen mongo-10gen-server
設定ファイル変更
下記を追加
port = 27017 bind_ip = 127.0.0.1
起動&デーモン化
service mongod start
chkconfig mongod on
PythonのTornadoで解説入れながらLoginしてみる
今流行の(たぶん)PythonのWeb frameworkであるTornado。
Facebookの中の人が作ってるらしい。Instagramでも使ってるおーって、なんかの記事で見た。
概要をまとめると、ノンブロッキングでイベントル〜プな比較的シンプルに書かれた軽量で爆速なフレームワークでC10Kファイヤー(まとめ適当!)、らしい(・へ・)
Documentは良い感じなんだけれど、Webに使い方の情報が少ない気がする(Flaskとかと比べると)。
何回か使ってて結構ハマったというか、ソースコード読まないとこれわからんだろ!という部分も多々。
それはさておき、ウェブサービスを作るときにログインの部分は結構使うよね、
そしていつも”あれ、これどう書くんだっけ?”ってなるよね。
ということでとりあえずTornadoでLoginしてみよう!
フォルダの構成
今回の構成はこんな感じ。大体Flaskとかと同じ。
/App /static (jsとかcssとかのスタティックファイル置き場) /templates (テンプレート置き場) login.html server.py (Tornadoのコード) server.conf (TornadoのConfigファイル)
Tornadoサーバー書くときの全体の流れ
- ハンドラーをクラスとして作成(クラスのメソッドにgetとかpostとかの処理を書いていく)
- Applicationクラスにルーティングとハンドラーのクラスを紐付けしつつ、設定を書き込む
- サーバー用のオプションをパースして、Portとか設定してサーバースタート
さぁ書くぞっ
server.pyのそーすこーど
とりあえず、ドン:|
読み飛ばしたあと、解説を書きます。
まずアプリケーションのクラス
こんな感じ。
class Application(tornado.web.Application): def __init__(self): handlers = [ (r'/', MainHandler), (r'/auth/login', AuthLoginHandler), (r'/auth/logout', AuthLogoutHandler), ] settings = dict( cookie_secret='gaofjawpoer940r34823842398429afadfi4iias', static_path=os.path.join(os.path.dirname(__file__), "static"), template_path=os.path.join(os.path.dirname(__file__), "templates"), login_url="/auth/login", xsrf_cookies=True, autoescape="xhtml_escape", debug=True, ) tornado.web.Application.__init__(self, handlers, **settings)
まず、tornado.web.Applicationをを継承したApplicationクラスをつくる。
あとは、ルーティングのhandlerとアプリケーションのSettingを書いてセット!
handlersは (r'/', MainHandler) のように、ルーティングとその時の処理(GetとかPost)などを書いたクラスをヒモ付する。
(HandlerClassの中身は後ほど書きます。)
settingsについては下記にまとめる。
static_path
jsとかcssとかを入れておくフォルダの設定 (デフォルトで"static"になっているので不要だけど念のため) 例えば、staticフォルダにscript.jsを入れておくと http://hogehoge.com/static/script.js みたいな感じでアクセスできるようになる。
template_path
htmlテンプレートのフォルダの設定 (デフォルトで"templates"になっているので不要だけど念のため)
login_url
ログインが必須なURLにアクセスした時に、ログインしてなかった場合に飛ばされる場所 (@tornado.web.authenticatedのデコレータがついたメソッドが呼び出された時にログインしてなかったら飛ばされる場所)
xsrf_cookies
XSRF対策用?ノリでTrueにしてみた。 Tornadoには、xsrf_form_html() というヘルパーみたいなものがあって、 それをでformタグ内に書くと自動的にcookieとフォームタグに乱数をセットしてくれるらしい。 ドキュメントには、 If you have set the ‘xsrf_cookies’ application setting, you must include this HTML within all of your HTML forms. と書いてあるので、Trueにしておくと全部のフォームタグ内にxsrf_form_html()をつけとかないとダメってことかな?
autoescape
テンプレートエンジンを使うときに自動でエスケープするかどうかの設定 ドキュメントさんいわく、 All template output is escaped by default, using the tornado.escape.xhtml_escape function. This behavior can be changed globally by passing autoescape=None to the Application or TemplateLoader constructors, for a template file with the {% autoescape None %} directive, or for a single expression by replacing {{ ... }} with {% raw ...%}. Additionally, in each of these places the name of an alternative escaping function may be used instead of None. だそうです。 つまり、tempate.htmlの中に出力する部分”{{...}}”のところを自動でエスケープするかどうかの設定、だと思う
debug
Trueにしておくと、ファイルを更新した時にリロードしてくれたり、 なにかエラーが起きた時にBrowser上にエラーを出力してくれると思う。
settingsの一覧ってどこに書いてあるのかわからん。
べーすはんどらー
tornado.web.RequestHandlerを継承したBaseHandlerを作る。
class BaseHandler(tornado.web.RequestHandler): cookie_username = "username" def get_current_user(self): username = self.get_secure_cookie(self.cookie_username) logging.debug('BaseHandler - username: %s' % username) if not username: return None return tornado.escape.utf8(username) def set_current_user(self, username): self.set_secure_cookie(self.cookie_username, tornado.escape.utf8(username)) def clear_current_user(self): self.clear_cookie(self.cookie_username)
ログイン機能をつけるために、ここにget_current_user()というのを実装しておく。
もともとtornado.web.RequestHandlerにget_current_user()というのが準備されていて、
@tornado.web.authenticatedのデコレータをつけたメソッドは、
get_current_user()で何かしら値を返すとパスできて、
何も書いてないとlogin_urlへリダイレクトされる仕組み。
set_current_user()と、clear_current_user()は利便性を高めるための自作メソッド。
メインハンドラー
先程作ったBaseHandlerを継承。
Applicationのhandlersで、(r'/', MainHandler)と設定してあるので、
http://localhost:5000/にアクセスすると、このクラスで処理される。
class MainHandler(BaseHandler): @tornado.web.authenticated def get(self): self.write("Hello, <b>" + self.get_current_user() + "</b> <br> <a href=/auth/logout>Logout</a>")
でたっ!@tornado.web.authenticated!
これをつけておくと、このハンドラーでgetされた時にログインしているかチェックされる。ログインしてなかったらリダイレクトされる。
self.write("Hello, <b>" + self.get_current_user() + "</b> <br> <a href=/auth/logout>Logout</a>")
の部分は、ログインしていれば、ユーザーネームを出力して、ログアウトのリンクが現れるように書いた。
ログインハンドラー
これもBaseHandlerを継承。
/auth/login にgetされると、login.htmlを出力。
postされるとログイン認証を行う。
login.htmlはこんな感じ。
<!DOCTYPE HTML> <html lang="en-US"> <head> <meta charset="UTF-8"> <title></title> </head> <body> <h1>Login</h1> <form action="/auth/login" method="post"> {% module xsrf_form_html() %} <p>username : <input type="text" name="username"/></p> <p>password : <input type="password" name="password"/></p> <input type="submit" value="Login!"/> </form> </body> </html>
login.html内の{% module xsrf_form_html() %}は、render()によって、
<input type="hidden" name="_xsrf" value="8bc949dcb6ae4734a48b7a514a1ed759">
に変換される。
これがハンドラー
class AuthLoginHandler(BaseHandler): def get(self): self.render("login.html") def post(self): logging.debug("xsrf_cookie:" + self.get_argument("_xsrf", None)) self.check_xsrf_cookie() username = self.get_argument("username") password = self.get_argument("password") logging.debug('AuthLoginHandler:post %s %s' % (username, password)) if username == options.username and password == options.password: self.set_current_user(username) self.redirect("/") else: self.write_error(403)
POSTの流れは下記の通り。
- xsrfチェック
- usernameとpasswordをチェック
- 合ってたらクッキーにusernameをセット
- リダイレクト
self.check_xsrf_cookie()は、cookieにセットされた_xsrfの値とpostで受け取った値をチェックして、
ダメだったら403エラーを出力してくれるメソッド。
options.username と options.passwordについては後ほど。
ログアウトハンドラー
これだけ。
/auth/logout にアクセスがあったら、クッキー内のusernameを削除
class AuthLogoutHandler(BaseHandler): def get(self): self.clear_current_user() self.redirect('/')
全体像+mainのところ
import tornado.ioloop import tornado.web import tornado.escape import tornado.options from tornado.options import define, options import os import logging define("port", default=5000, type=int) define("username", default="user") define("password", default="pass") 〜省略〜 def main(): tornado.options.parse_config_file(os.path.join(os.path.dirname(__file__), 'server.conf')) tornado.options.parse_command_line() app = Application() app.listen(options.port) logging.debug('run on port %d in %s mode' % (options.port, options.logging)) tornado.ioloop.IOLoop.instance().start() if __name__ == "__main__": main()
ここで、サーバーの起動する所を書いてます。
流れは、
- server.conf内の設定を読み込み
- コマンドラインからオプションの読み込み
- 作成したApplicationクラスからオブジェクト生成
- 設定したportでlisten
- サーバー起動
となる。
いきなり出てきたdefineってなんぞい??ってなりますよね。
これはコマンドラインからのoptionを追加できる便利なメソッドらしい。
そして、この部分がオプションをパースしてくれる。
tornado.options.parse_config_file(os.path.join(os.path.dirname(__file__), 'server.conf'))
tornado.options.parse_command_line()
parse_config_file()は予め設定ファイルにオプションを記述しておくと、
option.hogehogeのようにアクセスできるようになる。
今回はport, username, passwordをオリジナル設定として定義してる。
AuthLoginHandler内の、options.username と options.passwordはここで定義されてたものを使っている。
ちなみに、server.confの中身はこんな感じ。
port=5000
logging='debug'
logging='debug'はloggingの出力レベルを設定してくれる部分。
これでlogging.debug()が出力されるようになる。
Tornadoにはloggingオプションが標準で付いているっぽい。
parse_command_line()はコマンドラインに書いたoptionを適応してくれるメソッド。
python server.py --port=8888
みたいに書くとソースの変更なしにパラメータを変更できる(と思う)
おわりに
パスワードが決め打ち&平文なのでまだ実用的ではないですが、
認証の部分にDB入れたり、shaとかで暗号化すればとりあえずOKな気がします。
ソースコードはGithubにおいてあります。
https://github.com/contaconta/TornadoAuthTest
文章長い!日本語へたい!
プログラム書くよりブログ書くほうが時間かかるお(´・ω・`)
Sublime textというエディタがかなりイカしてる!
TextMateのいいプラグインないかなーって探していた所、
かなりいいエディタを見つけてしまった(・∀・)
その名はSublimeText!(↓これ)
http://www.sublimetext.com/
普段はJetBrainのIDEをよく使うのですが、ぱっと何かを試したい時にTextMate2を使っておりました。
TextMateは結構使いやすいのですが、画面の分割が出来なかったので
Emacsみたいに分割できたらいいのになーと思っていた所
(一応公式でそのうち対応するかも?って公式ブログに書いてあったような)
SubulimeTextに出会いました!
まだ2はベータ版らしいですが、かなりいいです!
何がいいの?
この動画をみると凄さがちょっとわかります。
http://www.youtube.com/watch?v=WPhhC31b8Sw&feature=related
こんだけ高機能なのにそこそこ軽い!
UIがおしゃれ
任意の画面分割できたりタブ移動ができたり非常に嬉しいです。
曖昧検索できるエディタ内ランチャーのCommand Palette
ctr+command+PでMacでいうSpotlightのような機能を利用できます。
便利すぎてビビります。ファイル切り替え、関数検索なんかも一発です!
豊富なプラグイン
まぁまぁ欲しいものは揃っています。
sublime Package controllというプラグインを入れるととても捗ります。
http://wbond.net/sublime_packages/package_control
マルチプラットフォーム対応
MacだけでなくWin,Linuxでも利用可能です。
おすすめプラグイン
僕が入れたものを紹介します。
Package Controller
これ必須です。これをいれて、
ランチャーで、”package Install”と入力すればプラグインが探せます。
Nettuts-Fetch
ここを参考にしました!
http://blog.mach3.jp/2012/01/sublime-text-and-nettuts-fetch.html
これは、よく使うjQueryやUnderscoreなどのライブラリを登録しておくことで、
ファイルをフェッチすることができるすぐれものです。
その他
こんなのも入れました。
Zen Coding
Backbone.js
Node.js
設定
Preference->Settingの部分をこんな感じで書き換えました。
ココらへんが参考になります。
http://www.sublimetext.com/docs/2/settings.html
// The number of spaces a tab is considered equal to "tab_size": 2, // Set to true to insert spaces when tab is pressed "translate_tabs_to_spaces": true,
それと、インデントを綺麗にするショートカットがなかったので
Preference->KeyBindings(User)
で下記のように設定しました。
[ { "keys": ["ctrl+alt+i"], "command": "reindent" } ]
あと、プラグインを入れるとキーバインドがぶつかったりすることがあるので、
そこら辺は注意が必要です。
(Node.jsをいれるとctrl+dが”デバッグ実行”に割り当てられるので、Node.jsプラグインの方のキーバインドを書き換えました)
まだまだ使い始めですが、これはかなり期待ですね☆
google spreadsheetのtext_dbとauthSubの連携 in Flask
メモメモ、忘れそう。
やっぱりポップアップの画面でログインできるようにしたいよね、
ってことでやってみました。
gdata.spreadsheet.text_db
の認証部分のソースコードの中身を見ると、
class DatabaseClient(object): """Allows creation and finding of Google Spreadsheets databases. The DatabaseClient simplifies the process of creating and finding Google Spreadsheets and will talk to both the Google Spreadsheets API and the Google Documents List API. """ def __init__(self, username=None, password=None): """Constructor for a Database Client. If the username and password are present, the constructor will contact the Google servers to authenticate. Args: username: str (optional) Example: jo@example.com password: str (optional) """ self.__docs_client = gdata.docs.service.DocsService() self.__spreadsheets_client = ( gdata.spreadsheet.service.SpreadsheetsService()) self.SetCredentials(username, password)
って書いてある。
なるほどね。
あと、ちょっとググってみたら
http://code.google.com/p/gdata-python-client/wiki/AuthSubWithTextDB
に色々書いてあった。
ということで、自作のDBクラスをこんな感じでカスタマイズ!(一部省略)
class SpreadDB: """ .... """ def getAuthUrl(self, nextUrl): self.client = gdata.spreadsheet.text_db.DatabaseClient() return self.client._GetDocsClient().GenerateAuthSubURL(next=nextUrl, scope='http://spreadsheets.google.com/feeds/ http://docs.google.com/feeds/documents/') def setToken(self, token): self.client._GetDocsClient().SetAuthSubToken(token) self.client._GetDocsClient().UpgradeToSessionToken() self.client._GetSpreadsheetsClient().SetAuthSubToken(self.client._GetDocsClient().GetAuthSubToken()) """ .... """
そしてこれを、Flaskのルーティングのとこに書き込み
@app.route('/login', methods=['GET']) def login(): token = flask.request.values.get('token','') if token: db.setToken(token) return flask.redirect(flask.url_for('index')) else: auth_url = db.getAuthUrl("http://localhost:5000/login") return render_template('index.html', auth_url=auth_url)
HTMLはテキトーにこんな感じで
<!DOCTYPE HTML> <html> <head> <meta charset="UTF-8"> <title>title</title> <script type='text/javascript' src="{{ url_for('static', filename = 'lib/jquery-1.7.1.min.js') }}"></script> </head> <body> <h1>Login</h1> <a href="{{auth_url}}">Google Sign In</a> </body> </html>
動いた(・∀・)
おしまい!
centosにPHPとMySQLインストール
メモメモ。
インストール
yum --enablerepo=remi install php php-cli php-common php-devel php-gd php-mbstring php-mysql php-pdo php-mcrypt php-pear mysql-server php-mysql
===================================================================================================== Package Arch Version Repository Size ===================================================================================================== Installing: mysql-server x86_64 5.5.20-1.el5.remi remi 13 M php x86_64 5.3.9-1.el5.remi remi 2.8 M php-cli x86_64 5.3.9-1.el5.remi remi 2.6 M php-common x86_64 5.3.9-1.el5.remi remi 997 k php-devel x86_64 5.3.9-1.el5.remi remi 1.3 M php-gd x86_64 5.3.9-1.el5.remi remi 209 k php-mbstring x86_64 5.3.9-1.el5.remi remi 2.3 M php-mcrypt x86_64 5.3.9-1.el5.remi remi 48 k php-mysql x86_64 5.3.9-1.el5.remi remi 96 k php-pdo x86_64 5.3.9-1.el5.remi remi 119 k php-pear noarch 1:1.9.4-3.el5.remi remi 436 k Installing for dependencies: mysql x86_64 5.5.20-1.el5.remi remi 7.4 M mysql-libs x86_64 5.5.20-1.el5.remi remi 1.1 M mysqlclient15 x86_64 5.0.67-1.el5.remi remi 1.3 M perl-DBD-MySQL x86_64 3.0007-2.el5 base 148 k Transaction Summary ===================================================================================================== Install 15 Package(s) Upgrade 0 Package(s) Total download size: 33 M Is this ok [y/N]: y Downloading Packages: (1/15): php-mcrypt-5.3.9-1.el5.remi.x86_64.rpm | 48 kB 00:00 (2/15): php-mysql-5.3.9-1.el5.remi.x86_64.rpm | 96 kB 00:00 (3/15): php-pdo-5.3.9-1.el5.remi.x86_64.rpm | 119 kB 00:00 (4/15): perl-DBD-MySQL-3.0007-2.el5.x86_64.rpm | 148 kB 00:00 (5/15): php-gd-5.3.9-1.el5.remi.x86_64.rpm | 209 kB 00:00 (6/15): php-pear-1.9.4-3.el5.remi.noarch.rpm | 436 kB 00:01 (7/15): php-common-5.3.9-1.el5.remi.x86_64.rpm | 997 kB 00:02 (8/15): mysql-libs-5.5.20-1.el5.remi.x86_64.rpm | 1.1 MB 00:02 (9/15): php-devel-5.3.9-1.el5.remi.x86_64.rpm | 1.3 MB 00:02 (10/15): mysqlclient15-5.0.67-1.el5.remi.x86_64.rpm | 1.3 MB 00:03 (11/15): php-mbstring-5.3.9-1.el5.remi.x86_64.rpm | 2.3 MB 00:05 (12/15): php-cli-5.3.9-1.el5.remi.x86_64.rpm | 2.6 MB 00:06 (13/15): php-5.3.9-1.el5.remi.x86_64.rpm | 2.8 MB 00:06 (14/15): mysql-5.5.20-1.el5.remi.x86_64.rpm | 7.4 MB 00:12 (15/15): mysql-server-5.5.20-1.el5.remi.x86_64.rpm | 13 MB 00:17 ----------------------------------------------------------------------------------------------------- Total 515 kB/s | 33 MB 01:06 Running rpm_check_debug Running Transaction Test Finished Transaction Test Transaction Test Succeeded Running Transaction WARNING : These php-* RPM are not official Fedora/Redhat build and overrides the official ones. Don't file bugs on Fedora Project nor Redhat. Use dedicated forums http://forums.famillecollet.com/ Installing : php-common 1/15 WARNING : This MySQL RPM is not an official Fedora/Redhat build and it overrides the official one. Don't file bugs on Fedora Project nor Redhat. Use dedicated forums http://forums.famillecollet.com/ Installing : mysql-libs 2/15 Installing : php-cli 3/15 Installing : php 4/15 Installing : mysql 5/15 Installing : php-pdo 6/15 Installing : mysqlclient15 7/15 Installing : perl-DBD-MySQL 8/15 Installing : php-mysql 9/15 Installing : mysql-server 10/15 Installing : php-gd 11/15 Installing : php-devel 12/15 Installing : php-pear 13/15 Installing : php-mcrypt 14/15 Installing : php-mbstring 15/15 Installed: mysql-server.x86_64 0:5.5.20-1.el5.remi php.x86_64 0:5.3.9-1.el5.remi php-cli.x86_64 0:5.3.9-1.el5.remi php-common.x86_64 0:5.3.9-1.el5.remi php-devel.x86_64 0:5.3.9-1.el5.remi php-gd.x86_64 0:5.3.9-1.el5.remi php-mbstring.x86_64 0:5.3.9-1.el5.remi php-mcrypt.x86_64 0:5.3.9-1.el5.remi php-mysql.x86_64 0:5.3.9-1.el5.remi php-pdo.x86_64 0:5.3.9-1.el5.remi php-pear.noarch 1:1.9.4-3.el5.remi Dependency Installed: mysql.x86_64 0:5.5.20-1.el5.remi mysql-libs.x86_64 0:5.5.20-1.el5.remi mysqlclient15.x86_64 0:5.0.67-1.el5.remi perl-DBD-MySQL.x86_64 0:3.0007-2.el5 Complete! [root@localhost admin]# /etc/init.d/mysqld start Starting mysqld: [ OK ]
ここで、
yum --enablerepo=remi install .... mysql mysql-server ...
ってしてしまうと
Installing: mysql i386 5.0.77-4.el5_6.6 base 4.8 M mysql x86_64 5.5.20-1.el5.remi remi 7.4 M
変なのが入る!!!!コレのせいで、何時間無駄にしたことか。
全く動かないと思ったら。気づかなかったよ。
yum --enablerepo=remi install .... mysql-server ...
という風に、mysqlをDependencyでもってくると
Installing for dependencies: mysql x86_64 5.5.20-1.el5.remi
みたいな感じでうまくいった。
あとはお好みでPhpmyadminをインストール
yum install --enablerepo=remi phpmyadmin cp /usr/share/phpMyAdmin/config.sample.inc.php /usr/share/phpMyAdmin/config.inc.php emacs /etc/httpd/conf.d/phpMyAdmin.conf
あぁー、いつもうまく行ってたのに、かなり時間かかってしまった(-_-;)