Banana Pi 測試 – bpi2015-lxde

好久不見的洪博所 Build 的 Banana Pi Image
開機登入畫面
[@more@]1. 桌面環境

2. 安裝的套件
影音

教育

系統工具

網際網路

美工繪圖

辦公

遊戲

附屬應用程式

偏好設定

其它:

使用之後的感想:
優點:
1. 執行速度非常快
2. 該有的軟體幾乎都有了,也有一些是專為教育推廣使用,如:OX 書庫、OX 教學工具、OX 數位測驗庫…等。
3. 螢幕顯示的字體有稍為加大,方便視力不太方便的使用者

個人認為可以改進的地方:
1. 這個 Image 應該是用來做為 demo 使用,因為套件無法做後續更新
    /etc/yum.repos.d 中沒有任何設定

2. 套件及軟體的版本稍舊
    Firefox 17.0.1 版本及 Fedora release 17(Beefy Wiracle)

並無內建安裝任何的外掛程式

3. 網際網路中的 gftp 建議改成 FileZilla,另外增加 Chromium 瀏覽器
4. 好久不見的 oxim 輸入法架構的行列輸入法,目前比較多人使用的應該是行列30,行列40使用的人應該比較少。

整體來說是一個值得期待的版本!

Banana Pi 測試 – Gentoo Linux 設定開機執行的服務

增加服務
語法:
# rc-update add scriptname runlevels
範例:
# rc-update add vixie-cron default
 * service vixie-cron added to runlevel default

刪除服務
語法:
# rc-update del scriptname runlevels
# rc-update del scriptname
範例:
# rc-update del dhcpd default
 * service dhcpd removed from runlevel default

runlevels 可以是 boot / default ….
[@more@]
列出可用的 Script 和運行層級
# rc-update show
             bootmisc | boot
                devfs |                       sysinit
                dmesg |                       sysinit
                 fsck | boot
             hostname | boot
              keymaps | boot
            killprocs |              shutdown
    kmod-static-nodes |                       sysinit
                local |      default
           localmount | boot
             loopback | boot
              modules | boot
             mount-ro |              shutdown
                 mtab | boot
             net.eth0 |      default
             netmount |      default
           ntp-client |      default
               procfs | boot
                 root | boot
            savecache |              shutdown
                 sshd |      default
                 swap | boot
            swapfiles | boot
              swclock | boot
               sysctl | boot
                sysfs |                       sysinit
         termencoding | boot
         tmpfiles.dev |                       sysinit
       tmpfiles.setup | boot
                 udev |                       sysinit
           udev-mount |                       sysinit
              urandom | boot

# rc-status
Runlevel: default
 net.eth0                                                                                             [  started  ]
 ntp-client                                                                                           [  started  ]
 sshd                                                                                                 [  started  ]
 netmount                                                                                             [  started  ]
 local                                                                                                [  started  ]
Dynamic Runlevel: hotplugged
Dynamic Runlevel: needed
Dynamic Runlevel: manual

Banana Pi 測試 – Gentoo Linux 的 rc.local

一般在 Linux 中,都有一個可以在開機後執行一些程式的設定檔,一般來說都叫做 rc.local,可能是位在 /etc 或 /etc/rc.d 的目錄之下,但也有一些 Linux 在新的版本中,逐漸捨棄這項功能,如果要使用這樣的功能,還要特別去設定。
在 Gentoo Linux 中,這一個設定檔,叫 local.start,位在 /etc/local.d 目錄之下
# vim /etc/local.d/local.start
#!/bin/bash
if [ -e /etc/firewall.server ] ;then
echo “Starting Firewall…”
   sh /etc/firewall.server
fi

設定檔案執行權限
# chmod 700 /etc/local.d/local.start

Banana Pi 測試 – Gentoo Linux 工作排程

cron 工作排程也不是內建就有安裝,須要另外安裝
# crontab -l
-bash: crontab: command not found

安裝
# emerge vixie-cron

# emerge fcron

# emerge cronie
[@more@]
列出工作排程
# crontab -l
# crontab -u bananapi -l

加入工作排程
# crontab -e
# crontab -u bananapi -e

移除工作排程
# crontab -r
# crontab -u bananapi -r

Banana Pi 測試 – Gentoo Linux 擴充 /root 分割區

原本的使用狀況
# df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/root       3.4G  1.7G  1.5G  53% /
devtmpfs        438M     0  438M   0% /dev
tmpfs            88M  284K   88M   1% /run
shm             438M     0  438M   0% /dev/shm
cgroup_root      10M     0   10M   0% /sys/fs/cgroup

使用 fdisk 做磁碟分割
# fdisk /dev/mmcblk0
[@more@]刪除第二個分割區,並重建第二個分割區

重新啟動電腦
# reboot

使用 resize2fs 擴大分割區的大小
# resize2fs /dev/mmcblk0p2
resize2fs 1.42.10 (18-May-2014)
Filesystem at /dev/mmcblk0p2 is mounted on /; on-line resizing required
old_desc_blocks = 1, new_desc_blocks = 1
The filesystem on /dev/mmcblk0p2 is now 1923584 blocks long.

擴充之後的磁碟空間
# df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/root       7.2G  1.7G  5.2G  25% /
devtmpfs        438M     0  438M   0% /dev
tmpfs            88M  284K   88M   1% /run
shm             438M     0  438M   0% /dev/shm
cgroup_root      10M     0   10M   0% /sys/fs/cgroup

Banana Pi 測試 – Gentoo Linux iptables 防火牆

Gentoo Linux 果然非常精簡,連 iptables 都沒有內建安裝
# iptables -L -n
-bash: iptables: command not found

安裝 iptables
# emerge iptables

設定開機時啟動
# rc-update add iptables default
 * service iptables added to runlevel default[@more@]
將目前的防火牆規則儲存起來
# /sbin/iptables-save > /var/lib/iptables/rules-save

# rc-service iptables save

Banana Pi 測試 – Gentoo Linux 更新系統

同步套件資訊
# emerge –sync

檢查需要更新的套件
[ebuild   R    ]:代表已安裝
[ebuild  N     ]:尚未安裝
[ebuild     U  ] :可以升級的套件
# emerge -pv world

These are the packages that would be merged, in order:

Calculating dependencies… done!
[ebuild   R    ] app-arch/xz-utils-5.0.5-r1  USE=”nls threads -static-libs” 1,276 kB
[ebuild   R    ] app-arch/bzip2-1.0.6-r6  USE=”-static -static-libs” 764 kB
[ebuild   R    ] sys-devel/gnuconfig-20140212  44 kB
[ebuild   R    ] sys-apps/which-2.20-r1  133 kB
[ebuild   R    ] sys-apps/baselayout-2.2  USE=”-build” 40 kB
[ebuild   R    ] sys-devel/patch-2.6.1  USE=”-static {-test}” 248 kB
[ebuild   R    ] virtual/os-headers-0  0 kB
[ebuild     U  ] sys-apps/file-5.21 [5.19] USE=”zlib -python -static-libs” PYTHON_TARGETS=”python2_7 python3_3 -python3_4 (-python3_2%)” 715 kB
[ebuild   R    ] sys-apps/net-tools-1.60_p20130513023548  USE=”nls -old-output (-selinux) -static” 196 kB
[ebuild   R    ] sys-apps/coreutils-8.21  USE=”acl nls -caps -gmp (-selinux) -static -vanilla -xattr” 5,281 kB
[ebuild   R    ] virtual/modutils-0  0 kB
[ebuild   R    ] virtual/libc-0  0 kB
[ebuild   R    ] app-shells/bash-4.2_p53  USE=”net nls (readline) (-afs) -bashlogger -examples -mem-scramble -plugins -vanilla” 6,977 kB
[ebuild   R    ] sys-apps/less-458  USE=”pcre unicode” 500 kB
[ebuild   R    ] sys-apps/sed-4.2.1-r1  USE=”acl nls (-selinux) -static” 879 kB
[ebuild   R    ] virtual/man-0-r1  0 kB
[ebuild   R    ] sys-devel/binutils-2.24-r3  USE=”cxx nls zlib (-multislot) -multitarget -static-libs {-test} -vanilla” 22,202 kB
[ebuild     U  ] sys-process/psmisc-22.21 [22.20] USE=”ipv6 nls -X (-selinux)” 442 kB
[ebuild   R    ] sys-apps/gawk-4.0.2  USE=”nls readline” 1,589 kB
[ebuild   R    ] app-arch/tar-1.27.1-r2  USE=”acl nls -minimal (-selinux) -static -xattr” 2,513 kB
[ebuild   R    ] sys-devel/make-4.0-r1  USE=”nls -guile -static” 1,311 kB
[ebuild   R    ] sys-apps/findutils-4.4.2-r1  USE=”nls (-selinux) -static” 2,100 kB
[ebuild   R    ] app-arch/gzip-1.5  USE=”nls -pic -static” 705 kB
[ebuild   R    ] virtual/pager-0  0 kB
[ebuild   R    ] sys-apps/diffutils-3.3  USE=”nls -static” 1,170 kB
[ebuild   R    ] sys-apps/mlocate-0.26-r1  USE=”nls (-selinux)” 0 kB
[ebuild   R    ] sys-devel/gcc-4.8.3:4.8  USE=”cxx fortran nls nptl openmp (-altivec) -awt -doc (-fixed-point) -gcj -go -graphite (-hardened) (-libssp) -mudflap (-multilib) (-multislot) -nopie -nossp -objc -objc++ -objc-gc -regression-test (-sanitize) -vanilla” 84,146 kB
[ebuild   R    ] sys-apps/man-pages-3.72  USE=”nls” LINGUAS=”-da -de -fr -it -ja -nl -pl -ro -ru -zh_CN” 1,251 kB
[ebuild  N     ] dev-libs/libevent-2.0.21-r1  USE=”ssl threads -static-libs {-test}” 831 kB
[ebuild   R    ] sys-apps/busybox-1.21.0  USE=”ipv6 pam static -livecd -make-symlinks -math -mdev -savedconfig (-selinux) -sep-usr -syslog -systemd” 2,150 kB
[ebuild   R    ] sys-apps/kbd-1.15.5-r1  USE=”nls pam” 1,691 kB
[ebuild   R    ] virtual/shadow-0  0 kB
[ebuild     U  ] net-misc/iputils-20121221-r1 [20121221] USE=”filecaps%* ipv6 ssl -SECURITY_HAZARD -caps -doc -gnutls -idn -static” 175 kB
[ebuild   R    ] virtual/ssh-0  USE=”-minimal” 0 kB
[ebuild   R    ] virtual/package-manager-0  0 kB
[ebuild   R    ] app-editors/vim-7.4.273  USE=”acl nls -X -cscope -debug -gpm -lua (-luajit) -minimal -perl -python (-racket) -ruby (-selinux) -tcl -vim-pager” PYTHON_SINGLE_TARGET=”python2_7 -python3_3 -python3_4″ PYTHON_TARGETS=”python2_7 python3_3 -python3_4″ 10,108 kB
[ebuild   R    ] virtual/editor-0  0 kB
[ebuild   R    ] net-dns/bind-tools-9.9.5  USE=”ipv6 readline ssl -doc -gost -gssapi -idn -urandom -xml” 0 kB
[ebuild   R    ] app-admin/sudo-1.8.11_p1  USE=”nls pam sendmail -ldap -offensive (-selinux) -skey” 2,346 kB
[ebuild   R    ] sys-apps/util-linux-2.24.1-r3  USE=”cramfs ncurses nls pam suid unicode -bash-completion -caps -cytune -fdformat -python (-selinux) -slang -static-libs {-test} -tty-helpers -udev” PYTHON_SINGLE_TARGET=”python2_7 -python3_3 -python3_4 (-python3_2%)” PYTHON_TARGETS=”python2_7 python3_3 -python3_4 (-python3_2%)” 3,461 kB
[ebuild   R    ] net-misc/rsync-3.0.9-r3  USE=”acl iconv ipv6 -static -xattr” 775 kB
[ebuild   R    ] sys-apps/grep-2.16  USE=”nls pcre -static” 1,182 kB
[ebuild   R    ] sys-process/procps-3.3.9  USE=”ncurses nls unicode -static-libs {-test}” 548 kB
[ebuild     U  ] net-misc/wget-1.16 [1.14] USE=”ipv6 nls pcre ssl zlib -debug -gnutls -idn -ntlm -static {-test%} -uuid” 1,658 kB
[ebuild     U  ] net-misc/ntp-4.2.8-r1 [4.2.6_p5-r10] USE=”ipv6 ssl -caps -debug -openntpd (-parse-clocks) -samba (-selinux) -snmp -vim-syntax -zeroconf” 6,638 kB
[ebuild   R    ] sys-process/vixie-cron-4.1-r14  USE=”pam -debug (-selinux)” 0 kB
[ebuild   R    ] sys-fs/e2fsprogs-1.42.10  USE=”nls -static-libs” 5,983 kB
[ebuild   R    ] sys-apps/openrc-0.12.4  USE=”ncurses netifrc pam unicode -debug -newnet (-prefix) (-selinux) -static-libs -tools” 129 kB
[ebuild   R    ] virtual/service-manager-0  USE=”(-prefix)” 0 kB
[ebuild   R    ] virtual/dev-manager-0  0 kB

Total: 50 packages (5 upgrades, 1 new, 44 reinstalls), Size of downloads: 172,141 kB[@more@]上面的資訊實在太複雜了,稍微精簡一下
# emerge -pv world | grep ‘[ebuild     U  ]’ | awk ‘{print $4}’
sys-apps/file-5.21
sys-process/psmisc-22.21
net-misc/iputils-20121221-r1
net-misc/wget-1.16
net-misc/ntp-4.2.8-r1

更新個別套件,以 wget 為例
系統安裝版本 1.14,新的版本是 1.16
# emerge -pv wget

These are the packages that would be merged, in order:

Calculating dependencies… done!
[ebuild     U  ] net-misc/wget-1.16 [1.14] USE=”ipv6 nls pcre ssl zlib -debug -gnutls -idn -ntlm -static {-test%} -uuid” 1,658 kB

Total: 1 package (1 upgrade), Size of downloads: 1,658 kB

進行更新
# emerge -u wget

更新整個系統
# emerge -u world

Banana Pi – Gentoo Linux 套件管理

Portage 是 Gentoo Linux 在套件管理的特色,感覺很像 BSD 中的 Ports Tree,透過 Portage 可以讓 Gentoo Linux 使用者可以取得套件名稱。 Portage 是指 ebuilds 的集合,檔案中包含 Portage 維護軟體所需的資訊(安裝,搜尋,查詢,…)。這些 ebuilds 預設存放在 /usr/portage 目錄之中,因此定期更新系統上的 ebuilds 是非常重要的。

emerge 是 Portage 的一個文字介面前端的管理式。
[@more@]
1. 同步套件庫  –sync
# emerge –sync

2. 搜尋套件 –search
# emerge –search bind-tools
# emerge -s bind-tools
Searching…
[ Results for search key : bind-tools ]
[ Applications found : 1 ]

*  net-dns/bind-tools
      Latest version available: 9.9.5
      Latest version installed: [ Not Installed ]
      Size of files: 7,548 kB
      Homepage:      http://www.isc.org/software/bind
      Description:   bind tools: dig, nslookup, host, nsupdate, dnssec-keygen
      License:       ISC BSD BSD-2 HPND JNIC RSA openssl

3. 搜尋描述的內容  –searchdesc
# emerge –searchdesc firefox
# emerge -S firefox
Searching…
[ Results for search key : firefox ]
[ Applications found : 3 ]

*  www-client/firefox
      Latest version available: 24.3.0
      Latest version installed: [ Not Installed ]
      Size of files: 116,599 kB
      Homepage:      http://www.mozilla.com/firefox
      Description:   Firefox Web Browser
      License:       MPL-2.0 GPL-2 LGPL-2.1

*  www-client/firefox-bin [ Masked ]
      Latest version available: 34.0.5
      Latest version installed: [ Not Installed ]
      Size of files: 0 kB
      Homepage:      http://www.mozilla.com/firefox
      Description:   Firefox Web Browser
      License:       MPL-2.0 GPL-2 LGPL-2.1

*  www-client/vimprobable2 [ Masked ]
      Latest version available: 9999
      Latest version installed: [ Not Installed ]
      Size of files: 0 kB
      Homepage:      http://www.vimprobable.org/
      Description:   A minimal web browser that behaves like the Vimperator plugin for Firefox
      License:       MIT

Calculating dependencies… done!

4. 安裝套件
# emerge bind-tools

安裝套件時指定編譯的參數
# USE=’sasl’ emerge postfix

# export USE=’sasl’
# emerge postfix

# emerge -k bind-tools
>>> Verifying ebuild manifests

>>> Emerging (1 of 1) net-dns/bind-tools-9.9.5
>>> Downloading ‘http://distfiles.gentoo.org/distfiles/bind-9.9.5.tar.gz’
–2014-12-30 20:46:22–  http://distfiles.gentoo.org/distfiles/bind-9.9.5.tar.gz
Resolving distfiles.gentoo.org… 64.50.233.100, 64.50.236.52, 137.226.34.42, …
Connecting to distfiles.gentoo.org|64.50.233.100|:80… connected.
HTTP request sent, awaiting response… 200 OK
Length: 7729695 (7.4M) [application/x-gzip]
Saving to: ‘/usr/portage/distfiles/bind-9.9.5.tar.gz’

100%[======================================>] 7,729,695   1.89MB/s   in 3.9s

2014-12-30 20:46:27 (1.89 MB/s) – ‘/usr/portage/distfiles/bind-9.9.5.tar.gz’ saved [7729695/7729695]
中略……..
   usr/bin/dig
   usr/bin/host
   usr/bin/nslookup
   usr/bin/nsupdate
   usr/bin/dnssec-keygen
ecompressdir: bzip2 -9 /usr/share/doc
ecompressdir: bzip2 -9 /usr/share/man

>>> Installing (1 of 1) net-dns/bind-tools-9.9.5

>>> Recording net-dns/bind-tools in “world” favorites file…
>>> Auto-cleaning packages…

>>> No outdated packages were found on your system.

 * GNU info directory index is up-to-date.

5. 檢查套件相依性 –pretend
# emerge –pretend vixie-cron
# emerge -p vixie-cron
# emerge -pv vixie-cron

These are the packages that would be merged, in order:

Calculating dependencies… done!
[ebuild  N     ] sys-process/cronbase-0.3.3
[ebuild  N     ] sys-process/vixie-cron-4.1-r14  USE=”pam -debug (-selinux)”

6. 移除套件 –unmerge
# emerge –unmerge wget
# emerge -C wget

7. 檢查系統需要更新的件
# emerge -pv world

8. 更新套件 –update
# emerge –update wget
# emerge -u wget

在部分套件升級完畢,需要執行 etc-update 才能正常使用。執行 etc-update 之後出現的選項:
-1:不使用新的設定檔取代舊的設定檔
-3 :使用新的設定檔取代舊的設定檔(會詢問)
-5 :使用新的設定檔取代舊的設定檔(不會詢問)

10. 更新整個系統
# emerge –update world
# emerge -u world

Banana Pi 測試 – Gentoo Linux 網路設定

Banana Pi 上預設 Gentoo Linux 是採用 DHCP 自動取得 IP
# cat /etc/conf.d/net
#For DHCP
config_eth0=”dhcp”
dns_domain_lo=”lemaker”
nis_domain_lo=”lemaker”

固定 IP 的設定方式
[@more@]參考網頁:
Gentoo Forums :: 觀看文章 – Switching to a static IP (within your network)

1. 先備份原檔
# cp /etc/conf.d/net /etc/conf.d/net.$(date +%F)

2. 修改設定檔 /etc/conf.d/net
# vim /etc/conf.d/net
#For Static IP
config_eth0=( “192.168.1.44 netmask 255.255.255.0” )
routes_eth0=( “default gw 192.168.1.254” )
dns_servers_eth0=( “168.95.1.1 140.111.66.1” )

3. 重新開機或啟動網路
# /etc/init.d/net.eth0 restart