<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>刘荣星的博客</title>
	<atom:link href="http://www.liurongxing.com/feed" rel="self" type="application/rss+xml" />
	<link>http://www.liurongxing.com</link>
	<description>关注Linux,记录自己成长点滴。</description>
	<lastBuildDate>Thu, 17 May 2012 02:06:29 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Ubuntu12.04无法使用vim系统剪贴板解决方法</title>
		<link>http://www.liurongxing.com/ubuntu-system-vim-to-use-the-system-clipboard.html</link>
		<comments>http://www.liurongxing.com/ubuntu-system-vim-to-use-the-system-clipboard.html#comments</comments>
		<pubDate>Wed, 09 May 2012 09:21:27 +0000</pubDate>
		<dc:creator>JavasBoy</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://www.liurongxing.com/?p=1236</guid>
		<description><![CDATA[以前一直是用鼠标来复制和粘贴网页里复制的文字，还有使用Ctrl+Shift+C/V.也查过在vim里怎么使用复制粘贴，只学会了用dd和p这两个。哎，笨呐。 今天终于理解了vim里多个剪贴板的使用。:reg查看VIM里所有剪贴板的文件。但是我这个Ubuntu12.04就没+和×。解决方法是安装以下这几包。我是又重装了一下vim。 1 问题来源 用 apt-get install安装的vim不能使用系统剪贴板，即复制：”+y，和粘贴”+p不能用；用:reg 命令查看没有”+寄存器 2 软件版本 操作系统：ubuntu 12.04；vim版本 7.3.429 3 安装过程 3.1 安装相关软件包 3.2 安装vim 设置映射： let mapleader = “,” let g:mapleader = “,” map c “+y map p “*p 请现在使用一下“:reg”命令（先按ESC 键，退出编辑模式，然后按:进入命令模式，然后输入reg回车），看到了？屏幕上的输出结果！是不是特别眼熟，对了！就是您之前复制过的所有内容！也许这 时候您还发现，VIM的剪切板原来有这么多个，按照数字还有符号一个一个的区分开的，这里举一个编号的例子——”5，看到了吗？是以”开头的。还有！有没 有看到编号为”+的剪切板？里面的内容是不是刚才你在浏览器里复制的那段文字啊？呵呵……没错了！系统剪切板的编号就是”+。 好了， 这时候您已经知道了如何查看之前的所有剪贴板内容，我们现在就试着把某一个特定剪切板的内容复制进我们正在编辑的文件中。我们知道，vi的粘贴指令是 “p”，但是如果要粘贴一个特定的剪贴板，只是用p就不行了，那怎么办？简单！把剪贴板的编号带上不就可以了？现在先按ESC，退出编辑模式，然后一词 按”+p这三个字符（怎么按？不会吧！”和+怎么按？用Shift啊！），好了！你看看，之前在浏览器中复制的这段文本，是不是被粘贴进文档中了？ 如何将系统剪切板里的内容复制进VIM当中，您已经清楚了。那如何将ViM中复制的字符粘贴到其他地方呢？很简单，我们只需要把要复制的文字，复制 进”+剪切板不就可以了？（”+剪切板是系统剪切板，忘记了？）在VIM中，复制的指令是y（在非编辑模式下按y就可以了），那要将文本复制进指定的剪切 板，和粘贴指定剪切板内容的方法一样，只需要加上剪切板的编号就可以了。举个例子，我们希望把VIM中的一段文本复制下来，然后粘贴到浏览器的地址栏中： 第一步，现把需要复制的文字选中（非编辑模式下），然后在键盘上依次按”+y这三个字符，OK！已经复制下来了，现在用:reg命令看看，是不是在”+剪 切板中了？]]></description>
			<content:encoded><![CDATA[<p>以前一直是用鼠标来复制和粘贴网页里复制的文字，还有使用Ctrl+Shift+C/V.也查过在vim里怎么使用复制粘贴，只学会了用dd和p这两个。哎，笨呐。<br />
今天终于理解了vim里多个剪贴板的使用。:reg查看VIM里所有剪贴板的文件。但是我这个Ubuntu12.04就没+和×。解决方法是安装以下这几包。我是又重装了一下vim。</p>
<p>1 问题来源</p>
<p>用 apt-get install安装的vim不能使用系统剪贴板，即复制：”+y，和粘贴”+p不能用；用:reg 命令查看没有”+寄存器</p>
<p>2 软件版本</p>
<p>操作系统：ubuntu 12.04；vim版本 7.3.429</p>
<p>3 安装过程</p>
<p>3.1 安装相关软件包</p>
<pre class="brush: bash; title: ; notranslate">$ sudo apt-get install build-essential
$ sudo apt-get install ncurses-dev
$ sudo apt-get install xorg-dev
$ sudo apt-get install libgtk2.0-dev</pre>
<p>3.2 安装vim</p>
<pre class="brush: bash; title: ; notranslate">sudo apt-get install vim vim-scripts vim-gnome vim-gtk
sudo apt-get install exuberant-ctags cscope</pre>
<p>设置映射： </p>
<p>let mapleader = “,”<br />
let g:mapleader = “,”</p>
<p>map <leader>c “+y<br />
map <leader>p “*p</p>
<p>请现在使用一下“:reg”命令（先按ESC 键，退出编辑模式，然后按:进入命令模式，然后输入reg回车），看到了？屏幕上的输出结果！是不是特别眼熟，对了！就是您之前复制过的所有内容！也许这 时候您还发现，VIM的剪切板原来有这么多个，按照数字还有符号一个一个的区分开的，这里举一个编号的例子——”5，看到了吗？是以”开头的。还有！有没 有看到编号为”+的剪切板？里面的内容是不是刚才你在浏览器里复制的那段文字啊？呵呵……没错了！系统剪切板的编号就是”+。</p>
<p>好了， 这时候您已经知道了如何查看之前的所有剪贴板内容，我们现在就试着把某一个特定剪切板的内容复制进我们正在编辑的文件中。我们知道，vi的粘贴指令是 “p”，但是如果要粘贴一个特定的剪贴板，只是用p就不行了，那怎么办？简单！把剪贴板的编号带上不就可以了？现在先按ESC，退出编辑模式，然后一词 按”+p这三个字符（怎么按？不会吧！”和+怎么按？用Shift啊！），好了！你看看，之前在浏览器中复制的这段文本，是不是被粘贴进文档中了？</p>
<p>如何将系统剪切板里的内容复制进VIM当中，您已经清楚了。那如何将ViM中复制的字符粘贴到其他地方呢？很简单，我们只需要把要复制的文字，复制 进”+剪切板不就可以了？（”+剪切板是系统剪切板，忘记了？）在VIM中，复制的指令是y（在非编辑模式下按y就可以了），那要将文本复制进指定的剪切 板，和粘贴指定剪切板内容的方法一样，只需要加上剪切板的编号就可以了。举个例子，我们希望把VIM中的一段文本复制下来，然后粘贴到浏览器的地址栏中： 第一步，现把需要复制的文字选中（非编辑模式下），然后在键盘上依次按”+y这三个字符，OK！已经复制下来了，现在用:reg命令看看，是不是在”+剪 切板中了？</p>
]]></content:encoded>
			<wfw:commentRss>http://www.liurongxing.com/ubuntu-system-vim-to-use-the-system-clipboard.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Linux下vi和vim不正常的解决方法</title>
		<link>http://www.liurongxing.com/linux-vi-vim.html</link>
		<comments>http://www.liurongxing.com/linux-vi-vim.html#comments</comments>
		<pubDate>Wed, 09 May 2012 04:39:40 +0000</pubDate>
		<dc:creator>JavasBoy</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[vi]]></category>

		<guid isPermaLink="false">http://www.liurongxing.com/?p=1233</guid>
		<description><![CDATA[用vi编辑文件遇到各种说不出的问题，按i插入移动一下光标，中文字就变乱码鸟，反正是各种不正常。以为是vi的问题，卸载重装了还是一样，那就是编码的问题了，因为我上传的都是UTF-8的文件，在其它linux上都是好的。 用在我这台的解决方法是： 编辑/etc/vimrc文件： 上面的意思是使vi同时支持GBK和UTF-8编码 操作系统语言是英文，显示中文字符 编辑/etc/sysconfig/i18n，修改为如下内容： 以下是网上找的，记录一下。 1、支持中文编码的基础 Vim要更好地支持中文编码需要两个特性：+multi_byte和+iconv，可以用&#124;:version&#124;命令检查当前使用的Vim是否支持，否则的话需要重新编译。 2、影响中文编码的设置项 Vim中有几个选项会影响对多字节编码的支持： encoding（enc）：encoding是Vim的内部使用编码，encoding的设置会影响Vim内部的Buffer、消息文字等。在 Unix环境下，encoding的默认设置等于locale；Windows环境下会和当前代码页相同。在中文Windows环境下encoding的 默认设置是cp936（GBK）。 fileencodings（fenc）：Vim在打开文件时会根据fileencodings选项来识别文件编码，fileencodings可以同时设置多个编码，Vim会根据设置的顺序来猜测所打开文件的编码。 fileencoding（fencs） ：Vim在保存新建文件时会根据fileencoding的设置编码来保存。如果是打开已有文件，Vim会根据打开文件时所识别的编码来保存，除非在保存时重新设置fileencoding。 termencodings（tenc）：在终端环境下使用Vim时，通过termencoding项来告诉Vim终端所使用的编码。 3、Vim中的编码转换 Vim内部使用iconv库进行编码转换，如果这几个选项所设置的编码不一致，Vim就有可能会转换编码。打开已有文件时会从文件编码转换到 encoding所设置的编码；保存文件时会从encoding设置的编码转换到fileencoding对应的编码。经常会看到Vim提示[已转换]，这是表明Vim内部作了编码转换。终端环境下使用Vim，会从termencoding设置的编码转换到encoding设置的编码。 可以用&#124;:help encoding-values&#124;列出Vim支持的所有编码。 4、具体应用环境的设置 只编辑GBK编码的文件 set fileencodings=cp936 set fileencoding=cp936 set encoding=cp936 只编辑UTF-8编码的中文文件 set fileencodings=utf-8 set fileencoding=utf-8 set encoding=cp936 或者 set encoding=utf-8 同时支持GBK和UTF-8编码 set fileencodings=ucs-bom,utf-8,cp936 set fileencoding=utf-8 set encoding=cp936 或者 set encoding=utf-8 如果在终端环境下使用Vim，需要设置termencoding和终端所使用的编码一致。例如： set termencoding=cp936 或者 [...]]]></description>
			<content:encoded><![CDATA[<p>用vi编辑文件遇到各种说不出的问题，按i插入移动一下光标，中文字就变乱码鸟，反正是各种不正常。以为是vi的问题，卸载重装了还是一样，那就是编码的问题了，因为我上传的都是UTF-8的文件，在其它linux上都是好的。</p>
<p>用在我这台的解决方法是：<br />
编辑/etc/vimrc文件：</p>
<pre class="brush: bash; title: ; notranslate">vim /etc/vimrc</pre>
<pre class="brush: bash; title: ; notranslate">set encoding=utf-8
set langmenu=zh_CN.UTF-8
language message zh_CN.UTF-8</pre>
<p>上面的意思是使vi同时支持GBK和UTF-8编码</p>
<p>操作系统语言是英文，显示中文字符</p>
<p>编辑/etc/sysconfig/i18n，修改为如下内容：</p>
<pre class="brush: bash; title: ; notranslate">LANG=&quot;zh_CN.UTF-8&quot;</pre>
<p><span id="more-1233"></span><br />
以下是网上找的，记录一下。</p>
<p>1、支持中文编码的基础</p>
<p>Vim要更好地支持中文编码需要两个特性：+multi_byte和+iconv，可以用|:version|命令检查当前使用的Vim是否支持，否则的话需要重新编译。</p>
<p>2、影响中文编码的设置项</p>
<p>Vim中有几个选项会影响对多字节编码的支持：</p>
<p>    encoding（enc）：encoding是Vim的内部使用编码，encoding的设置会影响Vim内部的Buffer、消息文字等。在 Unix环境下，encoding的默认设置等于locale；Windows环境下会和当前代码页相同。在中文Windows环境下encoding的 默认设置是cp936（GBK）。<br />
    fileencodings（fenc）：Vim在打开文件时会根据fileencodings选项来识别文件编码，fileencodings可以同时设置多个编码，Vim会根据设置的顺序来猜测所打开文件的编码。<br />
    fileencoding（fencs） ：Vim在保存新建文件时会根据fileencoding的设置编码来保存。如果是打开已有文件，Vim会根据打开文件时所识别的编码来保存，除非在保存时重新设置fileencoding。<br />
    termencodings（tenc）：在终端环境下使用Vim时，通过termencoding项来告诉Vim终端所使用的编码。</p>
<p>3、Vim中的编码转换</p>
<p>Vim内部使用iconv库进行编码转换，如果这几个选项所设置的编码不一致，Vim就有可能会转换编码。打开已有文件时会从文件编码转换到 encoding所设置的编码；保存文件时会从encoding设置的编码转换到fileencoding对应的编码。经常会看到Vim提示[已转换]，这是表明Vim内部作了编码转换。终端环境下使用Vim，会从termencoding设置的编码转换到encoding设置的编码。</p>
<p>可以用|:help encoding-values|列出Vim支持的所有编码。</p>
<p>4、具体应用环境的设置</p>
<p>    只编辑GBK编码的文件</p>
<p>    set fileencodings=cp936<br />
    set fileencoding=cp936<br />
    set encoding=cp936</p>
<p>    只编辑UTF-8编码的中文文件</p>
<p>    set fileencodings=utf-8<br />
    set fileencoding=utf-8<br />
    set encoding=cp936 或者 set encoding=utf-8</p>
<p>    同时支持GBK和UTF-8编码</p>
<p>    set fileencodings=ucs-bom,utf-8,cp936<br />
    set fileencoding=utf-8<br />
    set encoding=cp936 或者 set encoding=utf-8</p>
<p>    如果在终端环境下使用Vim，需要设置termencoding和终端所使用的编码一致。例如：</p>
<p>    set termencoding=cp936 或者 set termencoding=utf-8</p>
<p>Windows记事本编辑UTF-8编码文件时会在文件头上加上三个字节的BOM：EFBBBF。如果fileencodings中设 置ucs-bom的目的就是为了能够兼容用记事本编辑的文件，不需要的话可以去掉。Vim在保存UTF-8编码的文件时会去掉BOM。去掉BOM的最大好 处是在Unix下能够使用cat a b>c来正确合并文件，这点经常被忽略。</p>
<p>5、FAQ</p>
<p>    为什么在Vim中一次只能删除半个汉字？</p>
<p>    因为encoding设置错误，把encoding设置为cp936就可以解决此问题。在Unix环境下Vim会根据locale来设置默认的encoding，如果没有正确设置locale并且没有设置encoding就会一次只能删除半个汉字。<br />
    VIM为什么不能输入繁体字？</p>
<p>    把euc-cn或者GB2312改为cp936就可以了。euc-cn是GB2312的别名，不支持繁体汉字。cp936是GBK的别名，是GB2312的超集，可以支持繁体汉字。<br />
    VIM为什么提示不能转换？</p>
<p>    因为在编译Vim时没有加入iconv选项，重新编译Vim才能解决。<br />
    如何打开一个GBK编码的文件并另存为UTf-8编码？</p>
<p>    保存文件时运行命令|:set fileencoding=utf-8|就可以了。</p>
<p>SSH,telnet终端中文显示乱码解决办法 (CentOS）<br />
2011.12.26 5 Comments</p>
<p>方法一：配置SSH工具 SecureCRT中文版配置 [全局选项]→[默认会话]→[编辑默认设置]→[终端]→[外观]→[字体]→[新宋体 10pt CHINESE_GB2312]→[字符编码 UTF-8]<br />
如果经常使用，把这些设置保存在session里面。</p>
<p>打开putty，登录成功后，在shell中输入:export LC_ALL=&#8217;zh_CN.utf8&#8242;</p>
<p>方法二：配置系统</p>
<p>操作系统语言是中文，显示中文字符</p>
<p>编辑/etc/sysconfig/i18n，修改为如下内容：</p>
<p>LANG=”zh_CN.GB2312&#8243;</p>
<p>SUPPORTED=”zh_CN.UTF-8:zh_CN:zh”</p>
<p>SYSFONT=”latarcyrheb-sun16&#8243;</p>
<p>或者</p>
<p>LANG=zh_CN.GB18030</p>
<p>LANGUAGE=zh_CN.GB18030:zh_CN.GB2312:zh_CN</p>
<p>export LANG LANGUAGE</p>
<p>这样就能在终端输入和显示中文了，并且shell脚本里原本的中文显示乱码问题也解决了。</p>
<p>操作系统语言是英文，显示中文字符</p>
<p>编辑/etc/sysconfig/i18n，修改为如下内容：</p>
<p>LANG=”en_US”</p>
<p>SUPPORTED=”en_US.UTF-8:en_US:en”</p>
<p>SYSFONT=”latarcyrheb-sun16&#8243;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.liurongxing.com/linux-vi-vim.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>解决end_request I/O error on device fd0,sector 0 Buffer I/O error on device fd0,logical block 0</title>
		<link>http://www.liurongxing.com/end_request-io-error-on-device-fd0sector-0-buffer-io-error-on-device-fd0logical-block-0.html</link>
		<comments>http://www.liurongxing.com/end_request-io-error-on-device-fd0sector-0-buffer-io-error-on-device-fd0logical-block-0.html#comments</comments>
		<pubDate>Tue, 08 May 2012 16:44:00 +0000</pubDate>
		<dc:creator>JavasBoy</dc:creator>
				<category><![CDATA[Archlinux]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[双系统]]></category>

		<guid isPermaLink="false">http://www.liurongxing.com/?p=1223</guid>
		<description><![CDATA[以前刚装好Archlinux的时候就发现了，切换到tty1 2 3 4 下面就一直出现下面两行的error提示 end_request I/O error on device fd0,sector 0 Buffer I/O error on device fd0,logical block 0 后来一直也没管它，偶尔开机后还会卡住gonme进不去，我还一直以为是我的USB摄像头的问题呢！ 今天下定决心要把它搞定。用心google了一把，问题出现在fd0上面，也就是floppy上面，这个floppy也就是软驱，话说从我开始玩电脑起就没用过这玩意。虽然表哥送的电脑有软驱。 查看是否加载了floppy模块： 如果显示像下面这行说明加载了floppy模块。 在ArchWiKi里查到禁用软驱模块的方法有几种： Kernel modules (简体中文) 黑名单 对内核模块来说，黑名单是指禁止某个模块装入的机制。当对应的硬件不存在或者装入某个模块会导致问题时很有用。 有些模块作为 initramfs 的一部分装入。 mkinitcpio -M 会显示所有自动检测到到模块：要阻止 initramfs 装入某些模块，可以在 /etc/modprobe.d/modprobe.conf 中将它们加入黑名单。 运行 mkinitcpio -v 会显示各种钩子(例如 filesystem 钩子, SCSI 钩子等)装入的模块。如果要禁用这些模块，记得在配置完成后重新生成 initramfs。 使用 /etc/modprobe.d/ 中的文件 在 /etc/modprobe.d/ 中创建 [...]]]></description>
			<content:encoded><![CDATA[<p>以前刚装好Archlinux的时候就发现了，切换到tty1 2 3 4 下面就一直出现下面两行的error提示<br />
end_request I/O error on device fd0,sector 0<br />
Buffer I/O error on device fd0,logical block 0<br />
后来一直也没管它，偶尔开机后还会卡住gonme进不去，我还一直以为是我的USB摄像头的问题呢！</p>
<p>今天下定决心要把它搞定。用心google了一把，问题出现在fd0上面，也就是floppy上面，这个floppy也就是软驱，话说从我开始玩电脑起就没用过这玩意。虽然表哥送的电脑有软驱。<br />
查看是否加载了floppy模块：</p>
<pre class="brush: bash; title: ; notranslate">#lsmod | grep -i floppy</pre>
<p>如果显示像下面这行说明加载了floppy模块。</p>
<pre class="brush: bash; title: ; notranslate">floppy                 95465  0</pre>
<p>在ArchWiKi里查到禁用软驱模块的方法有几种：<br />
<a href="https://wiki.archlinux.org/index.php/Kernel_modules_(简体中文)" title="Kernel modules (简体中文)" target="_blank">Kernel modules (简体中文)</a><br />
<strong>黑名单</strong><br />
对内核模块来说，黑名单是指禁止某个模块装入的机制。当对应的硬件不存在或者装入某个模块会导致问题时很有用。</p>
<p>有些模块作为 <a title="Initramfs" href="https://wiki.archlinux.org/index.php/Initramfs">initramfs</a> 的一部分装入。</p>
<p><code>mkinitcpio -M</code> 会显示所有自动检测到到模块：要阻止 initramfs 装入某些模块，可以在 <code>/etc/modprobe.d/modprobe.conf</code> 中将它们加入黑名单。</p>
<p>运行 <code>mkinitcpio -v</code> 会显示各种钩子(例如 filesystem 钩子, SCSI 钩子等)装入的模块。如果要禁用这些模块，记得在配置完成后重新生成 initramfs。<br />
<strong>使用 /etc/modprobe.d/ 中的文件</strong><br />
在 <code>/etc/modprobe.d/</code> 中创建 <code>.conf</code> 文件，使用 <code>blacklist</code> 关键字屏蔽不需要的模块，例如如果不想装入 <code>pcspkr</code> 模块：</p>
<pre>/etc/modprobe.d/nobeep.conf
# Do not load the pcspkr module on boot
blacklist pcspkr</pre>
<div><strong> 注意: </strong><code>blacklist</code> 命令将屏蔽一个模板，所有不会自动装入，但是如果其它非屏蔽模块需要这个模块，系统依然会装入它。</div>
<p>要避免这个行为，可以让 modprobe 使用自定义的 <code>install</code> 命令，直接返回导入失败：</p>
<pre>/etc/modprobe.d/blacklist.conf
...
install MODULE /bin/false
...</pre>
<p>这样就可以 “屏蔽” 模块及所有依赖它的模块。<br />
<strong>使用内核命令行</strong><br />
同样可以通过内核命令行(位于 <a title="GRUB" href="https://wiki.archlinux.org/index.php/GRUB">GRUB</a>、<a title="LILO" href="https://wiki.archlinux.org/index.php/LILO">LILO</a> 或 <a title="Syslinux" href="https://wiki.archlinux.org/index.php/Syslinux">Syslinux</a>)禁用模块：</p>
<pre>modprobe.blacklist=modname1,modname2,modname3</pre>
<p>或者:</p>
<pre>modname.disable=1</pre>
<p>当某个模块导致系统无法启动时，可以使用此方法禁用模块。<br />
<strong>使用 GRUB 的示例</strong></p>
<pre>/boot/grub/menu.lst
...
kernel /vmlinuz-linux root=/dev/sda1 modprobe.blacklist=pcspkr,ipv6 ro
...
/boot/grub/menu.lst
...
kernel /vmlinuz-linux root=/dev/sda1 pcspkr.disable=1 ipv6.disable=1 ro
...</pre>
<p>我使用的方法是在/boot/grub/menu.lst里面加上modprobe.blacklist=floppy<br />
打开编辑/boot/grub/menu.lst文件</p>
<pre class="brush: bash; title: ; notranslate">vim /boot/grub/menu.lst</pre>
<pre class="brush: bash; title: ; notranslate">...
kernel /vmlinuz-linux root=/dev/sda1 modprobe.blacklist=floppy ro ...
...</pre>
<p>修改完保存重启系统</p>
<p># reboot</shell></p>
]]></content:encoded>
			<wfw:commentRss>http://www.liurongxing.com/end_request-io-error-on-device-fd0sector-0-buffer-io-error-on-device-fd0logical-block-0.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CentOS DNS resolv重起无效的解决方法</title>
		<link>http://www.liurongxing.com/centos-dns-ifcfg-resolv.html</link>
		<comments>http://www.liurongxing.com/centos-dns-ifcfg-resolv.html#comments</comments>
		<pubDate>Tue, 08 May 2012 07:08:49 +0000</pubDate>
		<dc:creator>JavasBoy</dc:creator>
				<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://www.liurongxing.com/?p=1214</guid>
		<description><![CDATA[上上个星期重装安装了一台CentOS 6.2手动分配了一下ip地址，在/etc/resolv.conf这里设置好了DNS。之后可以上网鸟。重起机子后无后ping能网站了，打开/etc/resolv.conf发现又变回没测试之前的。 原来直接修改/etc/resolv.conf不行。必须要在/etc/sysconfig/network-scripts/ifcfg-eth0里面最后加上dns的设置。要不然，重启后，肯定使用eth0设置中没有设dns的相关信息，使/etc/resolv.conf恢复到原来的状态。 这样设置后/etc/resolv.conf里面根本就不需要设置。 service network restart后，可以发现/etc/resolv.conf里面就有两个dns的解析ip了。 DNS解析设置成功。 在此要强调一点的是，直接修改/etc/resolv.conf这个文件是没用的，网络服务重启以后会根据/etc/sysconfig/network-scripts/ifcfg-eth0来重载配置，如果ifcfg-eth0没有配置DNS，那么resolv.conf会被冲掉，重新变成空值。 哎，不知道为啥以前装的系统没有出现这样的情况呢？ 修改host文件 打开host文件 添加你需要的项，格式如下： 格式: 示例: 编辑后，你需要重新启动一下你的网络。]]></description>
			<content:encoded><![CDATA[<p>上上个星期重装安装了一台CentOS 6.2手动分配了一下ip地址，在/etc/resolv.conf这里设置好了DNS。之后可以上网鸟。重起机子后无后ping能网站了，打开/etc/resolv.conf发现又变回没测试之前的。</p>
<p>原来直接修改/etc/resolv.conf不行。必须要在/etc/sysconfig/network-scripts/ifcfg-eth0里面最后加上dns的设置。要不然，重启后，肯定使用eth0设置中没有设dns的相关信息，使/etc/resolv.conf恢复到原来的状态。</p>
<pre class="brush: bash; title: ; notranslate">vim /etc/sysconfig/network-scripts/ifcfg-eth0

DEVICE=eth0
BOOTPROTO=none
HWADDR=00:xx:19:xx:xx:xx
ONBOOT=yes
TYPE=Ethernet
USERCTL=no
IPV6INIT=no
PEERDNS=yes
NETMASK=255.255.255.0
IPADDR=xxx.xxx.xxx.xxx
GATEWAY=xxx.xxx.xxx.xxx
DNS1=202.96.209.5 #上海dns,根据实际情况更换
DNS2=202.96.209.133 #上海dns,根据实际情况更换</pre>
<p>这样设置后/etc/resolv.conf里面根本就不需要设置。<br />
service network restart后，可以发现/etc/resolv.conf里面就有两个dns的解析ip了。</p>
<pre class="brush: bash; title: ; notranslate">cat /etc/resolv.conf

Generated by NetworkManager
nameserver 202.96.209.5
nameserver 202.96.209.133
search localdomain</pre>
<p>DNS解析设置成功。<br />
在此要强调一点的是，直接修改/etc/resolv.conf这个文件是没用的，网络服务重启以后会根据/etc/sysconfig/network-scripts/ifcfg-eth0来重载配置，如果ifcfg-eth0没有配置DNS，那么resolv.conf会被冲掉，重新变成空值。</p>
<p>哎，不知道为啥以前装的系统没有出现这样的情况呢？</p>
<p><strong>修改host文件</strong><br />
打开host文件</p>
<pre class="brush: bash; title: ; notranslate">/etc/hosts</pre>
<p>添加你需要的项，格式如下：</p>
<p>格式:</p>
<pre class="brush: bash; title: ; notranslate">&lt;IP&gt; &lt;HOSTNAME&gt;.&lt;DOMAIN&gt; &lt;ALIAS&gt;</pre>
<p>示例:</p>
<pre class="brush: bash; title: ; notranslate">216.239.37.99 www.google.com</pre>
<p>编辑后，你需要重新启动一下你的网络。</p>
<pre class="brush: bash; title: ; notranslate">/etc/init.d/networking restart</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.liurongxing.com/centos-dns-ifcfg-resolv.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>use expect SSH Auto login</title>
		<link>http://www.liurongxing.com/expect-ssh-auto-login.html</link>
		<comments>http://www.liurongxing.com/expect-ssh-auto-login.html#comments</comments>
		<pubDate>Mon, 07 May 2012 14:56:44 +0000</pubDate>
		<dc:creator>JavasBoy</dc:creator>
				<category><![CDATA[Archlinux]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[脚本]]></category>
		<category><![CDATA[SSH]]></category>

		<guid isPermaLink="false">http://www.liurongxing.com/?p=1199</guid>
		<description><![CDATA[一、要安装这两个东东。 CentOS下 ArchLinux下 自动登了ssh脚本 &#160; chmod +x sshlogin.exp 二、实现开机自动登录到tty4。 以下是在ArchLinux上操作的，其它系统也差不多。 1、安装自动登录tty的软件 mingetty-1.08-3-x86_64 vi /etc/inittab 找到关于tty4的，在Archlinux里是c4:2345:respawn:/sbin/agetty&#8230;这样的一行改成 把javasboy换成你要登录的用户，且能运行上面脚本的权限。 2、在javasboy用户下的~/.bashrc里面加上： 这样tty4就能开机运行这个命令了。 还可以通过crond定时检测7070端口和ssh进程是否运行来重新启动，这样就能实现断线自动重连的功能了。 在此感谢SUN的无私帮助。]]></description>
			<content:encoded><![CDATA[<p><strong>一、要安装这两个东东。</strong><br />
CentOS下</p>
<pre class="brush: bash; title: ; notranslate">1
yum install tcl
tcl.x86_64 1:8.5.7-6.el6
2
yum install expect
expect.x86_64 0:5.44.1.15-2.el6</pre>
<p>ArchLinux下</p>
<pre class="brush: bash; title: ; notranslate">1
pacman -S tcl
2
pacman -S expect</pre>
<p>自动登了ssh脚本</p>
<pre class="brush: bash; title: ; notranslate">vim sshlogin.exp</pre>
<p>&nbsp;</p>
<pre class="brush: bash; title: ; notranslate">#!/usr/bin/expect -f
#auto ssh login

set timeout 20
spawn ssh -qTfnN -D 7070 你的登录用户@服务器ip地址

expect &quot;*password:&quot;
send &quot;you passwd\r&quot;
interact</pre>
<p><span style="color: #008000;">chmod +x sshlogin.exp</span><br />
<strong>二、实现开机自动登录到tty4。</strong><br />
以下是在ArchLinux上操作的，其它系统也差不多。<br />
1、安装自动登录tty的软件</p>
<pre class="brush: bash; title: ; notranslate">pacman -S mingetty</pre>
<p>mingetty-1.08-3-x86_64</p>
<p>vi /etc/inittab</p>
<p>找到关于tty4的，在Archlinux里是c4:2345:respawn:/sbin/agetty&#8230;这样的一行改成</p>
<pre class="brush: bash; title: ; notranslate">c4:23:respawn:/sbin/mingetty --autologin javasboy tty4</pre>
<p>把javasboy换成你要登录的用户，且能运行上面脚本的权限。<br />
2、在javasboy用户下的~/.bashrc里面加上：</p>
<pre class="brush: bash; title: ; notranslate">tty | grep -q tty4 &amp;&amp; /home/javasboy/bin/sshlogin.exp</pre>
<p>这样tty4就能开机运行这个命令了。</p>
<p>还可以通过crond定时检测7070端口和ssh进程是否运行来重新启动，这样就能实现断线自动重连的功能了。<br />
在此感谢SUN的无私帮助。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.liurongxing.com/expect-ssh-auto-login.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

