寻觅生命中的那一片浅草......

文章带标签 Linux

ubuntu添加dvd光盘源

操作系统:ubuntu 9.04

准备:光驱、DVD光盘 | dvd的iso镜像文件

ubuntu的dvd包含了很多软件,但安装系统的时候默认并没有安装,限于网络的缘故(网络安装通常都比本地安装慢的多),如果你的网络不好,将DVD作为源是一种不错的选择。如果你刻录了DVD光盘并且你的电脑安装有dvd光驱,或者你没有iso镜像,请接下去看方案一。如果你有iso文件,也不希望经常使用光驱,可以直接跳到方案二。

方案一:使用DVD光盘

首先把你的光盘放入光驱,待光驱读取一段时间自动挂载后,打开终端,执行:
$ sudo apt-cdrom -m -d /media/cdrom0 add

执行结果如下:
现把 /media/ubuntu-9.04-dvd/ 作为了 CD-ROM 的挂载点
正在鉴别.. [6c9fa028a2a77a6a3b571ccefb68b9ea-2]
正在光盘中查找索引文件..
找到了 2 个软件包索引、0 个源代码包索引、0 个翻译索引和 1 个数字签名
这张光盘现在的名字是:
“Ubuntu 9.04 _Jaunty Jackalope_ – Release i386 (20090421.3)”
正在复制软件包列表……gpgv: 于 2009年04月22日 星期三 03时02分02秒 CST 创建的签名,使用 DSA,钥匙号 FBB75451
gpgv: 完好的签名,来自于“Ubuntu CD Image Automatic Signing Key <cdimage@ubuntu.com>”
Reading Package Indexes… 完成
正在写入新的软件包源列表
对应于该光盘的软件包源设置项是:
deb cdrom:[Ubuntu 9.04 _Jaunty Jackalope_ – Release i386 (20090421.3)]/ jaunty main restricted
请对您的光盘套件中的其它光盘重复相同的操作。
W: Skipping non-exisiting file /media/ubuntu-9.04-dvd/dists/jaunty/main/binary-i386/Packages
W: Skipping non-exisiting file /media/ubuntu-9.04-dvd/dists/jaunty/main/debian-installer/binary-i386/Packages
W: Skipping non-exisiting file /media/ubuntu-9.04-dvd/dists/jaunty/restricted/binary-i386/Packages

然后执行:sudo apt-get update 就可以安装你想要到软件了。

注意,执行完成后查看/etc/apt/sources.list文件,确保文件如下一行在文件顶部或者在网络源前面,否者,安装软件的时候系统还是优先从网络上下载。

deb cdrom:[Ubuntu 9.04 _Jaunty Jackalope_ – Release i386 (20090421.3)]/ jaunty main restricted

方案二:使用iso镜像

首先,你必须先挂载你的iso镜像文件。

$ sudo mount -o loop -t iso9660 /…/ubuntu-9.04-dvd-i386.iso /media/cdrom0/ (红色部分为你的iso文件的绝对路径)

$ sudo apt-cdrom -m -d /media/cdrom0 add

这样就同方案一显示的一样。推荐使用方案二,一来操作方便,二来可以减少光驱的使用次数,延长其寿命。

转自:http://stulog.com/?post=5

rsync_error_deflate

Today I check synchronization status of my backup files.There is three files are not synchronizing.I type the rsync command manually to see what happend.

rsync -vazu –password-file=/etc/my.pass rsy@192.168.1.130::db_backup /data/backup/

it shows these errors:

deflate on token returned 0 (12912 bytes left)
rsync error: error in rsync protocol data stream (code 12) at token.c(274)
rsync: connection unexpectedly closed (347 bytes received so far) [receiver]
rsync error: error in rsync protocol data stream (code 12) at io.c(463) [receiver=2.6.8]
rsync: connection unexpectedly closed (327 bytes received so far) [generator]
rsync error: error in rsync protocol data stream (code 12) at io.c(463) [generator=2.6.8]

After some googles,I find that There is something wrong with the last file in local directory.
Then I delete the last file in local directory and run the rsync command again.It works.All files are synchronizing.

References:
http://www.linuxsir.org/bbs/showthread.php?t=201042

2010-09-14
I can’t believe that the problem happens again.There is two files are not synchronizing.
I search this error “deflate on token returned” in google.I find this URL.
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=50248
It’s very helpful.According to this article,that guy also get “deflate on token returned” error when he use “rsync -z” to deal with a 2GB big file
All my files are nearly 7GB.Maybe the “-z” option make rsync crash.
When I run “rsync -vau –password-file=/etc/my.pass rsy@192.168.1.130::db_backup /data/backup/”,it works.
At last, I remove -z from my rsync scripts.

Bypass a fsck during boot

Today,I reboot my CentOS box,It show some errors:

An error occurred during the file system check.
Dropping you to a shell;the system will reboot
when you leave the shell.
Give root password for maintenance
(or type Control-D to continue):

I know what cause this:Yesterday, I remove one partition, but I didn’t remove it from /etc/fstab

I don’t know the root’s password.so what only I can do is clicking Ctl+D,then the system reboot.

During the boot procedure,I edit the grub boot menu, add “single” at the end of kernel line.
After editing, it look likes ” kernel /vmlinuz-2.6.18-92.1.22.el5 ro root=LABEL=/ single”

I think the system will boot into single user mode.But unfortunately,it show the same errors.

I google with “boot ignore system check”,and I find an useful article.It shows that we can
put fastboot at the end of the kernel line.

In the end it should look as follow:
kernel /vmlinuz-2.6.18-92.1.22.el5 ro root=LABEL=/ fastboot

Greate!It works.

I ssh to the server and remove the old partition from /etc/fstab

OK,the article’s URL is http://www.cyberciti.biz/faq/linux-unix-bypassing-fsck/

http://www.cyberciti.biz/ is a great website,it contains many tips on linux,also it contains many shell scripts makes your system administration work easy.You must add it to your Favorite。

MySQL:how to ignore errors loading a dump

When we load a dump sql file using the following command:
mysql -uroot -pdbpassword test < /data/mysql.sql
the procedure will stop as it detects an error.
How to make procedure ignore the errors and continue anyway?
There are two kinds of methond can do that.

The first one:use “-f” option
mysql -uroot -pdbpassword -f test < /data/mysql.sql

The second one:access into mysql,and use the “source” command.
mysql -uroot -pdbpassword test
source /data/mysql.sql
exit

References:

http://forums.mysql.com/read.php?28,78316,78316

Using Ketchup to manage your kernel sources

Today I discovered Ketchup, a little command-line tool to manage your Linux kernel sources. If you’re one of the weirdos, who is still compiling his kernel manually for whatever reason (like I do), I can only recommend it. Ketchup nicely eases up the entire process of checking for updates and applying them to your system.

Let’s not hesitate and look at few usage examples… Want to know what’s the latest version of a particular kernel-tree?

$ ketchup -s 2.6

2.6.17.7

$ ketchup -s 2.6-mm

2.6.18-rc1-mm2

Let’s play with your kernel sources a bit. First of all, you surely want to check what version you currently got lying around…

$ cd /usr/src/linux

$ ketchup -m

2.6.17.6

Let’s assume there is a newer kernel version available and you want to download it, bunzip it, revert the old patch and apply the new one. Nothing easier than that:

# cd /usr/src/linux

# ketchup 2.6-tip

2.6.17.6 -> 2.6.17.7

Applying patch-2.6.17.6.bz2 -R

Applying patch-2.6.17.7.bz2

That’s really it. It will download the patches, revert and apply them, so all you will have to do is watch and wait

Switching to an entirely different kernel versions is just as easy:

# cd /usr/src/linux

# ketchup 2.6.16.2

Final note: If Ketchup should abort with a gpg error, then it couldn’t verify the patch’s or kernel’s signature. Either add the 2.6 public key to your keyring (this is the proper solution) or call Ketchup with an additional -G parameter (this will override signature checking). I’d suggest the former, which is really easy to do by downloading it from a public pgp server:

# gpg –keyserver wwwkeys.pgp.net –recv-keys 0x517D0F0E

Have fun compiling,

muesli

From:http://amarok.kde.org/blog/archives/199-Using-Ketchup-to-manage-your-kernel-sources.html

2025年五月
« 5月    
 1234
567891011
12131415161718
19202122232425
262728293031