RedHat/CentOS、Debian/Ubuntu、Arch Linux、Gentoo 套件管理比較

1. 更新套件庫
ReHat/CentOS
# yum update
Debian/Ubuntu
# apt-get update
Arch Linux
# pacman -Sy
Gentoo Linux
# emerge –sync[@more@]2. 更新整個系統
ReHat/CentOS
# yum -y update
Debian/Ubuntu
# apt-get upgrade
# apt-get dist-upgrade
Arch Linux
# pacman -Syu
Gentoo Linux
# emerge -u world

3. 搜尋套件
ReHat/CentOS
# yum search pkg_filename
Debian/Ubuntu
# apt-cache search pkg_filename
Arch Linux
# pacman -Ss pkg_filename
Gentoo Linux
# emerge -s pkg_filename

4. 安裝套件
ReHat/CentOS
# yum install pkg_filename
# rpm -ivh pkg_filename.rpm
Debian/Ubuntu
# apt-get install pkg_filename
# dpkg -i pkg_filename.deb
Arch Linux
# pacman -S pkg_filename
Gentoo Linux
# emerge pkg_filename
# emerge -k pkg_filename

5. 移除套件
ReHat/CentOS
# yum remove pkg_filename
# rpm -e pkg_filename
Debian/Ubuntu
# apt-get remove –purge pkg_filename
# dpkg -P pkg_filename.deb
Arch Linux
# pacman -Rn pkg_filename
Gentoo Linux
# emerge -C pkg_filename

Cubie Truck 測試 – Fedora 20 擴展 root 分割區

切換到一般使用者
# su – linaro

原有的硬碟分割
$ df -h
檔案系統        容量  已用  可用 已用% 掛載點
/dev/root       4.0G  2.9G  970M   75% /
devtmpfs        889M     0  889M    0% /dev
tmpfs           985M   72K  985M    1% /dev/shm
tmpfs           985M  708K  984M    1% /run
tmpfs           985M     0  985M    0% /sys/fs/cgroup[@more@]安裝編譯套件
$ sudo yum groupinstall “Development Tools”

安裝編譯時缺少的套件
$ sudo yum install libusb-devel

下載 sunxi-tools
$ git clone https://github.com/linux-sunxi/sunxi-tools
Cloning into ‘sunxi-tools’…
remote: Counting objects: 1075, done.
remote: Total 1075 (delta 0), reused 0 (delta 0)
Receiving objects: 100% (1075/1075), 368.20 KiB | 24.00 KiB/s, done.
Resolving deltas: 100% (577/577), done.
Checking connectivity… done.

切換目錄
$ cd sunxi-tools

進行編譯
$ make

將 nand-part 複製到 /sbin 目錄
$ sudo cp nand-part /sbin

$ sudo nand-part -f a20 /dev/nand
check partition table copy 0: mbr: version 0x00000200, magic softw411
OK
check partition table copy 1: mbr: version 0x00000200, magic softw411
OK
check partition table copy 2: mbr: version 0x00000200, magic softw411
OK
check partition table copy 3: mbr: version 0x00000200, magic softw411
OK
mbr: version 0x00000200, magic softw411
3 partitions
partition  1: class =         DISK, name =   bootloader, partition start =    32768, partition size =   131072 user_type=0
partition  2: class =         DISK, name =       rootfs, partition start =   163840, partition size =  8388608 user_type=0
partition  3: class =         DISK, name =        UDISK, partition start =  8552448, partition size = 22380544 user_type=0

綠色是分割區的名字,粉紅色是分割區的起始位置,橘色是分割區的大小

UDISK 是還未用到的區域,也就是 root 分割區要擴展的區域
擴展之後 /dev/nandb 的大小 8388608+22380544 = 30769152

進行重新分割
$ sudo nand-part -f a20 /dev/nand 32768 ‘boot 131072’ ‘rootfs 30769152’

完成之後,重新啟動電腦
$ sudo reboot

重新設定 /dev/nandb 分割區大小
$ sudo resize2fs /dev/nandb
resize2fs 1.42.8 (20-Jun-2013)
Filesystem at /dev/nandb is mounted on /; on-line resizing required
old_desc_blocks = 1, new_desc_blocks = 1
The filesystem on /dev/nandb is now 3870720 blocks long.

之後的大小
$ df -h
檔案系統        容量  已用  可用 已用% 掛載點
/dev/root        15G  3.1G   11G   22% /
devtmpfs        889M     0  889M    0% /dev
tmpfs           985M   72K  985M    1% /dev/shm
tmpfs           985M  672K  984M    1% /run
tmpfs           985M     0  985M    0% /sys/fs/cgroup

CubieTruck 測試 – Fedora 20 rc.local

etc/rc.local 或 /etc/rc.d/rc.local 是 Linux 中一個系統開機快要完成時,會執行的一個檔案,有點像是 DOS 中的 autoexec.bat。Fedora 20 中似乎沒有這一個檔案,要自己手動加上去。
# vim /etc/rc.d/rc.local
#!/bin/bash
# 打開鍵盤上的 Num Lock
[ -x /usr/bin/numlockx ] && numlockx on

更改檔案權限
# chmod 755 /etc/rc.d/rc.local

重新開機後,發現 numlock 燈有亮,但也出現了一些錯誤訊息
[@more@]檢查 rc-local 服務出現的錯誤訊息
# systemctl status rc-local.service
rc-local.service – /etc/rc.d/rc.local Compatibility
   Loaded: loaded (/usr/lib/systemd/system/rc-local.service; static)
   Active: failed (Result: exit-code) since 一 2014-10-20 14:31:58 CST; 6min ago

10月 20 14:31:58 localhost systemd[1]: Starting /etc/rc.d/rc.local Compatibility…
10月 20 14:31:58 localhost systemd[1]: rc-local.service: control process exited, code=exited status=1
10月 20 14:31:58 localhost systemd[1]: Failed to start /etc/rc.d/rc.local Compatibility.
10月 20 14:31:58 localhost systemd[1]: Unit rc-local.service entered failed state.

啟動 rc-local 服務時出現的錯誤訊息,看起來好像 /usr/lib/systemd/system/rc-local.service 缺少了 Install 的區段
# systemctl enable rc-local
The unit files have no [Install] section. They are not meant to be enabled
using systemctl.
Possible reasons for having this kind of units are:
1) A unit may be statically enabled by being symlinked from another unit’s
   .wants/ or .requires/ directory.
2) A unit’s purpose may be to act as a helper for some other unit which has
   a requirement dependency on it.
3) A unit may be started when needed via activation (socket, path, timer,
   D-Bus, udev, scripted systemctl call, …).

/usr/lib/systemd/system/rc-local.service 最後面加入下面區段
[Install]
WantedBy=multi-user.target

# sed -i ‘$a[Install]nWantedBy=multi-user.target’ /usr/lib/systemd/system/rc-local.service
[Install]
WantedBy=multi-user.target

開機啟動 rc.local 服務
# systemctl enable rc-local
ln -s ‘/usr/lib/systemd/system/rc-local.service’ ‘/etc/systemd/system/multi-user.target.wants/rc-local.service’

查 rc-local 服務狀態
# systemctl status rc-local.service
rc-local.service – /etc/rc.d/rc.local Compatibility
   Loaded: loaded (/usr/lib/systemd/system/rc-local.service; enabled)
   Active: active (exited) since 一 2014-10-20 14:46:42 CST; 11s ago
  Process: 1961 ExecStart=/etc/rc.d/rc.local start (code=exited, status=0/SUCCESS)

10月 20 14:46:42 localhost systemd[1]: Started /etc/rc.d/rc.local Compatibility.

CubieTruck 測試 – Fedora 20 中文化

登入之後畫面是英文版的

[@more@]安裝中文字型
$ sudo yum install cjkuni-ukai-fonts cjkuni-uming-fonts taipeifonts wqy-bitmap-fonts wqy-microhei-fonts

移除 ibus 及安裝 gcin
$ sudo yum remove ibus ibus-chewing ibus-gtk2 ibus-gtk3 ibus-kkc ibus-libs ibus-setup ibus-wayland
$ sudo yum install gcin

修改 /etc/locale.confen_US 改成 zh_TW
$ sudo sed -i ‘s/en_US/zh_TW/’ /etc/locale.conf

重新開機
$ sudo reboot

是否要更改目錄名稱

整個的介面已經變成中文的了!