2017年2月26日 星期日

在樹莓派上安裝 R 語言

自從去年對 R 語言產生興趣後, 就一直想找時間好好來學習測試. 但想學的東西實在太多了, 時間總是不夠用. 最近聽了兩場機器學習的演講後, 對 R 語言又熱衷起來. 在資料探勘與機器學習這兩個領域上, Python 與 R 語言的使用度非常高, 我非常看好這兩個語言的發展. 參考資料探勘專業網站 KDnuggets 2014~2015 調查結果, R 與 Python 獨占鰲頭, 分別為 51% 與 29%, 合計占 80%, 且持續上升中, 其他語言則逐漸萎縮 :


今天在 "R語言 : 數學計算、統計模型與金融實務分析應用" 這本書上看到 R 語言也可以安裝在 Linux 機器上, 我想應該可以在樹莓派上跑吧! 下午回到鄉下後, 便將 B+ 那塊板子的 SD 卡先做備份, 然後用下列指令進行安裝 :

$ sudo apt-get install r-base

pi@raspberrypi:~ $ sudo apt-get install r-base
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
  libasn1-8-heimdal libgssapi3-heimdal libhcrypto4-heimdal libheimbase1-heimdal libheimntlm0-heimdal libhx509-5-heimdal
  libkrb5-26-heimdal libroken18-heimdal libwind0-heimdal libxfce4ui-1-0 xfce-keyboard-shortcuts
Use 'apt-get autoremove' to remove them.
The following extra packages will be installed:
  autotools-dev bzip2-doc cdbs gfortran gfortran-4.9 libblas-dev libbz2-dev libgfortran-4.9-dev libjpeg-dev libjpeg62-turbo-dev
  liblapack-dev liblzma-dev libncurses5-dev libpaper-utils libpaper1 libpcre3-dev libpcrecpp0 libreadline-dev libreadline6-dev
  libtinfo-dev r-base-core r-base-dev r-base-html r-cran-boot r-cran-class r-cran-cluster r-cran-codetools r-cran-foreign
  r-cran-kernsmooth r-cran-lattice r-cran-mass r-cran-matrix r-cran-mgcv r-cran-nlme r-cran-nnet r-cran-rpart r-cran-spatial
  r-cran-survival r-doc-html r-recommended zip
Suggested packages:
  devscripts gfortran-doc gfortran-4.9-doc libgfortran3-dbg liblzma-doc ncurses-doc readline-doc ess r-doc-info r-doc-pdf r-mathlib
  debhelper texlive-base texlive-latex-base texlive-generic-recommended texlive-fonts-recommended texlive-fonts-extra
  texlive-extra-utils texlive-latex-recommended texlive-latex-extra texinfo
The following NEW packages will be installed:
  autotools-dev bzip2-doc cdbs gfortran gfortran-4.9 libblas-dev libbz2-dev libgfortran-4.9-dev libjpeg-dev libjpeg62-turbo-dev
  liblapack-dev liblzma-dev libncurses5-dev libpaper-utils libpaper1 libpcre3-dev libpcrecpp0 libreadline-dev libreadline6-dev
  libtinfo-dev r-base r-base-core r-base-dev r-base-html r-cran-boot r-cran-class r-cran-cluster r-cran-codetools r-cran-foreign
  r-cran-kernsmooth r-cran-lattice r-cran-mass r-cran-matrix r-cran-mgcv r-cran-nlme r-cran-nnet r-cran-rpart r-cran-spatial
  r-cran-survival r-doc-html r-recommended zip
0 upgraded, 42 newly installed, 0 to remove and 17 not upgraded.
Need to get 44.0 MB of archives.
After this operation, 84.1 MB of additional disk space will be used.
Do you want to continue? [Y/n] Y
Get:1 http://mirrordirector.raspbian.org/raspbian/ jessie/main libpaper1 armhf 1.1.24+nmu4 [21.4 kB]
Get:2 http://mirrordirector.raspbian.org/raspbian/ jessie/main libpcrecpp0 armhf 2:8.35-3.3+deb8u4 [140 kB]
Get:3 http://mirrordirector.raspbian.org/raspbian/ jessie/main autotools-dev all 20140911.1 [70.5 kB]
Get:4 http://mirrordirector.raspbian.org/raspbian/ jessie/main bzip2-doc all 1.0.6-7 [307 kB]
Get:5 http://mirrordirector.raspbian.org/raspbian/ jessie/main gfortran armhf 4:4.9.2-2 [1,294 B]
Get:6 http://mirrordirector.raspbian.org/raspbian/ jessie/main cdbs all 0.4.130+deb8u1 [77.1 kB]
Get:7 http://mirrordirector.raspbian.org/raspbian/ jessie/main libgfortran-4.9-dev armhf 4.9.2-10 [179 kB]
Get:8 http://mirrordirector.raspbian.org/raspbian/ jessie/main gfortran-4.9 armhf 4.9.2-10 [4,525 kB]
Get:9 http://mirrordirector.raspbian.org/raspbian/ jessie/main libreadline-dev armhf 6.3-8 [994 B]
Get:10 http://mirrordirector.raspbian.org/raspbian/ jessie/main libblas-dev armhf 1.2.20110419-10 [117 kB]
Get:11 http://mirrordirector.raspbian.org/raspbian/ jessie/main libbz2-dev armhf 1.0.6-7 [27.5 kB]
Get:12 http://mirrordirector.raspbian.org/raspbian/ jessie/main libjpeg62-turbo-dev armhf 1:1.3.1-12 [400 kB]
Get:13 http://mirrordirector.raspbian.org/raspbian/ jessie/main libjpeg-dev all 1:1.3.1-12 [49.3 kB]
Get:14 http://mirrordirector.raspbian.org/raspbian/ jessie/main liblapack-dev armhf 3.5.0-4 [1,364 kB]
Get:15 http://mirrordirector.raspbian.org/raspbian/ jessie/main liblzma-dev armhf 5.1.1alpha+20120614-2 [272 kB]
Get:16 http://mirrordirector.raspbian.org/raspbian/ jessie/main libtinfo-dev armhf 5.9+20140913-1 [65.4 kB]
Get:17 http://mirrordirector.raspbian.org/raspbian/ jessie/main libncurses5-dev armhf 5.9+20140913-1 [154 kB]
Get:18 http://mirrordirector.raspbian.org/raspbian/ jessie/main libpaper-utils armhf 1.1.24+nmu4 [17.2 kB]
Get:19 http://mirrordirector.raspbian.org/raspbian/ jessie/main libpcre3-dev armhf 2:8.35-3.3+deb8u4 [413 kB]
Get:20 http://mirrordirector.raspbian.org/raspbian/ jessie/main libreadline6-dev armhf 6.3-8 [105 kB]
Get:21 http://mirrordirector.raspbian.org/raspbian/ jessie/main zip armhf 3.0-8 [326 kB]
Get:22 http://mirrordirector.raspbian.org/raspbian/ jessie/main r-base-core armhf 3.1.1-1 [19.5 MB]
Get:23 http://mirrordirector.raspbian.org/raspbian/ jessie/main r-cran-boot all 1.3-13-1 [571 kB]
Get:24 http://mirrordirector.raspbian.org/raspbian/ jessie/main r-cran-cluster armhf 1.15.3-1 [469 kB]
Get:25 http://mirrordirector.raspbian.org/raspbian/ jessie/main r-cran-foreign armhf 0.8.61-1 [203 kB]
Get:26 http://mirrordirector.raspbian.org/raspbian/ jessie/main r-cran-mass armhf 7.3-34-1 [1,011 kB]
Get:27 http://mirrordirector.raspbian.org/raspbian/ jessie/main r-cran-kernsmooth armhf 2.23-13-1 [80.0 kB]
Get:28 http://mirrordirector.raspbian.org/raspbian/ jessie/main r-cran-lattice armhf 0.20-29-1 [712 kB]
Get:29 http://mirrordirector.raspbian.org/raspbian/ jessie/main r-cran-nlme armhf 3.1.117-1 [1,986 kB]
Get:30 http://mirrordirector.raspbian.org/raspbian/ jessie/main r-cran-matrix armhf 1.1-4-1 [2,851 kB]
Get:31 http://mirrordirector.raspbian.org/raspbian/ jessie/main r-cran-mgcv armhf 1.8-3-1 [1,701 kB]
Get:32 http://mirrordirector.raspbian.org/raspbian/ jessie/main r-cran-survival armhf 2.37-7-1 [4,428 kB]
Get:33 http://mirrordirector.raspbian.org/raspbian/ jessie/main r-cran-rpart armhf 4.1-8-1 [854 kB]
Get:34 http://mirrordirector.raspbian.org/raspbian/ jessie/main r-cran-class armhf 7.3-11-1 [80.4 kB]
Get:35 http://mirrordirector.raspbian.org/raspbian/ jessie/main r-cran-nnet armhf 7.3-8-1 [93.4 kB]
Get:36 http://mirrordirector.raspbian.org/raspbian/ jessie/main r-cran-spatial armhf 7.3-8-1 [115 kB]
Get:37 http://mirrordirector.raspbian.org/raspbian/ jessie/main r-cran-codetools all 0.2-9-1 [45.7 kB]
Get:38 http://mirrordirector.raspbian.org/raspbian/ jessie/main r-recommended all 3.1.1-1 [2,852 B]
Get:39 http://mirrordirector.raspbian.org/raspbian/ jessie/main r-base all 3.1.1-1 [37.5 kB]
Get:40 http://mirrordirector.raspbian.org/raspbian/ jessie/main r-base-dev all 3.1.1-1 [4,018 B]
Get:41 http://mirrordirector.raspbian.org/raspbian/ jessie/main r-doc-html all 3.1.1-1 [529 kB]
Get:42 http://mirrordirector.raspbian.org/raspbian/ jessie/main r-base-html all 3.1.1-1 [81.1 kB]
Fetched 44.0 MB in 7min 7s (103 kB/s)
Extracting templates from packages: 100%
Preconfiguring packages ...
Selecting previously unselected package libpaper1:armhf.
(Reading database ... 131823 files and directories currently installed.)
Preparing to unpack .../libpaper1_1.1.24+nmu4_armhf.deb ...
Unpacking libpaper1:armhf (1.1.24+nmu4) ...
Selecting previously unselected package libpcrecpp0:armhf.
Preparing to unpack .../libpcrecpp0_2%3a8.35-3.3+deb8u4_armhf.deb ...
Unpacking libpcrecpp0:armhf (2:8.35-3.3+deb8u4) ...
Selecting previously unselected package autotools-dev.
Preparing to unpack .../autotools-dev_20140911.1_all.deb ...
Unpacking autotools-dev (20140911.1) ...
Selecting previously unselected package bzip2-doc.
Preparing to unpack .../bzip2-doc_1.0.6-7_all.deb ...
Unpacking bzip2-doc (1.0.6-7) ...
Selecting previously unselected package cdbs.
Preparing to unpack .../cdbs_0.4.130+deb8u1_all.deb ...
Unpacking cdbs (0.4.130+deb8u1) ...
Selecting previously unselected package libgfortran-4.9-dev:armhf.
Preparing to unpack .../libgfortran-4.9-dev_4.9.2-10_armhf.deb ...
Unpacking libgfortran-4.9-dev:armhf (4.9.2-10) ...
Selecting previously unselected package gfortran-4.9.
Preparing to unpack .../gfortran-4.9_4.9.2-10_armhf.deb ...
Unpacking gfortran-4.9 (4.9.2-10) ...
Selecting previously unselected package gfortran.
Preparing to unpack .../gfortran_4%3a4.9.2-2_armhf.deb ...
Unpacking gfortran (4:4.9.2-2) ...
Selecting previously unselected package libblas-dev.
Preparing to unpack .../libblas-dev_1.2.20110419-10_armhf.deb ...
Unpacking libblas-dev (1.2.20110419-10) ...
Selecting previously unselected package libbz2-dev:armhf.
Preparing to unpack .../libbz2-dev_1.0.6-7_armhf.deb ...
Unpacking libbz2-dev:armhf (1.0.6-7) ...
Selecting previously unselected package libjpeg62-turbo-dev:armhf.
Preparing to unpack .../libjpeg62-turbo-dev_1%3a1.3.1-12_armhf.deb ...
Unpacking libjpeg62-turbo-dev:armhf (1:1.3.1-12) ...
Selecting previously unselected package libjpeg-dev.
Preparing to unpack .../libjpeg-dev_1%3a1.3.1-12_all.deb ...
Unpacking libjpeg-dev (1:1.3.1-12) ...
Selecting previously unselected package liblapack-dev.
Preparing to unpack .../liblapack-dev_3.5.0-4_armhf.deb ...
Unpacking liblapack-dev (3.5.0-4) ...
Selecting previously unselected package liblzma-dev:armhf.
Preparing to unpack .../liblzma-dev_5.1.1alpha+20120614-2_armhf.deb ...
Unpacking liblzma-dev:armhf (5.1.1alpha+20120614-2) ...
Selecting previously unselected package libtinfo-dev:armhf.
Preparing to unpack .../libtinfo-dev_5.9+20140913-1_armhf.deb ...
Unpacking libtinfo-dev:armhf (5.9+20140913-1) ...
Selecting previously unselected package libncurses5-dev:armhf.
Preparing to unpack .../libncurses5-dev_5.9+20140913-1_armhf.deb ...
Unpacking libncurses5-dev:armhf (5.9+20140913-1) ...
Selecting previously unselected package libpaper-utils.
Preparing to unpack .../libpaper-utils_1.1.24+nmu4_armhf.deb ...
Unpacking libpaper-utils (1.1.24+nmu4) ...
Selecting previously unselected package libpcre3-dev:armhf.
Preparing to unpack .../libpcre3-dev_2%3a8.35-3.3+deb8u4_armhf.deb ...
Unpacking libpcre3-dev:armhf (2:8.35-3.3+deb8u4) ...
Selecting previously unselected package libreadline6-dev:armhf.
Preparing to unpack .../libreadline6-dev_6.3-8_armhf.deb ...
Unpacking libreadline6-dev:armhf (6.3-8) ...
Selecting previously unselected package libreadline-dev:armhf.
Preparing to unpack .../libreadline-dev_6.3-8_armhf.deb ...
Unpacking libreadline-dev:armhf (6.3-8) ...
Selecting previously unselected package zip.
Preparing to unpack .../archives/zip_3.0-8_armhf.deb ...
Unpacking zip (3.0-8) ...
Selecting previously unselected package r-base-core.
Preparing to unpack .../r-base-core_3.1.1-1_armhf.deb ...
Unpacking r-base-core (3.1.1-1) ...
Selecting previously unselected package r-cran-boot.
Preparing to unpack .../r-cran-boot_1.3-13-1_all.deb ...
Unpacking r-cran-boot (1.3-13-1) ...
Selecting previously unselected package r-cran-cluster.
Preparing to unpack .../r-cran-cluster_1.15.3-1_armhf.deb ...
Unpacking r-cran-cluster (1.15.3-1) ...
Selecting previously unselected package r-cran-foreign.
Preparing to unpack .../r-cran-foreign_0.8.61-1_armhf.deb ...
Unpacking r-cran-foreign (0.8.61-1) ...
Selecting previously unselected package r-cran-mass.
Preparing to unpack .../r-cran-mass_7.3-34-1_armhf.deb ...
Unpacking r-cran-mass (7.3-34-1) ...
Selecting previously unselected package r-cran-kernsmooth.
Preparing to unpack .../r-cran-kernsmooth_2.23-13-1_armhf.deb ...
Unpacking r-cran-kernsmooth (2.23-13-1) ...
Selecting previously unselected package r-cran-lattice.
Preparing to unpack .../r-cran-lattice_0.20-29-1_armhf.deb ...
Unpacking r-cran-lattice (0.20-29-1) ...
Selecting previously unselected package r-cran-nlme.
Preparing to unpack .../r-cran-nlme_3.1.117-1_armhf.deb ...
Unpacking r-cran-nlme (3.1.117-1) ...
Selecting previously unselected package r-cran-matrix.
Preparing to unpack .../r-cran-matrix_1.1-4-1_armhf.deb ...
Unpacking r-cran-matrix (1.1-4-1) ...
Selecting previously unselected package r-cran-mgcv.
Preparing to unpack .../r-cran-mgcv_1.8-3-1_armhf.deb ...
Unpacking r-cran-mgcv (1.8-3-1) ...
Selecting previously unselected package r-cran-survival.
Preparing to unpack .../r-cran-survival_2.37-7-1_armhf.deb ...
Unpacking r-cran-survival (2.37-7-1) ...
Selecting previously unselected package r-cran-rpart.
Preparing to unpack .../r-cran-rpart_4.1-8-1_armhf.deb ...
Unpacking r-cran-rpart (4.1-8-1) ...
Selecting previously unselected package r-cran-class.
Preparing to unpack .../r-cran-class_7.3-11-1_armhf.deb ...
Unpacking r-cran-class (7.3-11-1) ...
Selecting previously unselected package r-cran-nnet.
Preparing to unpack .../r-cran-nnet_7.3-8-1_armhf.deb ...
Unpacking r-cran-nnet (7.3-8-1) ...
Selecting previously unselected package r-cran-spatial.
Preparing to unpack .../r-cran-spatial_7.3-8-1_armhf.deb ...
Unpacking r-cran-spatial (7.3-8-1) ...
Selecting previously unselected package r-cran-codetools.
Preparing to unpack .../r-cran-codetools_0.2-9-1_all.deb ...
Unpacking r-cran-codetools (0.2-9-1) ...
Selecting previously unselected package r-recommended.
Preparing to unpack .../r-recommended_3.1.1-1_all.deb ...
Unpacking r-recommended (3.1.1-1) ...
Selecting previously unselected package r-base.
Preparing to unpack .../r-base_3.1.1-1_all.deb ...
Unpacking r-base (3.1.1-1) ...
Selecting previously unselected package r-base-dev.
Preparing to unpack .../r-base-dev_3.1.1-1_all.deb ...
Unpacking r-base-dev (3.1.1-1) ...
Selecting previously unselected package r-doc-html.
Preparing to unpack .../r-doc-html_3.1.1-1_all.deb ...
Unpacking r-doc-html (3.1.1-1) ...
Selecting previously unselected package r-base-html.
Preparing to unpack .../r-base-html_3.1.1-1_all.deb ...
Unpacking r-base-html (3.1.1-1) ...
Processing triggers for man-db (2.7.0.2-5) ...
Processing triggers for install-info (5.2.0.dfsg.1-6) ...
Processing triggers for hicolor-icon-theme (0.13-1) ...
Processing triggers for gnome-menus (3.13.3-6) ...
Processing triggers for desktop-file-utils (0.22-1) ...
Processing triggers for mime-support (3.58) ...
Setting up libpaper1:armhf (1.1.24+nmu4) ...

Creating config file /etc/papersize with new version
Setting up libpcrecpp0:armhf (2:8.35-3.3+deb8u4) ...
Setting up autotools-dev (20140911.1) ...
Setting up bzip2-doc (1.0.6-7) ...
Setting up cdbs (0.4.130+deb8u1) ...
Setting up libgfortran-4.9-dev:armhf (4.9.2-10) ...
Setting up gfortran-4.9 (4.9.2-10) ...
Setting up gfortran (4:4.9.2-2) ...
update-alternatives: using /usr/bin/gfortran to provide /usr/bin/f95 (f95) in auto mode
update-alternatives: using /usr/bin/gfortran to provide /usr/bin/f77 (f77) in auto mode
Setting up libblas-dev (1.2.20110419-10) ...
update-alternatives: using /usr/lib/libblas/libblas.so to provide /usr/lib/libblas.so (libblas.so) in auto mode
Setting up libbz2-dev:armhf (1.0.6-7) ...
Setting up libjpeg62-turbo-dev:armhf (1:1.3.1-12) ...
Setting up libjpeg-dev (1:1.3.1-12) ...
Setting up liblapack-dev (3.5.0-4) ...
update-alternatives: using /usr/lib/lapack/liblapack.so to provide /usr/lib/liblapack.so (liblapack.so) in auto mode
Setting up liblzma-dev:armhf (5.1.1alpha+20120614-2) ...
Setting up libtinfo-dev:armhf (5.9+20140913-1) ...
Setting up libncurses5-dev:armhf (5.9+20140913-1) ...
Setting up libpaper-utils (1.1.24+nmu4) ...
Setting up libpcre3-dev:armhf (2:8.35-3.3+deb8u4) ...
Setting up libreadline6-dev:armhf (6.3-8) ...
Setting up libreadline-dev:armhf (6.3-8) ...
Setting up zip (3.0-8) ...
Setting up r-base-core (3.1.1-1) ...

Creating config file /etc/R/Renviron with new version
Setting up r-cran-boot (1.3-13-1) ...
Setting up r-cran-cluster (1.15.3-1) ...
Setting up r-cran-foreign (0.8.61-1) ...
Setting up r-cran-mass (7.3-34-1) ...
Setting up r-cran-kernsmooth (2.23-13-1) ...
Setting up r-cran-lattice (0.20-29-1) ...
Setting up r-cran-nlme (3.1.117-1) ...
Setting up r-cran-matrix (1.1-4-1) ...
Setting up r-cran-mgcv (1.8-3-1) ...
Setting up r-cran-survival (2.37-7-1) ...
Setting up r-cran-rpart (4.1-8-1) ...
Setting up r-cran-class (7.3-11-1) ...
Setting up r-cran-nnet (7.3-8-1) ...
Setting up r-cran-spatial (7.3-8-1) ...
Setting up r-cran-codetools (0.2-9-1) ...
Setting up r-recommended (3.1.1-1) ...
Setting up r-base (3.1.1-1) ...
Setting up r-base-dev (3.1.1-1) ...
Setting up r-doc-html (3.1.1-1) ...
Setting up r-base-html (3.1.1-1) ...
Processing triggers for libc-bin (2.19-18+deb8u7) ...

安裝完畢後用 R (注意是大寫) 即可進入 R 語言命令列, 要跳出  R 回到 Linux 的話則輸入 q() :

pi@raspberrypi:~ $ R

R version 3.1.1 (2014-07-10) -- "Sock it to Me"
Copyright (C) 2014 The R Foundation for Statistical Computing
Platform: arm-unknown-linux-gnueabihf (32-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

  Natural language support but running in an English locale

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> 1+2
[1] 3
> 1/2
[1] 0.5
> q()
Save workspace image? [y/n/c]: n
pi@raspberrypi:~ $

可見樹莓派支援的是 R 3.1.1 版, 沒想到 R 語言在樹莓派也跑得挺順的, 如果寫個 R Script 放在 Crontab 裡面執行, 不就可以自動進行統計分析與機器學習了嗎? 樹莓派作為一個低功耗可 24 小時開機的 Linux 伺服器, 有了 R 語言可說如虎添翼啊!

大部分的 R 操作可在命令列執行, 但若執行 plot() 等繪圖函數時就必須在 X Window 桌面系統的 Terminal 視窗下才會顯示, 如果是透過 Putty 連線, 則執行 plot() 之後不會顯示圖形.



參考 :

Using R with the Pi
R on the Raspberry Pi

樹莓派重新安裝 Raspbian 作業系統

由於最早買的那塊樹莓派 (Type B) 裡的 MySQL 伺服器前幾天莫名其妙無法啟動, 造成 PHP 爬蟲程式無法運作, 在努力搶修兩天後, 因為對 Linux 系統的瞭解實在太膚淺, 無奈只好宣告放棄, 參見 :

# 樹莓派 MySQL/phpMyAdmin 無法登入問題

最後決定還是將 SD 卡格式化, 重新安裝系統算了. 當然在此之前要先將 PHP 專案全部用 WinSCP 複製到 Windows 下保存, 還有 ssmtp.conf 設定檔也複製到 /home/pi 下, 而 Crontab 內容必須用 nano 開啟後複製到 PC 下的記事本中儲存.

$ sudo cp /etc/ssmtp/ssmtp.conf ssmtp.conf

然後將樹莓派關機, 取下 SD 卡放入讀卡機連接 PC 後, 用 SD formatter 程式進行格式化 :


參考 :

記憶卡格式化/抹除工具 : SD Formatter 4.0

再到樹莓派官網下載最新的 Raspbian 作業系統 zip 檔, 目前是 Rasbian Jessie with Pixel (約 1.5GB), 由於官網頻寬較小, 所以要 2 小時才能完成下載 :



下載完成後解開 zip 得到約 4.3GB 的映像檔 2017-01-11-raspbian-jessie.img, 使用 Win32 Disk Imager (或下載免安裝版 Win32DiskImager-0.9.5-binary.zip) 將此映像檔燒入 SD 卡內 (注意, Device 要選對) :




作業系統燒錄完成後將 SD 卡插回樹莓派, 由於新系統無法使用無頭存取方式 (Headless), 因此必須接 HDMI 到螢幕或電視機, 並且插上無線鍵盤滑鼠組的 USB 接收器後再開機. 由於 Raspbian 預設都是英國 UK 使用者觀點 (keyboard, locale, language, timezone, ...), 因此開機登入 (預設帳號 pi, 密碼 raspberry) 後要先用 raspi-config 指令去更改設定, 否則光是鍵盤配置不同就會讓輸入的字元與期望不同 (例如雙引號在英式鍵盤被解讀為 @).

$ sudo raspi-config

這個設定畫面使用上下箭頭移動高亮度項目, 按 Enter 確認或進入選項, 多選時用 Space 鍵選取, 按 Tab 鍵可在不同按鈕間切換 :


首先第一項是擴充檔案系統 (Expand File System), 由於 Raspbian 映像檔大小為 4.3GB, 燒錄到我使用的 8GB 後, 超出 4.3GB 的部分將存取不到, 執行這項功能目的是讓 Raspbian 的 root partition 能擴充至整張 SD 卡, 不致浪費 4.3GB 以外的空間.

第二項 Change User Password 更改使用者密碼, 預設帳號 pi 的密碼是 raspberry, 為了安全最好改掉, 在舊版時我為了方便改成與帳號 pi 相同, 但在 2017 新版 Raspbian 不讓我這樣改了, 太簡單的不會被接受. 執行這項設定時會跳回命令列, 輸入新密碼並確認後會再回到設定畫面.

第三項 Boot Options 是選擇開機時要進入命令列 CML 或桌面 Desktop, 建議是進入命令列 (都選 B1), 因為桌面較占資源. 我的樹莓派主要是用作 IoT 與 cURL 的伺服器, 所以幾乎都是在命令列操作, 不需要的軟體不安裝, 不需要的軟體不執行, 以節省運算資源.



第四項 Internationalization Options 是區域設定, 其中 I1 是設定語系, 為單純起見, 我只用美式英文, 移動上下鍵至 en_US.UTF-8 UTF-8 時按 Space 鍵選取, 這時前面出現 * 表示已被選取 (再按一次 Space 則取消選取). 可以多選, 例如要加入繁體中文就選 lzh_TW UTF-8 這項, 但我覺得用不到所以不選. 參考 :

樹莓派系統設定 : 區域設置 (Locale)




I2 (Change Timezone) 用來設定時區, 選取 Asia/Taipei :



I3 (Change Keyboard Layout) 是設定鍵盤樣式, Keyboard Model 選 Generic 105-key (Intl) PC, Keyboard Layout 選 English (US); Key to function as AltGr 選 The default for the keyboard layout; Compose key 選 No compose key; 而 Use Control+Alt+Backspace to terminate the x server 則選 No.

I4 (Change WiFi Country) 選擇 Taiwan.

第五項 Enable Camera 選 Yes, 因為我已經買了 PiCam 準備要測試.

第六項超頻不要用跳過.

最後一項 Advanced Options 中目前只要打開 SSH 以便遠端 headless 存取即可.


注意, 2017 版 Raspbian 已經內建 VNC Server, 不須再安裝了. 如果需要用到遠端介面, 只要在系統設定中開啟 VNC 功能, 然後在命令列輸入 vncserver 啟動伺服器即可在 PC 上用 VNC Viewer 遠端存取樹莓派桌面了 (最好要用到時再啟動 VNC 伺服器, 不要開機自動啟動, 免得占用資源).

pi@raspberrypi:~ $ vncserver
VNC(R) Server 5.3.2 (RasPi) (r22607) ARMv6 (Oct 4 2016 11:26:16)
Copyright (C) 2002-2016 RealVNC Ltd.
RealVNC and VNC are trademarks of RealVNC Ltd and are protected by trademark
registrations and/or pending trademark applications in the European Union,
United States of America and other jurisdictions.
Protected by UK patent 2481870; US patent 8760366.
See http://www.realvnc.com for information on VNC.
For third party acknowledgements see:
http://www.realvnc.com/products/vnc/documentation/5.3/acknowledgements.txt

If a desktop environment fails to load for this virtual desktop, please see:
 http://www.realvnc.com/doclink/kb-345?version=5.3.2.22607
Running applications in /etc/vnc/xstartup

VNC Server catchphrase: "Bazaar baboon baker. Athena denial Berlin."
             signature: 53-d4-2f-81-aa-24-bc-0a

Log file is /home/pi/.vnc/raspberrypi:1.log
New desktop is raspberrypi:1 (192.168.2.111:1)   ==> 注意是編號 1 桌面

在遠端 PC 的 VNC Viewer 連線時要注意是第幾個桌面, 這裡是桌面 1 :



VNC Server 預設帳號是 pi, 預設密碼為 raspberry, 可用 vncpasswd 指令修改 (我改成跟樹莓派登入帳密相同) :

pi@raspberrypi:~ $ sudo vncpasswd -print
Password:
Verify:
Password=f602f71dcfdd782a

參考 :

# 以 VNC 和 Raspberry Pi 連線

以上便是 2017 版 Raspbian 的主要系統設定.

接下來是安裝一定會用到的基本軟體 :
  1. zip 與 unzip
  2. Apache+PHP+MySQL 伺服器
  3. PHP cURL
  4. ssmtp 與 mailutils
首先是壓縮解壓縮軟體 zip 與 unzip :

sudo apt-get install zip unzip

pi@raspberrypi:~ $ sudo apt-get install zip unzip
Reading package lists... Done
Building dependency tree
Reading state information... Done
unzip is already the newest version.
The following NEW packages will be installed:
  zip
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 326 kB of archives.
After this operation, 513 kB of additional disk space will be used.
Do you want to continue? [Y/n] Y
Get:1 http://mirrordirector.raspbian.org/raspbian/ jessie/main zip armhf 3.0-8 [326 kB]
Fetched 326 kB in 1s (168 kB/s)
Selecting previously unselected package zip.
(Reading database ... 121836 files and directories currently installed.)
Preparing to unpack .../archives/zip_3.0-8_armhf.deb ...
Unpacking zip (3.0-8) ...
Processing triggers for man-db (2.7.0.2-5) ...
Setting up zip (3.0-8) ...

其次是安裝 Apache+PHP+MySQL 伺服器, 參考 :

# 在樹莓派上架設 PHP+MySQL 網站伺服器

更新套件清單與升級套件這裡就不紀錄了, 因為升級很冗長 (1 個小時喔, 而且這次不會在途中詢問 lightdm.conf 的版本問題了). 其實我覺得不用更新升級, 直接輸入下面兩個指令安裝 Apache 與 PHP 就可以了 : 

$ sudo apt-get install apache2   

$ sudo apt-get install php5 libapache2-mod-php5   

安裝完畢後, /var 底下就會產生 www/html 目錄出來, 這就是放 PHP 網頁檔的地方, 不過須先重啟 Apache 伺服器才會運作 :

$ sudo service apache2 restart

接著安裝 MySQL 資料庫, 執行下列兩個指令 :

$ sudo apt-get install mysql-server mysql-client php5-mysql

$ sudo apt-get install php5-mcrypt

最後是安裝 phpMyAdmin 資料庫管理模組, 因為之前下載的 4.6.6 版 .bz 檔在格式化 SD 卡前有先備份出來, 所以直接用 WinSCP 從 PC 傳回樹莓派的 /home/pi 下用 tar 指令解壓即可, 不需再用 wget 指令下載 (因為 4.6.6 還是最新的版本) :

$ tar -jxf phpMyAdmin-4.6.6-all-languages.tar.bz2  

解開後產生 phpMyAdmin-4.6.6-all-languages 目錄, 實在太長了, 先用 mv 指令將其改為 mysql, 再將 mysql 搬移到 /var/www/html 目錄下 : 

$ mv phpMyAdmin-4.6.6-all-languages mysql
$ sudo mv mysql /var/www/html

最後還必須重啟 Apache 資料庫才能使用 phpMyAdmin :

sudo service apache2 restart

但是, 當我以帳號 root 密碼 mysql 連線到 phpMyAdmin 網站時 (此處是 192.168.111.2/mysql), 卻出現如下錯誤 :

"#1045: Access denied for user 'root'@'localhost' (using password: YES)"


奇怪, 我安裝 MySQL 時指定 root 帳號之密碼為 mysql 啊! 怎會無法登入? 參考了許多網路資料都無法解決. 最後我突然想到, 該不會是當初輸入密碼時是在大寫狀態吧? 果然, 用大寫的 MYSQL 就順利登入了! 所以鍵盤上有無 CAPS LOCK 指示燈很重要!

雖然可以登入 phpMyAdmin 了, 但是要如何把 root 的密碼改回去小寫呢? 我習慣用小寫啊! 我參考下面網站的方法, 順利地更改了 root 的密碼 :

# 解決 MYSQL 登入時,ERROR 1045 (28000) using password: NO 的方法
# mysql ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)

pi@raspberrypi:~ $ mysql -u root -p   (以 root 帳號登入)
Enter password:                                   (輸入 MYSQL)
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 62
Server version: 5.5.54-0+deb8u1 (Raspbian)

Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> use mysql;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
mysql> UPDATE user SET Password=PASSWORD("mysql") WHERE User='root';
Query OK, 4 rows affected (0.00 sec)
Rows matched: 4  Changed: 4  Warnings: 0

mysql> flush privileges;
Query OK, 0 rows affected (0.01 sec)

mysql> exit
Bye
pi@raspberrypi:~ $

接下來是安裝 PHP cURL 套件, 參考 :

# 在樹莓派上安裝 cURL 與設定 Crontab

安裝指令如下 :

sudo apt-get install php5-curl

安裝完後須重啟 Apache 伺服器才有效.

$ sudo service apache2 restart

另外要修改 php.ini 將 max_execution_time (執行時間上限) 由預設 30 秒提高為 180 秒 :

sudo nano /etc/php5/apache2/php.ini

最後是安裝 ssmtp, 這是可傳送郵件到 SMTP 伺服器 (例如 Gmail) 的簡單郵件代理程式 MTA (Mail Tranfer Agent) :

安裝指令有兩個 :

$ sudo apt-get install ssmtp
$ sudo apt-get install mailutils

完成後還須編輯 ssmtp.conf 設定檔才能透過 Gmail 傳送郵件 :

sudo nano /etc/ssmtp/ssmtp.conf 

參考 :

在樹莓派上利用 sSMTP 傳送郵件的方法

至此總算完成系統重灌了, 雖然好事多磨, 但也學到了一些經驗. 花了兩天才搞定, 所以趕緊先做個備份, 萬一系統又有問題時就直接從備份映像檔回復, 不用再跑上面程序了.

# 備份樹莓派 SD 卡的方法

2017年2月24日 星期五

踢踏舞

最近在電視上看到黃山石的廣告, 其中女舞者跳著輕快的踢踏舞, 舞鞋敲擊地板的聲音襯托出地板磚的堅硬, 看著女舞者輕盈的舞步也讓人心情快活起來, 踢踏舞真是很有活力的舞蹈啊! 很多人好奇的是, 片中的女舞者是誰呢? 原來是有 "童顏美女" 之稱的台灣舞者簡瑞萍 (Ray), 她在台北有開設工作室.

https://www.youtube.com/watch?v=48LoMlO-aSM


黃山石前一部廣告也是踢踏舞, 也非常好看, 其中女舞者是來自日本福岡的島田惠 :

https://www.youtube.com/watch?v=ekahYlgXbOY


成功的廣告就是在賞心悅目的美學感受中傳達商品的價值. 

從幕後花絮也可以了解拍一部短短的廣告片真是不容易耶!


哈! 有看到配電箱中探頭出來瞧的好奇小貓嗎 (35 秒處)? 

2017-03-29 補充 :

上面島田惠拍的這部, 裡面那首好聽的歌到底是甚麼曲子呢? 在底下回應中也有人問, 原來是美國作曲家 Max Brodie 的 Bird Song : 


這首歌曲調輕快, 讓人聽了彷彿一切不快樂都一掃而空了.

SHIMANO 21 速 VAICHE VX507 鋁合金 700C 彎把公路車

今年度公司福利金第二個用途是買台公路車. 福利社網站最近特價兩款 Shimano 的公路車, 一款是 VAICHE VX507 (特價 8500); 另一款是 VX508 (特價 9900). 兩者差別是齒輪配置, VX507 是 3*7=21 速; 而 VX508 是 2*8=16 速. 據老同學鋒仔說後齒盤數大一點較好, 爬陡坡比較有力. 此兩款公路車前後輪皆可快拆放入攜車袋 (另購), 方便搭火車或高鐵.


正統公路車幾何,專業級設計,入門級價位

液壓成型車架管材,內走線設計,增加簡潔與低風阻的效果
SHIMANO 3*7煞變一體公路車套件,不混搭登山車零件
完美齒比,平路衝刺登山爬坡皆適宜
40mm高框板輪,兼具低風阻及高慣性的衝刺
卡式崑藤花鼓,傳動更直接,升級更有空間
台灣設計,台灣組裝,品質後續有保障
非人為損壞車架保固五年零件一年(不包含消耗性零件,如內外胎、煞車皮等)
100%組裝99%包裝,踏板已組裝完成,只需組裝快拆式前輪及坐管,附工具及說明書
★尺寸47適合身高約165~175公分;尺寸50適合身高約170~180公分
★不含踏板實測約10.6公斤
★本商品已投保國泰產險1000(限台灣地區)
參考 :

# 【南紡購物中心】SHIMANO 21速 VAICHE VX507 鋁合金 700C 彎把公路車 $10800
# 【南紡購物中心】SHIMANO CLARIS 2*8 16速 VAICHE VX508 鋁合金 700C 彎把公路車 $9999
# SHIMANO CLARIS 2*8 16速 VAICHE VX508 鋁合金 700C 彎把公路車 $12800

2017年2月23日 星期四

如何在 PC 的 VNC Viewer 上抓取樹莓派螢幕圖像

最近在寫樹莓派實驗筆記時感到最麻煩的一件事就是抓取樹莓派的 X Window 螢幕, 由於透過 VNC Viewer 遠端登入樹莓派時, 發現用 PrintScreen 無法抓 VNC Viewer 上樹莓派的圖像, 所以我只好用 Apowersoft 的螢幕錄影功能先錄成影像後, 再於播放時抓圖.

這種方式實在很彆扭, 而且畫面也不夠精細. 今天在下面這篇文章中發現, 原來其實 VNC Viewer 是可以抓圖的, 原先不行是因為它預設會將 PrintScrint 之類的特殊鍵傳送回樹莓派的 VNC Server, 導致 PrintScreen 鍵在 PC 上無作用 :

Print screen doesn't work

那要怎麼做才能順利在 PC 上抓取樹莓派螢幕圖像呢? 將滑鼠移到 VNC Viewer 最上方中間的矩形突出物處, 會彈出一個工具列 :


點選其中的 VNC 設定按鈕, 切到 "Input" 頁籤, 將其中的 "Pass special keys to VNC Server"  這項取消勾選即可 :


這樣於 VNC Viewer 上按 PreintScreen 就可以抓到樹莓派螢幕圖像了. 早知道就不用繞遠路了.

關於 VNC Viewer 參考 :

# 樹莓派的遠端桌面控制 : 使用 VNC

好用的 Chrome 應用程式 : EPUB 閱讀器 Readium

平常看的電子書大都是 PDF 檔, 最近找到一本 EPUB 電子書, 但要開啟它卻需要安裝像 Calibre 之類的軟體. 今天找到一款 Chrome 應用程式 Readium, 是安裝在 Chrome 裡當作插件, 可直接在 Crome 上開啟 EPUB 電子書, 字體大又美觀, 比 Calibre 還要好用.

安裝方式是在 Chrome 點選下列連結搜尋 EPUB Reader :

https://chrome.google.com/webstore/search/EPUB%20reader%20for%20Chrome?hl=zh-TW

向下找到 Readium 後按右方的 "加到 CHROME" 即可.


完成後點選 Chrome 工具列上的 "應用程式" 按鈕就可以看到 Readium :


點擊執行 Readium 後按右上角 "+" 選擇 EPUB 檔案即可閱讀了 :



掃地機器人 VBOT i6+

今年福利金加碼到 13500 元, 正在慎重考慮要買甚麼. 今天上公司福利社看到這款 VBOT i6+ 掃地機器人, 價格 $3690 元 (市價 4280 元), 兩三年來一直想買, 最後又打消念頭的掃地機器人, 又重回考慮序列惹 ...

以前都堅持一定要有自動回座充電功能, 但看了介紹之後才知道自動回充並不像想像中好用. 因為面積太大或空間較複雜時它可能會找不到回家的路, 只好限縮為一個房間一個房間去打掃, 回充變成單一房間內回充. 這台掃地機沒有回充, 也沒有預約遙控等功能, 算是很陽春的產品. 但優點是 :
  1. 鋰電池比較耐用 (5 年)
  2. 貼地吸塵效果好
  3. 超大容量集塵盒
底下是幾個廣告影片 :

Vbot 超級鋰電池迷你智慧型掃地機器人 (2合1) i6蛋糕掃地機器人


貴的掃地機比較好用嗎? 實測iRobot vs Vbot i6蛋糕機


Vbot 掃地機 民視推薦-人氣療癒



# Vbot i6 蛋糕掃地機器人【實境拍攝 防纏線+自動升降吸風口 免清噁心滾刷 專利技術篇】


Vbot i6蛋糕掃地機器人 二代極淨濾網 超優清潔能力【實境拍攝 毛髮+貓砂+空氣濾清清潔】 

有考慮高雄與鄉下各買一個, 還沒決定.



2017-04-05 補充 :

今天終於決定上公司福利社買了這台掃地機, 我選討喜的草莓色, 先買一台, 如果好用再買第二台. 


2017年2月22日 星期三

樹莓派 MySQL/phpMyAdmin 無法登入問題

前天晚上登入樹莓派 B 的 phpMyAdmin 時發現登入失敗, 出現如下錯誤訊息 :

"#2002 - Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) — 伺服器沒有回應(或者是伺服器的 socket 沒有被正確的設定)。"

"mysqli_real_connect(): (HY000/2002): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)"


想從命令列進入 mysql shell 也失敗 :

pi@raspberrypi:~ $ mysql
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)

重新啟動 MySQL 伺服器也失敗 :

$ sudo /etc/init.d/mysql restart

pi@raspberrypi:~ $ sudo /etc/init.d/mysql restart
[....] Restarting mysql (via systemctl): mysql.serviceJob for mysql.service failed. See 'systemctl status mysql.service' and 'journalctl -xn' for details.
 failed!

照錯誤訊息下 systemctl 指令, 結果還是無法啟動 MySQL 伺服器 :

pi@raspberrypi:~ $ sudo systemctl status mysql.service -l
● mysql.service - LSB: Start and stop the mysql database server daemon
   Loaded: loaded (/etc/init.d/mysql)
   Active: failed (Result: exit-code) since Tue 2017-02-21 06:51:17 CST; 13min ago
  Process: 24848 ExecStart=/etc/init.d/mysql start (code=exited, status=1/FAILURE)

Feb 21 06:51:17 raspberrypi /etc/init.d/mysql[25575]: 0 processes alive and '/usr/bin/mysqladmin --defaults-file=/etc/mysql/debian.cnf ping' resulted in
Feb 21 06:51:17 raspberrypi mysql[24848]: Starting MySQL database server: mysqld . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . failed!
Feb 21 06:51:17 raspberrypi systemd[1]: mysql.service: control process exited, code=exited status=1
Feb 21 06:51:17 raspberrypi systemd[1]: Failed to start LSB: Start and stop the mysql database server daemon.
Feb 21 06:51:17 raspberrypi systemd[1]: Unit mysql.service entered failed state.

而 journalctl 指令的回應如下 : 

pi@raspberrypi:~ $ sudo journalctl -xn
-- Logs begin at Mon 2017-02-20 22:59:07 CST, end at Tue 2017-02-21 07:13:18 CST. --
Feb 21 07:10:04 raspberrypi CRON[26287]: pam_unix(cron:session): session closed for user pi
Feb 21 07:10:04 raspberrypi CRON[26293]: pam_unix(cron:session): session closed for user pi
Feb 21 07:10:04 raspberrypi CRON[26294]: pam_unix(cron:session): session closed for user pi
Feb 21 07:10:05 raspberrypi CRON[26289]: pam_unix(cron:session): session closed for user pi
Feb 21 07:10:05 raspberrypi CRON[26290]: pam_unix(cron:session): session closed for user pi
Feb 21 07:10:06 raspberrypi CRON[26295]: pam_unix(cron:session): session closed for user pi
Feb 21 07:10:11 raspberrypi CRON[26296]: pam_unix(cron:session): session closed for user pi
Feb 21 07:10:12 raspberrypi CRON[26291]: pam_unix(cron:session): session closed for user pi
Feb 21 07:13:18 raspberrypi sudo[26460]: pi : TTY=pts/0 ; PWD=/home/pi ; USER=root ; COMMAND=/bin/journalctl -xn
Feb 21 07:13:18 raspberrypi sudo[26460]: pam_unix(sudo:session): session opened for user root by pi(uid=0)

似乎沒啥線索. 用 systemctl 指令重啟也是不成功 :

pi@raspberrypi:~ $ sudo systemctl restart mysql.service
Job for mysql.service failed. See 'systemctl status mysql.service' and 'journalctl -xn' for details.

檢視 /var/log/mysql/error.log 發現可能是資料庫分頁毀損 (page corruption), 可能需要重新安裝 :

pi@raspberrypi:~ $ cat /var/log/mysql/error.log
170221  6:50:43 [Warning] Using unique option prefix myisam-recover instead of myisam-recover-options is deprecated and will be removed in a future release. Please use the full name instead.
170221  6:50:43 [Note] Plugin 'FEDERATED' is disabled.
170221  6:50:43 InnoDB: The InnoDB memory heap is disabled
170221  6:50:43 InnoDB: Mutexes and rw_locks use GCC atomic builtins
170221  6:50:43 InnoDB: Compressed tables use zlib 1.2.8
170221  6:50:43 InnoDB: Using Linux native AIO
170221  6:50:43 InnoDB: Initializing buffer pool, size = 128.0M
170221  6:50:43 InnoDB: Completed initialization of buffer pool
170221  6:50:43 InnoDB: highest supported file format is Barracuda.
InnoDB: Log scan progressed past the checkpoint lsn 1539448058
170221  6:50:43  InnoDB: Database was not shut down normally!
InnoDB: Starting crash recovery.
InnoDB: Reading tablespace information from the .ibd files...
InnoDB: Restoring possible half-written data pages from the doublewrite
InnoDB: buffer...
InnoDB: Doing recovery: scanned up to log sequence number 1539464794
170221  6:50:44  InnoDB: Starting an apply batch of log records to the database...
InnoDB: Progress in percents: 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99
InnoDB: Apply batch completed
InnoDB: Database page corruption on disk or a failed   (資料庫毀損?)
InnoDB: file read of page 1622.
InnoDB: You may have to recover from a backup.   (要重裝系統?)
..... (很長的 page dump : 略) .....
InnoDB: End of page dump
170221  7:15:21  InnoDB: Page checksum 627908371, prior-to-4.0.14-form checksum 3948757627
InnoDB: stored checksum 3484663501, prior-to-4.0.14-form stored checksum 3948757627
InnoDB: Page lsn 0 20662285, low 4 bytes of lsn at page end 20662285
InnoDB: Page number (if stored to page already) 1622,
InnoDB: space id (if created with >= MySQL-4.1.1 and stored already) 0
InnoDB: Page may be an index page where index id is 3
InnoDB: (index "CLUST_IND" of table "SYS_INDEXES")
InnoDB: Database page corruption on disk or a failed
InnoDB: file read of page 1622.
InnoDB: You may have to recover from a backup.
InnoDB: It is also possible that your operating
InnoDB: system has corrupted its own file cache
InnoDB: and rebooting your computer removes the
InnoDB: error.
InnoDB: If the corrupt page is an index page
InnoDB: you can also try to fix the corruption
InnoDB: by dumping, dropping, and reimporting
InnoDB: the corrupt table. You can use CHECK
InnoDB: TABLE to scan your table for corruption.
InnoDB: about forcing recovery.
InnoDB: Ending processing because of a corrupt database page.
170221  7:15:21  InnoDB: Assertion failure in thread 3069522928 in file buf0buf.c line 3623
InnoDB: We intentionally generate a memory trap.
InnoDB: Submit a detailed bug report to http://bugs.mysql.com.
InnoDB: If you get repeated assertion failures or crashes, even
InnoDB: immediately after the mysqld startup, there may be
InnoDB: corruption in the InnoDB tablespace. Please refer to
InnoDB: http://dev.mysql.com/doc/refman/5.5/en/forcing-innodb-recovery.html
InnoDB: about forcing recovery.
23:15:21 UTC - mysqld got signal 6 ;
This could be because you hit a bug. It is also possible that this binary
or one of the libraries it was linked against is corrupt, improperly built,
or misconfigured. This error can also be caused by malfunctioning hardware.
We will try our best to scrape up some info that will hopefully help
diagnose the problem, but since we have already crashed,
something is definitely wrong and this may fail.

key_buffer_size=16777216
read_buffer_size=131072
max_used_connections=0
max_threads=151
thread_count=0
connection_count=0
It is possible that mysqld could use up to
key_buffer_size + (read_buffer_size + sort_buffer_size)*max_threads = 346093 K  bytes of memory
Hope that's ok; if not, decrease some variables in the equation.

Thread pointer: 0x0
Attempting backtrace. You can use the following information to find out
where mysqld died. If you see no messages after this, something went
terribly wrong...
stack_bottom = 0 thread_stack 0x30000
information that should help you find out what is causing the crash.

我參考下面這篇試試看能否將 MySQL 系統救回來 :

# ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)

pi@raspberrypi:~ $ sudo service mysql start
Job for mysql.service failed. See 'systemctl status mysql.service' and 'journalctl -xn' for details.
pi@raspberrypi:~ $ ps -A|grep mysql
pi@raspberrypi:~ $ sudo pkill mysql
pi@raspberrypi:~ $ sudo pkill mysqld
pi@raspberrypi:~ $ service mysql restart
Failed to restart mysql.service: Access denied
pi@raspberrypi:~ $ sudo service mysql restart
Job for mysql.service failed. See 'systemctl status mysql.service' and 'journalctl -xn' for details.
pi@raspberrypi:~ $ mysql -u root -p
Enter password:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
pi@raspberrypi:~ $ systemctl status mysql.service
● mysql.service - LSB: Start and stop the mysql database server daemon
   Loaded: loaded (/etc/init.d/mysql)
   Active: failed (Result: exit-code) since Mon 2017-02-20 23:21:01 CST; 1min 31s ago
  Process: 3821 ExecStart=/etc/init.d/mysql start (code=exited, status=1/FAILURE)

仍然無濟於事, 看來只好將 MySQL 移除重新安裝了. 參考下面這篇 :

# How do I completely remove mysql-server on Debian?

pi@raspberrypi:~ $ dpkg -S /etc/mysql
mysql-server-5.5, mysql-common: /etc/mysql

先用 apt-get remove --purge 'mysql-.*' 指令將 MySQL 完全移除 :

pi@raspberrypi:/var/www/html $ sudo apt-get remove --purge 'mysql-.*'
Reading package lists... Done
Building dependency tree
Reading state information... Done
Note, selecting 'mha4mysql-node' for regex 'mysql-.*'
Note, selecting 'libghc6-hsql-mysql-prof' for regex 'mysql-.*'
Note, selecting 'bacula-common-mysql-dbg' for regex 'mysql-.*'
Note, selecting 'lighttpd-mod-mysql-vhost' for regex 'mysql-.*'
Note, selecting 'virtual-mysql-client' for regex 'mysql-.*'
Note, selecting 'dpm-mysql-copyd' for regex 'mysql-.*'
Note, selecting 'mysql-mmm-agent' for regex 'mysql-.*'
Note, selecting 'libmysql-java' for regex 'mysql-.*'
Note, selecting 'virtual-mysql-server-core' for regex 'mysql-.*'
Note, selecting 'virtual-mysql-testsuite' for regex 'mysql-.*'
Note, selecting 'virtual-mysql-server' for regex 'mysql-.*'
Note, selecting 'libwtdbomysql-dev' for regex 'mysql-.*'
Note, selecting 'mysql-server-5.0' for regex 'mysql-.*'
Note, selecting 'mysql-server-5.1' for regex 'mysql-.*'
Note, selecting 'mysql-server-5.5' for regex 'mysql-.*'
Note, selecting 'mysql-server-5.6' for regex 'mysql-.*'
Note, selecting 'haskell-hsql-mysql-doc' for regex 'mysql-.*'
Note, selecting 'libdbd-mysql-5.1-perl' for regex 'mysql-.*'
Note, selecting 'voms-mysql-plugin-dbg' for regex 'mysql-.*'
Note, selecting 'mysql-navigator' for regex 'mysql-.*'
Note, selecting 'libmysql-ocaml-dev-ep3t6' for regex 'mysql-.*'
Note, selecting 'kexi-mysql-driver' for regex 'mysql-.*'
Note, selecting 'mysql-testsuite-5.5' for regex 'mysql-.*'
Note, selecting 'mysql-testsuite-5.6' for regex 'mysql-.*'
Note, selecting 'mysql-client-core-5.5' for regex 'mysql-.*'
Note, selecting 'mysql-client-core-5.6' for regex 'mysql-.*'
Note, selecting 'mysql-client' for regex 'mysql-.*'
Note, selecting 'libmysql-ocaml' for regex 'mysql-.*'
Note, selecting 'libdatetime-format-mysql-perl' for regex 'mysql-.*'
Note, selecting 'lua-dbi-mysql-dbg' for regex 'mysql-.*'
Note, selecting 'mysql-mmm-tools' for regex 'mysql-.*'
Note, selecting 'mysql-server' for regex 'mysql-.*'
Note, selecting 'mysql-proxy' for regex 'mysql-.*'
Note, selecting 'lua-dbi-mysql-dev' for regex 'mysql-.*'
Note, selecting 'mha4mysql-master' for regex 'mysql-.*'
Note, selecting 'dpm-mysql-srmv22' for regex 'mysql-.*'
Note, selecting 'mha4mysql-manager' for regex 'mysql-.*'
Note, selecting 'libcrypt-mysql-perl' for regex 'mysql-.*'
Note, selecting 'lua5.1-dbi-mysql-dev' for regex 'mysql-.*'
Note, selecting 'lua5.2-sql-mysql-dev' for regex 'mysql-.*'
Note, selecting 'libghc-hsql-mysql-prof' for regex 'mysql-.*'
Note, selecting 'libtime-piece-mysql-perl' for regex 'mysql-.*'
Note, selecting 'gsql-mysql-engine' for regex 'mysql-.*'
Note, selecting 'libdbd-mysql-perl' for regex 'mysql-.*'
Note, selecting 'libnss-mysql-bg' for regex 'mysql-.*'
Note, selecting 'libmysql-diff-perl' for regex 'mysql-.*'
Note, selecting 'libkaya-mysql-dev' for regex 'mysql-.*'
Note, selecting 'libghc-hsql-mysql-dev-1.8.2-8c662' for regex 'mysql-.*'
Note, selecting 'bacula-sd-mysql-dbg' for regex 'mysql-.*'
Note, selecting 'bacula-director-mysql-dbg' for regex 'mysql-.*'
Note, selecting 'mysql-mmm-monitor' for regex 'mysql-.*'
Note, selecting 'libghc6-hsql-mysql-dev' for regex 'mysql-.*'
Note, selecting 'mysql-source-5.5' for regex 'mysql-.*'
Note, selecting 'mysql-workbench' for regex 'mysql-.*'
Note, selecting 'libmysql-ocaml-ep3t6' for regex 'mysql-.*'
Note, selecting 'mysql-client-5.0' for regex 'mysql-.*'
Note, selecting 'mysql-client-5.1' for regex 'mysql-.*'
Note, selecting 'mysql-client-5.5' for regex 'mysql-.*'
Note, selecting 'mysql-client-5.6' for regex 'mysql-.*'
Note, selecting 'libclass-dbi-mysql-perl' for regex 'mysql-.*'
Note, selecting 'mysql-testsuite' for regex 'mysql-.*'
Note, selecting 'libghc-hsql-mysql-dev' for regex 'mysql-.*'
Note, selecting 'virtual-mysql-client-core' for regex 'mysql-.*'
Note, selecting 'pinba-engine-mysql-5.5' for regex 'mysql-.*'
Note, selecting 'mysql-common' for regex 'mysql-.*'
Note, selecting 'handlersocket-mysql-5.1' for regex 'mysql-.*'
Note, selecting 'handlersocket-mysql-5.5' for regex 'mysql-.*'
Note, selecting 'mysql-server-core-5.0' for regex 'mysql-.*'
Note, selecting 'mysql-server-core-5.1' for regex 'mysql-.*'
Note, selecting 'mysql-server-core-5.5' for regex 'mysql-.*'
Note, selecting 'mysql-server-core-5.6' for regex 'mysql-.*'
Note, selecting 'libreoffice-mysql-connector' for regex 'mysql-.*'
Note, selecting 'dpm-mysql-nameserver' for regex 'mysql-.*'
Note, selecting 'libghc6-hsql-mysql-doc' for regex 'mysql-.*'
Note, selecting 'mysql-server-core' for regex 'mysql-.*'
Note, selecting 'voms-mysql-plugin' for regex 'mysql-.*'
Note, selecting 'monodoc-mysql-manual' for regex 'mysql-.*'
Note, selecting 'lua-sql-mysql-dev' for regex 'mysql-.*'
Note, selecting 'mysql-utilities' for regex 'mysql-.*'
Note, selecting 'libghc-hsql-mysql-doc' for regex 'mysql-.*'
Note, selecting 'dpm-mysql-srmv1' for regex 'mysql-.*'
Note, selecting 'dpm-mysql-srmv2' for regex 'mysql-.*'
Note, selecting 'libghc-hsql-mysql-prof-1.8.2-8c662' for regex 'mysql-.*'
Note, selecting 'mysql-workbench-data' for regex 'mysql-.*'
Note, selecting 'lua5.1-sql-mysql-dev' for regex 'mysql-.*'
Note, selecting 'libmysql-ocaml-dev' for regex 'mysql-.*'
Note, selecting 'mysql-mmm-common' for regex 'mysql-.*'
Note, selecting 'libmysql-cil-dev' for regex 'mysql-.*'
Note, selecting 'mysql-server-core-5.5' instead of 'mysql-server-core'
Note, selecting 'dpm-copy-server-mysql' instead of 'dpm-mysql-copyd'
Note, selecting 'dpm-name-server-mysql' instead of 'dpm-mysql-nameserver'
Note, selecting 'dpm-srm-server-mysql' instead of 'dpm-mysql-srmv1'
Note, selecting 'dpm-srm-server-mysql' instead of 'dpm-mysql-srmv2'
Note, selecting 'dpm-srm-server-mysql' instead of 'dpm-mysql-srmv22'
Package 'handlersocket-mysql-5.1' is not installed, so not removed
Note, selecting 'libghc-hsql-mysql-dev' instead of 'libghc-hsql-mysql-dev-1.8.2-8c662'
Note, selecting 'libghc-hsql-mysql-prof' instead of 'libghc-hsql-mysql-prof-1.8.2-8c662'
Note, selecting 'libmysql-ocaml' instead of 'libmysql-ocaml-ep3t6'
Note, selecting 'libmysql-ocaml-dev' instead of 'libmysql-ocaml-dev-ep3t6'
Note, selecting 'lua-dbi-mysql-dev' instead of 'lua5.1-dbi-mysql-dev'
Note, selecting 'lua-sql-mysql-dev' instead of 'lua5.1-sql-mysql-dev'
Note, selecting 'lua-sql-mysql-dev' instead of 'lua5.2-sql-mysql-dev'
Package 'libdbd-mysql-5.1-perl' is not installed, so not removed
Package 'mysql-server-5.1' is not installed, so not removed
Package 'mysql-client-core-5.5' is not installed, so not removed
Package 'mysql-client-core-5.6' is not installed, so not removed
Package 'mysql-client-5.6' is not installed, so not removed
Package 'mysql-server-core-5.6' is not installed, so not removed
Package 'mysql-server-5.6' is not installed, so not removed
Package 'mysql-testsuite-5.6' is not installed, so not removed
Package 'mha4mysql-master' is not installed, so not removed
Package 'mysql-client-5.0' is not installed, so not removed
Package 'mysql-client-5.1' is not installed, so not removed
Package 'mysql-server-core-5.1' is not installed, so not removed
Package 'mysql-server-5.0' is not installed, so not removed
Package 'mysql-server-core-5.0' is not installed, so not removed
Package 'bacula-common-mysql-dbg' is not installed, so not removed
Package 'bacula-director-mysql-dbg' is not installed, so not removed
Package 'bacula-sd-mysql-dbg' is not installed, so not removed
Package 'gsql-mysql-engine' is not installed, so not removed
Package 'handlersocket-mysql-5.5' is not installed, so not removed
Package 'haskell-hsql-mysql-doc' is not installed, so not removed
Package 'kexi-mysql-driver' is not installed, so not removed
Package 'libclass-dbi-mysql-perl' is not installed, so not removed
Package 'libcrypt-mysql-perl' is not installed, so not removed
Package 'libdatetime-format-mysql-perl' is not installed, so not removed
Package 'libghc-hsql-mysql-dev' is not installed, so not removed
Package 'libghc-hsql-mysql-doc' is not installed, so not removed
Package 'libghc-hsql-mysql-prof' is not installed, so not removed
Package 'libghc6-hsql-mysql-dev' is not installed, so not removed
Package 'libghc6-hsql-mysql-doc' is not installed, so not removed
Package 'libghc6-hsql-mysql-prof' is not installed, so not removed
Package 'libkaya-mysql-dev' is not installed, so not removed
Package 'libmysql-cil-dev' is not installed, so not removed
Package 'libmysql-diff-perl' is not installed, so not removed
Package 'libmysql-java' is not installed, so not removed
Package 'libmysql-ocaml' is not installed, so not removed
Package 'libmysql-ocaml-dev' is not installed, so not removed
Package 'libnss-mysql-bg' is not installed, so not removed
Package 'libtime-piece-mysql-perl' is not installed, so not removed
Package 'libwtdbomysql-dev' is not installed, so not removed
Package 'lighttpd-mod-mysql-vhost' is not installed, so not removed
Package 'lua-dbi-mysql-dbg' is not installed, so not removed
Package 'lua-dbi-mysql-dev' is not installed, so not removed
Package 'lua-sql-mysql-dev' is not installed, so not removed
Package 'mha4mysql-manager' is not installed, so not removed
Package 'mha4mysql-node' is not installed, so not removed
Package 'monodoc-mysql-manual' is not installed, so not removed
Package 'mysql-mmm-agent' is not installed, so not removed
Package 'mysql-mmm-common' is not installed, so not removed
Package 'mysql-mmm-monitor' is not installed, so not removed
Package 'mysql-mmm-tools' is not installed, so not removed
Package 'mysql-navigator' is not installed, so not removed
Package 'mysql-proxy' is not installed, so not removed
Package 'mysql-source-5.5' is not installed, so not removed
Package 'mysql-testsuite' is not installed, so not removed
Package 'mysql-testsuite-5.5' is not installed, so not removed
Package 'mysql-utilities' is not installed, so not removed
Package 'mysql-workbench' is not installed, so not removed
Package 'mysql-workbench-data' is not installed, so not removed
Package 'pinba-engine-mysql-5.5' is not installed, so not removed
Package 'voms-mysql-plugin' is not installed, so not removed
Package 'voms-mysql-plugin-dbg' is not installed, so not removed
Package 'libreoffice-mysql-connector' is not installed, so not removed
The following packages were automatically installed and are no longer required:
  libaio1 libdbi-perl libhtml-template-perl libterm-readkey-perl
Use 'apt-get autoremove' to remove them.
The following packages will be REMOVED:
  libdbd-mysql-perl* libmailutils4* libmysqlclient18* mailutils* mysql-client* mysql-client-5.5* mysql-common* mysql-server* mysql-server-5.5*
  mysql-server-core-5.5* php5-mysql*
0 upgraded, 0 newly installed, 11 to remove and 17 not upgraded.
After this operation, 90.7 MB disk space will be freed.
Do you want to continue? [Y/n] Y
(Reading database ... 131585 files and directories currently installed.)
Removing mysql-server (5.5.54-0+deb8u1) ...
Removing mysql-server-5.5 (5.5.54-0+deb8u1) ...
Purging configuration files for mysql-server-5.5 (5.5.54-0+deb8u1) ...
Removing mysql-client (5.5.54-0+deb8u1) ...
Removing mysql-client-5.5 (5.5.54-0+deb8u1) ...
Removing libdbd-mysql-perl (4.028-2+deb8u2) ...
Removing mailutils (1:2.99.98-2) ...
update-alternatives: using /usr/bin/bsd-from to provide /usr/bin/from (from) in auto mode
Removing libmailutils4:armhf (1:2.99.98-2) ...
Purging configuration files for libmailutils4:armhf (1:2.99.98-2) ...
Removing php5-mysql (5.6.29+dfsg-0+deb8u1) ...
php5_invoke prerm: Disable module mysql for cli SAPI
php5_invoke prerm: Disable module mysql for apache2 SAPI
php5_invoke prerm: Disable module mysqli for cli SAPI
php5_invoke prerm: Disable module mysqli for apache2 SAPI
php5_invoke prerm: Disable module pdo_mysql for cli SAPI
php5_invoke prerm: Disable module pdo_mysql for apache2 SAPI
Purging configuration files for php5-mysql (5.6.29+dfsg-0+deb8u1) ...
Removing libmysqlclient18:armhf (5.5.54-0+deb8u1) ...
Purging configuration files for libmysqlclient18:armhf (5.5.54-0+deb8u1) ...
Removing mysql-common (5.5.54-0+deb8u1) ...
Purging configuration files for mysql-common (5.5.54-0+deb8u1) ...
dpkg: warning: while removing mysql-common, directory '/etc/mysql' not empty so not removed
Removing mysql-server-core-5.5 (5.5.54-0+deb8u1) ...
Processing triggers for man-db (2.7.0.2-5) ...
Processing triggers for libc-bin (2.19-18+deb8u7) ...
Processing triggers for libapache2-mod-php5 (5.6.29+dfsg-0+deb8u1) ...

移除完畢後重新安裝 MySQL 伺服器 :

pi@raspberrypi:/var/www/html $ sudo apt-get install mysql-server mysql-client php5-mysql
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
  guile-2.0-libs libgc1c2 libgsasl7 libkyotocabinet16 libntlm0 libunistring0 mailutils-common
Use 'apt-get autoremove' to remove them.
The following extra packages will be installed:
  libdbd-mysql-perl libmysqlclient18 mysql-client-5.5 mysql-common mysql-server-5.5 mysql-server-core-5.5
Suggested packages:
  mailx tinyca
The following NEW packages will be installed:
  libdbd-mysql-perl libmysqlclient18 mysql-client mysql-client-5.5 mysql-common mysql-server mysql-server-5.5 mysql-server-core-5.5 php5-mysql
0 upgraded, 9 newly installed, 0 to remove and 17 not upgraded.
Need to get 0 B/7,542 kB of archives.
After this operation, 87.3 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
Preconfiguring packages ...
Selecting previously unselected package mysql-common.
(Reading database ... 131205 files and directories currently installed.)
Preparing to unpack .../mysql-common_5.5.54-0+deb8u1_all.deb ...
Unpacking mysql-common (5.5.54-0+deb8u1) ...
Selecting previously unselected package libmysqlclient18:armhf.
Preparing to unpack .../libmysqlclient18_5.5.54-0+deb8u1_armhf.deb ...
Unpacking libmysqlclient18:armhf (5.5.54-0+deb8u1) ...
Selecting previously unselected package libdbd-mysql-perl.
Preparing to unpack .../libdbd-mysql-perl_4.028-2+deb8u2_armhf.deb ...
Unpacking libdbd-mysql-perl (4.028-2+deb8u2) ...
Selecting previously unselected package mysql-client-5.5.
Preparing to unpack .../mysql-client-5.5_5.5.54-0+deb8u1_armhf.deb ...
Unpacking mysql-client-5.5 (5.5.54-0+deb8u1) ...
Selecting previously unselected package mysql-server-core-5.5.
Preparing to unpack .../mysql-server-core-5.5_5.5.54-0+deb8u1_armhf.deb ...
Unpacking mysql-server-core-5.5 (5.5.54-0+deb8u1) ...
Processing triggers for man-db (2.7.0.2-5) ...
Setting up mysql-common (5.5.54-0+deb8u1) ...
Selecting previously unselected package mysql-server-5.5.
(Reading database ... 131397 files and directories currently installed.)
Preparing to unpack .../mysql-server-5.5_5.5.54-0+deb8u1_armhf.deb ...
Unpacking mysql-server-5.5 (5.5.54-0+deb8u1) ...
Selecting previously unselected package mysql-client.
Preparing to unpack .../mysql-client_5.5.54-0+deb8u1_all.deb ...
Unpacking mysql-client (5.5.54-0+deb8u1) ...
Selecting previously unselected package mysql-server.
Preparing to unpack .../mysql-server_5.5.54-0+deb8u1_all.deb ...
Unpacking mysql-server (5.5.54-0+deb8u1) ...
Selecting previously unselected package php5-mysql.
Preparing to unpack .../php5-mysql_5.6.29+dfsg-0+deb8u1_armhf.deb ...
Unpacking php5-mysql (5.6.29+dfsg-0+deb8u1) ...
Processing triggers for man-db (2.7.0.2-5) ...
Processing triggers for systemd (215-17+deb8u6) ...
Processing triggers for libapache2-mod-php5 (5.6.29+dfsg-0+deb8u1) ...
Setting up libmysqlclient18:armhf (5.5.54-0+deb8u1) ...
Setting up libdbd-mysql-perl (4.028-2+deb8u2) ...
Setting up mysql-client-5.5 (5.5.54-0+deb8u1) ...
Setting up mysql-server-core-5.5 (5.5.54-0+deb8u1) ...
Setting up mysql-server-5.5 (5.5.54-0+deb8u1) ...
170222 20:55:27 [Warning] Using unique option prefix key_buffer instead of key_buffer_size is deprecated and will be removed in a future release. Please use the full name instead.
170222 20:55:27 [Note] Ignoring --secure-file-priv value as server is running with --bootstrap.
170222 20:55:27 [Note] /usr/sbin/mysqld (mysqld 5.5.54-0+deb8u1) starting as process 30672 ...
insserv: warning: script 'K01vncboot' missing LSB tags and overrides
insserv: warning: script 'vncboot' missing LSB tags and overrides
Job for mysql.service failed. See 'systemctl status mysql.service' and 'journalctl -xn' for details.
invoke-rc.d: initscript mysql, action "start" failed.
dpkg: error processing package mysql-server-5.5 (--configure):
 subprocess installed post-installation script returned error exit status 1
Setting up mysql-client (5.5.54-0+deb8u1) ...
dpkg: dependency problems prevent configuration of mysql-server:
 mysql-server depends on mysql-server-5.5; however:
  Package mysql-server-5.5 is not configured yet.

dpkg: error processing package mysql-server (--configure):
 dependency problems - leaving unconfigured
Setting up php5-mysql (5.6.29+dfsg-0+deb8u1) ...

Creating config file /etc/php5/mods-available/mysql.ini with new version
php5_invoke: Enable module mysql for cli SAPI
php5_invoke: Enable module mysql for apache2 SAPI

Creating config file /etc/php5/mods-available/mysqli.ini with new version
php5_invoke: Enable module mysqli for cli SAPI
php5_invoke: Enable module mysqli for apache2 SAPI

Creating config file /etc/php5/mods-available/pdo_mysql.ini with new version
php5_invoke: Enable module pdo_mysql for cli SAPI
php5_invoke: Enable module pdo_mysql for apache2 SAPI
Processing triggers for libc-bin (2.19-18+deb8u7) ...
Processing triggers for systemd (215-17+deb8u6) ...
Processing triggers for libapache2-mod-php5 (5.6.29+dfsg-0+deb8u1) ...
Errors were encountered while processing:
 mysql-server-5.5
 mysql-server
E: Sub-process /usr/bin/dpkg returned an error code (1)

如上黃色凸顯部分所示, 重新安裝時出現錯誤, 仍然是無法啟動 MySQL 服務, 所以重新安裝完成後仍然無法登入 phpMyAdmin. 因為對 Linux 不熟, 看來只有重新安裝系統了.

參考 :

Can't start mysql service [closed]  (無用)
How to remove MySQL completely with config and library files?
# The MySQL Command-Line Tool

2017年2月21日 星期二

在樹莓派上安裝 Crontab 桌面程式 gnome-schedule

向母校圖書館借的 "Raspberry Pi 專案實作 (碁峰, 曾吉弘譯)" 要歸還了, 這本書收錄了樹莓派攝影機, 音訊卡, 語音時鐘, 循跡機器人, 以及 GPIO/I2C 介面實做等應用專案, 非常棒, 值得按圖索驥測試一番. 我也是在這本書看到如何用 Tkinter 來撰寫 GUI 視窗介面程式後, 開始對 Tk 產生了興趣. 不過由於時間有限, 等下次借回來再說吧!


這本書的範例程式碼可在碁峰網站下載 :

http://books.gotop.com.tw/download/ach019000

其實這本書是譯自 Jack Creasey 寫的 "Raspberry Pi Essentials", 在專案一結尾處有介紹如何安裝 Crontab 的桌面程式 gnome-schedule, 下面是我的實驗記錄.

安裝 gnome-schedule 需要 root 權限, 指令如下 :

1. 開啟 root 權限 :

$ sudo -s

2. 取得更新清單 (可略)

$ apt-get update

3. 升級已安裝軟體 (可略)

$ apt-get upgrade

4. 安裝 gnome-schedule

$ apt-get install gnome-schedule

5. 退出 root 權限

$ exit

當然, 在上面 apt-get 指令前面直接用 sudo 也是可以的.

pi@raspberrypi:~ $ sudo apt-get update
Get:1 http://mirrordirector.raspbian.org jessie InRelease [14.9 kB]
Get:2 http://archive.raspberrypi.org jessie InRelease [22.9 kB]
Get:3 http://mirrordirector.raspbian.org jessie/main armhf Packages [8,981 kB]
Get:4 http://archive.raspberrypi.org jessie/main armhf Packages [144 kB]
Get:5 http://archive.raspberrypi.org jessie/ui armhf Packages [54.8 kB]
Ign http://archive.raspberrypi.org jessie/main Translation-en_US
Get:6 http://mirrordirector.raspbian.org jessie/contrib armhf Packages [37.5 kB]
Ign http://archive.raspberrypi.org jessie/main Translation-en
Get:7 http://mirrordirector.raspbian.org jessie/non-free armhf Packages [70.3 kB]
Ign http://archive.raspberrypi.org jessie/ui Translation-en_US
Get:8 http://mirrordirector.raspbian.org jessie/rpi armhf Packages [1,356 B]
Ign http://archive.raspberrypi.org jessie/ui Translation-en
Ign http://mirrordirector.raspbian.org jessie/contrib Translation-en_US
Ign http://mirrordirector.raspbian.org jessie/contrib Translation-en
Ign http://mirrordirector.raspbian.org jessie/main Translation-en_US
Ign http://mirrordirector.raspbian.org jessie/main Translation-en
Ign http://mirrordirector.raspbian.org jessie/non-free Translation-en_US
Ign http://mirrordirector.raspbian.org jessie/non-free Translation-en
Ign http://mirrordirector.raspbian.org jessie/rpi Translation-en_US
Ign http://mirrordirector.raspbian.org jessie/rpi Translation-en
Fetched 9,327 kB in 51s (183 kB/s)
Reading package lists... Done
pi@raspberrypi:~ $ sudo apt-get upgrade
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... The following packages were automatically installed and are no longer required:
  libasn1-8-heimdal libgssapi3-heimdal libhcrypto4-heimdal libheimbase1-heimdal libheimntlm0-heimdal libhx509-5-heimdal
  libkrb5-26-heimdal libroken18-heimdal libwind0-heimdal libxfce4ui-1-0 xfce-keyboard-shortcuts
Use 'apt-get autoremove' to remove them.
Done
The following packages have been kept back:
  gstreamer1.0-plugins-bad libgl1-mesa-dri libgstreamer-plugins-bad1.0-0 libraspberrypi-bin libraspberrypi-dev libraspberrypi-doc
  libraspberrypi0 lxpanel lxpanel-data nuscratch plymouth pypy-upstream raspberrypi-bootloader raspberrypi-sys-mods
  raspberrypi-ui-mods sonic-pi xserver-xorg-input-all
The following packages will be upgraded:
  libevent-2.0-5 libgd3 libjasper1 liblcms2-2 libpam-modules libpam-modules-bin libpam-runtime libpam0g libssl1.0.0 libxpm4 ntfs-3g
  openssl raspi-config rc-gui vim-common vim-tiny
16 upgraded, 0 newly installed, 0 to remove and 17 not upgraded.
Need to get 3,840 kB of archives.
After this operation, 797 kB disk space will be freed.
Do you want to continue? [Y/n] Y
Get:1 http://archive.raspberrypi.org/debian/ jessie/main libpam0g armhf 1.1.8-3.1+deb8u2+rpi1 [121 kB]
Get:2 http://mirrordirector.raspbian.org/raspbian/ jessie/main libssl1.0.0 armhf 1.0.1t-1+deb8u6 [853 kB]
Get:3 http://mirrordirector.raspbian.org/raspbian/ jessie/main libxpm4 armhf 1:3.5.12-0+deb8u1 [43.7 kB]
Get:4 http://archive.raspberrypi.org/debian/ jessie/main libpam-modules-bin armhf 1.1.8-3.1+deb8u2+rpi1 [101 kB]
Get:5 http://mirrordirector.raspbian.org/raspbian/ jessie/main libgd3 armhf 2.1.0-5+deb8u9 [127 kB]
Get:6 http://mirrordirector.raspbian.org/raspbian/ jessie/main libjasper1 armhf 1.900.1-debian1-2.4+deb8u2 [110 kB]
Get:7 http://mirrordirector.raspbian.org/raspbian/ jessie/main liblcms2-2 armhf 2.6-3+deb8u1 [116 kB]
Get:8 http://mirrordirector.raspbian.org/raspbian/ jessie/main ntfs-3g armhf 1:2014.2.15AR.2-1+deb8u3 [483 kB]
Get:9 http://archive.raspberrypi.org/debian/ jessie/main libpam-modules armhf 1.1.8-3.1+deb8u2+rpi1 [288 kB]
Get:10 http://mirrordirector.raspbian.org/raspbian/ jessie/main openssl armhf 1.0.1t-1+deb8u6 [652 kB]
Get:11 http://archive.raspberrypi.org/debian/ jessie/main libpam-runtime all 1.1.8-3.1+deb8u2+rpi1 [213 kB]
Get:12 http://mirrordirector.raspbian.org/raspbian/ jessie/main libevent-2.0-5 armhf 2.0.21-stable-2+deb8u1 [134 kB]
Get:13 http://archive.raspberrypi.org/debian/ jessie/main raspi-config all 20170214 [18.4 kB]
Get:14 http://archive.raspberrypi.org/debian/ jessie/ui rc-gui armhf 1.7 [38.2 kB]
Get:15 http://mirrordirector.raspbian.org/raspbian/ jessie/main vim-tiny armhf 2:7.4.488-7+deb8u2 [357 kB]
Get:16 http://mirrordirector.raspbian.org/raspbian/ jessie/main vim-common armhf 2:7.4.488-7+deb8u2 [185 kB]
Fetched 3,840 kB in 34s (110 kB/s)
Preconfiguring packages ...
(Reading database ... 130602 files and directories currently installed.)
Preparing to unpack .../libpam0g_1.1.8-3.1+deb8u2+rpi1_armhf.deb ...
Unpacking libpam0g:armhf (1.1.8-3.1+deb8u2+rpi1) over (1.1.8-3.1+deb8u2) ...
Processing triggers for libc-bin (2.19-18+deb8u7) ...
Setting up libpam0g:armhf (1.1.8-3.1+deb8u2+rpi1) ...
Processing triggers for libc-bin (2.19-18+deb8u7) ...
(Reading database ... 130602 files and directories currently installed.)
Preparing to unpack .../libpam-modules-bin_1.1.8-3.1+deb8u2+rpi1_armhf.deb ...
Unpacking libpam-modules-bin (1.1.8-3.1+deb8u2+rpi1) over (1.1.8-3.1+deb8u2) ...
Processing triggers for man-db (2.7.0.2-5) ...
Setting up libpam-modules-bin (1.1.8-3.1+deb8u2+rpi1) ...
(Reading database ... 130602 files and directories currently installed.)
Preparing to unpack .../libpam-modules_1.1.8-3.1+deb8u2+rpi1_armhf.deb ...
Unpacking libpam-modules:armhf (1.1.8-3.1+deb8u2+rpi1) over (1.1.8-3.1+deb8u2) ...
Processing triggers for man-db (2.7.0.2-5) ...
Setting up libpam-modules:armhf (1.1.8-3.1+deb8u2+rpi1) ...
(Reading database ... 130602 files and directories currently installed.)
Preparing to unpack .../libssl1.0.0_1.0.1t-1+deb8u6_armhf.deb ...
Unpacking libssl1.0.0:armhf (1.0.1t-1+deb8u6) over (1.0.1t-1+deb8u5) ...
Preparing to unpack .../libevent-2.0-5_2.0.21-stable-2+deb8u1_armhf.deb ...
Unpacking libevent-2.0-5:armhf (2.0.21-stable-2+deb8u1) over (2.0.21-stable-2) ...
Preparing to unpack .../libxpm4_1%3a3.5.12-0+deb8u1_armhf.deb ...
Unpacking libxpm4:armhf (1:3.5.12-0+deb8u1) over (1:3.5.11-1) ...
Preparing to unpack .../libgd3_2.1.0-5+deb8u9_armhf.deb ...
Unpacking libgd3:armhf (2.1.0-5+deb8u9) over (2.1.0-5+deb8u8) ...
Preparing to unpack .../libjasper1_1.900.1-debian1-2.4+deb8u2_armhf.deb ...
Unpacking libjasper1:armhf (1.900.1-debian1-2.4+deb8u2) over (1.900.1-debian1-2.4+deb8u1) ...
Preparing to unpack .../liblcms2-2_2.6-3+deb8u1_armhf.deb ...
Unpacking liblcms2-2:armhf (2.6-3+deb8u1) over (2.6-3) ...
Preparing to unpack .../ntfs-3g_1%3a2014.2.15AR.2-1+deb8u3_armhf.deb ...
Unpacking ntfs-3g (1:2014.2.15AR.2-1+deb8u3) over (1:2014.2.15AR.2-1+deb8u2) ...
Preparing to unpack .../libpam-runtime_1.1.8-3.1+deb8u2+rpi1_all.deb ...
Unpacking libpam-runtime (1.1.8-3.1+deb8u2+rpi1) over (1.1.8-3.1+deb8u2) ...
Processing triggers for initramfs-tools (0.120+deb8u2) ...
Processing triggers for man-db (2.7.0.2-5) ...
Setting up libpam-runtime (1.1.8-3.1+deb8u2+rpi1) ...
(Reading database ... 130602 files and directories currently installed.)
Preparing to unpack .../vim-tiny_2%3a7.4.488-7+deb8u2_armhf.deb ...
Unpacking vim-tiny (2:7.4.488-7+deb8u2) over (2:7.4.488-7+deb8u1) ...
Preparing to unpack .../vim-common_2%3a7.4.488-7+deb8u2_armhf.deb ...
Unpacking vim-common (2:7.4.488-7+deb8u2) over (2:7.4.488-7+deb8u1) ...
Preparing to unpack .../openssl_1.0.1t-1+deb8u6_armhf.deb ...
Unpacking openssl (1.0.1t-1+deb8u6) over (1.0.1t-1+deb8u5) ...
Preparing to unpack .../raspi-config_20170214_all.deb ...
Unpacking raspi-config (20170214) over (20161207) ...
Preparing to unpack .../archives/rc-gui_1.7_armhf.deb ...
Unpacking rc-gui (1.7) over (1.5) ...
Processing triggers for hicolor-icon-theme (0.13-1) ...
Processing triggers for man-db (2.7.0.2-5) ...
Processing triggers for gnome-menus (3.13.3-6) ...
Processing triggers for desktop-file-utils (0.22-1) ...
Processing triggers for mime-support (3.58) ...
Processing triggers for systemd (215-17+deb8u6) ...
Setting up libssl1.0.0:armhf (1.0.1t-1+deb8u6) ...
Setting up libevent-2.0-5:armhf (2.0.21-stable-2+deb8u1) ...
Setting up libxpm4:armhf (1:3.5.12-0+deb8u1) ...
Setting up libgd3:armhf (2.1.0-5+deb8u9) ...
Setting up libjasper1:armhf (1.900.1-debian1-2.4+deb8u2) ...
Setting up liblcms2-2:armhf (2.6-3+deb8u1) ...
Setting up ntfs-3g (1:2014.2.15AR.2-1+deb8u3) ...
update-initramfs: deferring update (trigger activated)
Setting up vim-common (2:7.4.488-7+deb8u2) ...
Setting up vim-tiny (2:7.4.488-7+deb8u2) ...
Setting up openssl (1.0.1t-1+deb8u6) ...
Setting up raspi-config (20170214) ...
insserv: warning: script 'vncboot' missing LSB tags and overrides
Setting up rc-gui (1.7) ...
Processing triggers for libc-bin (2.19-18+deb8u7) ...
Processing triggers for initramfs-tools (0.120+deb8u2) ...
You have new mail in /var/mail/pi
pi@raspberrypi:~ $ sudo apt-get install gnome-schedule
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
  libasn1-8-heimdal libgssapi3-heimdal libhcrypto4-heimdal libheimbase1-heimdal libheimntlm0-heimdal libhx509-5-heimdal
  libkrb5-26-heimdal libroken18-heimdal libwind0-heimdal libxfce4ui-1-0 xfce-keyboard-shortcuts
Use 'apt-get autoremove' to remove them.
The following extra packages will be installed:
  anacron at gnome-mime-data libart-2.0-2 libbonobo2-0 libbonobo2-common libbonoboui2-0 libbonoboui2-common libgail18 libglade2-0
  libgnome-2-0 libgnome2-common libgnomecanvas2-0 libgnomecanvas2-common libgnomeui-0 libgnomeui-common libgnomevfs2-0
  libgnomevfs2-common libgnomevfs2-extra libidl0 liborbit-2-0 liborbit2 python-gconf python-glade2 python-gnome2 python-pyorbit
Suggested packages:
  libbonobo2-bin libgnomevfs2-bin python-gnome2-doc python-gtk2-doc
The following NEW packages will be installed:
  anacron at gnome-mime-data gnome-schedule libart-2.0-2 libbonobo2-0 libbonobo2-common libbonoboui2-0 libbonoboui2-common libgail18
  libglade2-0 libgnome-2-0 libgnome2-common libgnomecanvas2-0 libgnomecanvas2-common libgnomeui-0 libgnomeui-common libgnomevfs2-0
  libgnomevfs2-common libgnomevfs2-extra libidl0 liborbit-2-0 liborbit2 python-gconf python-glade2 python-gnome2 python-pyorbit
0 upgraded, 27 newly installed, 0 to remove and 17 not upgraded.
Need to get 8,150 kB of archives.
After this operation, 33.8 MB of additional disk space will be used.
Do you want to continue? [Y/n] Y
Get:1 http://mirrordirector.raspbian.org/raspbian/ jessie/main libart-2.0-2 armhf 2.3.21-2 [63.8 kB]
Get:2 http://mirrordirector.raspbian.org/raspbian/ jessie/main libbonobo2-common all 2.32.1-3 [243 kB]
Get:3 http://mirrordirector.raspbian.org/raspbian/ jessie/main liborbit-2-0 armhf 1:2.14.19-0.3 [196 kB]
Get:4 http://mirrordirector.raspbian.org/raspbian/ jessie/main libbonobo2-0 armhf 2.32.1-3 [236 kB]
Get:5 http://mirrordirector.raspbian.org/raspbian/ jessie/main libglade2-0 armhf 1:2.6.4-2 [76.2 kB]
Get:6 http://mirrordirector.raspbian.org/raspbian/ jessie/main gnome-mime-data all 2.18.0-1 [725 kB]
Get:7 http://mirrordirector.raspbian.org/raspbian/ jessie/main libgnomevfs2-common all 1:2.24.4-6 [763 kB]
Get:8 http://mirrordirector.raspbian.org/raspbian/ jessie/main libgnomevfs2-0 armhf 1:2.24.4-6 [450 kB]
Get:9 http://mirrordirector.raspbian.org/raspbian/ jessie/main libgnome2-common all 2.32.1-5 [936 kB]
Get:10 http://mirrordirector.raspbian.org/raspbian/ jessie/main libgnome-2-0 armhf 2.32.1-5 [463 kB]
Get:11 http://mirrordirector.raspbian.org/raspbian/ jessie/main libgail18 armhf 2.24.25-3+deb8u1 [537 kB]
Get:12 http://mirrordirector.raspbian.org/raspbian/ jessie/main libgnomecanvas2-common all 2.30.3-2 [132 kB]
Get:13 http://mirrordirector.raspbian.org/raspbian/ jessie/main libgnomecanvas2-0 armhf 2.30.3-2 [94.7 kB]
Get:14 http://mirrordirector.raspbian.org/raspbian/ jessie/main libbonoboui2-common all 2.24.5-2 [192 kB]
Get:15 http://mirrordirector.raspbian.org/raspbian/ jessie/main libbonoboui2-0 armhf 2.24.5-2 [177 kB]
Get:16 http://mirrordirector.raspbian.org/raspbian/ jessie/main libgnomeui-common all 2.24.5-3 [514 kB]
Get:17 http://mirrordirector.raspbian.org/raspbian/ jessie/main libgnomeui-0 armhf 2.24.5-3 [285 kB]
Get:18 http://mirrordirector.raspbian.org/raspbian/ jessie/main libidl0 armhf 0.8.14-0.4 [109 kB]
Get:19 http://mirrordirector.raspbian.org/raspbian/ jessie/main liborbit2 armhf 1:2.14.19-0.3 [110 kB]
Get:20 http://mirrordirector.raspbian.org/raspbian/ jessie/main at armhf 3.1.16-1 [43.9 kB]
Get:21 http://mirrordirector.raspbian.org/raspbian/ jessie/main anacron armhf 2.3-23 [32.2 kB]
Get:22 http://mirrordirector.raspbian.org/raspbian/ jessie/main python-gconf armhf 2.28.1+dfsg-1.1 [51.0 kB]
Get:23 http://mirrordirector.raspbian.org/raspbian/ jessie/main python-pyorbit armhf 2.24.0-7 [57.1 kB]
Get:24 http://mirrordirector.raspbian.org/raspbian/ jessie/main python-gnome2 armhf 2.28.1+dfsg-1.1 [142 kB]
Get:25 http://mirrordirector.raspbian.org/raspbian/ jessie/main python-glade2 armhf 2.24.0-4 [42.1 kB]
Get:26 http://mirrordirector.raspbian.org/raspbian/ jessie/main gnome-schedule all 2.1.1-4 [1,128 kB]
Get:27 http://mirrordirector.raspbian.org/raspbian/ jessie/main libgnomevfs2-extra armhf 1:2.24.4-6 [351 kB]
Fetched 8,150 kB in 33s (244 kB/s)
Selecting previously unselected package libart-2.0-2:armhf.
(Reading database ... 130602 files and directories currently installed.)
Preparing to unpack .../libart-2.0-2_2.3.21-2_armhf.deb ...
Unpacking libart-2.0-2:armhf (2.3.21-2) ...
Selecting previously unselected package libbonobo2-common.
Preparing to unpack .../libbonobo2-common_2.32.1-3_all.deb ...
Unpacking libbonobo2-common (2.32.1-3) ...
Selecting previously unselected package liborbit-2-0:armhf.
Preparing to unpack .../liborbit-2-0_1%3a2.14.19-0.3_armhf.deb ...
Unpacking liborbit-2-0:armhf (1:2.14.19-0.3) ...
Selecting previously unselected package libbonobo2-0:armhf.
Preparing to unpack .../libbonobo2-0_2.32.1-3_armhf.deb ...
Unpacking libbonobo2-0:armhf (2.32.1-3) ...
Selecting previously unselected package libglade2-0:armhf.
Preparing to unpack .../libglade2-0_1%3a2.6.4-2_armhf.deb ...
Unpacking libglade2-0:armhf (1:2.6.4-2) ...
Selecting previously unselected package gnome-mime-data.
Preparing to unpack .../gnome-mime-data_2.18.0-1_all.deb ...
Unpacking gnome-mime-data (2.18.0-1) ...
Selecting previously unselected package libgnomevfs2-common.
Preparing to unpack .../libgnomevfs2-common_1%3a2.24.4-6_all.deb ...
Unpacking libgnomevfs2-common (1:2.24.4-6) ...
Selecting previously unselected package libgnomevfs2-0:armhf.
Preparing to unpack .../libgnomevfs2-0_1%3a2.24.4-6_armhf.deb ...
Unpacking libgnomevfs2-0:armhf (1:2.24.4-6) ...
Selecting previously unselected package libgnome2-common.
Preparing to unpack .../libgnome2-common_2.32.1-5_all.deb ...
Unpacking libgnome2-common (2.32.1-5) ...
Selecting previously unselected package libgnome-2-0:armhf.
Preparing to unpack .../libgnome-2-0_2.32.1-5_armhf.deb ...
Unpacking libgnome-2-0:armhf (2.32.1-5) ...
Selecting previously unselected package libgail18:armhf.
Preparing to unpack .../libgail18_2.24.25-3+deb8u1_armhf.deb ...
Unpacking libgail18:armhf (2.24.25-3+deb8u1) ...
Selecting previously unselected package libgnomecanvas2-common.
Preparing to unpack .../libgnomecanvas2-common_2.30.3-2_all.deb ...
Unpacking libgnomecanvas2-common (2.30.3-2) ...
Selecting previously unselected package libgnomecanvas2-0:armhf.
Preparing to unpack .../libgnomecanvas2-0_2.30.3-2_armhf.deb ...
Unpacking libgnomecanvas2-0:armhf (2.30.3-2) ...
Selecting previously unselected package libbonoboui2-common.
Preparing to unpack .../libbonoboui2-common_2.24.5-2_all.deb ...
Unpacking libbonoboui2-common (2.24.5-2) ...
Selecting previously unselected package libbonoboui2-0:armhf.
Preparing to unpack .../libbonoboui2-0_2.24.5-2_armhf.deb ...
Unpacking libbonoboui2-0:armhf (2.24.5-2) ...
Selecting previously unselected package libgnomeui-common.
Preparing to unpack .../libgnomeui-common_2.24.5-3_all.deb ...
Unpacking libgnomeui-common (2.24.5-3) ...
Selecting previously unselected package libgnomeui-0:armhf.
Preparing to unpack .../libgnomeui-0_2.24.5-3_armhf.deb ...
Unpacking libgnomeui-0:armhf (2.24.5-3) ...
Selecting previously unselected package libidl0:armhf.
Preparing to unpack .../libidl0_0.8.14-0.4_armhf.deb ...
Unpacking libidl0:armhf (0.8.14-0.4) ...
Selecting previously unselected package liborbit2:armhf.
Preparing to unpack .../liborbit2_1%3a2.14.19-0.3_armhf.deb ...
Unpacking liborbit2:armhf (1:2.14.19-0.3) ...
Selecting previously unselected package at.
Preparing to unpack .../archives/at_3.1.16-1_armhf.deb ...
Unpacking at (3.1.16-1) ...
Selecting previously unselected package anacron.
Preparing to unpack .../anacron_2.3-23_armhf.deb ...
Unpacking anacron (2.3-23) ...
Selecting previously unselected package python-gconf.
Preparing to unpack .../python-gconf_2.28.1+dfsg-1.1_armhf.deb ...
Unpacking python-gconf (2.28.1+dfsg-1.1) ...
Selecting previously unselected package python-pyorbit.
Preparing to unpack .../python-pyorbit_2.24.0-7_armhf.deb ...
Unpacking python-pyorbit (2.24.0-7) ...
Selecting previously unselected package python-gnome2.
Preparing to unpack .../python-gnome2_2.28.1+dfsg-1.1_armhf.deb ...
Unpacking python-gnome2 (2.28.1+dfsg-1.1) ...
Selecting previously unselected package python-glade2.
Preparing to unpack .../python-glade2_2.24.0-4_armhf.deb ...
Unpacking python-glade2 (2.24.0-4) ...
Selecting previously unselected package gnome-schedule.
Preparing to unpack .../gnome-schedule_2.1.1-4_all.deb ...
Unpacking gnome-schedule (2.1.1-4) ...
Selecting previously unselected package libgnomevfs2-extra:armhf.
Preparing to unpack .../libgnomevfs2-extra_1%3a2.24.4-6_armhf.deb ...
Unpacking libgnomevfs2-extra:armhf (1:2.24.4-6) ...
Processing triggers for man-db (2.7.0.2-5) ...
Processing triggers for gconf2 (3.2.6-3) ...
Processing triggers for systemd (215-17+deb8u6) ...
Processing triggers for gnome-menus (3.13.3-6) ...
Processing triggers for desktop-file-utils (0.22-1) ...
Processing triggers for mime-support (3.58) ...
Setting up libart-2.0-2:armhf (2.3.21-2) ...
Setting up libbonobo2-common (2.32.1-3) ...
Setting up liborbit-2-0:armhf (1:2.14.19-0.3) ...
Setting up libbonobo2-0:armhf (2.32.1-3) ...
Setting up libglade2-0:armhf (1:2.6.4-2) ...
Setting up gnome-mime-data (2.18.0-1) ...
Setting up libgnomevfs2-common (1:2.24.4-6) ...
Setting up libgnomevfs2-0:armhf (1:2.24.4-6) ...
Setting up libgnome2-common (2.32.1-5) ...
Setting up libgnome-2-0:armhf (2.32.1-5) ...
Setting up libgail18:armhf (2.24.25-3+deb8u1) ...
Setting up libgnomecanvas2-common (2.30.3-2) ...
Setting up libgnomecanvas2-0:armhf (2.30.3-2) ...
Setting up libbonoboui2-common (2.24.5-2) ...
Setting up libbonoboui2-0:armhf (2.24.5-2) ...
Setting up libgnomeui-common (2.24.5-3) ...
Setting up libgnomeui-0:armhf (2.24.5-3) ...
Setting up libidl0:armhf (0.8.14-0.4) ...
Setting up liborbit2:armhf (1:2.14.19-0.3) ...
Setting up at (3.1.16-1) ...
insserv: warning: script 'vncboot' missing LSB tags and overrides
Setting up anacron (2.3-23) ...
insserv: warning: script 'vncboot' missing LSB tags and overrides
Setting up python-gconf (2.28.1+dfsg-1.1) ...
Setting up python-pyorbit (2.24.0-7) ...
Setting up python-gnome2 (2.28.1+dfsg-1.1) ...
Setting up python-glade2 (2.24.0-4) ...
Setting up gnome-schedule (2.1.1-4) ...
Setting up libgnomevfs2-extra:armhf (1:2.24.4-6) ...
Processing triggers for libc-bin (2.19-18+deb8u7) ...
Processing triggers for systemd (215-17+deb8u6) ...
Processing triggers for python-support (1.0.15) ...

這樣就安裝好 gnome-schedule 了.

接下來輸入 startx 進入桌面系統, 在 Menu 的 System tools 裡可以看到 Gnome-schedule, 執行後進入設定畫面 :



如果 Menu 中找不到 Scheduled Task, 可以在 "Menu/Run" 彈出視窗中輸入 gnome-schedule 後按 OK 也可以進入設定頁面 :



設定頁面有三種新增 Cron job 的模式 : 一是週期性執行的 (每幾分鐘, 幾小時執行一次); 二是指定時間執行的 (每日一次); 三是從儲存的模板 (template) 執行.




參考 :

# SCHEDULING TASKS WITH CRON