Raspberry Pi 測試 – 修改 RASPBIAN

因為 Raspberry Pi 除了 ArchLinux 外,並沒有完全對 Server 提出的解決方案,如果對 ArchLinux 不熟悉的話,可以考慮把 RASPBIAN 修改成文字模式,就是去除 XWindow 的圖形化介面程式。
底下文章參考:
Linux Pi的奇幻旅程(15)-大改造 – iT邦幫忙::IT知識分享社群
Linux Pi的奇幻旅程(16)-大改造(續) – iT邦幫忙::IT知識分享社群
Linux Pi的奇幻旅程(17)-大改造(結) – iT邦幫忙::IT知識分享社群

[@more@]1. 設定 RASPBIAN 開機後進入文字模式
$ sudo raspi-config
選擇 3 Enable Boot to Desktop/Scratch

選擇 Console Text console, requiring login (default)


移除 S03lightdm 連結
$ ls -l /etc/rc2.d/S03lightdm
lrwxrwxrwx 1 root root 17 Sep 29 18:32 /etc/rc2.d/S03lightdm -> ../init.d/lightdm
$ sudo update-rc.d lightdm disable 2
update-rc.d: using dependency based boot sequencing
insserv: warning: current start runlevel(s) (3 4 5) of script `lightdm’ overrides LSB defaults (2 3 4 5).
insserv: warning: current stop runlevel(s) (0 1 2 6) of script `lightdm’ overrides LSB defaults (0 1 6).
$ ls -l /etc/rc2.d/S03lightdm
ls: cannot access /etc/rc2.d/S03lightdm: No such file or directory

2. 移除 x11 相關套件
$ sudo  apt-get remove –purge dbus-x11 gsfonts-x11 libx11-6 libx11-data libx11-xcb1 x11-common x11-utils x11-xkb-utils
移除不須要的套件
$ sudo  apt-get autoremove
$ sudo  apt-get remove –purge xkb-data menu-xdg desktop-file-utils lxde-icon-theme libx264-130 libxapian-dev libxapian22 libxvidcore4 libxml2 gnome-themes-standard-data
$ sudo apt-get remove –purge alsa-base alsa-utils gstreamer1.0-alsa gstreamer1.0-omx omxplayer libraspberrypi-dev libraspberrypi-doc raspberrypi-artwork
$ sudo  apt-get autoremove

3.重新分配記憶體
$ sudo raspi-config
選擇 8 Advanced Options

選擇 A3 Memory Split

分配給 GPU 的 RAM 改成 16M,因為不使用圖形模式

4. 做一下套件庫及套件更新、系統升級
# apt-get update
# apt-get upgrade
# apt-get dist-upgrade

5.查看成果
# df -m
# free -m

Raspberry Pi 測試 – ArchLinux Server 篇 超頻 Overclock

參考網站:
Cortex-A/M: Raspberry Pi: Overclocking on Arch linux
Raspberry Pi Safe Overclocking – Hayden James
修改 /boot/config.txt
# vim /boot/config.txt
##None(未超頻)
#arm_freq=700
#core_freq=250
#sdram_freq=400
#over_voltage=0

##Modest(超頻一些)
#arm_freq=800
#core_freq=300
#sdram_freq=400
#over_voltage=0

##Medium(中等)
#arm_freq=900
#core_freq=333
#sdram_freq=450
#over_voltage=2

##High(快)
#arm_freq=950
#core_freq=450
#sdram_freq=450
#over_voltage=6

##Turbo(最快)
#arm_freq=1000
#core_freq=500
#sdram_freq=500
#over_voltage=6[@more@]

這裡改用 Turbo
##Turbo
arm_freq=1000
core_freq=500
sdram_freq=500
over_voltage=6

重新啟動電腦
# reboot

Firefox 33.0.2 版釋出

Firefox 33.0.2 更新部分可以參考:
Firefox — Notes (33.0.2) — Mozilla
火狐浏览器Firefox 33.0.2下载发布 – 火狐浏览器,Firefox,Firefox浏览器 – IT之家

可以使用功能表上的 說明(H)/ 關於 Firefox(A),來檢查新版本下載並安裝

Windows 版本下載
ftp://ftp.mozilla.org/pub/mozilla.org/firefox/releases/33.0.2/win32/zh-TW/Firefox%20Setup%2033.0.2.exe

Mac 版下載
ftp://ftp.mozilla.org/pub/mozilla.org/firefox/releases/33.0.2/mac/zh-TW/Firefox%2033.0.2.dmg

CentOS Linux 6.6 x86 客製化

現在已經很少使用 x86 版本了,連 CentOS 7.x 已都只出 x86_64 的版本,但還是製作一份,以備不時之需!
安裝只要二步驟:
光碟安裝畫面,已取消倒數計時
[@more@]
第一步驟:硬碟分割


第二步驟:設定 root 密碼


共有 649 個套件

安裝完畢!

和之前的 CentOS Linux 6.6 x86_64 客製化一樣,只是安裝介面改成正體中文

這個版本的特點:
1. 套件更新到 2014-10-29
2. 套件更新伺服器改成臺灣
3. 預設啟動 LAMP (Linux + Apache + MySQL + PHP) / vsFTP Server
4. Apache Web Server 增加一些安全性上的設定
    ServerTokens Prod
    ServerSignature Off
5. MySQL Server 修改成 UTF-8 的使用環境
6. PHP 部分的設定,僅列出部份的修改
    時區改成 Asia/Taipei
    upload_max_filesize = 500M
    post_max_size = 500
7. 修改 SELinux 讓 vsFTP Server 能正常使用(SELINUX=enforcing)
8. 每天早上 6 點向 time.stdtime.gov.tw 對時

不過這版本少安裝了 php-mbstring 套件,因為有出現相依性的錯誤訊息
# yum install php-mbstring
Loaded plugins: fastestmirror, security
Setting up Install Process
Loading mirror speeds from cached hostfile
 * base: ftp.jaist.ac.jp
 * extras: ftp.jaist.ac.jp
 * updates: ftp.jaist.ac.jp
Resolving Dependencies
–> Running transaction check
—> Package php-mbstring.i686 0:5.3.3-27.el6_5.2 will be installed
–> Processing Dependency: php-common(x86-32) = 5.3.3-27.el6_5.2 for package: php-mbstring-5.3.3-27.el6_5.2.i686
–> Finished Dependency Resolution
Error: Package: php-mbstring-5.3.3-27.el6_5.2.i686 (updates)
           Requires: php-common(x86-32) = 5.3.3-27.el6_5.2
           Installed: php-common-5.3.3-38.el6.i686 (@anaconda-CentOS-201410241409.i386/6.6)
               php-common(x86-32) = 5.3.3-38.el6
           Available: php-common-5.3.3-26.el6.i686 (base)
               php-common(x86-32) = 5.3.3-26.el6
           Available: php-common-5.3.3-27.el6_5.i686 (updates)
               php-common(x86-32) = 5.3.3-27.el6_5
           Available: php-common-5.3.3-27.el6_5.1.i686 (updates)
               php-common(x86-32) = 5.3.3-27.el6_5.1
           Available: php-common-5.3.3-27.el6_5.2.i686 (updates)
               php-common(x86-32) = 5.3.3-27.el6_5.2
 You could try using –skip-broken to work around the problem
 You could try running: rpm -Va –nofiles –nodigest

CentOS Linux 6.6 x86_64 客製化

試裝了 CentOS Linux 6.6 x86_64 之後,順手把 Server 的安裝光碟完成。
安裝只要二步驟:
光碟安裝畫面,已取消倒數計時
[@more@]第一步驟:硬碟分割

第二步驟:設定 root 密碼

開始安裝

共有 646 個套件

安裝完成

這個版本的特點:
1. 套件更新到 2014-10-29
2. 套件更新伺服器改成臺灣
3. 預設啟動 LAMP (Linux + Apache + MySQL + PHP) / vsFTP Server
4. Apache Web Server 增加一些安全性上的設定
    ServerTokens Prod
    ServerSignature Off
5. MySQL Server 修改成 UTF-8 的使用環境
6. PHP 部分的設定,僅列出部份的修改
    時區改成 Asia/Taipei
    upload_max_filesize = 500M
    post_max_size = 500
7. 修改 SELinux 讓 vsFTP Server 能正常使用(SELINUX=enforcing)
8. 每天早上 6 點向 time.stdtime.gov.tw 對時

更改 CentOS Linux Mirror 來源

原本是使用交通大學資訊工程學系,改用義守大學
# crontab -l | grep rsync
#0 */6 * * * /usr/bin/rsync -avqzH –delete linux.cs.nctu.edu.tw::CentOS /var/ftp/CentOS > /dev/null 2>&1
0 */6 * * * /usr/bin/rsync -avqzH –delete ftp.isu.edu.tw::centos /var/ftp/CentOS > /dev/null 2>&1

放棄 Scientific Linux Mirror

放棄 Scientific Linux Mirror,因為它把 Server 的 2T 硬碟給塞滿了!
# df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/sda2       4.0G  2.2G  1.7G  57% /
tmpfs           939M     0  939M   0% /dev/shm
/dev/sda1       194M  121M   64M  66% /boot
/dev/sda6       1.5G   35M  1.4G   3% /tmp
/dev/sda3       4.0G  1.5G  2.3G  41% /usr
/dev/sda7       216G  451M  205G   1% /var
/dev/sdb1       1.8T  271G  1.5T  16% /var/ftp
/dev/sdc1       1.8T  1.8T     0 100% /var/ftp/Linux

CentOS Linux 6.6

CentOS Linux 6.6 已經釋出,可以下載 ISO  檔來安裝,或使用 yum update 來更新到最新版本。
# yum update

關於 CentOS 6.6 的介紹可以參考:CentOS 6.6 正式发布 – 开源中国社区
CentOS Linux ISO 6.6 版下載
i386
樹德科技大學
ftp://ftp.stu.edu.tw/Linux/CentOS/6.6/isos/i386/
元智大學
ftp://ftp.yzu.edu.tw/Linux/CentOS/6.6/isos/i386/
Hinet IDC
http://mirror01.idc.hinet.net/CentOS/6.6/isos/i386/
義守大學
ftp://ftp.isu.edu.tw/pub/Linux/CentOS/6.6/isos/i386/
國家高速網路與計算中心
ftp://ftp.twaren.net/Linux/CentOS/6.6/isos/i386/
南臺科技大學
ftp://ftp.stust.edu.tw/pub/Linux/CentOS/6.6/isos/i386/
中山大學
http://ftp.nsysu.edu.tw/CentOS/6.6/isos/i386/
台中市教網
http://ftp.tc.edu.tw/Linux/CentOS/6.6/isos/i386/
頭城國小
ftp://140.111.74.109/CentOS/6.6/isos/i386/
[@more@]
x86_64
樹德科技大學
ftp://ftp.stu.edu.tw/Linux/CentOS/6.6/isos/x86_64/
元智大學
ftp://ftp.yzu.edu.tw/Linux/CentOS/6.6/isos/x86_64/
Hinet IDC
http://mirror01.idc.hinet.net/CentOS/6.6/isos/x86_64/
義守大學
ftp://ftp.isu.edu.tw/pub/Linux/CentOS/6.6/isos/x86_64/
國家高速網路與計算中心
ftp://ftp.twaren.net/Linux/CentOS/6.6/isos/x86_64/
南臺科技大學
ftp://ftp.stust.edu.tw/pub/Linux/CentOS/6.6/isos/x86_64/
中山大學
http://ftp.nsysu.edu.tw/CentOS/6.6/isos/x86_64/
台中市教網
http://ftp.tc.edu.tw/Linux/CentOS/6.6/isos/x86_64/
頭城國小
ftp://140.111.74.109/CentOS/6.6/isos/x86_64/

Raspberry Pi 測試 – ArchLinux Server 篇 擴展 root 分割區

參考網站:Cubiksoundz – Technically Speaking…: Expanding Raspberry Pi SD Card Partition on Arch Linux
分割硬碟
# fdisk /dev/mmcblk0

[@more@]刪除第 2 個分割區
Command (m for help): d
Partition number (1,2,5, default 5): 2

Partition 2 has been deleted.

建立 extended 分割區
Command (m for help): n

Partition type:
   p   primary (1 primary, 0 extended, 3 free)
   e   extended
Select (default p): e
Partition number (2-4, default 2): 2
First sector (186368-30881791, default 186368):
Last sector, +sectors or +size{K,M,G,T,P} (186368-30881791, default 30881791):

Created a new partition 2 of type ‘Extended’ and of size 14.7 GiB.

建立 logical 分割區
Command (m for help): n

Partition type:
   p   primary (1 primary, 1 extended, 2 free)
   l   logical (numbered from 5)
Select (default p): l

Adding logical partition 5
First sector (188416-30881791, default 188416):
Last sector, +sectors or +size{K,M,G,T,P} (188416-30881791, default 30881791):

Created a new partition 5 of type ‘Linux’ and of size 14.7 GiB.

寫入並結束

重新啟動電腦
# reboot

使用 resize2fs 擴大分割區的大小
# resize2fs /dev/mmcblk0p5
resize2fs 1.42.9 (28-Dec-2013)
Filesystem at /dev/mmcblk0p5 is mounted on /; on-line resizing required
old_desc_blocks = 1, new_desc_blocks = 1
The filesystem on /dev/mmcblk0p5 is now 3836672 blocks long.