14
14

More than 5 years have passed since last update.

UbuntuでIRC用Hubotを1から立ち上げる

Last updated at Posted at 2014-01-20

だいたい5分ぐらいでできます。

環境

  • OS:Ubuntu 12.04 LTS
  • Node.js v0.10.24

環境を整える

必要なパッケージ群をインストール

sudo aptitude update
sudo aptitude install build-essential
sudo aptitude install redis-server

redisは必須ではないがいろいろやるためには入れておいた方がいい。

Node.jsをmakeしmake install

http://nodejs.org/download/
からSource Codeをダウンロードし、makeしてinstall

wget http://nodejs.org/dist/v0.10.24/node-v0.10.24.tar.gz
tar xvf node-v0.10.24.tar.gz
cd node-v0.10.24
./configure
make
sudo make install

確認のため、

node -v

をして

v0.10.24

と表示されたらNode.jsが入りました。

Hubotを設定する

全部入りのやつを持ってくる

予めすべて設定してあるやつを持ってきちゃいます。

git clone https://github.com/jgable/hubot-irc-runnable.git mybot
cd mybot

上記ではmybotとしていますがなんでも大丈夫です。
ここではmybotとします。

実行スクリプトをいじくる

runbot.shが起動スクリプトです。
中身を編集しましょう。

runbot.sh
# Set Environment Variables
export HUBOT_IRC_NICK=mybot #ここにbotの名前
export HUBOT_IRC_SERVER=irc.freenode.net #ここにIRCサーバのアドレス
export HUBOT_IRC_ROOMS="#my_stoopid_bots_lair,#test" #JoinしたいChannelをカンマで区切る

実行してみる

npm install
./runbot.sh

初回のみnpm installが必要です。

おわりに

本来ならIRC用のアダプタを入れたり色々しないといけないのですが、
全部入りのやつを持ってくるととても簡単に立ち上げることができちゃいました。
次回はscriptを書いたり、他人のを持ってきたりする方法について書きたいと思います。

続編リンク

Hubotにlogbot機能を追加する
http://qiita.com/Morikuma_Works/items/7313f061f9f3d9c11f54

以上!

14
14
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
14
14