CentOSインストールmemo

とりあえずインストール→Mojolicious::Liteが動くまでの作業メモ。

OSのインストール

netinstall使用
http://ftp.riken.jp/Linux/centos/5/os/x86_64/

とりあえず開発ツールとライブラリを含めてインストール

GNU Screenbash-completionを追加する

# yum install screen
# wget http://packages.sw.be/rpmforge-release/rpmforge-release-0.5.1-1.el5.rf.x86_64.rpm
# rpm -ivh rpmforge-release-0.5.1-1.el5.rf.x86_64.rpm
# vim /etc/yum.repos.d/rpmforge.repo
 enable=0に変更
# yum --enablerepo=rpmforge install bash-completion

ユーザを追加

# useradd xxx
# passwd xxx

今作ったユーザに切り替える。

# su - xxx

Subversionで管理している.rcファイルをとってくる。

perlcpanを入れる

cpanminusとperl5.12.2を入れる

$ wget http://xrl.us/perlbrew
$ perl perlbrew install
$ perl perlbrew init

.bashrcに追記

source ~/perl5/perlbrew/etc/bashrc

シェルを立ち上げ直す

$ perlbrew install perl-5.12.2
$ perlbrew switch perl-5.12.2
$ curl -L http://cpanmin.us/ | perl - App::cpanminus
Mojolicious::Liteを動かす
$ cpanm Mojolicious::Lite
$ perldoc Mojolicious::Lite

perldoc中のSYNOPSISをtest.plとして保存

#!/usr/bin/env perl

# Using Mojolicious::Lite will enable "strict" and "warnings"
use Mojolicious::Lite;

# Route with placeholder
get '/:foo' => sub {
    my $self = shift;
    my $foo  = $self->param('foo');
    $self->render(text => "Hello from $foo!");
};

# Start the Mojolicious command system
app->start;

とりあえずこれで動作する。

$ perl test.pl daemon
Fri Jan 21 18:28:29 2011 info Mojo::Server::Daemon:320 [12846]: Server listening (http://*:3000)
Server available at http://*:3000.

止める時はCtrl+Cで。
あと、このページはスクロールしてみると分かるが遊び心があって楽しい。

Mojolicious::Liteでフレームワークを勉強してから何か作ってみたい。