computerの日記

Cisco,SHELL,C,Qt,C++,Linux,ネットワーク,Windows Scriptなどの発言です

Fedora Arm イメージを分解する(kpartx)

Fedora Arm イメージを分解します

- 準備
$ rpm -q kpartx

インストールされていなければ、インストールします。

# dnf install kpartx

Fedora の ARM イメージを解凍します。

$ unxz Fedora-Workstation-armhfp-28-1.1-sda.raw.xz

解凍されると、以下のようになります。

Fedora-Workstation-armhfp-28-1.1-sda.raw

file コマンドで確認します。

$ file Fedora-Workstation-armhfp-28-1.1-sda.raw
Fedora-Workstation-armhfp-28-1.1-sda.raw: DOS/MBR boot sector; partition 1 : ID=0xc, start-CHS (0x4,4,1), end-CHS (0x78,119,2), startsector 2048, 59392 sectors; partition 2 : ID=0x83, active, start-CHS (0x78,120,1), end-CHS (0x3ff,254,2), startsector 61440, 999424 sectors; partition 3 : ID=0x82, start-CHS (0x3ff,254,2), end-CHS (0x3ff,254,2), startsector 1060864, 999424 sectors; partition 4 : ID=0x83, start-CHS (0x3ff,254,2), end-CHS (0x3ff,254,2), startsector 2060288, 12109824 sectors

.raw を、 .img にリネームします。
$ mv Fedora-Workstation-armhfp-28-1.1-sda.raw Fedora-Workstation-armhfp-28-1.1-sda.img

kpartx を実行します。

# kpartx -a Fedora-Workstation-armhfp-28-1.1-sda.img

/dev/mapper を確認します。

# ls -l /dev/mapper/
合計 0
crw-------. 1 root root 10, 236 7月 13 19:07 control
lrwxrwxrwx. 1 root root 7 7月 13 19:07 docker-253:0-3154371-pool -> ../dm-3
lrwxrwxrwx. 1 root root 7 7月 13 19:07 fedora-home -> ../dm-2
lrwxrwxrwx. 1 root root 7 7月 13 19:07 fedora-root -> ../dm-0
lrwxrwxrwx. 1 root root 7 7月 13 19:07 fedora-swap -> ../dm-1
lrwxrwxrwx. 1 root root 7 7月 13 19:54 loop2p1 -> ../dm-4
lrwxrwxrwx. 1 root root 7 7月 13 19:54 loop2p2 -> ../dm-5
lrwxrwxrwx. 1 root root 7 7月 13 19:54 loop2p3 -> ../dm-6
lrwxrwxrwx. 1 root root 7 7月 13 19:54 loop2p4 -> ../dm-7

loop2p1 から、loop2p4 までが、Fedora Arm と思われます。

以下の手順でマウントします。

# mkdir /mnt/{Fedora,Fedora-2,Fedora-3,Fedora-4}
# mount /dev/mapper/loop0p1 /mnt/fedora-1
# mount /dev/mapper/loop0p1 /mnt/fedora-2
# mount /dev/mapper/loop0p1 /mnt/fedora-3
# mount /dev/mapper/loop0p1 /mnt/fedora-4

では、それぞれを確認してみます。

# ls -l /mnt/Fedora
合計 13006
-rwxr-xr-x. 1 root root 52064 4月 25 15:37 bootcode.bin
-rwxr-xr-x. 1 root root 1105 4月 25 15:37 config-64.txt
-rwxr-xr-x. 1 root root 1181 4月 25 15:37 config.txt
-rwxr-xr-x. 1 root root 6575 4月 25 15:37 fixup.dat
-rwxr-xr-x. 1 root root 2599 4月 25 15:37 fixup_cd.dat
-rwxr-xr-x. 1 root root 9726 4月 25 15:37 fixup_db.dat
-rwxr-xr-x. 1 root root 9730 4月 25 15:37 fixup_x.dat
drwxr-xr-x. 2 root root 12288 4月 25 15:37 overlays
-rwxr-xr-x. 1 root root 410560 4月 25 15:37 rpi2-u-boot.bin
-rwxr-xr-x. 1 root root 421224 4月 25 15:37 rpi3-u-boot.bin
-rwxr-xr-x. 1 root root 2825124 4月 25 15:37 start.elf
-rwxr-xr-x. 1 root root 673444 4月 25 15:37 start_cd.elf
-rwxr-xr-x. 1 root root 4968292 4月 25 15:37 start_db.elf
-rwxr-xr-x. 1 root root 3912164 4月 25 15:37 start_x.elf

# ls -l /mnt/Fedora-2
合計 65056
drwxr-xr-x. 3 root root 4096 4月 25 15:32 239f94d4501440c9b6524057b3972fc4
-rw-------. 1 root root 3436883 4月 24 09:48 System.map-4.16.3-301.fc28.armv7hl
-rw-r--r--. 1 root root 209896 4月 24 09:48 config-4.16.3-301.fc28.armv7hl
lrwxrwxrwx. 1 root root 27 4月 25 15:32 dtb -> dtb-4.16.3-301.fc28.armv7hl
drwxr-xr-x. 2 root root 36864 4月 25 15:23 dtb-4.16.3-301.fc28.armv7hl
drwxr-xr-x. 2 root root 4096 4月 25 15:37 extlinux
drwxrwxr-x. 2 root root 4096 4月 25 15:13 fw
drwxrwxr-x. 2 root root 4096 4月 25 15:37 grub
drwxr-xr-x. 3 root root 4096 4月 25 15:19 grub2
-rw-------. 1 root root 56166524 4月 25 15:34 initramfs-4.16.3-301.fc28.armv7hl.img
drwx------. 2 root root 16384 4月 25 15:13 lost+found
-rwxr-xr-x. 1 root root 6672896 4月 24 09:49 vmlinuz-4.16.3-301.fc28.armv7hl

# ls -l /mnt/Fedora-3
合計 0

# ls -l /mnt/Fedora-4
合計 84
lrwxrwxrwx. 1 root root 7 2月 7 19:27 bin -> usr/bin
drwxrwxr-x. 2 root root 4096 4月 25 15:13 boot
drwxr-xr-x. 4 root root 4096 4月 25 15:32 dev
drwxr-xr-x. 131 root root 12288 4月 25 15:37 etc
drwxr-xr-x. 2 root root 4096 2月 7 19:27 home
lrwxrwxrwx. 1 root root 7 2月 7 19:27 lib -> usr/lib
drwx------. 2 root root 16384 4月 25 15:13 lost+found
drwxr-xr-x. 2 root root 4096 2月 7 19:27 media
drwxr-xr-x. 2 root root 4096 2月 7 19:27 mnt
drwxr-xr-x. 2 root root 4096 2月 7 19:27 opt
drwxrwxr-x. 2 root root 4096 4月 25 15:13 proc
dr-xr-x---. 2 root root 4096 4月 25 15:37 root
drwxr-xr-x. 32 root root 4096 4月 25 15:31 run
lrwxrwxrwx. 1 root root 8 2月 7 19:27 sbin -> usr/sbin
drwxr-xr-x. 2 root root 4096 2月 7 19:27 srv
drwxrwxr-x. 2 root root 4096 4月 25 15:13 sys
drwxrwxrwt. 2 root root 4096 4月 25 15:37 tmp
drwxr-xr-x. 11 root root 4096 4月 25 15:15 usr
drwxr-xr-x. 22 root root 4096 4月 25 15:31 var

好きな作業をしてください。
アンマウントします。

# umount /mnt/Fedora-4
# umount /mnt/Fedora-3
# umount /mnt/Fedora-2
# umount /mnt/Fedora

ファイルを戻します。
# kpartx -d Fedoara-Workstation-armhfp-28-1.1-sda.img
確認します。
$ ls
Fedora-Workstation-armhfp-28-1.1-sda.img
ファイル名も戻します。
$ mv Fedora-Workstation-armhfp-28-1.1-sda.img Fedora-Workstation-armhfp-28-1.1-sda.raw
圧縮します(かなりの時間がかかります)。
# xz Fedora-Workstation-armhfp-28-1.1-sda.raw
SDカードに書き込みます。
# dnf install -y fedora-arm-installer
以下のコマンドを実行します。
# shred -v /dev/mmcblk0p1
# shred -v /dev/mmcblk0p2

# mkfs.vfat /dev/mmcblk0p1

# mkfs.ext4 /dev/mmcblk0p2
# arm-image-installer --image=Fedora-Workstation-armhfp-28-1.1-sda.raw.xz --target=Bananapi --media=/dev/mmcblk0

(参考)
https://fedoraproject.org/wiki/Architectures/ARM/Raspberry_Pi
https://linuxconfig.org/how-to-extract-xz-compressed-archive-on-linux
https://medium.com/@madhav2code/how-to-mount-fedora-atomic-host-image-to-local-directory-file-system-98bae20751c1

Raspberry Pi 2 用のOS(ディストリビューション)を作成します-その2

ラズパイ2 用のイメージは、前回、Buildroot を使うことで、ビルドできました。

でも、あまりソフトが入っていませんね。じゃ、どんどん入れてみます。

ビルドの時に、入れて、.sdcard イメージを作成します。


Target Packages-->Networking applications の ntp , ntpdate にチェックを入れました。

早速エラーになりました。

64-bit filesystem support is not enabled. The larger fields afforded by this feature enable full-strength checksumming. Pass -O 64bit to rectify.

と出たので、additional mke2fs options を、-O ^64bit から、-O 64bit に直しました。

再度の make all で、エラーは出ませんでした。

しかし、次のエラーが出ました。

Copying files into the device: __populate_fs: Could not allocate block in ext2 filesystem while writing file "libuClibc-1.0.30.so"
mkfs.ext4: Could not allocate block in ext2 filesystem while populating file system
*** Maybe you need to increase the filesystem size (BR2_TARGET_ROOTFS_EXT2_SIZE)
make[1]: *** [fs/ext2/ext2.mk:56: /home/xxxx/BUILDROOT/buildroot-2018.05_save/output/images/rootfs.ext2] エラー 1

Filesystem で、exact size を、120M にしました。

エラーなく終了しました!

では、Target Packages-->Development tools で、check,git,make,pkgconf にチェックをつけました。

以下のエラーになりました。

/home/xxxxx/BUILDROOT/buildroot-2018.05_save/output/build/make-4.2.1/config/missing: 行 81: makeinfo: コマンドが見つかりません

ホストマシンに、texinfo を入れました。

エラーなく終了しました!

Target Packages-->Networking applications で、dhcpd,ethtool,iproute2,iptables,openssh,tcpdump にチェックを入れました。

エラーなく終了しました!

 どんどんいきます。

Target Packages--> Graphic libraries and applications (graphic/text) --->

imagemagick、Qt(Obsolete) と、xkeyboard-config にチェックを入れました。

ここまでの成果を確認します。

# dd if=./output/images/sdcard.img of=/dev/mmcblk0
311297+0 レコード入力
311297+0 レコード出力
159384064 bytes (159 MB, 152 MiB) copied, 32.9621 s, 4.8 MB/s

 イメージを立ち上げて、ntpdate と打つと、日付けが、UTC でセットされました!

眠い。。

Raspberry Pi 2 用のOS(ディストリビューション)を作成します

Raspberry Pi 2 を持っているんですが、最近全然遊んでいないです。
久しぶりに遊んでみます。
今回、Buildroot を使ってみます。

$ curl -O http://buildroot.org/downloads/buildroot-2018.05.tar.gz
$ tar zxvf buildroot-2018.05.tar.gz
$ cd buildroot-2018.05/
$ make menuconfig

以下、うまくいったやり方となります。

以下のページのとおりやってみました。
(参考)
http://ltekieli.com/buildroot-with-raspberry-pi-what-where-and-how/
------------------------------------------------

$ curl -O http://buildroot.org/downloads/buildroot-2018.05.tar.gz
$ tar zxvf buildroot-2018.05.tar.gz
$ cd buildroot-2018.05/
$ make raspberrypi2_defconfig(*注1)
(表示)
...(snip)...
# configuration written to /home/fujiwara/BUILDROOT/buildroot-2018.05/.config

ここで、make menuconfig として、設定をグラフィカリに確認してもよいでしょう。

では、ビルドを開始します。

$ make all

約 30分弱でビルド完了しました。
以下のディレクトリを確認します。

$ ls -lah output/images
合計 158M
drwxr-xr-x. 3 4.0K 7月 8 04:20 .
drwxrwxr-x. 6 4.0K 7月 8 03:35 ..
-rw-r--r--. 1 23K 7月 8 04:20 bcm2709-rpi-2-b.dtb
-rw-r--r--. 1 32M 7月 8 04:20 boot.vfat
-rw-r--r--. 1 60M 7月 8 04:20 rootfs.ext2
lrwxrwxrwx. 1 11 7月 8 04:20 rootfs.ext4 -> rootfs.ext2
drwxr-xr-x. 2 4.0K 7月 8 04:07 rpi-firmware
-rw-r--r--. 1 93M 7月 8 04:20 sdcard.img
-rw-r--r--. 1 4.7M 7月 8 04:20 zImage
-------------------------
ビルドが一度できたので、安心しました。

(*注1)
下記のようにすると、make のリストが表示されます。
$ make list-defconfigs

SDカードにイメージを書き出します。

# dd if=sdcard.img of=/dev/mmcblk0 status=progress

実施結果です。

# dd if=./output/images/sdcard.img of=/dev/mmcblk0 status=progress
188417+0 レコード入力
188417+0 レコード出力
96469504 bytes (96 MB, 92 MiB) copied, 16.845 s, 5.7 MB/s

うまくいきました。こちらに、展開しました。root : pinkrabbit

pinkrabbit-rpi-2018.05-sdcard.img

 Fedora のイメージを試してみました。

# arm-image-installer --image=Fedora-Workstation-armhfp-28-1.1-sda.raw.xz --target=rpi2 --media=/dev/mmcblk0

次の表示となりました。

=====================================================
= Selected Image:
= ./Fedora-Workstation-armhfp-28-1.1-sda.raw.xz
= Selected Media : /dev/mmcblk0
= U-Boot Target : rpi2
=====================================================

*****************************************************
*****************************************************
******** WARNING! ALL DATA WILL BE DESTROYED ********
*****************************************************
*****************************************************

Type 'YES' to proceed, anything else to exit now

= Proceed?

YES と入力して、Fedora が立ち上がったのを確認できました。

 

以下は、うまくいかなかった一例となります。

Linux kernel の menuconfig かのような画面が立ち上がりました。
以下の設定に変更します。

----------------------
Top level configuration

Target Architecture ARM (little endian)
Target Architecture Variant arm1176jzf-s
Target ABI EABI
----------------------
Build options

Download dir $(HOME)/buildroot/dl デフォルトで、($(TOPDIR)/dl) Download dir となっているので、これでよいかも。
Enable compiler cache YES
Compiler cache location $(HOME)/buildroot/ccache デフォルトで、($(HOME)/.buildroot-ccache) Compiler cache location となっているので、これでよいかも。
----------------------
Toolchain

Kernel Headers Linux 3.6.x kernel headers デフォルトで、Linux 4.16.x kernel headers となっているので、これでよいかも。

GCC compiler Version GCC 4.7.x デフォルトで、GCC compiler Version (gcc 6.x) となっているので、これでよいかも。

Additional gcc options --with-float=hard --with-fpu=vfp

Purge unwanted locales YES
Locales to keep C en_US
Generate locale data en_US
-----------------------
System configuration

System hostname rpi
System banner Welcome to Raspberry Pi!
/dev management Dynamic using mdev デフォルトで、/dev management (Dynamic using devtmpfs only) となっているので、これでよいかも。 │ │

Port to run a getty (login prompt) on tty1
Baudrate to use 38400
-----------------------
ackage selection for target

This is the section where you specify which packages get in and which will be left out.

Busybox - which is enabled by default - gives us a fairly complete userland, so the only extra you should enable here is dropbear, a small SSH server under Networking applications which will let us log in remotely.

Also, if you want to mount NFS filesystems, you should enable Networking applications / Portmap.

You may select other packages too, as you see fit.
------------------------
Filesystem images

Compression method gzip

Here we ask Buildroot to generate a rootfs.tar.gz (besides rootfs.tar). デフォルトで、 [*] tar the root filesystem (NEW) となっているので、これでよいかも。 │ │
------------------------
Kernel
Linux Kernel YES
Kernel version Custom Git tree
URL of custom Git repository https://github.com/raspberrypi/linux
Custom Git version rpi-3.6.y ここは、上記リンクを見ると、4.14.y が正しいかな。
Kernel configuration Using a defconfig
Defconfig name bcmrpi
Kernel binary format zImage

With these settings, Buildroot will clone the foundation's rpi-3.6.y branch, configure it using arch/arm/configs/bcmrpi_defconfig (included in the source) and build a zImage which we can then shove into /boot. (Note that post-processing with the imagetool-uncompressed.py script is not needed anymore as the latest firmware can load zImage kernels without a hitch.)

Now exit the configuration program - save the new configuration as you leave! - and initiate a full build of the system by executing:
------------------------
$ make all

You seem to have the current working directory in your
LD_LIBRARY_PATH environment variable. This doesn't work.
make[1]: *** [support/dependencies/dependencies.mk:21: dependencies] エラー 1
make: *** [Makefile:79: _all] エラー 2
[fujiwara@gns3vm buildroot-2018.05]$ make menuconfig


*** End of the configuration.
*** Execute 'make' to start the build or try 'make help'.

$ ls
CHANGES Config.in DEVELOPERS Makefile.legacy arch boot configs docs linux package system utils
COPYING Config.in.legacy Makefile README board build dl fs output support toolchain
[buildroot-2018.05]$ echo $LD_LIBRARY_PATH
/opt/lib:/opt/lib:

http://lists.busybox.net/pipermail/buildroot/2015-April/124424.html

: が付いているのが悪かったようだ。
変更する。

$ LD_LIBRARY_PATH=/opt/lib:/opt/lib; export LD_LIBRARY_PATH

もう一度、

$ make

 

でも、このままだと、なにも面白いソフトが入っていないです。

もう一度、不備なところを再修正します。
$ make menuconfig

以下の設定を実施します。
System configuration

System hostname Pink Rabbit Linux
System banner Welcome to Raspberry Pi!
------------------------
$ make all

$ ls -lah output/images/
合計 158M
drwxr-xr-x. 3 4.0K 7月 8 04:42 .
drwxrwxr-x. 6 4.0K 7月 8 03:35 ..
-rw-r--r--. 1 23K 7月 8 04:20 bcm2709-rpi-2-b.dtb
-rw-r--r--. 1 32M 7月 8 04:42 boot.vfat
-rw-r--r--. 1 60M 7月 8 04:42 rootfs.ext2
lrwxrwxrwx. 1 11 7月 8 04:42 rootfs.ext4 -> rootfs.ext2
drwxr-xr-x. 2 4.0K 7月 8 04:07 rpi-firmware
-rw-r--r--. 1 93M 7月 8 04:42 sdcard.img
-rw-r--r--. 1 4.7M 7月 8 04:20 zImage
---------------------------
ビルドできました。
まだまだ、面白くないです。
ありったけのソフトをインストールしてみたいですね。
こんな感じに。


Networking appliations --->
では、apache、bind、dhcpcd、ethtool、iptables、ntp、ntpdate、tcpdump と openssh を入れてみます。
チェックを入れます。
Shell and utilities --->
screen にチェックをいれます。
System tools --->
util-linux --->
audit、hwclock、kill、logger にチェックを入れます。
Security --->
semodule-utils
*** checkpolicy needs a glibc toolchain w/ threads, dynamic library ***
って出てます。
Libraries --->
Database --->
mysqlpostgresqlsqlite
Javascript --->
bootstrap、jQuery
Target packages --->
Development tools --->
git、make、pkgconf
Toolchain --->
C library (glibc) --->
これをしたことで、Target Package の Security で、SELinux 関連がインストールできるようになりました。
checkpolicy, policycoreutils, refpolicy, restorecond, selinux-python(audit2allow, sepolgen もチェック),
semodule-utils, setools
にチェックを入れます。
Libraries --->
Interpreter languages and scripting --->
Text and terminal handling --->
ncurses にチェックを入れます。
Enable ECHAR support
Enable toolchain locale/i18n support

Enable root login with password
(root) Root password -- root
https://buildroot.org/downloads/manual/manual.html
Install timezone info
default local time -- Asia/Tokyo
---------------------------
$ make all

glibc に変更したので、結構時間がかかるかも。
エラーになりました。
では、glibc はダメみたいですね。uClibc にしました。
$ make clean
$ make all

ビルドが始まりました。

 

(その他参考にしたサイト)
https://qiita.com/pu_ri/items/75c80e388c79fe0d3f0b

Fedora28 に Phalcon をインストールしてみた

Phalcon は、PHP フレームワークのうちのひとつで、爆速で知られています。

今回は、ソースからのコンパイルをやってみます(*注1)。

こちらのドキュメントを参考にしました。

docs.phalconphp.com php7 をインストールします。

# dnf install php
...(snip)...
インストール済み:
php.x86_64 7.2.7-1.fc28
php-fpm.x86_64 7.2.7-1.fc28
nginx-filesystem.noarch 1:1.12.1-8.fc28

 その他、必要なパッケージをインストールします。

# dnf install php-json php-devel pcre-devel gcc make

確認したところでは、必要なパッケージは、以下となります。
php, php-json, php-devel, pcre-devel, gcc, make

PHP 関係だけ確認します。

$ rpm -qa | grep php
php-cli-7.2.7-1.fc28.x86_64
php-devel-7.2.7-1.fc28.x86_64
php-json-7.2.7-1.fc28.x86_64
php-7.2.7-1.fc28.x86_64
php-mysqlnd-7.2.7-1.fc28.x86_64
php-fpm-7.2.7-1.fc28.x86_64
php-pdo-7.2.7-1.fc28.x86_64
php-common-7.2.7-1.fc28.x86_64

では、cphalcon を clone します。

$ git clone https://github.com/phalcon/cphalcon

build ディレクトリに移動して、make します。

$ cd cphalcon/build
# ./install
find . -name \*.gcno -o -name \*.gcda | xargs rm -f
find . -name \*.lo -o -name \*.o | xargs rm -f
find . -name \*.la -o -name \*.a | xargs rm -f
find . -name \*.so | xargs rm -f
find . -name .libs -a -type d|xargs rm -rf
rm -f libphp.la modules/* libs/*
Cleaning..
Configuring for:
PHP Api Version: 20170718
Zend Module Api No: 20170718
Zend Extension Api No: 320170718
configure: WARNING: You will need re2c 0.13.4 or later if you want to regenerate PHP parsers.
libtool: compile: gcc -I. -I/home/fujiwara/PHALCON/cphalcon/build/php7/64bits -DPHP_ATOM_INC -I/home/fujiwara/PHALCON/cphalcon/build/php7/64bits/include -I/home/fujiwara/PHALCON/cphalcon/build/php7/64bits/main -I/home/fujiwara/PHALCON/cphalcon/build/php7/64bits -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext -I/usr/include/php/ext/date/lib -DPHALCON_RELEASE -DHAVE_CONFIG_H -march=native -mtune=native -O2 -fomit-frame-pointer -c /home/fujiwara/PHALCON/cphalcon/build/php7/64bits/phalcon.zep.c -fPIC -DPIC -o .libs/phalcon.o
libtool: link: gcc -shared -fPIC -DPIC .libs/phalcon.o -march=native -mtune=native -O2 -Wl,-soname -Wl,phalcon.so -o .libs/phalcon.so
libtool: link: ( cd ".libs" && rm -f "phalcon.la" && ln -s "../phalcon.la" "phalcon.la" )
libtool: install: cp ./.libs/phalcon.so /home/fujiwara/PHALCON/cphalcon/build/php7/64bits/modules/phalcon.so
libtool: install: cp ./.libs/phalcon.lai /home/fujiwara/PHALCON/cphalcon/build/php7/64bits/modules/phalcon.la
libtool: finish: PATH="/usr/lib64/qt-3.3/bin:/usr/local/bin:/usr/bin:/bin:/home/fujiwara/.rvm/bin:/usr/local/sbin:/usr/sbin:/home/fujiwara/.rvm/bin:/home/fujiwara/.local/bin:/home/fujiwara/bin:/home/fujiwara/.rvm/bin:/sbin" ldconfig -n /home/fujiwara/PHALCON/cphalcon/build/php7/64bits/modules
----------------------------------------------------------------------
Libraries have been installed in:
/home/fujiwara/PHALCON/cphalcon/build/php7/64bits/modules

If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the '-LLIBDIR'
flag during linking and do at least one of the following:
- add LIBDIR to the 'LD_LIBRARY_PATH' environment variable
during execution
- add LIBDIR to the 'LD_RUN_PATH' environment variable
during linking
- use the '-Wl,-rpath -Wl,LIBDIR' linker flag
- have your system administrator add LIBDIR to '/etc/ld.so.conf'

See any operating system documentation about shared libraries for
more information, such as the ld(1) and ld.so(8) manual pages.
----------------------------------------------------------------------

Build complete.
Don't forget to run 'make test'.

Installing shared extensions: /usr/lib64/php/modules/
Installing header files: /usr/include/php/

Thanks for compiling Phalcon!
Build succeed: Please restart your web server to complete the installation

共有モジュールがインストールされました。確認します。

# ls /usr/lib64/php/modules/
bz2.so ctype.so exif.so ftp.so iconv.so mysqlnd.so pdo_mysql.so phalcon.so sockets.so tokenizer.so
calendar.so curl.so fileinfo.so gettext.so mysqli.so pdo.so pdo_sqlite.so phar.so sqlite3.so

ヘッダーファイルがインストールされました。確認します。

# ls /usr/include/php/ext
date dom filter gd hash iconv json libxml mbstring mysqli mysqlnd pcre pdo phalcon phar session simplexml sockets spl standard xml

以下のファイルを作成して、extension の記述をします。
php.ini に記述するよりも、この方がよいようです(*注2)。

# vim /etc/php.d/30-phalcon.ini
--------
; Enable phalcon extension module
extension=phalcon
--------

ini ファイルのディレクトリ配下は、以下のようになりました。

# ls /etc/php.d
20-bz2.ini 20-curl.ini 20-ftp.ini 20-json.ini 20-phar.ini 20-tokenizer.ini 30-pdo_sqlite.ini
20-calendar.ini 20-exif.ini 20-gettext.ini 20-mysqlnd.ini 20-sockets.ini 30-mysqli.ini 30-phalcon.ini
20-ctype.ini 20-fileinfo.ini 20-iconv.ini 20-pdo.ini 20-sqlite3.ini 30-pdo_mysql.ini

httpd.service をリスタートします。

# systemctl restart httpd.service

loaded extensions を確認します。
phpinfo を見たところ、Phalcon の項目がありました。

以下のコマンドでも確認できました。

# php -r 'print_r(get_loaded_extensions());'| grep phalcon
[33] => phalcon

さあ、なに食べようか。。

--------
(*注1)
リポジトリをインストールして、パッケージインストールをする場合はこちらです。

phalcon のリポジトリをインストールします。

# curl -s https://packagecloud.io/install/repositories/phalcon/stable/script.rpm.sh | bash

phalcon のリポジトリ設定ファイルがあることを確認します。

# ls -l /etc/yum.repos.d
...(snip)...
phalcon_stable.repo

(*注2)
php.ini に直接モジュールの読み込み設定を記述すると、たとえば、以下のようなエラーになります。

/usr/lib64/php/modules/phalcon.so (/usr/lib64/php/modules/phalcon.so: undefined symbol: php_json_decode_ex)) in Unknown on line 0 

あるプロセスが使用しているメモリの正確な値を知る方法-その2

お疲れさまです。

プロセスや、サービスがどの程度メモリを使用しているかって、気になりますよね。

以前、このブログで以下のようなエントリーを書きました。

あるプロセスが使用しているメモリの正確な値を知る方法 - computerの日記

/proc から、ひとつひとつのプロセス番号を洗いだしていくのは疲れますよね。

なんか簡単に確認する方法はないのでしょうか。探してみたらありました。

いいプログラムを見つけましたよ。これを root で動かしてみてください。

https://github.com/pixelb/ps_mem/blob/master/ps_mem.py

やってみました。

# python ps_mem.py
Private + Shared = RAM used Program

244.0 KiB + 15.5 KiB = 259.5 KiB mcelog
228.0 KiB + 33.5 KiB = 261.5 KiB atd
316.0 KiB + 20.5 KiB = 336.5 KiB audispd
416.0 KiB + 48.5 KiB = 464.5 KiB irqbalance
436.0 KiB + 37.5 KiB = 473.5 KiB rtkit-daemon
340.0 KiB + 158.5 KiB = 498.5 KiB alsactl
536.0 KiB + 38.5 KiB = 574.5 KiB sedispatch
280.0 KiB + 345.5 KiB = 625.5 KiB sh
720.0 KiB + 5.5 KiB = 725.5 KiB ssh-agent
636.0 KiB + 92.5 KiB = 728.5 KiB chronyd
716.0 KiB + 16.5 KiB = 732.5 KiB auditd
676.0 KiB + 91.5 KiB = 767.5 KiB agent
732.0 KiB + 63.5 KiB = 795.5 KiB dconf-service
752.0 KiB + 79.5 KiB = 831.5 KiB xfconfd
756.0 KiB + 133.5 KiB = 889.5 KiB ibus-engine-simple
764.0 KiB + 161.5 KiB = 925.5 KiB gconfd-2
804.0 KiB + 123.5 KiB = 927.5 KiB ibus-portal
840.0 KiB + 124.5 KiB = 964.5 KiB at-spi-bus-launcher
928.0 KiB + 44.5 KiB = 972.5 KiB crond
972.0 KiB + 14.5 KiB = 986.5 KiB vmware-authdlauncher
904.0 KiB + 122.5 KiB = 1.0 MiB at-spi2-registryd
896.0 KiB + 137.5 KiB = 1.0 MiB ibus-dconf
436.0 KiB + 612.0 KiB = 1.0 MiB avahi-daemon (2)
1.0 MiB + 66.5 KiB = 1.1 MiB gssproxy
1.1 MiB + 58.5 KiB = 1.1 MiB vmware-vmblock-
824.0 KiB + 383.5 KiB = 1.2 MiB systemd-machined
964.0 KiB + 276.5 KiB = 1.2 MiB rngd
696.0 KiB + 576.0 KiB = 1.2 MiB dnsmasq (2)
1.0 MiB + 282.5 KiB = 1.3 MiB gvfsd
1.1 MiB + 140.5 KiB = 1.3 MiB imsettings-daemon
1.4 MiB + 63.5 KiB = 1.4 MiB bluetoothd
1.3 MiB + 164.5 KiB = 1.5 MiB gvfsd-metadata
1.5 MiB + 13.5 KiB = 1.5 MiB vmware-usbarbitrator
1.0 MiB + 485.5 KiB = 1.5 MiB gpg-agent (3)
1.5 MiB + 114.5 KiB = 1.6 MiB accounts-daemon
1.3 MiB + 383.5 KiB = 1.7 MiB gvfsd-trash
1.2 MiB + 476.5 KiB = 1.7 MiB su
1.6 MiB + 195.5 KiB = 1.8 MiB xscreensaver
1.8 MiB + 57.5 KiB = 1.9 MiB smartd
1.6 MiB + 409.5 KiB = 2.0 MiB abrtd
1.8 MiB + 426.5 KiB = 2.2 MiB abrt-dbus
1.9 MiB + 428.5 KiB = 2.3 MiB upowerd
2.0 MiB + 431.5 KiB = 2.4 MiB gvfs-udisks2-volume-monitor
2.1 MiB + 519.5 KiB = 2.6 MiB ibus-x11
2.1 MiB + 798.5 KiB = 2.9 MiB panel-6-systray
2.9 MiB + 135.5 KiB = 3.0 MiB ibus-daemon
2.5 MiB + 601.5 KiB = 3.0 MiB systemd-logind
2.8 MiB + 431.5 KiB = 3.2 MiB wpa_supplicant
2.8 MiB + 427.5 KiB = 3.3 MiB gnome-keyring-daemon
2.4 MiB + 959.5 KiB = 3.4 MiB panel-2-actions
3.0 MiB + 647.5 KiB = 3.6 MiB xfsettingsd
2.9 MiB + 837.0 KiB = 3.7 MiB lightdm (2)
3.5 MiB + 248.5 KiB = 3.8 MiB ModemManager
3.0 MiB + 789.5 KiB = 3.8 MiB abrt-applet
3.7 MiB + 255.5 KiB = 4.0 MiB dhclient
3.6 MiB + 637.5 KiB = 4.3 MiB xfce4-session
3.9 MiB + 459.5 KiB = 4.3 MiB dbus-daemon (3)
3.1 MiB + 1.4 MiB = 4.4 MiB (sd-pam)
4.1 MiB + 521.5 KiB = 4.6 MiB udisksd
4.6 MiB + 558.5 KiB = 5.1 MiB systemd-udevd
4.3 MiB + 1.3 MiB = 5.5 MiB xfce-polkit
4.7 MiB + 919.0 KiB = 5.6 MiB bash (2)
5.5 MiB + 1.0 MiB = 6.5 MiB xfce4-notifyd
5.6 MiB + 1.5 MiB = 7.1 MiB xfwm4
4.2 MiB + 3.5 MiB = 7.7 MiB systemd (2)
7.0 MiB + 1.1 MiB = 8.1 MiB NetworkManager
7.2 MiB + 1.2 MiB = 8.4 MiB ibus-ui-gtk3
7.8 MiB + 701.5 KiB = 8.5 MiB ibus-extension-gtk3
7.7 MiB + 1.5 MiB = 9.2 MiB xfce4-power-manager (2)
8.5 MiB + 1.5 MiB = 9.9 MiB nm-applet
7.9 MiB + 2.1 MiB = 10.0 MiB leafpad
4.7 MiB + 5.5 MiB = 10.2 MiB httpd (5)
10.0 MiB + 1.1 MiB = 11.1 MiB abrt-dump-journal-core
10.4 MiB + 2.2 MiB = 12.6 MiB xfce4-panel
13.5 MiB + 892.5 KiB = 14.3 MiB abrt-dump-journal-xorg
13.1 MiB + 1.7 MiB = 14.8 MiB cav
12.2 MiB + 3.0 MiB = 15.1 MiB xfce4-terminal
14.1 MiB + 1.4 MiB = 15.5 MiB xfdesktop
16.7 MiB + 193.5 KiB = 16.9 MiB polkitd
14.9 MiB + 2.0 MiB = 16.9 MiB blueman-tray
15.7 MiB + 2.1 MiB = 17.8 MiB seapplet
18.8 MiB + 2.3 MiB = 21.1 MiB blueman-applet
20.1 MiB + 1.3 MiB = 21.4 MiB firewalld
20.3 MiB + 2.0 MiB = 22.3 MiB pulseaudio
20.5 MiB + 7.0 MiB = 27.5 MiB systemd-journald
22.4 MiB + 5.7 MiB = 28.0 MiB abrt-dump-journal-oops
29.4 MiB + 1.7 MiB = 31.1 MiB libvirtd
31.2 MiB + 103.5 KiB = 31.3 MiB net.downloadhelper.coapp-linux-64
34.1 MiB + 16.5 KiB = 34.1 MiB docker-containerd
34.2 MiB + 3.1 MiB = 37.3 MiB dnfdragora-upda
32.9 MiB + 8.2 MiB = 41.1 MiB rsyslogd
46.8 MiB + 618.5 KiB = 47.4 MiB ibus-engine-kkc
68.6 MiB + 107.5 KiB = 68.7 MiB dockerd
148.9 MiB + 12.8 MiB = 161.7 MiB Xorg
200.0 MiB + 4.0 MiB = 204.0 MiB cmgdaemon
333.0 MiB + 5.4 MiB = 338.5 MiB cmdagent
308.1 MiB + 67.8 MiB = 375.9 MiB skypeforlinux (3)
529.1 MiB + 34.6 MiB = 563.7 MiB firefox
2.5 GiB + 81.8 MiB = 2.6 GiB Web Content (4)
---------------------------------
5.0 GiB

=================================

-d オプションで、プロセス番号も出力されます。

# python ps_mem.py -d
Private + Shared = RAM used Program[pid]

244.0 KiB + 15.5 KiB = 259.5 KiB mcelog [936]
228.0 KiB + 33.5 KiB = 261.5 KiB atd [1221]
316.0 KiB + 20.5 KiB = 336.5 KiB audispd [897]
80.0 KiB + 262.5 KiB = 342.5 KiB dnsmasq [1991]
132.0 KiB + 278.5 KiB = 410.5 KiB avahi-daemon [975]
416.0 KiB + 48.5 KiB = 464.5 KiB irqbalance [950]
436.0 KiB + 37.5 KiB = 473.5 KiB rtkit-daemon [930]
328.0 KiB + 156.5 KiB = 484.5 KiB gpg-agent [2672]
340.0 KiB + 158.5 KiB = 498.5 KiB alsactl [925]
340.0 KiB + 162.5 KiB = 502.5 KiB gpg-agent [5032]
392.0 KiB + 166.5 KiB = 558.5 KiB gpg-agent [5107]
536.0 KiB + 38.5 KiB = 574.5 KiB sedispatch [900]
280.0 KiB + 345.5 KiB = 625.5 KiB sh [2175]
304.0 KiB + 333.5 KiB = 637.5 KiB avahi-daemon [952]
720.0 KiB + 5.5 KiB = 725.5 KiB ssh-agent [2497]
636.0 KiB + 92.5 KiB = 728.5 KiB chronyd [993]
716.0 KiB + 16.5 KiB = 732.5 KiB auditd [895]
676.0 KiB + 91.5 KiB = 767.5 KiB agent [2893]
732.0 KiB + 63.5 KiB = 795.5 KiB dconf-service [3272]
664.0 KiB + 152.5 KiB = 816.5 KiB dbus-daemon [2732]
752.0 KiB + 79.5 KiB = 831.5 KiB xfconfd [2669]
756.0 KiB + 133.5 KiB = 889.5 KiB ibus-engine-simple [3856]
764.0 KiB + 162.5 KiB = 926.5 KiB gconfd-2 [3721]
804.0 KiB + 123.5 KiB = 927.5 KiB ibus-portal [3291]
616.0 KiB + 313.5 KiB = 929.5 KiB dnsmasq [1990]
840.0 KiB + 124.5 KiB = 964.5 KiB at-spi-bus-launcher [2727]
928.0 KiB + 44.5 KiB = 972.5 KiB crond [1240]
972.0 KiB + 14.5 KiB = 986.5 KiB vmware-authdlauncher [1273]
904.0 KiB + 122.5 KiB = 1.0 MiB at-spi2-registryd [2736]
896.0 KiB + 137.5 KiB = 1.0 MiB ibus-dconf [3281]
1.0 MiB + 66.5 KiB = 1.1 MiB gssproxy [946]
1.1 MiB + 58.5 KiB = 1.1 MiB vmware-vmblock- [1211]
824.0 KiB + 383.5 KiB = 1.2 MiB systemd-machined [953]
964.0 KiB + 276.5 KiB = 1.2 MiB rngd [933]
1.1 MiB + 154.5 KiB = 1.2 MiB dbus-daemon [2310]
1.0 MiB + 283.5 KiB = 1.3 MiB gvfsd [2394]
1.1 MiB + 140.5 KiB = 1.3 MiB imsettings-daemon [2386]
360.0 KiB + 1.0 MiB = 1.4 MiB httpd [11343]
1.4 MiB + 63.5 KiB = 1.4 MiB bluetoothd [954]
1.2 MiB + 242.5 KiB = 1.5 MiB lightdm [1699]
1.3 MiB + 164.5 KiB = 1.5 MiB gvfsd-metadata [2871]
1.5 MiB + 13.5 KiB = 1.5 MiB vmware-usbarbitrator [1275]
1.5 MiB + 114.5 KiB = 1.6 MiB accounts-daemon [963]
1.3 MiB + 383.5 KiB = 1.7 MiB gvfsd-trash [2826]
404.0 KiB + 1.3 MiB = 1.7 MiB httpd [1207]
1.2 MiB + 476.5 KiB = 1.7 MiB su [16758]
1.6 MiB + 195.5 KiB = 1.8 MiB xscreensaver [2899]
1.8 MiB + 57.5 KiB = 1.9 MiB smartd [931]
1.6 MiB + 409.5 KiB = 2.0 MiB abrtd [965]
1.8 MiB + 426.5 KiB = 2.2 MiB abrt-dbus [2109]
2.1 MiB + 152.5 KiB = 2.3 MiB dbus-daemon [955]
1.7 MiB + 594.5 KiB = 2.3 MiB lightdm [2072]
1.9 MiB + 428.5 KiB = 2.3 MiB upowerd [3020]
1.2 MiB + 1.1 MiB = 2.3 MiB httpd [11345]
1.2 MiB + 1.1 MiB = 2.3 MiB httpd [11346]
2.0 MiB + 431.5 KiB = 2.4 MiB gvfs-udisks2-volume-monitor [2767]
1.4 MiB + 1.1 MiB = 2.5 MiB systemd [2168]
1.5 MiB + 1.1 MiB = 2.5 MiB httpd [11344]
2.0 MiB + 551.5 KiB = 2.6 MiB xfce4-power-manager [2920]
2.1 MiB + 519.5 KiB = 2.6 MiB ibus-x11 [3285]
2.3 MiB + 464.5 KiB = 2.7 MiB bash [16764]
2.4 MiB + 455.5 KiB = 2.8 MiB bash [4164]
2.1 MiB + 798.5 KiB = 2.9 MiB panel-6-systray [2741]
2.9 MiB + 135.5 KiB = 3.0 MiB ibus-daemon [3270]
2.5 MiB + 601.5 KiB = 3.0 MiB systemd-logind [961]
2.8 MiB + 431.5 KiB = 3.2 MiB wpa_supplicant [1676]
2.8 MiB + 427.5 KiB = 3.3 MiB gnome-keyring-daemon [3459]
2.4 MiB + 959.5 KiB = 3.4 MiB panel-2-actions [2749]
3.0 MiB + 647.5 KiB = 3.6 MiB xfsettingsd [2690]
3.5 MiB + 248.5 KiB = 3.8 MiB ModemManager [957]
3.0 MiB + 789.5 KiB = 3.8 MiB abrt-applet [2809]
3.7 MiB + 255.5 KiB = 4.0 MiB dhclient [2260]
3.6 MiB + 637.5 KiB = 4.3 MiB xfce4-session [2665]
3.1 MiB + 1.4 MiB = 4.4 MiB (sd-pam) [2170]
4.1 MiB + 521.5 KiB = 4.6 MiB udisksd [2801]
4.6 MiB + 558.5 KiB = 5.1 MiB systemd-udevd [657]
2.8 MiB + 2.5 MiB = 5.2 MiB systemd [1]
4.3 MiB + 1.3 MiB = 5.5 MiB xfce-polkit [2827]
5.5 MiB + 1.0 MiB = 6.5 MiB xfce4-notifyd [2877]
5.7 MiB + 1.0 MiB = 6.7 MiB xfce4-power-manager [2726]
5.6 MiB + 1.5 MiB = 7.1 MiB xfwm4 [2673]
7.0 MiB + 1.1 MiB = 8.1 MiB NetworkManager [1194]
7.2 MiB + 1.2 MiB = 8.4 MiB ibus-ui-gtk3 [3282]
7.8 MiB + 701.5 KiB = 8.5 MiB ibus-extension-gtk3 [3283]
8.5 MiB + 1.5 MiB = 9.9 MiB nm-applet [2800]
7.9 MiB + 2.1 MiB = 10.0 MiB leafpad [5129]
10.0 MiB + 1.1 MiB = 11.1 MiB abrt-dump-journal-core [1000]
10.4 MiB + 2.2 MiB = 12.6 MiB xfce4-panel [2688]
944.0 KiB + 12.2 MiB = 13.1 MiB skypeforlinux [2951]
13.5 MiB + 892.5 KiB = 14.3 MiB abrt-dump-journal-xorg [1001]
13.1 MiB + 1.7 MiB = 14.8 MiB cav [2955]
12.2 MiB + 3.0 MiB = 15.2 MiB xfce4-terminal [4160]
14.1 MiB + 1.4 MiB = 15.5 MiB xfdesktop [2694]
16.7 MiB + 193.5 KiB = 16.9 MiB polkitd [1002]
14.9 MiB + 2.0 MiB = 16.9 MiB blueman-tray [3047]
15.7 MiB + 2.1 MiB = 17.8 MiB seapplet [2883]
18.8 MiB + 2.3 MiB = 21.1 MiB blueman-applet [2797]
20.1 MiB + 1.3 MiB = 21.4 MiB firewalld [960]
20.3 MiB + 2.0 MiB = 22.3 MiB pulseaudio [2834]
20.5 MiB + 7.0 MiB = 27.5 MiB systemd-journald [627]
22.4 MiB + 5.7 MiB = 28.0 MiB abrt-dump-journal-oops [999]
29.4 MiB + 1.7 MiB = 31.1 MiB libvirtd [1206]
31.3 MiB + 103.5 KiB = 31.4 MiB net.downloadhelper.coapp-linux-64 [15418]
34.1 MiB + 16.5 KiB = 34.1 MiB docker-containerd [2092]
34.2 MiB + 3.1 MiB = 37.3 MiB dnfdragora-upda [2907]
32.9 MiB + 8.2 MiB = 41.1 MiB rsyslogd [927]
46.8 MiB + 618.5 KiB = 47.4 MiB ibus-engine-kkc [3304]
68.6 MiB + 107.5 KiB = 68.7 MiB dockerd [2075]
98.3 MiB + 26.5 MiB = 124.8 MiB skypeforlinux [2747]
148.9 MiB + 12.8 MiB = 161.7 MiB Xorg [1720]
200.0 MiB + 4.0 MiB = 204.0 MiB cmgdaemon [1658]
209.0 MiB + 29.1 MiB = 238.0 MiB skypeforlinux [3340]
333.0 MiB + 5.4 MiB = 338.5 MiB cmdagent [1686]
435.7 MiB + 17.2 MiB = 453.0 MiB Web Content [3635]
453.3 MiB + 23.6 MiB = 476.9 MiB Web Content [3998]
529.3 MiB + 34.6 MiB = 563.9 MiB firefox [3483]
831.2 MiB + 19.8 MiB = 851.0 MiB Web Content [3832]
889.0 MiB + 21.3 MiB = 910.3 MiB Web Content [4747]
---------------------------------
5.0 GiB
=================================

 Shared メモリが表示されるのは嬉しいです。

お腹すいた。。

DHCP-DNS DDNS-UPDATES について、実験をおこないました-新2

さて、実験していたら、どうも通信が安定しません。

どうやら、GNS3 のバージョン、VirtualBox、Fedora28 の相性のようです。

なので、GNS3 を、1.5.2 に落としました。テストのためにトポロジは単純化して、これでしばらく実験しよう、というところです。

この状態で、各サーバはそれぞれ ping が通り、PC1 や utubntu マシンは、DHCP

アドレスが取得できる状態となっています。障害探求で何度も確かめていたせいか、cisco のコマンドをバカすか打てるようになっちゃいました。。

やれやれ、お腹すいたぁ。

f:id:intrajp:20180628072321p:plain

Docker 備忘録その2

さて、自分の好きな docker イメージをつくりたいのですが、やり方をすっかり忘れているので、ここでまたメモします。

前回までで、hello-world イメージが一般ユーザで動きましたよね。

今までに作成したイメージを確認してみます。

$ docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
centos 7 49f7960eb7e4 2 weeks ago 200MB
centos latest 49f7960eb7e4 2 weeks ago 200MB
hello-world latest e38bc07ac18e 2 months ago 1.85kB
hello-world latest f2a91732366c 7 months ago 1.85kB
intrajp/centos7_kea ver1.1 62624c59d0ac 13 months ago 654MB
intrajp/centos7_kea ver1.0 aa2f983fde6d 13 months ago 621MB
centos latest a8493f5f50ff 14 months ago 192MB

 一つのイメージを動かしてみます。

$ docker run -it <tab>
centos hello-world intrajp/centos7_kea:ver1.0
centos:7 hello-world:latest intrajp/centos7_kea:ver1.1
centos:latest intrajp/centos7_kea
$ docker run -it centos:latest
[root@696fe9d155e9 /]#

 動いたようなので、exit しました。

では、一つのイメージに名前をつけてみます。

$ docker tag 49f7960eb7e4 intrajp/centos_for_gns3_user

確認します。

]$ docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
intrajp/centos_for_gns3_user latest 49f7960eb7e4 2 weeks ago 200MB
...(snip)...

 では、このイメージ intrajp/centos_for_gns3_user を動かして、このコンテナにはいくつのパッケージがインストールされているのかを確認します。

[$ docker run -it intrajp/centos_for_gns3_user
[root@67768806eeb3 /]# rpm -qa | sort;rpm -qa | wc -l
acl-2.2.51-14.el7.x86_64
audit-libs-2.8.1-3.el7.x86_64
basesystem-10.0-7.el7.centos.noarch
bash-4.2.46-30.el7.x86_64
bind-license-9.9.4-61.el7.noarch
binutils-2.27-27.base.el7.x86_64
bzip2-libs-1.0.6-13.el7.x86_64
ca-certificates-2018.2.22-70.0.el7_5.noarch
centos-release-7-5.1804.el7.centos.2.x86_64
chkconfig-1.7.4-1.el7.x86_64
coreutils-8.22-21.el7.x86_64
cpio-2.11-27.el7.x86_64
cracklib-2.9.0-11.el7.x86_64
cracklib-dicts-2.9.0-11.el7.x86_64
cryptsetup-libs-1.7.4-4.el7.x86_64
curl-7.29.0-46.el7.x86_64
cyrus-sasl-lib-2.1.26-23.el7.x86_64
dbus-1.10.24-7.el7.x86_64
dbus-glib-0.100-7.el7.x86_64
dbus-libs-1.10.24-7.el7.x86_64
dbus-python-1.1.1-9.el7.x86_64
device-mapper-1.02.146-4.el7.x86_64
device-mapper-libs-1.02.146-4.el7.x86_64
diffutils-3.3-4.el7.x86_64
dracut-033-535.el7.x86_64
elfutils-default-yama-scope-0.170-4.el7.noarch
elfutils-libelf-0.170-4.el7.x86_64
elfutils-libs-0.170-4.el7.x86_64
expat-2.1.0-10.el7_3.x86_64
file-libs-5.11-33.el7.x86_64
filesystem-3.2-25.el7.x86_64
findutils-4.5.11-5.el7.x86_64
gawk-4.0.2-4.el7_3.1.x86_64
gdbm-1.10-8.el7.x86_64
glib2-2.54.2-2.el7.x86_64
glibc-2.17-222.el7.x86_64
glibc-common-2.17-222.el7.x86_64
gmp-6.0.0-15.el7.x86_64
gnupg2-2.0.22-4.el7.x86_64
gobject-introspection-1.50.0-1.el7.x86_64
gpgme-1.3.2-5.el7.x86_64
grep-2.20-3.el7.x86_64
gzip-1.5-10.el7.x86_64
hardlink-1.0-19.el7.x86_64
hostname-3.13-3.el7.x86_64
info-5.1-5.el7.x86_64
iputils-20160308-10.el7.x86_64
keyutils-libs-1.5.8-3.el7.x86_64
kmod-20-21.el7.x86_64
kmod-libs-20-21.el7.x86_64
kpartx-0.4.9-119.el7.x86_64
krb5-libs-1.15.1-19.el7.x86_64
libacl-2.2.51-14.el7.x86_64
libassuan-2.1.0-3.el7.x86_64
libattr-2.4.46-13.el7.x86_64
libblkid-2.23.2-52.el7.x86_64
libcap-2.22-9.el7.x86_64
libcap-ng-0.7.5-4.el7.x86_64
libcom_err-1.42.9-12.el7_5.x86_64
libcurl-7.29.0-46.el7.x86_64
libdb-5.3.21-24.el7.x86_64
libdb-utils-5.3.21-24.el7.x86_64
libffi-3.0.13-18.el7.x86_64
libgcc-4.8.5-28.el7_5.1.x86_64
libgcrypt-1.5.3-14.el7.x86_64
libgpg-error-1.12-3.el7.x86_64
libidn-1.28-4.el7.x86_64
libmount-2.23.2-52.el7.x86_64
libpwquality-1.2.3-5.el7.x86_64
libselinux-2.5-12.el7.x86_64
libsemanage-2.5-11.el7.x86_64
libsepol-2.5-8.1.el7.x86_64
libssh2-1.4.3-10.el7_2.1.x86_64
libstdc++-4.8.5-28.el7_5.1.x86_64
libtasn1-4.10-1.el7.x86_64
libuser-0.60-9.el7.x86_64
libutempter-1.1.6-4.el7.x86_64
libuuid-2.23.2-52.el7.x86_64
libverto-0.2.5-4.el7.x86_64
libxml2-2.9.1-6.el7_2.3.x86_64
libxml2-python-2.9.1-6.el7_2.3.x86_64
lua-5.1.4-15.el7.x86_64
lz4-1.7.5-2.el7.x86_64
ncurses-5.9-14.20130511.el7_4.x86_64
ncurses-base-5.9-14.20130511.el7_4.noarch
ncurses-libs-5.9-14.20130511.el7_4.x86_64
nspr-4.19.0-1.el7_5.x86_64
nss-3.36.0-5.el7_5.x86_64
nss-pem-1.0.3-4.el7.x86_64
nss-softokn-3.36.0-5.el7_5.x86_64
nss-softokn-freebl-3.36.0-5.el7_5.x86_64
nss-sysinit-3.36.0-5.el7_5.x86_64
nss-tools-3.36.0-5.el7_5.x86_64
nss-util-3.36.0-1.el7_5.x86_64
openldap-2.4.44-15.el7_5.x86_64
openssl-libs-1.0.2k-12.el7.x86_64
p11-kit-0.23.5-3.el7.x86_64
p11-kit-trust-0.23.5-3.el7.x86_64
pam-1.1.8-22.el7.x86_64
passwd-0.79-4.el7.x86_64
pcre-8.32-17.el7.x86_64
pinentry-0.8.1-17.el7.x86_64
pkgconfig-0.27.1-4.el7.x86_64
popt-1.13-16.el7.x86_64
procps-ng-3.3.10-17.el7_5.2.x86_64
pth-2.0.7-23.el7.x86_64
pygpgme-0.3-9.el7.x86_64
pyliblzma-0.5.3-11.el7.x86_64
python-2.7.5-68.el7.x86_64
python-chardet-2.2.1-1.el7_1.noarch
python-gobject-base-3.22.0-1.el7_4.1.x86_64
python-iniparse-0.4-9.el7.noarch
python-kitchen-1.1.1-5.el7.noarch
python-libs-2.7.5-68.el7.x86_64
python-pycurl-7.19.0-19.el7.x86_64
python-urlgrabber-3.10-8.el7.noarch
pyxattr-0.5.1-5.el7.x86_64
qrencode-libs-3.4.1-3.el7.x86_64
readline-6.2-10.el7.x86_64
rootfiles-8.1-11.el7.noarch
rpm-4.11.3-32.el7.x86_64
rpm-build-libs-4.11.3-32.el7.x86_64
rpm-libs-4.11.3-32.el7.x86_64
rpm-python-4.11.3-32.el7.x86_64
sed-4.2.2-5.el7.x86_64
setup-2.8.71-9.el7.noarch
shadow-utils-4.1.5.1-24.el7.x86_64
shared-mime-info-1.8-4.el7.x86_64
sqlite-3.7.17-8.el7.x86_64
systemd-219-57.el7.x86_64
systemd-libs-219-57.el7.x86_64
tar-1.26-34.el7.x86_64
tzdata-2018e-3.el7.noarch
ustr-1.0.4-16.el7.x86_64
util-linux-2.23.2-52.el7.x86_64
vim-minimal-7.4.160-4.el7.x86_64
xz-5.2.2-1.el7.x86_64
xz-libs-5.2.2-1.el7.x86_64
yum-3.4.3-158.el7.centos.noarch
yum-metadata-parser-1.1.4-10.el7.x86_64
yum-plugin-fastestmirror-1.1.31-45.el7.noarch
yum-plugin-ovl-1.1.31-45.el7.noarch
yum-utils-1.1.31-45.el7.noarch
zlib-1.2.7-17.el7.x86_64
144
 

 しかし、なんで dracut が必要なんだろうか。

あるパッケージ(hping3)をいれたいのですが、epel にしかないので、まずは、epel-release をいれます。

# yum install epel-release

# yum -y install hping3

 まあ、これでこのイメージについては、固まった感じですね。次は、ネットワークになじませるところをやりたいですね。

 

Docker 備忘録その1

Docker イメージなんですが、ほかのことにかまけて最近とんとやっていなくて、すっかり忘れていました。

別の blog に書いていたことを、もう一度体験してやってみようという趣旨になります。別の blog では、Fedora25 でしたが、今回は、Fedora28 での作業となります。

まずは、最初に、現在インストールされているパッケージを削除します。

Get Docker CE for Fedora | Docker Documentation

# dnf remove docker \
                  docker-client \
                  docker-client-latest \
                  docker-common \
                  docker-latest \
                  docker-latest-logrotate \
                  docker-logrotate \
                  docker-selinux \
                  docker-engine-selinux \
                  docker-engine 

Docker-CE をインストールします。

リポジトリの設定をします。

docs.docker.com

 

# dnf -y install dnf-plugins-core

# dnf config-manager \ --add-repo \ https://download.docker.com/linux/fedora/docker-ce.repo

# dnf config-manager --set-enabled docker-ce-edge

# dnf config-manager --set-enabled docker-ce-test

# dnf install docker-ce
#
dnf list docker-ce --showduplicates | sort -r

Docker を起動します。次回起動時にも起動するようにします。

# systemctl start docker
# systemctl enable docker

 hello-world イメージをダウンロードして、Docker が動くかどうか確認します。

# docker run hello-world

 成功すると、各種メッセージが出力されます。

 postinstall の設定をします。

Post-installation steps for Linux | Docker Documentation

# groupadd docker
#
usermod -aG docker $USER

 では、一般ユーザで docker を実行してみます。

$ docker run hello-world

エラーとはならず、root で実行したときと同じような表示が出れば成功です。

とりあえず、今回はここまで。 

DHCP-DNS DDNS-UPDATES について、実験をおこないました-7.2

今回は、DNS サーバの 2台目を追加してみました。

DNS1 とは同じネットワークに配置しますが、異なるスイッチにぶら下げます。

これは、DNS1のスイッチが故障しても、名前解決に支障を生じさせないための処置となります。

f:id:intrajp:20180622225606p:plain

DNS2 の設定は、以下となります。

options {
     listen-on port 53 { any; };
     listen-on-v6 port 53 { ::1; };
     directory "/var/named";
     dump-file "/var/named/data/cache_dump.db";
     statistics-file "/var/named/data/named_stats.txt";
     memstatistics-file "/var/named/data/named_mem_stats.txt";
     allow-query { any; };
     recursion yes;
};

zone "intrajp-test.org" IN {
     type slave;
     file "data/bak.intrajp-test.org";
     masters { 172.16.100.2; };
     allow-update { any; };
};

zone "100.16.172.in-addr.arpa" IN {
     type slave;
     file "data/bak.172.16.100.intrajp-test.org";
    masters { 172.16.100.2; };
    allow-update { any; };
};

zone "100.168.192.in-addr.arpa" IN {
     type slave;
     file "data/bak.192.168.100.intrajp-test.org";
     masters { 172.16.100.2; };
     allow-update { any; };
};

zone "0.0.127.in-addr.arpa" IN {
     type master;
     file "data/db.127.0.0.intrajp-test.org";
     allow-update { any; };
};

logging {
     channel default_debug {
         file "data/named.run";
        severity dynamic;
     };
};

# service named start

/etc/named/data に、bak ファイルが生成されました。内容は、DNS1(マスター)から取ってきた zone データとなっていました。

DHCP-DNS DDNS-UPDATES について、実験をおこないました-7.1

今回も、前回のトポロジの続きです。

DHCP-DNS DDNS-UPDATES について、実験をおこないました-7 - computerの日記

DNSサーバの設定ですが、あまりにもいい加減過ぎたので、ちょっとまともになるように修正してみました。

 /etc/named.conf

options {
     listen-on port 53 { any; };
     listen-on-v6 port 53 { ::1; };
     directory "/var/named";
     dump-file "/var/named/data/cache_dump.db";
     statistics-file "/var/named/data/named_stats.txt";
     memstatistics-file "/var/named/data/named_mem_stats.txt";
     allow-query { any; };
     recursion yes;

    //these check statements can be overloaded in each zone
     check-names master fail: //bind default
     //check-names master warn; //you can set warn if you want
    check-name slave warn; //bind default
     //check-names slave ignore; //you can set ignore if you want
    check-names response ignore;
};

zone "intrajp-test.org" IN {
     type master;
     file "data/db.intrajp-test.org";
     allow-update { any; };
};

zone "100.16.172.in-addr.arpa" IN {
     type master;
     file "data/db.172.16.100.intrajp-test.org";
     allow-update { any; };
};

zone "100.168.192.in-addr.arpa" IN {
     type master;
     file "data/db.192.168.100.intrajp-test.org";
     allow-update { any; };
};

logging {
     channel default_debug {
         file "data/named.run";
        severity dynamic;
     };
};

forward mapping file (正引きファイル)です。

db.intrajp-test.org

 $ORIGIN .
$TTL 86400 ; 1 day
intrajp-test.org. IN SOA ns1.intrajp-test.org. hostmaster.intrajp-test.org. (
     2018060328 ; serial
     21600 ; refresh (6 hours)
     3600 ; retry (1 hour)
     604800 ; expire (1 week)
     86400 ; minimum (1 day as a negative cache TTL)
)
;
;NAME SERVER
;

intrajp-test.org. IN NS ns1.intrajp-test.org.

;
;addresses for forward mapping
;

localhost.intrajp-test.org. IN A 127.0.0.1
ns1.intrajp-test.org. IN A 172.16.100.2
dhcp-primary.intrajp-test.org. IN A 192.168.100.1

;
;CNAME
;

dhcp1.intrajp-test.org. IN CNAME dhcp-primary.intrajp-test.org.

 reverse mapping file (逆引きファイル)です。

db.172.16.100.intrajp-test.org

 $ORIGIN .
$TTL 86400 ; 1 day
100.16.172.in-addr.arpa. IN SOA ns1.intrajp-test.org. hostmaster.intrajp-test.org. (
     2018060311 ; serial
     28800 ; refresh (8 hours)
     14400 ; retry (4 hours)
     3600000 ; expire (5 weeks 6 days 16 hours)
     86400 ; minimum (1 day as a negative cache TTL)
)
;
;NAME SERVER
;

100.16.172.in-addr.arpa. IN NS ns1.intrajp-test.org.

;
;addresses for reverse mapping
;

2.100.16.172.in-addr.arpa IN PTR ns1.intrajp-test.org.

 db.192.168.100.intrajp-test.org

$ORIGIN .
$TTL 86400 ; 1 day
100.168.192.in-addr.arpa. IN SOA ns1.intrajp-test.org. hostmaster.intrajp-test.org. (
     2018060311 ; serial
     28800 ; refresh (8 hours)
     14400 ; retry (4 hours)
     3600000 ; expire (5 weeks 6 days 16 hours)
     86400 ; minimum (1 day as a negative cache TTL)
)
;
;NAME SERVER
;

100.168.192.in-addr.arpa. IN NS ns1.intrajp-test.org.

;
;addresses for reverse mapping
;

1.100.168.192.in-addr.arpa IN PTR dhcp-primary.intrajp-test.org. 

 

db.127.0.0.intrajp-test.org

$ORIGIN .
$TTL 86400 ; 1 day
0.0.127.in-addr.arpa. IN SOA ns1.intrajp-test.org. hostmaster.intrajp-test.org. (
     2018060311 ; serial
     28800 ; refresh (8 hours)
     14400 ; retry (4 hours)
     3600000 ; expire (5 weeks 6 days 16 hours)
     86400 ; minimum (1 day as a negative cache TTL)
)
;
;NAME SERVER
;

0.0.127.in-addr.arpa. IN NS ns1.intrajp-test.org.

;
;addresses for reverse mapping
;

1.0.0.127.in-addr.arpa IN PTR localhost.

/etc/nsswich.conf

#hosts: files dns
#### fixed for intranet system
hosts: dns files

DNS サーバ上で

$ hostname

ns1.intrajp-test.org

DHCP サーバ上で

$ hostname

dhcp-primary.intrajp-test.org

 

また、DHCP サーバからでも、dig コマンドにより正引き、逆引きができました。

DHCP-DNS DDNS-UPDATES について、実験をおこないました-7

お疲れさまです。

前回は、5 でしたが、今回は、7 にしました。

実は、IOU がうまく働かなくて、なぜかとパケットを見たりして調べていたら、どうも、ルータからの ICMP しか流れていません。これは、片通信となっているということなのだと直感しました。そこで、トランクポートを range 指定して、# duplex full としたところ、PING が通りました。

そこで、今回も、PC1 から IP を採ってみました。IP は、前回と同じ様に採れました。

今回も、以下のようなトポロジで実験しましたが、やはり、DNS の updatge はできませんでした。今回も、前回と同様、.... .... ...0 .... = Non-authenticated data: Unacceptable のようになってしまったのですが、その理由として、DNS サーバの方で、なにもセキュリティの設定をしていないからだと思います。

どうしたらいいのかな?

f:id:intrajp:20180618220239p:plain

f:id:intrajp:20180618220544p:plain