ラベル Debian の投稿を表示しています。 すべての投稿を表示
ラベル Debian の投稿を表示しています。 すべての投稿を表示

2016/10/28

[作業記録][Debian] Debian 8.5 最小構成インストールから Redmine3 + redmine_code_review を使えるようになるまで

環境

  • Debian 8.5 最小構成インストール
  • sudo, vim, ssh はインストール済み

目標

Debian 8.5 で、Redmine を使いたい、そしてコードレビューもしたい。

そのため、下記組み合わせで Redmine を使用できるようにする。

  • Redmine 3.3.1
  • redmine_code_review
  • sqlite3
  • Unicorn
  • nginx

Redmine と Nginx, Unicorn の連携については、このあたり の投稿を参考にすれば問題ないはずなので省略。

作業概要

  1. Redmine の準備
    1. 必要パッケージのインストール
    2. Redmine ソースコードの取得
    3. データベース設定
    4. 必要な gem のインストール
    5. デフォルトデータ作成
    6. secret token の準備
    7. 動作確認
  2. redmine_code_review の準備
    1. redmine_code_review ソースコードの取得と配置
    2. データベースのマイグレーション
    3. 動作確認

以下、各作業の詳細を記述していく。

Redmie の準備

必要パッケージのインストール

Redmine インストールにあたり、いろいろ必要なので apt でインストールする。

# ベースの最新化
sudo apt update
sudo apt upgrade

# rails のためのパッケージ
sudo apt install ruby-rails

# redmine の gem インストール時に必要になるものたち
sudo apt install zlib1g-dev pkg-config libmagickcore-dev libmagickwand-dev libsqlite3-dev

# Redmine を svn で取得してこれるように
sudo apt install subversion

Redmine ソースコードの取得

svn の stable ブランチからソースを取得する。今回は、 3.3-stable を取得する。

今回は、Redmine のルートディレクトリは /var/redmine とする。

sudo mkdir /var/redmine
sudo svn co https://svn.redmine.org/redmine/branches/3.3-stable /var/redmine
sudo chown -R www-data:www-data /var/redmine

データベース設定

今回は、 /var/redmine/db/redmine.sqlite3 を Redmine 用のデータベースとする。

1. ひな形コピー

cd /var/redmine
sudo -u www-data cp config/database.yml.example config/database.yml
sudo -u www-data vim config/database.yml

2. 設定ファイル編集

/var/redmine/db/redmine.sqlite3 を編集する。

# SQLite3 configuration example
production:
  adapter: sqlite3
  database: db/redmine.sqlite3

必要な gem のインストール

gem をインストール

cd /var/redmine
sudo -u www-data bundle install --path vendor/bundle

デフォルトデータ作成

cd /var/redmine
sudo -u www-data bundle exec rake db:migrate RAILS_ENV=production
sudo -u www-data bundle exec rake redmine:load_default_data RAILS_ENV=production

secret token の準備

セッション関係で使うトークンを生成するらしい。

cd /var/redmine
sudo -u www-data bundle exec rake generate_session_store

動作確認

cd /var/redmine
sudo -u www-data bundle exec rails server webrick -b 0.0.0.0 -e production

redmine_code_review の準備

redmine_code_review ソースコードの取得と配置

cd ~
wget https://bitbucket.org/haru_iida/redmine_code_review/downloads/redmine_code_review-0.7.0.zip
unzip redmine_code_review-0.7.0.zip
sudo -u www-data cp -r redmine_code_review /var/redmine/plugins

データベースのマイグレーション

cd /var/redmine
sudo -u www-data bundle exec rake redmine:plugins:migrate RAILS_ENV=production

動作確認

cd /var/redmine
sudo -u www-data bundle exec rails server webrick -b 0.0.0.0 -e production

2016/10/26 時点では、「コードレビュー」タブをクリックすると Internal Error になってしまう。 そのため、プロジェクトの設定で「コードレビュータブを隠す」にチェックを入れてタブを隠す。

以上。

2016/10/19

[作業記録][Debian] Sphinx を使ってみたい

環境

  • Debian 8.5 最小構成インストール
  • sudo, vim, ssh はインストール済み

目標

Sphinx でドキュメントを作成し、生成した html を Nginx で公開する。

作業

下記手順で作業を行う。

  1. 必要パッケージのインストール
  2. sphinx プロジェクトの作成
  3. ドキュメント作成
  4. ドキュメントビルド
  5. html を配置

必要パッケージのインストール

make が必要なの注意。

sudo apt install python3-sphinx
sudo apt install nginx
sudo apt install make

sphinx プロジェクトの作成

Separate source and build directoriesy のほうが管理しやすい感じがした。 その他はよしなにする感じで。

mikoto@debian-base:~$ mkdir -p sphinx/test
mikoto@debian-base:~$ cd sphinx/test/
mikoto@debian-base:~/sphinx/test$ sphinx-quickstart
Welcome to the Sphinx 1.2.3 quickstart utility.

Please enter values for the following settings (just press Enter to
accept a default value, if one is given in brackets).

Enter the root path for documentation.
> Root path for the documentation [.]:     

You have two options for placing the build directory for Sphinx output.
Either, you use a directory "_build" within the root path, or you separate
"source" and "build" directories within the root path.
> Separate source and build directories (y/n) [n]: y

Inside the root directory, two more directories will be created; "_templates"
for custom HTML templates and "_static" for custom stylesheets and other static
files. You can enter another prefix (such as ".") to replace the underscore.
> Name prefix for templates and static dir [_]: 

The project name will occur in several places in the built documentation.
> Project name: Test
> Author name(s): Mikoto2000

Sphinx has the notion of a "version" and a "release" for the
software. Each version can have multiple releases. For example, for
Python the version is something like 2.5 or 3.0, while the release is
something like 2.5.1 or 3.0a1.  If you don't need this dual structure,
just set both to the same value.
> Project version: 1.0.0
> Project release [1.0.0]: 

The file name suffix for source files. Commonly, this is either ".txt"
or ".rst".  Only files with this suffix are considered documents.
> Source file suffix [.rst]: 

One document is special in that it is considered the top node of the
"contents tree", that is, it is the root of the hierarchical structure
of the documents. Normally, this is "index", but if your "index"
document is a custom template, you can also set this to another filename.
> Name of your master document (without suffix) [index]: 

Sphinx can also add configuration for epub output:
> Do you want to use the epub builder (y/n) [n]: 

Please indicate if you want to use one of the following Sphinx extensions:
> autodoc: automatically insert docstrings from modules (y/n) [n]: 
> doctest: automatically test code snippets in doctest blocks (y/n) [n]: 
> intersphinx: link between Sphinx documentation of different projects (y/n) [n]: 
> todo: write "todo" entries that can be shown or hidden on build (y/n) [n]: 
> coverage: checks for documentation coverage (y/n) [n]: 
> pngmath: include math, rendered as PNG images (y/n) [n]: 
> mathjax: include math, rendered in the browser by MathJax (y/n) [n]: 
> ifconfig: conditional inclusion of content based on config values (y/n) [n]: 
> viewcode: include links to the source code of documented Python objects (y/n) [n]: 

A Makefile and a Windows command file can be generated for you so that you
only have to run e.g. `make html' instead of invoking sphinx-build
directly.
> Create Makefile? (y/n) [y]: 
> Create Windows command file? (y/n) [y]: n

Creating file ./source/conf.py.
Creating file ./source/index.rst.
Creating file ./Makefile.

Finished: An initial directory structure has been created.

You should now populate your master file ./source/index.rst and create other documentation
source files. Use the Makefile to build the docs, like so:
   make builder
where "builder" is one of the supported builders, e.g. html, latex or linkcheck.

こんな感じのディレクトリ構成になります。

mikoto@debian-base:~/sphinx/test$ find ./ -maxdepth 2 
./
./build
./Makefile
./source
./source/conf.py
./source/index.rst
./source/_templates
./source/_static

ドキュメント作成

適当にドキュメントを作ります。

今回は、test.rst を作成して、 index.rsttoctreetest.rst を追加。

mikoto@debian-base:~/sphinx/test$ cat source/test.rst 
====
test
====

Hello Sphinx document!

mikoto@debian-base:~/sphinx/test$ cat source/index.rst 
.. Test documentation master file, created by
   sphinx-quickstart on Tue Oct 18 23:52:34 2016.
   You can adapt this file completely to your liking, but it should at least
   contain the root `toctree` directive.

Welcome to Test's documentation!
================================

Contents:

.. toctree::
   :maxdepth: 2

   test


Indices and tables
==================


* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`

ドキュメントビルド

プロジェクトルートで make html するだけ。

mikoto@debian-base:~/sphinx/test$ make html
sphinx-build -b html -d build/doctrees   source build/html
Making output directory...
Running Sphinx v1.2.3
loading pickled environment... failed: [Errno 2] No such file or directory: '/home/mikoto/sphinx/test/build/doctrees/environment.pickle'
building [html]: targets for 2 source files that are out of date
updating environment: 2 added, 0 changed, 0 removed
reading sources... [100%] test                                                                                       looking for now-outdated files... none found
pickling environment... done
checking consistency... done
preparing documents... done
writing output... [100%] test                                                                                        writing additional files... genindex search
copying static files... done
copying extra files... done
dumping search index... done
dumping object inventory... done
build succeeded.

build/html に html ファイルが生成される。

html を配置

生成された heml ファイルをそのまま nginx のドキュメントルートに突っ込んでしまえば OK。

mikoto@debian-base:~/sphinx/test$ sudo cp -r build/html/* /var/www/html/

これで、 http://ホスト名/ にアクセスすると、生成した Sphinx ドキュメントが参照できるようになっているはず。

以上。

2016/10/18

[作業記録][Debian] Debian 最小構成から Redmine を動かすまで(3) - Nginx インストールから自動起動設定まで -

環境

  • Debian 8.5 最小構成インストール
  • sudo, vim, ssh はインストール済み
  • Redmine は準備済み(前々回の投稿)
  • Unicorn はインストール済み(前回の投稿)

目標

Redmine + sqlite3 + Nginx + Unicorn な環境を作る。

今回は、 Nginx のインストールから、デーモンとして自動起動するための設定まで。

Unicorn の準備

nginx と unicorn を socket で連携させるための設定を行う。

  1. /var/redmine/config/unicorn.rblisten "/var/redmine/tmp/unicorn.sock" を追加
  2. unicorn リスタート

Nginx の準備

Nginx をインストールし、 Unicorn との連携するための設定を行う。

Nginx のインストール

sudo apt install nginx

Nginx の設定

  1. デフォルトの設定を無効化
  2. redmine 用の設定ファイル作成
  3. redmine 用の設定を有効化

デフォルトの設定を無効化

sudo rm /etc/nginx/sites-enabled/default

redmine 用の設定ファイル作成

デフォルト設定をコピーし、redmine 用の設定ファイルにする。

sudo cp /etc/nginx/sites-available/default /etc/nginx/sites-available/redmine.conf

redmine 用設定ファイル /etc/nginx/sites-available/redmine.conf を修正する。

# redmine minimum configuration
server {
        listen 80 default_server;
        listen [::]:80 default_server;

        # Add index.php to the list if you are using PHP
        index index.html index.htm index.nginx-debian.html;

        location / {
                proxy_pass http://unix:/var/redmine/tmp/unicorn.sock;
        }
}

redmine 用の設定を有効化

sudo ln -s /etc/nginx/sites-available/redmine.conf /etc/nginx/sites-enabled/redmine.conf

Nginx の動作確認

sudo service nginx restart

この後、http://ホスト名:80/ にアクセスすれば、 redmine のトップページが見れるはず。

以上。

2016/10/02

[作業記録][Debian] Debian 最小構成から Redmine を動かすまで(2) - Unicorn インストールから自動起動設定まで -

環境

  • Debian 8.5 最小構成インストール
  • sudo, vim, ssh はインストール済み
  • Redmine は準備済み(前回の投稿)

目標

Redmine + sqlite3 + Nginx + Unicorn な環境を作る。

今回は、 Unicorn のインストールから、デーモンとして自動起動するための設定まで。

手順概要

Unicorn の準備

Unicorn のインストール

sudo apt install unicorn

Unicorn の設定

/etc/default/unicorn

デフォルトで起動する unicorn の起動スクリプト設定ファイルは /etc/default/unicorn にあるのでこれを編集。 APP_ROOT を Redmine のルートディレクトリに修正。

これと、起動スクリプトをコピーして、 Rails アプリごとに Unicorn サーバーを立てるのが普通なのかな?動なんだろうか。

# Change paramentres below to appropriate values and set CONFIGURED to yes.
# CONFIGURED=no
CONFIGURED=yes

# Default timeout until child process is killed during server upgrade,
# it has *no* relation to option "timeout" in server's config.rb.
TIMEOUT=60

# Path to your web application, sh'ld be also set in server's config.rb,
# option "working_directory". Rack's config.ru is located here.
# APP_ROOT=/path/to/your/web/application
APP_ROOT=/var/redmine

# Server's config.rb, it's not a rack's config.ru
# CONFIG_RB="$APP_ROOT/unicorn.conf.rb"
CONFIG_RB="$APP_ROOT/config/unicorn.rb"

# Where to store PID, sh'ld be also set in server's config.rb, option "pid".
# PID=/run/unicorn.pid
PID=/var/redmine/run/unicorn.pid

# Additional arguments passed to unicorn, see man (1) unicorn.
# UNICORN_OPTS="-D -c $CONFIG_RB"
UNICORN_OPTS="/var/redmine/config.ru -D -c $CONFIG_RB -E production"

/var/redmine/config/unicorn.rb

unicorn の設定ファイルは、ひな形が /usr/share/doc/unicorn/examples/unicorn.conf.minimal.rb にあるので、それをコピーして使用する。コピー先は、 /etc/default/unicorn 内の CONFIG_RB の設定値(今回は /var/redmine/config/unicorn.rb)。

sudo -u www-data cp /usr/share/doc/unicorn/examples/unicorn.conf.minimal.rb /var/redmine/config/unicorn.rb

下記のように修正。

# Minimal sample configuration file for Unicorn (not Rack) when used
# with daemonization (unicorn -D) started in your working directory.
#
# See http://unicorn.bogomips.org/Unicorn/Configurator.html for complete
# documentation.
# See also http://unicorn.bogomips.org/examples/unicorn.conf.rb for
# a more verbose configuration using more features.

listen 2007 # by default Unicorn listens on port 8080
worker_processes 2 # this should be >= nr_cpus
# pid "/path/to/app/shared/pids/unicorn.pid"
pid "/var/redmine/run/unicorn.pid"
stderr_path "/var/redmine/log/unicorn_stderr.log"
# stderr_path "/path/to/app/shared/log/unicorn.log"
stdout_path "/var/redmine/log/unicorn_stdout.log"
# stdout_path "/path/to/app/shared/log/unicorn.log"

ディレクトリ作成

ログ出力先と PID 出力先を作成。

cd /var/redmine
sudo -u www-data mkdir run log

Unicorn の動作確認(手動)

cd /var/redmine
sudo -u www-data unicorn -c config/unicorn.rb -E production

これで、ホストの 2007 ポートにアクセスすれば、 Redmine のトップページが見れるはず。 終了は Ctrl-D で。

起動スクリプトの準備

/etc/init.c/unicorn がそのままだと動かなかったので修正。

PID と、起動時のオプションを変えた。

起動スクリプト修正

#!/bin/sh
### BEGIN INIT INFO
# Provides:          unicorn
# Required-Start:    $local_fs $remote_fs
# Required-Stop:     $local_fs $remote_fs
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: unicorn initscript
# Description:       unicorn
### END INIT INFO

set -e

NAME=unicorn
DESC="Unicorn web server"

. /lib/lsb/init-functions

if [ -f /etc/default/unicorn ]; then
  . /etc/default/unicorn
fi

DAEMON=/usr/bin/unicorn
# PID=${PID-/run/unicorn.pid}
PID=/var/redmine/run/unicorn.pid

run_by_init() {
    ([ "${previous-}" ] && [ "${runlevel-}" ]) || [ "${runlevel-}" = S ]
}

exit_with_message() {
  if ! run_by_init; then
    log_action_msg "$1 Not starting."
  fi
  exit 0
}

check_config() {
  if [ $CONFIGURED != "yes" ]; then
    exit_with_message "Unicorn is not configured (see /etc/default/unicorn)."
  fi
}

check_app_root() {
  if ! [ -d $APP_ROOT ]; then
    exit_with_message "Application directory $APP_ROOT is not exist."
  fi
}

set -u

case "$1" in
  start)
        check_config
        check_app_root

        log_daemon_msg "Starting $DESC" $NAME || true
#         if start-stop-daemon --start --quiet --oknodo --pidfile $PID --exec $DAEMON -- $UNICORN_OPTS; then
        if start-stop-daemon --start --chdir /var/redmine --quiet --oknodo --pidfile $PID --exec $DAEMON -- $UNICORN_OPTS; then
          log_end_msg 0 || true
        else
          log_end_msg 1 || true
        fi
              ;;
  stop)
        log_daemon_msg "Stopping $DESC" $NAME || true
        if start-stop-daemon --stop --signal QUIT --quiet --oknodo --pidfile $PID; then
          log_end_msg 0 || true
        else
          log_end_msg 1 || true
        fi
        ;;
  force-stop)
        log_daemon_msg "Forcing stop of $DESC" $NAME || true
        if start-stop-daemon --stop --quiet --oknodo --pidfile $PID; then
          log_end_msg 0 || true
        else
          log_end_msg 1 || true
        fi
        ;;
  restart|force-reload)
        log_daemon_msg "Restarting $DESC" $NAME || true
        start-stop-daemon --stop --quiet --oknodo --pidfile $PID
        sleep 1
        if start-stop-daemon --start --quiet --oknodo --pidfile $PID --exec $DAEMON -- $UNICORN_OPTS; then
          log_end_msg 0 || true
        else
          log_end_msg 1 || true
        fi
        ;;
  reload)
        log_daemon_msg "Reloading $DESC" $NAME || true
        if start-stop-daemon --stop --signal HUP --quiet --oknodo --pidfile $PID; then
          log_end_msg 0 || true
        else
          log_end_msg 1 || true
        fi
        ;;
  reopen-logs)
        log_daemon_msg "Relopening log files of $DESC" $NAME || true
        if start-stop-daemon --stop --signal USR1 --quiet --oknodo --pidfile $PID; then
          log_end_msg 0 || true
        else
          log_end_msg 1 || true
        fi
        ;;
  status)
        status_of_proc -p $PID $DAEMON $NAME && exit 0 || exit $?
        ;;
  *)
        log_action_msg "Usage: $0 <start|stop|restart|force-reload|reload|force-stop|reopen-logs|status>" || true
        exit 1
        ;;
esac

systemctl 更新

sudo systemctl daemon-reload

動作確認

起動確認

sudo service unicorn start

終了確認

sudo service unicorn stop

2016/09/30

[作業記録][Debian]Debian 最小構成から Redmine を動かすまで(1)

Debian 最小構成から Redmine を動かすまで(1)

環境

  • Debian 8.5 最小構成インストール
  • sudo, vim, ssh はインストール済み

目標

Redmine + sqlite3 + Nginx + Unicorn な環境を作る。

...が、今回は、Redmine をインストールして、 動作確認のため WEBRick でトップページを拝むまで。

Apache2 は昔やっていたらしい。

親知らずの日記: [Debian][鯖][作業記録] Debian 最小構成インストールから Apache2 + Redmine の index.html を拝むまで : http://oyasirazu.blogspot.jp/2012/09/debian-debian-apache2-redmine-indexhtml.html

手順概要

  1. Redmine の準備
    1. Redmine のインストール
    2. Redmine の動作確認

Redmine の準備

Redmine のインストール

sudo apt install redmine

...(略、次のは Yes を選択)
┌────────────────────────────────────┤ Configuring redmine ├
│ │ The redmine/instances/default package must have a database installed and configured before │
│ it can be used.  This can be optionally handled with dbconfig-common.                         │
│                                                                                               │
│ If you are an advanced database administrator and know that you want to perform this          │
│ configuration manually, or if your database has already been installed and configured, you    │
│ should refuse this option.  Details on what needs to be done should most likely be provided   │
│ in /usr/share/doc/redmine/instances/default.                                                  │
│                                                                                               │
│ Otherwise, you should probably choose this option.                                            │
│                                                                                               │
│ Configure database for redmine/instances/default with dbconfig-common?                        │
│                                                                                               │
│                          <Yes>>                             <No>>                             │
│                                                                                               │
└─────────────────────────────────────────────────
....(略、次のは sqlite3 を選択)
┌─────────────────────────────────┤ Configuring redmine ├
│ The redmine/instances/default package can be configured to use one of several database  │
│ types. Below, you will be presented with the available choices.                         │
│                                                                                         │
│ Database type to be used by redmine/instances/default:                                  │
│                                                                                         │
│                                         sqlite3                                         │
│                                         pgsql                                           │
│                                         mysql                                           │
│                                                                                         │
│                                                                                         │
│                         <Ok>                             <Cancel>                       │
│                                                                                         │
└──────────────────────────────────────────────
....(略)

Redmine の動作確認

デフォルトの場所が気に入らないので移動して動作確認する。

sudo mkdir /var/redmine
cd /var/redmine
sudo cp -a /usr/share/redmine/* /var/redmine/
sudo chown -R www-data:www-data /var/redmine/
sudo -u www-data ruby bin/rails server webrick -e production

この状態でホストの 3000 ポートにアクセスすれば、 Redmine のトップページが拝める。

2015/11/10

[作業記録]Mikutter on JRuby on Debian 環境構築手順メモ

目次

環境

  • OS: Debian 8 minimal インストールから、ssh, sudo をインストールした状態。

手順

### 必要なパッケージのインストール
sudo aptitude update
sudo aptitude install git default-jdk

### jruby の準備(apt のパッケージが古くて?gem install に失敗するため、新しいのを持ってくる)
mkdir develop
cd develop
wget https://s3.amazonaws.com/jruby.org/downloads/9.0.3.0/jruby-bin-9.0.3.0.tar.gz
tar zxfv jruby-bin-9.0.3.0.tar.gz
PATH=$PATH:~/develop/jruby-9.0.3.0/bin/

mkdir -p ~/project
cd ~/project
git clone git://toshia.dip.jp/mikutter.git
cd mikutter

### プラグイン調整開始
cd core/plugin

# 不要なプラグインを削除
rm -rf achievement activity alsa aspectframe bitly bugreport change_account command console direct_message display_requirements extract followingcontrol gtk gui home_timeline image_file_cache libnotify list list_for_profile list_settings mentions notify openimg photo_support profile proxy ratelimit saved_search search set_input set_view settings shortcutkey skin smartthread sound user_filesystem_cache

# CUI で streaming が有効になるように、依存関係から gui を外す
sed -e "s/  - gui//g" streaming/.mikutter.yml > streaming/.mikutter.yml_; mv streaming/.mikutter.yml_ streaming/.mikutter.yml

# CUI 用のプラグインを入れる
mkdir -p ~/.mikutter/plugin
cd ~/.mikutter/plugin
git clone git://github.com/mikoto2000/mikutter_stdout.git stdout
git clone git://github.com/mikoto2000/mikutter_cui_account_register.git cui_account_register

### 実行
cd ~/project/mikutter
jruby -S gem install bundle
jruby -S bundle install --path=vendor/bundle
jruby -S bundle exec jruby mikutter.rb

2014/09/27

[作業記録, Debian] tmux をビルドした

早速ダウンロード・ビルド

git clone git://git.code.sf.net/p/tmux/tmux-code tmux-tmux-code

./configure
-bash: ./configure: No such file or directory

あ、configure ない。 README 見よう。

...(抜粋)
    $ git clone git://git.code.sf.net/p/tmux/tmux-code tmux
    $ cd tmux
    $ sh autogen.sh
    $ ./configure && make

autogen が必要みたい。

sh autogen.sh
autogen.sh: 16: autogen.sh: aclocal: not found
aclocal failed

aclocal とな。 automake がいるのか。というか入れてなかったっけ?

sudo aptitude install automake
sh autogen.sh
./configure
checking for library containing event_init... !!!configure: error: "libevent not found"!!!

こんどは libevent だ。

sudo aptitude install libevent-dev
./configure --prefix=/home/mikoto/opt/tmux
make -j8
make install

うん、できたっぽい。作業記録なので動作確認は割愛。あと、ビルドのためのパッケージはほぼすべてインストール済みだったのでそれも省略。

2014/09/20

[Debian, Ruby]Debian(wheezy) に rbenv で ruby2.1.3 をインストール

これだけ。

# 必要パッケージ取得
sudo apt-get install autoconf bison build-essential libssl-dev libyaml-dev libreadline6-dev zlib1g-dev libncurses5-dev rbenv ruby-build

# rbenv 初期設定
rbenv init
echo eval "$(rbenv init -)" >> .bashrc

# 2.1.3 のパッケージ URL を指定したファイルを作成
vim 2.1.3
cat ./2.1.3
install_package "yaml-0.1.4" "http://pyyaml.org/download/libyaml/yaml-0.1.4.tar.gz"
install_package "ruby-2.1.3" "http://ftp.ruby-lang.org/pub/ruby/2.1/ruby-2.1.3.tar.gz"

# 2.1.3 インストール
rbenv install ./2.1.3

# ruby コマンドで 2.1.3 が呼び出されるようにする。
rbenv global 2.1.3

2014/05/11

[作業記録][Debian]ALminium を導入しようとしてみた


下準備

仮想マシン再作成

# ホストPCで
sudo virsh destroy alminium
sudo virsh undefine alminium
sudo virsh vol-delete --pool default alminium.img
sudo rm /var/lib/libvirt/images/alminium.img
sudo virt-clone -o debian_org -n alminium --file /var/lib/libvirt/images/alminium.img
sudo virsh setmaxmem alminium 2048000
sudo virsh start alminium
sudo virsh setmem alminium 2048000
# 下記確認・設定を行う
# ホスト名修正
# IP アドレス確認
sudo virsh console alminium

ベースは ssh, git 導入済みなので ssh で接続。 次に、 Jenkins のインストールと、ベース URL の設定を行う。

Jenkins のインストール・設定

# ゲストPCで
sudo aptitude update && sudo aptitude -y dist-upgrade
# Debian では Jenkins インストールしてくれなかったのでインストールする
wget -q -O - http://pkg.jenkins-ci.org/debian/jenkins-ci.org.key | sudo apt-key add -
echo 'deb http://pkg.jenkins-ci.org/debian binary/' | sudo tee -a /etc/apt/sources.list
sudo aptitude update && sudo aptitude install jenkins
sudo service jenkins restart

ベース URL の設定。

/etc/default/jenkins の JENKINS_ARGS の末尾に "--prefix=$PREFIX" を追加する。

本番

ALMinium のインストール

cd ~/work
git clone https://github.com/alminium/alminium.git
cd alminium
sudo bash ./smelt
Debian / Ubuntu が検出されました。
インストールに失敗するかも知れませんが、お許しくださいm(__)m

途中MySQLのパスワードを聞かれたら空のままエンターキーを押してください。
MySQLのパスワードを設定するとインストールに失敗します。
パスワードを設定したい場合は、ALMiniumのインストール完了後行ってください
*******************************************************
  ホスト名の設定
*******************************************************
ホスト名(IPアドレスもしくはDNS名)を入力してください。ホスト名はApacheのバーチャルホストで利用されます。
例えば、192.168.1.4をホスト名で入力すると、http://192.168.1.4/でアクセスすることになります。
(上記の設定ではhttp://localhost/では接続できないのでご注意ください)
ホスト名: 192.168.11.209


*******************************************************
  SSLのサポート
*******************************************************
SSLのサポートを有効にすると、httpsのみの接続を許可します。
httpでのアクセスは、全てhttpsのポートへ転送されるようになります。
SSLの証明書は認証機関により署名されたものではありません。通信の暗号化のみ
に利用します。
gitの利用では、

  $ git config --global http.sslVerify false

などのコマンドで、SSLの証明書を無効にする必要があります。

SSL(https)サポートを有効にしますか?(y/N) N


*******************************************************
  メール設定
*******************************************************
Redmineのシステムメールを送信するための設定を行います。

<利用する上での注意>
・利用したいメールシステムと通信可能なことをご確認ください。ファイアーウォールなどで遮断されている場合は管理者にお問い合わせください。
・Sendmailコマンドを利用する場合、別途Sendmailの設定を行う必要があります。
・G-Mail/Hotmailを利用する場合、ユーザー名とパスワードがあれば利用可能です。

次の中から、使いたいメールシステムを選択してください。
ここでメール設定を行わない場合は「N」を選択してください。

0. 独自のメールサーバーを設定する
1. Linux内のSendmailコマンドを使用する
2. G-Mail/Google Apps
3. Windows Live Hotmail

N. メール設定をしない

番号選択: N


メール設定を行いません。


継続的インテグレーションツールのJenkinsのインストール・設定を行うことができます。デフォルトはインストールしません。よく分からなければNを選択してください。Jenkinsをインストールしますか?[y/N]y

※ ここで、MySQL のルートパスワード入力になるが、空ですすめる。

... (snip)

Enabling site jenkins.
To activate the new configuration, you need to run:
  service apache2 reload
mkdir: cannot create directory `/var/lib/jenkins/plugins': File exists
[ ok ] Restarting Jenkins Continuous Integration Server: jenkins.
--2014-05-10 10:20:28--  http://localhost:8080/jenkins/jnlpJars/jenkins-cli.jar
Resolving localhost (localhost)... ::1, 127.0.0.1
Connecting to localhost (localhost)|::1|:8080... connected.
HTTP request sent, awaiting response... 503 Service Unavailable
2014-05-10 10:20:32 ERROR 503: Service Unavailable.
...(snip)

こんな感じのエラーで無限ループになるので、 Jenkins の設定を頑張る。

cd /var/lib/jenkins
mv config.xml _config.xml
sudo service jenkins restart

先には進むが、いろいろ残念なことになるので解消する。

[....] Starting web server: apache2apache2: Syntax error on line 268 of /etc/apache2/apache2.conf: Syntax error on line 1 of /etc/apache2/sites-enabled/redmine: Cannot load /usr/lib/ruby/gems/1.9.1/gems/passenger-4.0.42/buildout/apache2/mod_passenger.so into server: /usr/lib/ruby/gems/1.9.1/gems/passenger-4.0.42/buildout/apache2/mod_passenger.so: cannot open shared object file: No such file or directory
Action 'start' failed.
The Apache error log may have more information.
 failed!

Jenkins から。

cd /var/lib/jenkins
mv _config.xml config.xml
sudo service jenkins restart

その後、 Jenkins にアクセスし、アップデート等行う。

次、 apache2。これは、 mod_passenger が無いと言っているようなので apt でインストールする。

sudo aptitude install libapache2-mod-passenger
sudo service apache2 restart

apache2 のページを開くと、 gem 'thin (>=0) ruby' が無いって怒られた。 thin をインストールする。

sudo gem install thin rubu

...まだたりないらしい。

gem パッケージが足りないとすると、Gemfile.local あたり探せば良いかな。あった。

cd /opt/alminium
bundle update
...(snip)

いろいろインストールされた。 ALMinium のホーム画面は表示されたけれど、エラーだか警告だかのメッセージが表示されている。

バックログが設定されていません。設定画面 管理 > プラグイン, からリンク 設定 をクリックして設定してください。フィールドを設定後、このページへ戻りツールを利用してください。

ログを見てみる。 (/opt/alminium/log/production.log)

~ { .log } DEPRECATION WARNING: Passing a template handler in the template name is deprecated. You can simply remove the handler name or pass render :handlers => [:erb] instead. (called from realtime at /usr/lib/ruby/1.9.1/benchmark.rb:295) }

バックログの設定の警告とは関係ないログっぽい。 /opt/alminium/plugins/redmine_backlogs/app/controllers/rb_server_variables_controller.rb を修正。

---    format.js { render :file => 'rb_server_variables/show.js.erb', :layout => false }
+++    format.js { render :file => 'rb_server_variables/show', :layout => false }

バックログの DB マイグレーションがうまくいっていなかったらしい。

Support - "Plugin migrations have not been executed" after successfull installation

cd /opt/alminium
sudo rake redmine:plugins:migrate RAILS_ENV=production

とりあえずホーム画面は映った。

残課題

  • Jenkins の認証がおかしい。
    • ログインユーザが「(null)」になっている。
    • 「Jenkinsの管理」画面に「リバースプロキシーの設定がおかしいようです。」と表示される。

あと、インストールスクリプトちょっと見る限り、 Jenkins はリポジトリの登録さえしておけば apt-get でインストールはしてくれそう。その後の設定がどうなるかは読んでないけれど。

apache2, redmine, jenkins あたりの認証共通化の仕組みを勉強しないことにはこれ以上ダメそうね。どうしたものか。

2013/12/22

[Debian]Ricty のインストール

Ricty のインストール

# 合成元のフォントパッケージをインストール
sudo aptitude install fontforge ttf-inconsolata fonts-migmix

# 作業用ディレクトリの作成と移動
mkdir -p ~/tmp/ricty
cd ~/tmp/ricty/

# 合成スクリプト取得
wget https://raw.github.com/yascentur/Ricty/master/ricty_generator.sh

# 合成開始
sh ricty_generator.sh auto

# フォントインストール
mkdir ~/.fonts
cp -f Ricty-\*.ttf ~/.fonts/
fc-cache -vf

2013/10/29

[Debian][鯖]Gitit のインストール

インストール

aptitude install gitit git-core

データ格納ディレクトリ作成

mkdir -p /data/wiki

デフォルト設定ファイルの作成

gitit --print-default-config > /data/wiki/gitit.conf
vi /data/wiki/gitit.conf
# 修正点のみ抜き出し
# パスをすべて絶対パスに直す
repository-path: /data/wiki/wikidata
user-file: /data/wiki/gitit-users
static-dir: /data/wiki/static
templates-dir: /data/wiki/templates
log-file: /data/wiki/gitit.log

起動スクリプト作成

cp /etc/init.d/skeleton /etc/init.d/gitit
vi /etc/init.d/gitit
#! /bin/sh
### BEGIN INIT INFO
# Provides:          gitit
# Required-Start:    $remote_fs $syslog
# Required-Stop:     $remote_fs $syslog
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Wiki Server Gitit
# Description:       Wiki Server Gitit
### END INIT INFO

# Author: mikoto2000 <mikoto2000>

# Do NOT "set -e"

# PATH should only include /usr/* if it runs after the mountnfs.sh script
PATH=/sbin:/usr/sbin:/bin:/usr/bin
DESC="Wiki Server Gitit"
NAME=gitit
DAEMON=/usr/bin/$NAME
DAEMON_ARGS="-f /data/wiki/gitit.conf"
PIDFILE=/var/run/$NAME.pid
SCRIPTNAME=/etc/init.d/$NAME
PWD=/data/wiki

# Exit if the package is not installed
[ -x "$DAEMON" ] || exit 0

# Read configuration variable file if it is present
[ -r /etc/default/$NAME ] && . /etc/default/$NAME

# Load the VERBOSE setting and other rcS variables
. /lib/init/vars.sh

# Define LSB log_* functions.
# Depend on lsb-base (>= 3.2-14) to ensure that this file is present
# and status_of_proc is working.
. /lib/lsb/init-functions

#
# Function that starts the daemon/service
#
do_start()
{
    # Return
    #   0 if daemon has been started
    #   1 if daemon was already running
    #   2 if daemon could not be started
    start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON --test > /dev/null \
        || return 1
    start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON --background -- \
        $DAEMON_ARGS \
        || return 2
    # Add code here, if necessary, that waits for the process to be ready
    # to handle requests from services started subsequently which depend
    # on this one.  As a last resort, sleep for some time.
}

#
# Function that stops the daemon/service
#
do_stop()
{
    # Return
    #   0 if daemon has been stopped
    #   1 if daemon was already stopped
    #   2 if daemon could not be stopped
    #   other if a failure occurred
    start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --pidfile $PIDFILE --name $NAME
    RETVAL="$?"
    [ "$RETVAL" = 2 ] && return 2
    # Wait for children to finish too if this is a daemon that forks
    # and if the daemon is only ever run from this initscript.
    # If the above conditions are not satisfied then add some other code
    # that waits for the process to drop all resources that could be
    # needed by services started subsequently.  A last resort is to
    # sleep for some time.
    start-stop-daemon --stop --quiet --oknodo --retry=5 --signal 0 --exec $DAEMON
    [ "$?" = 2 ] && return 2
    # Many daemons don't delete their pidfiles when they exit.
    rm -f $PIDFILE
    return "$RETVAL"
}

#
# Function that sends a SIGHUP to the daemon/service
#
do_reload() {
    #
    # If the daemon can reload its configuration without
    # restarting (for example, when it is sent a SIGHUP),
    # then implement that here.
    #
    start-stop-daemon --stop --signal 1 --quiet --pidfile $PIDFILE --name $NAME
    return 0
}

case "$1" in
  start)
    [ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME"
    do_start
    case "$?" in
        0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
        2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
    esac
    ;;
  stop)
    [ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"
    do_stop
    case "$?" in
        0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
        2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
    esac
    ;;
  status)
       status_of_proc "$DAEMON" "$NAME" && exit 0 || exit $?
       ;;
  #reload|force-reload)
    #
    # If do_reload() is not implemented then leave this commented out
    # and leave 'force-reload' as an alias for 'restart'.
    #
    #log_daemon_msg "Reloading $DESC" "$NAME"
    #do_reload
    #log_end_msg $?
    #;;
  restart|force-reload)
    #
    # If the "reload" option is implemented then remove the
    # 'force-reload' alias
    #
    log_daemon_msg "Restarting $DESC" "$NAME"
    do_stop
    case "$?" in
      0|1)
        do_start
        case "$?" in
            0) log_end_msg 0 ;;
            1) log_end_msg 1 ;; # Old process is still running
            *) log_end_msg 1 ;; # Failed to start
        esac
        ;;
      *)
        # Failed to stop
        log_end_msg 1
        ;;
    esac
    ;;
  *)
    #echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload}" >&2
    echo "Usage: $SCRIPTNAME {start|stop|status|restart|force-reload}" >&2
    exit 3
    ;;
esac

:

起動スクリプトに実行権限追加

chmod a+x /etc/init.d/gitit

スタート確認

/etc/init.d/gitit start
ps aux | grep gitit

ストップ確認

/etc/init.d/gitit stop
ps aux | grep gitit

サービス登録

update-rc.d gitit defaults

2013/05/28

[Debian] Debian 最小構成インストールからデスクトップ環境を作る

全部作業が終わってからメモしてないのに気づいて .bash_history から作業内容をサルベージした。あとから見て思い出す分には多分大丈夫という程度の残念メモ。

1. aptitude のプロキシ設定

2. aptline の修正

3. パッケージのインストール

aptitude install awesome awesome-extra
aptitude install x-window-system
aptitude install mozc
aptitude install iceweasel
aptitude install iceweasel-vimperator
aptitude install vim
aptitude install git
aptitude install ibus-mozc
aptitude install ttf-japanese-gothic ttf-japanese-mincho
aptitude install fonts-japanese-gothic fonts-japanese-mincho
aptitude install fonts-ipafont-gothic fonts-ipafont-mincho
aptitude install ttf-kochi-gothic-naga10 ttf-kochi-mincho-naga10
aptitude install ttf-vlgothic
aptitude install ttf-takao

4. キーボードレイアウト変更(capsをctrlへ)

/etc/default/keyboard を編集する。 XKBOPTIONS に "ctrl:nocaps" を設定する。
XKBOPTIONS="ctrl:nocaps"

5. グラフィックドライバインストール(?)

aptitude install nvidia-glx

6. (ここまでやって x-window-system が立ち上がらなくなる)

7. xorg.conf の作成

Xorg -configure
mv xorg.conf.new /etc/X11/xorg.conf

8. パッケージインストール第 2 弾

aptitude install cifs-utils
aptitude install vim-athena
aptitude install sudo
aptitude install xdm

9. vim 環境

vim プラグインのインストールと、 vimproc のビルド。
aptitude install gcc make
cd ~/.vim/bundle/vimproc/
make -f make_unix.mak

10. 新しい iceweasel のインストール

aptitude install debian-keyring
aptitude install pkg-mozilla-archive-keyring
# "deb http://mozilla.debian.net/ wheezy-backports iceweasel-release" を追加
vi /etc/apt/sources.list
aptitude update
aptitude purge iceweasel
deb http://debian.multimedia.org wheezy main contrib non-free
aptitude install -t wheezy-backports iceweasel

11. google-chrome のインストール

mkdir /var/cache/localdeb
cd /var/cache/localdeb/
apt-ftparchive packages . | gzip -c9 > Packages.gz
apt-ftparchive sources . | gzip -c9 > Sources.gz
# "deb file:/va/cache/localdeb ./" を追加
vi /etc/apt/sources.list
aptitude update
aptitude install google-chrome-stable

12. 音関係

aptitude install alsa
# 認識されているサウンドデバイスの一覧表示らしい。
# 結果の card, device を確認
aplay -l
# どの card,device で音がなるかを確認していく
aplay -D plughw:1,3 /usr/share/sounds/alsa/Front_Center.wav 
aplay -D plughw:1,7 /usr/share/sounds/alsa/Front_Center.wav 
...
# デフォルトで使用するサウンドデバイスを設定する
vi /etc/asound.conf
# /etc/asound.conf の中身.
# pcm.!default {
#  type hw
#  card 1
#  device 7
#}

13. 今思い出したパッケージ

aptitude install pandoc

14. ファイル関連付け

vi ~/.local/share/applications/mimeapps.list
# ~/.local/share/applications/mimeapps.list の内容
# [Default Applications]
# text/plain=gvim.desktop
# text/x-markdown=gvim.desktop
# text/html=iceweasel.desktop
# application/pdf=xpdf.desktop

まとめ

素直にインストール時点で Desktop 環境を選択しましょう。

2012/09/01

[Debian][鯖][作業記録] Debian 最小構成インストールから Apache2 + Redmine の index.html を拝むまで

やったこと

  1. redmine のインストール
  2. apache との連携設定

redmine の導入

# パッケージのインストール
aptitude install redmine

# コンテンツ(?)ファイル郡のコピー
#(デフォルトの場所が気に入らなかったので場所変更)
mkdir /var/redmine
cd /var/redmine
cp -a /usr/share/redmine/* ./

# 起動テスト
ruby script/server webrick -e production
=> Booting WEBrick
=> Rails 2.3.5 application starting on http://127.0.0.1:3000
./script/../config/../vendor/rails/railties/lib/rails/gem_dependency.rb:119:Warning: Gem::Dependency#version_requirements is deprecated and will be removed on or after August 2010.  Use #requirement
/var/redmine/vendor/rails/railties/lib/rails/rack/log_tailer.rb:10:in `size': No such file or directory - /var/redmine/log/production.log (Errno::ENOENT)
        from /var/redmine/vendor/rails/railties/lib/rails/rack/log_tailer.rb:10:in `initialize'
        from /usr/lib/ruby/1.8/rack/builder.rb:54:in `new'
        from /usr/lib/ruby/1.8/rack/builder.rb:54:in `use'
        from /usr/lib/ruby/1.8/rack/builder.rb:73:in `call'
        from /usr/lib/ruby/1.8/rack/builder.rb:73:in `to_app'
        from /usr/lib/ruby/1.8/rack/builder.rb:71:in `inject'
        from /usr/lib/ruby/1.8/rack/builder.rb:73:in `each'
        from /usr/lib/ruby/1.8/rack/builder.rb:73:in `inject'
        from /usr/lib/ruby/1.8/rack/builder.rb:73:in `to_app'
        from /var/redmine/vendor/rails/railties/lib/commands/server.rb:95
        from /usr/lib/ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
        from /usr/lib/ruby/1.8/rubygems/custom_require.rb:31:in `require'
        from script/server:3

# production.log がないと怒られたので作成する
mkdir log
touch log/production.log
ruby script/server webrick -e production

# 動作確認
w3m http://127.0.0.1:3000/

apache2 との連携設定

# 必要パッケージインストール
aptitude install apache2 libapache2-mod-passenger

# ここで指定したパスにアクセスすると、 rails が動く?
echo 'RailsBaseURI /redmine" >> /etc/apache2/httpd.conf

# apache の公開ディレクトリに、
# redmine のファイルへのシンボリックリンクを作成。
ln -s /var/redmine/public redmine

# apache スタート
/etc/init.d/apache2 restart

設定は、深く考えずに書きサイトよりコピペ的に拝借しました。

複数 Rails を行う設定なんかもあるようですね。 いつかは調べることになりそう。

参考文献

Apache + Passenger で作る Redmine 環境

複数アプリを動かす時のDocumentRootとRailsBaseURIの関係 | 世界 - daipresents!!

2012/08/23

[作業記録][Debian][KVM] Debian 最小構成から KVM 仮想マシンを作成するまで

Debian で KVM

事前準備

  1. 最初の HDD に ESXi が残ったままだったので、 grub がインストールできなかった...。
  2. grub インストールをスキップし、とりあえずインストールを完了させる。
  3. netinst CD を使って、レスキューモードで起動。
  4. なんか使い方解らんかった...。
  5. ということで再インストール。
  6. ssh をインストール。

結局のところ、 Debian 最小構成 + SSH からのスタートということで。 さて、ここから KVM.

事前準備

aptitude install kvm
adduser mikoto kvm
shutdown -r now

※ mikoto を kvm グループに入れてますが、ブリッジ接続の為に、 sudo(or root ユーザ) で起動することになりました。

VM 作成

mkdir -p ~/vms/vdebian
kvm-img create -f qcow2 ~/vms/vdebian/vdebian.img 10GB

VM 実行してみる

iso はたまたま HDD にあった Debian の LiveCD イメージを流用。 インストール不要ですぐ動作確認・環境確認ができて意外と便利でした。

ホスト OS に X サーバを入れていないので、 VNC 接続でインストールする。

kvm -hda vdebian.img -cdrom ~/debian-live-6.0.4md64-standard.iso -boot d -m 2048 -vnc :0,password -monitor stdio 
cQEMU 0.12.5 monitor - type 'help' for more information
(qemu) change vnc password
Password: **********
(qemu) 

これで、 VNC クライアントで VM に接続できるようになった。

今は、 qemu への入力をファイルに書いてリダイレクトで流し込むようにしている。 本当は設定ファイルとかありそうですがね。

kvm -hda vdebian.img -cdrom ~/debian-live-6.0.4md64-standard.iso -boot d -m 2048 -vnc :0,password -monitor stdio < vdebian.conf
cQEMU 0.12.5 monitor - type 'help' for more information
(qemu) change vnc password
Password: **********
(qemu) 

これだけだと、 NAT 接続の設定のようなので、ブリッジの設定を行う必要がある。

ブリッジの設定

/etc/network/interfaces の編集

# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

# The loopback network interface
auto lo br0
iface lo inet loopback

iface eth0 inet manual

# The primary network interface
allow-hotplug eth0
iface br0 inet static
    address 192.168.1.111
    netmask 255.255.255.0
    gateway 192.168.1.1
    bridge_ports eth0
    bridge_stp off

ネットワークの再起動

service networking restart

VM 起動

最終的に起動はこんな感じで。

  • ブートでバイスを sda に設定
  • qemu コンソールに接続したい場合は telnet を使用
  • ホストに X が無いので、 -vnc は設定しておく。(無いとエラーで怒られるので)
  • (基本的にコンソールでしか使わないので、 ssh の設定さえしてしまえばこっちのもの)
  • デーモンとして起動
kvm -hda vdebian.img -boot c -m 2048 -monitor telnet:127.0.0.1:10023,server,nowait -net nic,macaddr=12:34:56:78:90:12,model=e1000 -net tap,ifname=tap0 -vnc none -daemonize

参考文献

openSUSE 12.2: 第13章 QEMU モニタを利用した仮想マシンの管理

vnc設定に挑戦してみる - ymkoの日記

KVMを使う(ネットワーク設定編) « さくらインターネット研究所

DebianにインストールしたKVMの仮想OSで、ブリッジ接続が使えるようにする - Symfoware

2010/12/19

[Debian]debian squeeze amd64 に AcrobatReader9 をインストール

atpline に追加

deb http://www.debian-multimedia.org etch main non-free

acroread と、その日本語環境インストール

sudo aptitude search acroread acroread-fonts-jpn acroread-l10n-ja acroread-dictionary-ja
以上。

2010/12/07

[Debian]windowsに接続されたプリンタを使う

必要パッケージ

sudo aptitude install dpkg-dev debhelper autotools-dev
sudo aptitude install cups libcups2-dev
sudo aptitude install libltdl3-dev

pipslite_1.5.0-2.tar.gz をダウンロード。

Linuxドライバー|アヴァシス株式会社
tar zxfv pipslite_3.5.0-2.tar.gz
cd pipslite_1.5.0
sudo dpkg-buildpackage -rfakeroot -us -uc
cd ..
sudo dpkg -i pipslite_1.5.0-2_amd64.deb

windows側の設定

[Debian]いろんな(?)開発環境導入

OS

は squeez です。

java5

一時的に aptline を lenny に変更し、
sudo aptitude install sun-java5-jdk
aptline を元にもどすのを忘れずに!

java6

sudo aptitude install sun-java6-jdk

java5 と java6 の切り替え

sudo update-alternatives --config java
sudo update-alternatives --config javac
それぞれ、使いたい java に対応した番号を入力すれば ok.

android, em ビルドのためのものども(java は上でインストール済みだから除く)

sudo aptitude install git-core gnupg flex bison gperf build-essential zip curl zlib1g-dev gcc-multilib g++-multilib libc6-dev-i386 lib32ncurses5-dev ia32-libs x11proto-core-dev libx11-dev lib32readline5-dev lib32z-dev uboot-mkimage
X11 のシンボリックリンクが無いらしい。
sudo ln -s /usrsudo ln -s /usr/lib32/libX11.so.6 /usr/lib32/libX11.so/lib32/libX11.so.6 /usr/lib32/libX11.so

eclipse

sudo aptitude install eclipse

arm linux クロスコンパイル環境

下記サイトをみて arm linux 用の toolchain を持ってくる。
Embedded Debian -- Cross-development toolchains
aptline に 
deb http://www.emdebian.org/debian/ lenny main 
を追加すると同時に、 squeeze を lenny とする。
sudo aptitude install linux-libc-dev-armel-cross libc6-armel-cross libc6-dev-armel-cross binutils-arm-linux-gnueabi gcc-4.3-arm-linux-gnueabi g++-4.3-arm-linux-gnueabi
lenny を squeez に戻す。

自分用に arm-linux-gnueabi をコピー

cp -r /usr/arm-linux-gnueabi ~/embdebian/

jpeglib のクロスコンパイル

mkdir -p ~/embdebian/libs
cd ~/embdebian/libs
apt-get source libjpeg8-dev
cd libjpeg8-8b
./configure CC=arm-linux-gnueabi-gcc --host=x86_64-linux --target=arm-linux-gnueabi --prefix=~/embdebian/arm-linux-gnueabi
make -j8
make install
これで、 arm-linux-gnueabi 内に、 arm 用の jpeglib がインストールされる。

2010/12/04

[Debiain]最小構成インストールから一通りインストールした記録

apt-line の設定。

vi /etc/apt/sources.list
すべての行に「 contrib non-free 」を追加。

apt パッケージ情報の更新

aptitude update

x-window-system のインストール

aptitude install x-window-system

xfce4 のインストール

aptitude install xfce4

slim (ログインマネージャ) のインストール

aptitude install slim

管理?

aptitude install sudo

ブラウザ

sudo aptitude install iceweasel iceweasel-vimperator
sudo aptitude install flashplugin-nonfree

エディタ

aptitude install vim-gtk

フォント

aptitude install ttf-ipafont-gothic ttf-ipafont-mincho

日本語入力

aptitude install anthy uim-anthy
スタートメニューから、設定->入力メソッド切替器
uim-toolbar を選択。
うかつにターミナルで LC_ALL=C とかいう設定をすると、日本語入力受け付けなくなるので注意。

スクリーンショット

sudo aptitude install xfce4-screenshooter

ランチャ

<Super>space(スタート+スペース)に xfrun4 を割り当てる。
スタートメニュー->設定->キーボード->アプリケーションショートカットキー
xfrun4 をダブルクリックし、スタート+スペースを押下。
"Gnome Do" とかインストールしても、アプリケーションランチャとしてしか使わないからこれで十分。
xfrun4 の環境変数とかがよく分からなかったから、シンボリックリンクで alias の代わりとする。
cd /usr/bin
sudo ln -s xfce4-terminal terminal
sudo ln -s xfce4-screenshooter screenshooter
sudo chmod go-w terminal screenshooter

ネットワーク共有

sudo aptitude install cifs-utils
mount.cifs //ネットワークドライブ マウントポイント
で、ネットワークドライブのマウントができるようになる。
面倒だけれど、 fstab なんかに設定すれば許容範囲内?
マウントしたところに書き込めるように設定
/etc/fstab
//192.168.1.24/datas /home/netdrives/data cifs gid=netdrive,file_mode=0774,dir_mode=0775 0 0
//192.168.1.24/datas02 /home/netdrives/data02 cifs gid=netdrive,file_mode=0774,dir_mode=0775 0 0
こんな感じで設定して、書き込みを許すユーザに netdrive グループに入ってもらう。
IP 直打ちが嫌なら以下の LAN 内の名前解決をする。

LAN 内の名前解決

必要パッケージのインストール
sudo aptitude install samba winbind
名前解決の設定
sudo vi /etc/nsswitch.conf
hosts の項目に wins を追加
sudo vi /etc/samba/smb.conf
wins support = yes と変更。
不要サービスの停止
sudo mv /etc/init.d/S18winbind /etc/init.d/K18winbind

画像ビューワ

sudo aptitude install ristrett

動画プレイヤー

sudo aptitude install vlc
倍速再生でも音が高くならない設定
ツール->設定->左下の「すべて」を選択->オーディオ->フィルタ
「再生レートとオーディオ速度調整機能の同期」にチェック
多分その下のテキストエリアに「scaletempo」と表示される。
表示されなければ自分で書いて。

パネルの設定

sudo aptitude install xfce4-cpugraph-plugin
パネルに、ミキサー, cpugraph, Orageカレンダーを追加

グラフィックドライバ

sudo aptitude install nvidia-setting nvidia-xconfig
依存関係があるから必要なカーネルやら何やらもすべてインストールしてくれる。

リモートデスクトップ

sudo aptitude install rdesktop

仮想端末?

sudo aptitude install screen

圧縮解凍

sudo aptitude install xarchiver

パッケージ内ファイル検索

sudo aptitude install apt-file

マインドマップ

sudo aptitude install freemind ttf-sazanami-gothic ttf-sazanami-mincho
さざなみフォントをインストールしないと文字化けするみたい。

2009/12/05

[Debian]ネットにつながらなくなりました...。

■ ネットにつながらなくなりました...。

 インストール後しばらくは普通に使えていたのですがねぇ...。
dhclient: DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 3
 こんな感じのがひたすら表示されていく感じ。IPを静的割当にしてもつながらない、というかルータへの ping すら通らないという...。
 取り合えず ifconfig。eth0 の認識を確認。それと同時にものすごい勢いで増えていく損失パケット(dropped)を確認。

■ 原因をさぐる

 やっぱり google 検索。「debian ifconfig 損失」で検索。 NIC のドライバがおかしいとこうなるらしい。Debian が NIC 用にロードしたモジュールが、実際はその NIC に対応していなかったって感じ?

■ NIC のドライバをインストールしよう

 今回の本題。
・このノートパソコンの NIC は何だ?
 初めのうちはきちんと動いているみたいだったから特に調べてませんよ? PC の型番で検索をかけて NIC の型番を調べる。
 NIC = Realtek RTL 8168D/8111D Family PCI-E GBE NIC
 (【NVIDIA ION】ドスパラ Prime Note Cresion NA まとめページ【Atom 330】 - スペックより)
 そういえばさっき調べたページでも蟹さんはちょっとアレという話題がでていたなぁ。
・ドライバ入手
 Realteck のホームページから r8168-8.015.00.tar.bz2 をダウンロード。解凍、READMEを読む。ふむ、ビルドにはヘッダやら何やら、新たにパッケージをインストールする必要があるらしい。
・必要なパッケージのダウンロード
 カーネルヘッダーパッケージが必要らしい。自分が使っているカーネルは 2.6.26-2-amd64(?) だから、ダウンロードするのは「linux-headers-2.6.26-2-amd64」。
 もちろん aptitude とか使えないので、別 PC にて手動ダウンロード。debian パッケージの内容を検索(http://www.debian.org/distrib/packages#search_packages) で「linux-headers-2.6.26-2」を検索し、「linux-headers-2.6.26-2-amd64」パッケージをダウンロード。芋づる式に依存パッケージ、依存パッケージの依存パッケージ...とか、全部もってくる。
 もってきたパッケージを USB 経由で debian へ。
・必要なパッケージのインストール
 もってきたパッケージがすべて揃っているディレクトリで、dpkg。
: dpkg -i *
 何か言われると思ったけれどすんなり完了しました。
・ドライバのビルド
 間違ってロードされているモジュールの削除。
: rmmod r8169
 正しいモジュールのビルド
: make clean modules
: make install
 変更の適用(?)
: depmod -a
 正しいモジュールのロード
: modprobe r8168
 確認
: ifconfig -a
・ドライバの自動ロード設定
 mkinitramfs で、起動時に r8168 をロードしてくれる initrd を作成する。
: mkinitramfs -o initrd.img-2.6.26-2-amd64 2.6.26-2-amd64
 元の initrd のバックアップをとったのち、今作った initrd を /boot に突っ込む。
: mv /boot/initrd.img-2.6.26-2-amd64 /boot/initrd.img-2.6.26-2-amd64.bkup
: mv initrd.img-2.6.26-2-amd64 /boot/
 これで、起動時に自動で r8168 をロードしてくれる。...はず。

■ ネットにつながるようになりました!

 めでたしめでたし。