Archive for 03月, 2006

准备网络同步复制系统 星期四, 03月 23rd, 2006

2006-3-23 周四, 下午3:47
晚上整理一下。

本记录思想是通过以太网络,配合简单的3个命令,实现把配置好了的完整系统复制到其他机器。以便于局域网上的快速安装,并减少单台机器系统配置的过程。

使用了3个命令:nc,dump,restore。

代码:
netcat 简称 nc. Netcat 是一把非常简单易用的基于 TCP/IP 协议(C/S模型的)的“瑞士军刀”(man里面,第一句就是这样说的),它能允许我们通过网络创建管道(pipe)。dump 和 restore 是用于备份和恢复系统的常用命令。位于dump包中。可以apt-get install dump。

实验的目的:我们将源机器的根分区,通过 dump/restore 和 nc 来传送到目标机器的指定分区。 先实验将源机器的/var/cache/apt/archives/复制到目标机器。

1:在接收端(目标电脑),创建一个 netcat 的监听例程(-l),这个监听例程将管道输出到 restore。 把接受到的数据写到目标机器。
nc -l -p 2000 -q 1 | restore -r -f -

这里-p是建立一个端口。-q 选项是让 nc 在到达文件结束(EOF)时延时n秒后,自动停止运行。

2:在 源电脑, 创建另一个 netcat 的例程,这个例程将它从管道里得到的输入(也就是dump备份的数据)发给目标电脑。
dump -0 -f – /dir | nc <target-ip> 2000

这里 target-IP 是目标电脑的 IP 地址。 2000是端口号。

以下是man里面的原版说明,可以参考。

代码:
restore说明:
-f file
Read  the  backup  from  file; file may be a special device file like /dev/st0 (a tape drive), /dev/sda1 (a disk drive), an ordinary file, or – (the standard input). If the name of the file isof the form host:file or user@host:file, restore reads from  the named file on the remote host using rmt(8). -r     Restore (rebuild) a file system. The target file  system  should be made pristine with mke2fs(8), mounted, and the user cd’d into the pristine file system before starting the restoration of  the initial  level  0  backup. If the level 0 restores successfully, the -r flag may be used to  restore  any  necessary  incremental backups on top of the level 0. The -r flag precludes an interac‐tive file extraction and can be detrimental to one’s health (not to mention the disk) if not used carefully. An example:

mke2fs /dev/sda1
mount /dev/sda1 /mnt
cd /mnt
restore rf /dev/st0

Note  that  restore  leaves  a  file restoresymtable in the root directory  to  pass  information  between  incremental   restore passes.   This  file should be removed when the last incremental has been restored.

代码:
dump说明:
-f file
Write the backup to file; file may be a special device file like /dev/st0 (a tape drive), /dev/rsd1c (a floppy  disk  drive),  an ordinary  file,  or – (the standard output). Multiple file names may be given as a single argument separated by commas. Each file will  be  used  for  one dump volume in the order listed; if the dump requires more volumes than the number of names  given,  the last file name will used for all remaining volumes after prompt‐ing for media changes. If the name of the file is  of  the  form host:file or user@host:file dump writes to the named file on the remote host (which should already exist, dump doesn’t  create  a new  remote  file)  using  rmt(8).  The default path name of the remote rmt(8) program is /etc/rmt; this can be overridden by the environment variable RMT.[-level#]
代码:
nc – TCP/IP swiss army knife说明:
-l           listen mode, for inbound connects
-n           numeric-only IP addresses, no DNS
-o file      hex dump of traffic
-p port      local port number  (port  numbers  can  be  individual  or ranges: lo-hi [inclusive])
-q seconds   after  EOF  is detected, wait the specified number of seconds and then quit.

-------------------------
实验结果,数据送传可以,只是目标路径有些偏差。2边执行了

代码:
sudo dump -0 -f – /var/cache/apt/archives/ | nc 10.23.1.100 2000
~$ nc -l -p 2000 -q 1 | restore -r -f -

结果数据全部传送到了~/var/cache/apt/archives/。
当时考虑失误,安装目标机器系统时,图简单,安装时选了格式全盘,安装的server,然后安装了dump包。结果搞得没有空闲分区测试。直接根目录对根目录传送,提示失败,被中断。想来也想得到。挂载了并且在运行中的根目录怎么会让你覆盖哦。

总体来说,实验还是成功的。数据传送正常。以后就只要找个带了nc/dump/restore命令的live cd。就可以在裸机或者其他任何有空间的机器上,复制其他机器上配置好了的linux系统了。我想以太网络的速度应该比usb硬盘之类的要好得多。 Laughing 省去了独立安装系统时,系统检测,解包,下载包,配置软件的时间,这些也是占用很长的时间的。

忘记了,复制以后,需要按照机器设置,修改/etc/fstab(分区结构), /etc/network/interfaces(网络ip,dhcp的就可以不要修改), /boot/grub/menu.lst(多数不要修改,除开目标机器有其他不同的系统), 然后就是显卡和声卡(这个我以前写过),硬件的驱动。
Laughing

fonts 星期二, 03月 21st, 2006

[ Embarrased 心情: Embarrased ]
把/usr/share/fonts/下面清理了。把中文字体放到~/install/fonts/下面。然后执行

代码:
/usr/share/fonts$ ln -s ~/install/fonts/
/usr/share/fonts$ sudo fc-cache -f -v

使用英文路径的原因是,abiword里面带中文路径的字体都用不了。系统字体设置那里现在死活不出圆体的预览了,刷出了的文泉译字体连看也看不到。就是这2个字体,系统等于没有。

另外一台,路径又带了中文,圆体的abiword认到。系统字体还是认不到。中文字体名的就都认不到。

dapper安装经历 星期一, 03月 13th, 2006

dapper安装经历

从breezy升级到dapper。嫌主页的源慢了。等了1个小时还只有10%。自作聪明,修改为cn99的地址,升级完,再改回主页的升级地址,看到就只有60k的下载量了。没想到,不进入X。最重要的是提示内核版本不支持pppoe和提示vi命令没有,系统还调侃的说“你是不是在使用2.4.x的内核“,吐血。
下载了dapper flight 5,安装界面清晰。为了避免少安装一些软件,在分区时,选择了不格式化原来的/目录。想起installer会只是覆盖文件。不曾想,输入用户名等以后,安装基本系统提示失败。只好退回到分区的那一个步骤,设置为格式化/分区。安装完成,gdm登录,提示用户名或者密码不对。只好reboot,进入recovery mode。还从来没有命令行下处理过用户。记得有useradd和adduser命令,找了一下,看了man。执行“useradd exp -g exp“,以为系统缺省建立了用户的其他信息。到正常模式的gdm,登录不上。又找到usermod,执行“usermod exp -G gdm,exp”。提示不认识group名,只好一个一个分开添加到组。到正常模式的gdm,还是不行。回recovery mode。配置好pppoeconf。突发奇想,输入了irc,竟然有此命令。接着一个一个猜,/connect irc.freenode.net,幸好知道/join #ubuntu-cn,还在<status>状态下用/echo发了半天,没一个人回答,才发现其实还没有连接到房间。再来一次,连接上了。问了好些问题,一直不能加入其他的组,还手动修改了/etc/group文件也没用(增加了sudo:x:27:exp这样的格式),但终于把用户搞好了,到gdm登录成功。进入X,以为正常了,执行“usermod exp -G sudo”,然后依次加入“adm, dialout, cdrom, floppy, audio, dip, video, plugdev, lpadmin, scanner, admin”。结果发现好多软件还是提示“The underlying authorization mechanism (sudo) does not allow you to run this program. Contact the system administrator.”。终端的提示符串还是“sh-3.1”,ping ip可以,但是dns没设置,gaim等都不动。又回到recovery mode。设置/etc/resolv.conf。这下竟然root都不能使用dns了。比较痛苦啊。
崽崽醒了,一急,干脆重装了。执行了pppoeconf,修改/etc/apt/sources.list,把universe的行都加上,update,安装scim-chinese,会话-启动里面添加scim,本来在这个步骤应该先删除一些不用的软件的,竟然忘记了,接着执行了upgrade。
字体我都是设置为courier的。dapper显示的字体够黑,还不错。源没有opera,还要去找。等我写完这些。upgrade还在配置,刷新字头缓冲,这里太慢了。幸好启动很快。本来就是冲着快才升级的。
修改了以下启动,sysv-rc-conf:bluez-uti,2-5; laptop-mo,2-5; lvm,0-s; mdadm,2-5; mdadm-raid,0-s; pcmcia*,s; hplip,2-5;
//—————
CSD1220520 6641672447
//—————
好多人问播放的问题。加到这里算了。
totem-xine:
播放mp3,需要libxine-extracodecs
其他的视频,还是w32codecs

源的说明
# The Opera browser (packages)
deb http://deb.opera.com/opera etch non-free

# (00:24:00) AnThOnYhO: 这三个是w32codecs的源
deb ftp://ftp.nerim.net/debian-marillat/ sarge main
deb ftp://ftp.nerim.net/debian-marillat/ sid main
deb ftp://ftp.nerim.net/debian-marillat/ etch main

7个月 星期三, 03月 8th, 2006

学步车上


–>

7个月 星期三, 03月 8th, 2006

Laughing


–>