<?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>服务器安全维护工作室 &#187; 阿里云ECS编译升级VM内核到4.x</title>
	<atom:link href="https://www.fuwuqiok.com/tag/%e9%98%bf%e9%87%8c%e4%ba%91ecs%e7%bc%96%e8%af%91%e5%8d%87%e7%ba%a7vm%e5%86%85%e6%a0%b8%e5%88%b04-x/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.fuwuqiok.com</link>
	<description></description>
	<lastBuildDate>Sun, 01 Mar 2020 07:28:40 +0000</lastBuildDate>
	<language>zh-CN</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>https://wordpress.org/?v=4.2.26</generator>
	<item>
		<title>阿里云ECS编译升级VM内核到4.x</title>
		<link>https://www.fuwuqiok.com/%e9%98%bf%e9%87%8c%e4%ba%91ecs%e7%bc%96%e8%af%91%e5%8d%87%e7%ba%a7vm%e5%86%85%e6%a0%b8%e5%88%b04-x/</link>
		<comments>https://www.fuwuqiok.com/%e9%98%bf%e9%87%8c%e4%ba%91ecs%e7%bc%96%e8%af%91%e5%8d%87%e7%ba%a7vm%e5%86%85%e6%a0%b8%e5%88%b04-x/#comments</comments>
		<pubDate>Sun, 10 Jan 2016 13:14:08 +0000</pubDate>
		<dc:creator><![CDATA[admin]]></dc:creator>
				<category><![CDATA[服务器迁移]]></category>
		<category><![CDATA[系统安全代维]]></category>
		<category><![CDATA[网站代维]]></category>
		<category><![CDATA[服务器基础环境搭建]]></category>
		<category><![CDATA[阿里云ECS编译升级VM内核到4.x]]></category>

		<guid isPermaLink="false">https://www.fuwuqiok.com/?p=2859</guid>
		<description><![CDATA[<p>今天没事通过编译的方法，测试了一下centos7.x系统下降3.x内核升级到4.x，记录一下。以前阿里云的EC [&#8230;]</p>
<p><a rel="nofollow" href="https://www.fuwuqiok.com/%e9%98%bf%e9%87%8c%e4%ba%91ecs%e7%bc%96%e8%af%91%e5%8d%87%e7%ba%a7vm%e5%86%85%e6%a0%b8%e5%88%b04-x/">阿里云ECS编译升级VM内核到4.x</a>，首发于<a rel="nofollow" href="https://www.fuwuqiok.com">服务器安全维护工作室</a>。</p>
]]></description>
				<content:encoded><![CDATA[<p>今天没事通过编译的方法，测试了一下centos7.x系统下降3.x内核升级到4.x，记录一下。以前阿里云的ECS是不可以升级内核的，实际阿 里云centos5.8以上的系统，就支持yum升级内核了。只是内核升级是一件有风险的事情，特别是在定制的非标准硬件的云环境下，所以<a href="http://help.aliyun.com/knowledge_detail.htm?knowledgeId=5975061">阿里云ECS购买须知</a>也明确提醒，不要轻易升级内核。<br />
<span id="more-538"></span>操作有风险，请做好快照备份。下面是操作过程：</p>
<p>查看当前系统版本centos7.0；内核版本：3.10.0；</p>
<pre class="brush: shell; auto-links: false;">[root@iZ28yx1yevuZ ~]# lsb_release -a
LSB Version:    :core-4.1-amd64:core-4.1-noarch
Distributor ID: CentOS
Description:    CentOS Linux release 7.0.1406 (Core)
Release:        7.0.1406
Codename:       Core
[root@iZ28yx1yevuZ ~]# uname -r
3.10.0-123.9.3.el7.x86_64</pre>
<p><a href="https://www.fuwuqiok.com/wp-content/uploads/2016/01/1.png"><img class="attachment-medium" src="https://www.fuwuqiok.com/wp-content/uploads/2016/01/1.png" alt="1" width="484" height="130" /></a><br />
前往kernel.org下载目前最新的内核版本：</p>
<pre class="brush: shell; auto-links: false;">[root@iZ28yx1yevuZ ~]#wget https://www.kernel.org/pub/linux/kernel/v4.x/linux-4.1.6.tar.xz;mv linux-4.1.6.tar.xz /usr/src
[root@iZ28yx1yevuZ ~]#cd /usr/src;tar -xf linux-4.1.6.tar.xz</pre>
<div>解压压缩包，并通过make menuconfig方式编译，如下，出现报错：</div>
<div><a href="https://www.fuwuqiok.com/wp-content/uploads/2016/01/21.png"><img class="attachment-medium" src="https://www.fuwuqiok.com/wp-content/uploads/2016/01/21.png" alt="21" width="726" height="135" /></a></div>
<div></div>
<div>
<p>这是因为menuconfig需要ncurses-devel 支持，下面安装ncurses-devel后重新编译就可以了</p>
<pre class="brush: shell; auto-links: false;">root@iZ28yx1yevuZ ~]# yum install ncurses-devel -y</pre>
<div><a href="https://www.fuwuqiok.com/wp-content/uploads/2016/01/3.png"><img class="attachment-medium" src="https://www.fuwuqiok.com/wp-content/uploads/2016/01/3.png" alt="3" width="648" height="387" /></a></div>
<div></div>
<div>由于阿里云目前大部分机器还是xen环境的，所以阿里云环境下编译和普通系统相比，需要增加xen guest support，如下（menuconfig下如果找不到配置，可以个vi一样，通过”/”方式搜索）：</div>
<div>注意：这些模块需要built-in，也就是复选框内需要是*，而不是M</div>
<div></div>
<div>
<div>Processor type and features-&gt;Linux guest support-&gt;Xen guest support</div>
<div><a href="https://www.fuwuqiok.com/wp-content/uploads/2016/01/4.png"><img class="attachment-medium" src="https://www.fuwuqiok.com/wp-content/uploads/2016/01/4.png" alt="4" width="636" height="386" /></a></div>
<div> Device Drivers  —&gt; Block devices  —&gt; Xen virtual block device support<br />
Device Drivers  —&gt; Block devices  —&gt;  Xen block-device backend driver</div>
<div> <a href="https://www.fuwuqiok.com/wp-content/uploads/2016/01/5.png"><img class="attachment-medium" src="https://www.fuwuqiok.com/wp-content/uploads/2016/01/5.png" alt="5" width="650" height="375" /></a></div>
<div></div>
<div>
<div>Device Drivers  —&gt;Xen driver support  把下面的选项建议都选上</div>
</div>
<div></div>
<div><a href="https://www.fuwuqiok.com/wp-content/uploads/2016/01/6.png"><img class="attachment-medium" src="https://www.fuwuqiok.com/wp-content/uploads/2016/01/6.png" alt="6" width="638" height="372" /></a></div>
<div> 网络方面的驱动：</div>
<div>
<p>Device Drivers  —&gt; Network device support  —&gt; Xen network device frontend driver<br />
Device Drivers  —&gt; Network device support  —&gt;  Xen backend network device</p>
</div>
<div><a href="https://www.fuwuqiok.com/wp-content/uploads/2016/01/7.png"><img class="attachment-medium" src="https://www.fuwuqiok.com/wp-content/uploads/2016/01/7.png" alt="7" width="642" height="371" /></a></div>
<div></div>
<div></div>
<div>
<p>完成后开始编译，这里使用vzImage编译后的核心是压缩的。</p>
<pre class="brush: shell; auto-links: false;">[root@iZ28yx1yevuZ ~]#make -j 16 bzImage</pre>
<p>（这个过程会非常的漫长，为了防止终端意外断开导致前功尽弃，这里建议在screen下执行操作。我测试服务器是16核，所以这里制定了16个job加速编译）</p>
</div>
</div>
<div><a href="https://www.fuwuqiok.com/wp-content/uploads/2016/01/8.png"><img class="attachment-medium" src="https://www.fuwuqiok.com/wp-content/uploads/2016/01/8.png" alt="8" width="593" height="313" /></a></div>
<div></div>
<div>可以看到16core都是跑满状态<a href="https://www.fuwuqiok.com/wp-content/uploads/2016/01/9.png"><img class="attachment-medium" src="https://www.fuwuqiok.com/wp-content/uploads/2016/01/9.png" alt="9" width="728" height="389" /></a></div>
<div></div>
<div>完成后依次编译模块，安装</div>
<pre class="brush: shell; auto-links: false;">[root@iZ28yx1yevuZ ~]#make -j16 modules
[root@iZ28yx1yevuZ ~]#make -j16 modules_install
[root@iZ28yx1yevuZ ~]#make -j16 install</pre>
<div><a href="https://www.fuwuqiok.com/wp-content/uploads/2016/01/10.png"><img class="attachment-medium" src="https://www.fuwuqiok.com/wp-content/uploads/2016/01/10.png" alt="10" width="491" height="83" /></a></div>
<div></div>
<div></div>
<div> 完成后看一下grub文件，目前有三个引导项目：</div>
<div>
<pre class="brush: shell; auto-links: false;">root@iZ28yx1yevuZ ~]#cat /etc/grub2.cfg |egrep ^menuentry</pre>
</div>
<div> <a href="https://www.fuwuqiok.com/wp-content/uploads/2016/01/11.png"><img class="attachment-medium" src="https://www.fuwuqiok.com/wp-content/uploads/2016/01/11.png" alt="11" width="718" height="164" /></a></div>
<div>看一下目前的默认引导项是3.10.0内核</div>
<div>
<pre class="brush: shell; auto-links: false;">root@iZ28yx1yevuZ linux-4.1.6]# grub2-editenv list
saved_entry=CentOS Linux (3.10.0-123.9.3.el7.x86_64) 7 (Core)</pre>
<div>将默认引导内核改为我们刚安装的4.1.6版本</p>
<pre class="brush: shell; auto-links: false;">[root@iZ28yx1yevuZ linux-4.1.6]# grub2-set-default "CentOS Linux (4.1.6) 7 (Core)"</pre>
<div>目前默认引导项是最新的内核了，这时候重启测试</div>
<pre class="brush: shell; auto-links: false;">root@iZ28yx1yevuZ linux-4.1.6]# grub2-editenv list
saved_entry=CentOS Linux (4.1.6) 7 (Core)
[root@iZ28yx1yevuZ linux-4.1.6]# reboot</pre>
<div>默认选择的是4.1.6内核</div>
<div><a href="https://www.fuwuqiok.com/wp-content/uploads/2016/01/12.png"><img class="attachment-medium" src="https://www.fuwuqiok.com/wp-content/uploads/2016/01/12.png" alt="12" width="696" height="403" /></a></div>
<div></div>
<div>正常启动后测试，内核已经是最新的版本了。</div>
<div></div>
<div><a href="https://www.fuwuqiok.com/wp-content/uploads/2016/01/13.png"><img class="attachment-medium" src="https://www.fuwuqiok.com/wp-content/uploads/2016/01/13.png" alt="13" width="608" height="112" /></a></div>
</div>
</div>
</div>
<p>&nbsp;</p>
<div class="wumii-hook"></div>
<p><a rel="nofollow" href="https://www.fuwuqiok.com/%e9%98%bf%e9%87%8c%e4%ba%91ecs%e7%bc%96%e8%af%91%e5%8d%87%e7%ba%a7vm%e5%86%85%e6%a0%b8%e5%88%b04-x/">阿里云ECS编译升级VM内核到4.x</a>，首发于<a rel="nofollow" href="https://www.fuwuqiok.com">服务器安全维护工作室</a>。</p>
]]></content:encoded>
			<wfw:commentRss>https://www.fuwuqiok.com/%e9%98%bf%e9%87%8c%e4%ba%91ecs%e7%bc%96%e8%af%91%e5%8d%87%e7%ba%a7vm%e5%86%85%e6%a0%b8%e5%88%b04-x/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
