Tinycore Linux Wiki 学习日记之四至八:设置、持久化、引导器、命令工具等

这篇学习日记包括 TinyCore Linux Wiki 的第四部分:设置,讲多种系统设置和应用程序的设置;第五部分:持久化设置,讲持久化目录、备份方式、加密、网络上的持久化等等;第六部分:引导器,讲了 Grub2, GRUB4DOS, linld 系统引导器;第七部分:常用 Linux 命令;第八部分:Tinycore 和 Microcore Linux 里面常用的命令行工具。

2011年10月01日 星期六
第四部分:
Set Up
Adding a Desktop to MicroCore
http://wiki.tinycorelinux.net/wiki:adding_a_desktop_to_microcore
有两种方法加载核心组件:进入持久化的 tce 目录的扩展包,做成 cpio 的映像文件在启动时加载

Copy and Paste with the Mouse
http://wiki.tinycorelinux.net/wiki:mouse
设置两键鼠标双键粘贴: sed -i 's/-shadow -mouse/-shadow -2button -mouse/' ~/.xsession

Cpu frequency scaling basics
http://wiki.tinycorelinux.net/wiki:cpu_frequency_scaling_basics
需要 CPU 驱动(专用的p4-clockmod (Intel) powernow-k6 (AMD K6) powernow-k7 (AMD K7) powernow-k8 (AMD K8) longhaul (VIA Nehemiah) 或通用的acpi-cpufreq )
调节器:cpufreq-set -g ondemand 多核处理器可以针对每个处理器进行调节

Display Modes
http://wiki.tinycorelinux.net/wiki:display_modes
可以在启动时指定 vga=xxx 来设定使用 xfbdev 显示驱动的分辨率。
除了 xvesa、xorg 驱动,也可以使用 xfbdev 驱动,在 .xsession 中设定:
Xfbdev -mouse /dev/input/mice,5 -nolisten tcp -I &>/dev/null &''

在这里非标准分辨率的信息获取通过进入 tinycore textmode 执行:Xvesa -listmodes

Ecofont and other printer ink saving tips
http://wiki.tinycorelinux.net/wiki:economic_printing
讲小一点的字可以节省打印墨水,技术上主要是讲怎样在系统中加入字体。

Firewall
http://wiki.tinycorelinux.net/wiki:firewall
简述怎样设置 iptables
在“/opt/bootlocal.sh”添加 “/usr/local/sbin/basic-firewall”

2011年10月02日 星期日
Flash Player
http://wiki.tinycorelinux.net/wiki:flash_player
可以把 flash 扩展下载下本地,需要在选“本地安装”即时安装使用。

GTK themes
http://wiki.tinycorelinux.net/wiki:gtk_themes?&#configuration
GTK 主题定义在 ~/gtkrc-2.0 中。
tinycore 仓库里的扩展有gnome-icon-theme、lxde-icon-theme等。
除了主题文件,还需要:hicolor-icon-theme.tcz、 shared-mime-info.tcz,librsvg.tcz(可选,缩放图需要)

MySQL Set-Up Guide
http://wiki.tinycorelinux.net/wiki:mysql_persistence_guide
使用持久化的方法比使用备份的方法数据丢失的可能性要小些,使用备份的方法数据都在内存中运行,使用持久化的方法要读写磁盘。

Maximize the life of a USB Drive
http://wiki.tinycorelinux.net/wiki:usb_life
已读。

Netbook Tips
http://wiki.tinycorelinux.net/wiki:netbook_tips
设置持久化目录而不是备份模式。

2011年10月03日 星期一

Netbooting and Storage
http://wiki.tinycorelinux.net/wiki:netbooting
从网络 pxe 启动 Tinycore
todo: 需要时再学习实验一下

Printer Setup Using Cups
http://wiki.tinycorelinux.net/wiki:printer_setup_using_cups
已读。

Printer Setup Using Cups1311
http://wiki.tinycorelinux.net/wiki:cups1311
一个不需要设置 root 密码的打印系统。

PulseAudio
http://wiki.tinycorelinux.net/wiki:pulseaudio
PulseAudio 并不能自动检测声卡,需要先安装 ALSA 系统。

Remove Applications from the Menu and Wbar
http://wiki.tinycorelinux.net/wiki:menu

主要方法是把系统默认建立的 ~/.wmx 文件移走,用自定义的项目代替。把下面的内容加入 /opt/bootlocal.sh

mv /home/tc/.wmx /home/tc/.wmx_old
cp -r /home/tc/.mymenu/.wmx /home/tc/.wmx

2011年10月04日 星期二
Run Commands during Startup or Shutdown
http://wiki.tinycorelinux.net/wiki:bootlocal.sh_and_shutdown.sh
系统启动或关闭要执行的自定义代码分别写入:
/opt/bootsysnc.sh 启动前期
/opt/bootlocal.sh 启动后期
/opt/shutdown.sh 关闭
todo: 这些代码启动与结束的具体时刻

Security
http://wiki.tinycorelinux.net/wiki:security
把 etc/group, etc/passwd, and etc/shadow 加入 /opt/.filetool.lst 保留用户、组信息。

文件 /etc/inittab 指定了 rungetty 应该以 tc 用户自动登录。

Setting up Sound
http://wiki.tinycorelinux.net/wiki:setting_up_sound
讲了 OSS 和 alsa 详细的声音设置。包括:多个声音设备、摄像头录音等等。需要进再详细学习。

Setting up Wifi
http://wiki.tinycorelinux.net/wiki:setting_up_wifi
已读。

Set Up a Kiosk
http://wiki.tinycorelinux.net/wiki:kiosk
“Kiosk”(售货亭) 大概就是只让用户看到可使用的程序,而不能接触系统设置等与使用无关的东西,像摆在大街旁供信息查询的公用信息亭之类。主要方法就是移除菜单和启动条里面的一些程序和工具。

Using acpid to control your PC buttons
http://wiki.tinycorelinux.net/wiki:using_acpid_to_control_your_pc_buttons
使用 acpid.tcz 包实现功能键(如 EEEPC 上的睡眠、音量等),文中举出一个运用于 EEEPC 1000HE 上的例子。

Using Xorg over Xvesa
http://wiki.tinycorelinux.net/wiki:using_xorg_over_xvesa
使用 Xorg 需要安装两个扩展包:如:Xorg-7.4.tcz、graphics-2.6.29.1-tinycore.tcz(4.* 系列好像没有这个包了,也许是融合到 Xorg 包了?)
如果有对 xorg.conf 有自定义的部分仅在 xorg.conf 包含有关部分的设置就行了(如:键盘),而不用完整的写出 xorg.conf。

View Random Image
http://wiki.tinycorelinux.net/wiki:random_background
使用随机数脚本控制。核心代码:

NUMBPIC=$(ls | wc -l)
PICSEL=$((($RANDOM%$NUMBPIC) +1))
PICCHANGE=$(ls | tail -$PICSEL | head -1)

VirtualBox
http://wiki.tinycorelinux.net/wiki:virtualbox
1、
VirtualBox 混和模式使用一个真实硬盘分区安装 Tinycore,使 Tinycore 既可以从运行着的宿主机里的 VirtualBox 里启动,也可以从 Bios 里设置在真实物理机里运行。
2、
“Portable VirtualBox: http://www.vbox.me/” 可以从U盘运行其它操作系统而不用安装步骤(一般的情况是要在宿主机安装一下 VirtualBox 才行的)。

Wallpaper/Desktop background
http://wiki.tinycorelinux.net/wiki:wallpaper_desktop_background
已读。

Window Managers and Desktop Environments
http://wiki.tinycorelinux.net/wiki:window_managers_and_desktop_environments
不是所有“窗口管理器”都支持 Tinycore 的动态菜单系统。

第五部分 Persistence

Persistence for Dummies
http://wiki.tinycorelinux.net/wiki:persistence_for_dummies
已读。

Persistence when Netbooting ( NFS, NBD, and AOE )
http://wiki.tinycorelinux.net/wiki:netbooting
已读。

Backup
http://wiki.tinycorelinux.net/wiki:backup

Safe Backup: 把前一次的备份重命名为 "mydatabk.tgz",并创建一个新的备份。

Backup with Date and Time
http://wiki.tinycorelinux.net/wiki:backup_date
使用脚本把备份时间写入备份文件名,把脚本加入 /opt/shutdown.sh 中。

Xfe and Backup:如果使用 Xfe 文件管理器,会把删除的文件或目录存入回收站,所以在备份时把 “home/tc/.xfe”写入 “/opt/.xfiletool.lst”;或者在 Xfe 中设置永久删除不进入回收站之类的选项。

Options when Installed on a Hard Drive
http://wiki.tinycorelinux.net/wiki:backup_hd
如果把 Tinycore 安装在硬盘中,理想的方式是使用持久化目录而不是备份模式,如下:
opt=sda1 home=sda1 norestore

Options when Installed on a USB Drive
http://wiki.tinycorelinux.net/wiki:backup_usb
如果把 Tinycore 安装在 U 盘中,“Backup” 模式用于减少写入 U 盘的次数(因为在使用过程中都是先写入内存,结束使用时才写入磁盘)。 /opt 目录很少改动,使用持久化目录的方式可以更少写入。 /home 如果里面的很多文件需要改变,使用 backup 模式,如果很少改变(如作工具系统)则使用持久化目录的模式。判断的标准是回答一个问题:是每当文件改变就写入磁盘还是当电脑关闭再写入所有文件的方式使写入U盘的数据更少?

Backup with Date and Time
http://wiki.tinycorelinux.net/wiki:backup_date
已读。

Encrypted Backup
http://wiki.tinycorelinux.net/wiki:encrypted_backup
在启动代码中包含:“protect”启用加密备份模式。
在“传统备份”和“加密备份”模式之间切换将不会自动载入需要备份的文件。解决方法:在改变期间使用持久化 /home 和 /opt; 或者 把需要备份的文件在启动加密备份前拷入一个临时的目录,启用后再拷贝回来。

Manually Encrypt Files
http://wiki.tinycorelinux.net/wiki:encrypt_files
使用 “bcrypt -c filename”加密和使用“bcrypt -c filename.bfe”解密文件。

Persistent home and opt
http://wiki.tinycorelinux.net/wiki:persistent_home
如果在 U 盘上使用持久化 /opt 和 /home 目录,理想的方法是使用 UUID 指定分区。如果在 U 盘上除了使用持久化目录还使用备份模式,那在 /opt/.filetool.lst 移除所有 /home /opt 中的目录或文件(持久化了的),把想备份的文件或目录加进去。

Make Extensions for Settings
http://wiki.tinycorelinux.net/wiki:extension_for_settings
已读。

2011年10月06日 星期四
第六部分:
Bootloaders

Grub2
http://wiki.tinycorelinux.net/wiki:grub2_from_grub1
查看MBR:
sudo dd if=/dev/sda bs=512 count=1 | strings
strings 命令的作用是显示二进制文件里面的字符串

可以在 grub legacy 中包含 grub2 的引导菜单

另外讲了设置 grub2 字体、图片,设置 Chainload。

GRUB4DOS
http://wiki.tinycorelinux.net/wiki:grub4dos

Grub4dos 通过搜索 grldr 开始引导系统。

把 ntfs-3g 集成入 tinycore.gz 的脚本: http://forum.tinycorelinux.net/index.php?topic=6246.0

安装初始化引导器的命令”/usr/local/share/grub4dos/bootlace.com –time-out=0 /dev/” 可以在 Linux 和 DOS/Windows 下运行

linld
http://wiki.tinycorelinux.net/wiki:linld
在 DOS 下引导 Linux 的命令

第七部分:
Linux Commands
基础 Linux 命令。
Basic Commands for New Users
32 or 64 bit CPU
Change Owner and Group
Download using Wget
Extract tar.gz, tar.bz2, zip, and other Compressed Files
http://wiki.tinycorelinux.net/wiki:tar
等同压缩文件扩展名
.tgz is equivalent to .tar.gz
.tbz and .tb2 are equivalent to .tar.bz2
.taz is equivalent to .tar.Z
.tlz is equivalent to .tar.lz
.txz is equivalent to .tar.xz

解压 tinycore.gz: zcat tinycore.gz | sudo cpio -i -H newc -d
解压 .deb 文件:
ar vx filename.deb
tar -xzvf data.tar.gz
解压 .rpm 文件: rpm2cpio filename.rpm | cpio -vid
Mount an ISO
Use md5sum to Check if a File has been Corrupted

第八部分:
Tinycore and Microcore Commands
一些 Tinycore 里面的命令行工具,已读。
App Browser
Backup and Restore
Install Applications Using Commands
Run the Installer
Select Mirror
Shutdown and Restart
Start or Load Applications
System Information
Update Applications
Package management cheat sheet