- 追加された行はこの色です。
- 削除された行はこの色です。
*Debian Jessie on Raspberry Pi 2 [#g0ab33f6]
-イメージをMicroSDへ焼く(以下を使用)
**お試し [#ve7201ee]
-イメージ(以下を使用)
--http://sjoerd.luon.net/posts/2015/02/debian-jessie-on-rpi2/
---https://images.collabora.co.uk/rpi2/jessie-rpi2-20150202.img.gz
---https://images.collabora.co.uk/rpi2/jessie-rpi2-20150705.img.gz
--イメージをMicroSDへ焼く(手順省略)
-SSHログイン
--Login as root with password debian
-sshログイン
--有線で接続
---dhcpでIPアドレスが自動で割り振られる。
---Login as root with password debian
-locale,timezone等の設定
#pre{{
# dpkg-reconfigure locales # ja_JP.UTF-8 UTF-8 を選択
# dpkg-reconfigure tzdata # アジア→Tokyo を選択
}}
-レポジトリ設定
--/etc/apt/sources.list
#pre{{
deb http://ftp.jp.debian.org/debian/ jessie main contrib non-free
#deb-src http://ftp.jp.debian.org/debian/ jessie main contrib non-free
#deb http://security.debian.org/ jessie/updates main contrib non-free
#deb-src http://security.debian.org/ jessie/updates main contrib non-free
deb https://repositories.collabora.co.uk/debian/ jessie rpi2
}}
-パッケージ導入
#pre{{
# apt-get update
# apt-get upgrade
# apt-get install emacs-nox screen
# apt-get install wicd-curses firmware-ralink # WiFi設定
# apt-get install curl build-essential # rpi-update
}}
-WiFi設定
--BUFFALO WLI-UC-GNW を使用
--wicd-curses を使って設定
-USER と sudo 設定
#pre{{
# adduser USER
# gpasswd -a USER sudo
}}
**その他 [#k0ea6709]
-firmware(kernel等)の更新
--rpi-updateの準備
#pre{{
# wget -O /usr/local/bin/rpi-update https://raw.githubusercontent.com/Hexxeh/rpi-update/master/rpi-update
# chmod +x /usr/local/bin/rpi-update
}}
--firmware更新
#pre{{
# BOOT_PATH=/boot/firmware ROOT_PATH=/ rpi-update
# reboot
}}
-USB出力電流を増やす設定(1.2Aまで流せるようになる)
-- /boot/firmware/config.txt の最後に以下を追記
#pre{{
safe_mode_gpio=4
max_usb_current=1
}}
-パーティション拡張
--http://eco.senritu.net/raspberrypi_resizefs/ を参照
--/dev/mmcblk0p2パーティションを削除し、再作成(開始セクタはそのままで,終了セクタを最大値にする)
#pre{{
# &color(red){fdisk /dev/mmcblk0};
Command (m for help): &color(red){p};
Disk /dev/mmcblk0: 29.5 GiB, 31657558016 bytes, 61831168 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x50446648
Device Boot Start End Sectors Size Id Type
/dev/mmcblk0p1 2048 249855 247808 121M c W95 FAT32 (LBA)
/dev/mmcblk0p2 249856 6146047 5896192 2.8G 83 Linux
Command (m for help): &color(red){d};
Partition number (1,2, default 2): &color(red){2};
Partition 2 has been deleted.
Command (m for help): &color(red){n};
Partition type
p primary (1 primary, 0 extended, 3 free)
e extended (container for logical partitions)
Select (default p): &color(red){p};
Partition number (2-4, default 2): &color(red){2};
First sector (249856-61831167, default 249856):
Last sector, +sectors or +size{K,M,G,T,P} (249856-61831167, default 61831167):
Created a new partition 2 of type 'Linux' and of size 29.4 GiB.
Command (m for help): &color(red){p};
Disk /dev/mmcblk0: 29.5 GiB, 31657558016 bytes, 61831168 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x50446648
Device Boot Start End Sectors Size Id Type
/dev/mmcblk0p1 2048 249855 247808 121M c W95 FAT32 (LBA)
/dev/mmcblk0p2 249856 61831167 61581312 29.4G 83 Linux
Command (m for help): &color(red){w};
The partition table has been altered.
Calling ioctl() to re-read partition table.
Re-reading the partition table failed.: Device or resource busy
The kernel still uses the old table. The new table will be used at the next reboot or after you run partprobe(8) or kpartx(8).
}}
--リーブート
--パーティション拡張
#pre{{
# resize2fs /dev/mmcblk0p2
}}
-レポジトリ追加
**基本情報 [#c391f88b]
-uname -a
#pre{{
# diff -urpN /etc/apt/sources.list~ /etc/apt/sources.list
--- /etc/apt/sources.list~ 2015-02-02 18:49:11.704413787 +0000
+++ /etc/apt/sources.list 2015-02-10 18:29:58.054818423 +0000
@@ -1,3 +1,3 @@
-deb http://ftp.debian.org/debian jessie main
+deb http://ftp.debian.org/debian jessie main contrib non-free
Linux jessie-rpi 3.18.7-v7+ #755 SMP PREEMPT Thu Feb 12 17:20:48 GMT 2015 armv7l GNU/Linux
}}
deb https://repositories.collabora.co.uk/debian/ jessie rpi2
-free
#pre{{
total used free shared buffers cached
Mem: 949328 132992 816336 12248 8396 77424
-/+ buffers/cache: 47172 902156
Swap: 0 0 0
}}
-パッケージ導入
**systemd-nspawn による軽量コンテナ試行 [#u642e4be]
-systemd-nspawn とは
--拡張版chroot環境。cgroup機能を用いてホストとは独立した名前空間を持つLinux環境(軽量コンテナ)を構築できる。
-コンテナ&color(red){app};の作成~
--/var/lib/container/下に作成するのがミソ~
#pre{{
# apt-get update
# apt-get install emacs-nox screen wicd-curses firmware-ralink
# apt-get install gcc g++ make
# apt-get install debootstrap
# debootstrap --arch=armhf jessie /var/lib/container/&color(red){app};
以下のコマンドでコンテナに入る。
# systemd-nspawn -D app
#コンテナの中
# apt-get install dbus sudo
# adduser debian
…省略…
# gpasswd -a debian sudo
# exit
}}
-WiFi設定
--BUFFALO WLI-UC-GNW を使用
--/etc/wpa_supplicant/wpa_supplicant.conf
-コンテナ起動
#pre{{
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
network={
ssid="********"
scan_ssid=1
proto=WPA2
key_mgmt=WPA-PSK
pairwise=CCMP
group=CCMP
#psk="********"
psk=********
# systemctl start systemd-nspawn@app.service
ちなみに、ホスト起動時、コンテナを自動起動させる場合は、
# systemctl enable systemd-nspawn@app.service
}}
-起動中コンテナの確認
#pre{{
# machiectl
MACHINE CONTAINER SERVICE
app container nspawn
}}
-コンテナ jessie のステータス確認
#pre{{
# machinectl status app
jessie
Since: 火 2015-09-29 23:54:43 JST; 5min ago
Leader: &color(red){14828}; (systemd)
Service: nspawn; class container
Root: /var/lib/container/app
Address: fe80::cee1:d5ff:fe17:b641
2408:10:c300:bb00:cee1:d5ff:fe17:b641
192.168.1.31
OS: Debian GNU/Linux 8 (jessie)
Unit: systemd-nspawn@app.service
tq14827 /usr/bin/systemd-nspawn --quiet --keep-unit --boot --link-journal=try-guest --directory=/var/lib/container/a...
tq14828 /lib/systemd/systemd
mqsystem.slice
tqcron.service
x mq14892 /usr/sbin/cron -f
tqsystemd-journald.service
x mq14842 /lib/systemd/systemd-journald
tqconsole-getty.service
x mq14899 /sbin/agetty --noclear --keep-baud console 115200 38400 9600 vt102
mqrsyslog.service
mq14894 /usr/sbin/rsyslogd -n
}}
-コンテナへのログイン ( 抜けるにはCTRL+]]] )
#pre{{
# machinectl login app
}}
**アプリ [#ie167d7c]
-install
#pre{{
# apt-get install monit redis-server libredis-perl
# apt-get install sqlite3 libdbd-sqlite3-perl libjson-xs-perl libdatetime-perl
# apt-get install libwww-perl libdatetime-format-http-perl
# apt-get install libmojolicious-perl libapp-daemon-perl liblog-dispatch-filerotate-perl
}}
-monit
--/etc/monit/monitrc に以下を追加
#pre{{
set httpd port 2812 and
use address localhost
allow admin:monit
}}
--/etc/nginx/conf.d/monit.conf
#pre{{
server {
listen 80;
location /monit/ {
rewrite ^/monit/(.*) /$1 break;
proxy_pass http://localhost:2812;
proxy_redirect http://localhost:2812/monit /monit/;
proxy_set_header Host $host;
}
}
}}
**基本情報 [#c391f88b]
-uname -a
--datafetch.plというスクリプトを作成しmonit監視対象にする場合の設定
---/etc/monit/conf.d/datafetch.conf
#pre{{
Linux jessie-rpi 3.18.0-trunk-rpi2 #1 SMP PREEMPT Debian 3.18.5-1~exp1.co1 (2015-02-02) armv7l GNU/Linux
check process datafetch matching "detafetch"
start program = "/home/pi/detafetch/bin/datafetch.pl -log" as uid pi and gid pi
stop program = "/usr/bin/pkill datafetch.pl" as uid pi and gid pi
if 5 restarts within 5 cycles then unmonitor
}}
-gcc -v
-freetds
--/etc/freetds/freetds.conf
--[global]に以下を追加
#pre{{
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/arm-linux-gnueabihf/4.9/lto-wrapper
Target: arm-linux-gnueabihf
Configured with: ../src/configure -v --with-pkgversion='Debian 4.9.1-19'
--with-bugurl=file:///usr/share/doc/gcc-4.9/README.Bugs
--enable-languages=c,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr
--program-suffix=-4.9 --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix
--with-gxx-include-dir=/usr/include/c++/4.9 --libdir=/usr/lib
--enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug
--enable-libstdcxx-time=yes --enable-gnu-unique-object --disable-libitm
--disable-libquadmath --enable-plugin --with-system-zlib --disable-browser-plugin
--enable-java-awt=gtk --enable-gtk-cairo --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-4.9-armhf/jre
--enable-java-home --with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-4.9-armhf
--with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-4.9-armhf --with-arch-directory=arm
--with-ecj-jar=/usr/share/java/eclipse-ecj.jar --enable-objc-gc --enable-multiarch
--disable-sjlj-exceptions &color(red){--with-arch=armv7-a}; --with-fpu=vfpv3-d16 --with-float=hard
--with-mode=thumb --enable-checking=release --build=arm-linux-gnueabihf
--host=arm-linux-gnueabihf --target=arm-linux-gnueabihf
Thread model: posix
gcc version 4.9.1 (Debian 4.9.1-19)
[global]
port = 1433
tds version = 8.0
client charset = UTF-8
}}