debian 5 升级 debian 6

冷暖自知 提交于 2019-12-02 20:52:35

             由于需求要使用xen 4.0提供虚拟化,所以需要将线上一些debian 5系统升级为debian 6.

1.修改源为debian 6

root@10.1.6.200:~# cat /etc/debian_version 
5.0.2
root@10.1.6.200:~# vim /etc/apt/sources.list
deb http://mirrors.163.com/debian squeeze main non-free contrib

2.更新源,这里使用dist-upgrade,而没有使用upgrade,稍后解释.

root@10.1.6.200:~# apt-get dist-upgrade
之后就是安装升级包,基本上一路按默认提示安装即可.

最后装完,查看版本

root@10.1.6.200:~# cat /etc/debian_version 
6.0.2

3.既然系统已升级为debian6,之后就可以装xen4.0

root@10.1.6.200:~#apt-get install linux-image-2.6.32-5-amd64 linux-headers-2.6.32-5-amd64
root@10.1.6.200:~#apt-get install linux-image-2.6.32-5-xen-amd64 xen-linux-system-2.6.32-5-xen-amd64 xen-hypervisor-4.0-amd64 xen-utils-4.0 xenstore-utils xen-tools  xen-qemu-dm-4.0 xen-utils-common
更改到xen内核 由于重启使用ipmi抓屏 需要注意加上console=tty0 console=ttyS1,115200
root@10.1.6.200:~#vi /boot/grub/grub.cfg
default=8

menuentry 'Debian GNU/Linux, with Linux 2.6.32-5-xen-amd64 and XEN 4.0-amd64' --class debian --class gnu-linux --class gnu --class os --class xen {
	insmod part_msdos
	insmod ext2
	set root='(hd0,msdos1)'
	search --no-floppy --fs-uuid --set 3e896e08-d01a-43fa-b6b5-c265e526913c
	echo	'Loading Linux 2.6.32-5-xen-amd64 ...'
	multiboot	/boot/xen-4.0-amd64.gz placeholder  
	module	/boot/vmlinuz-2.6.32-5-xen-amd64 placeholder root=UUID=3e896e08-d01a-43fa-b6b5-c265e526913c console=tty0 console=ttyS1,115200  ro 
	echo	'Loading initial ramdisk ...'
	module	/boot/initrd.img-2.6.32-5-xen-amd64
}
menuentry 'Debian GNU/Linux, with Linux 2.6.32-5-xen-amd64 and XEN 4.0-amd64 (recovery mode)' --class debian --class gnu-linux --class gnu --class os --class xen {
	insmod part_msdos
	insmod ext2
	set root='(hd0,msdos1)'
	search --no-floppy --fs-uuid --set 3e896e08-d01a-43fa-b6b5-c265e526913c
	echo	'Loading Linux 2.6.32-5-xen-amd64 ...'
	multiboot	/boot/xen-4.0-amd64.gz placeholder 
	module	/boot/vmlinuz-2.6.32-5-xen-amd64 placeholder root=UUID=3e896e08-d01a-43fa-b6b5-c265e526913c console=tty0 console=ttyS1,115200 ro  single 
	echo	'Loading initial ramdisk ...'
	module	/boot/initrd.img-2.6.32-5-xen-amd64
}


重启机器,更改biso 打开虚拟化选项.

root@10.1.6.200:~# xm list
Name                                        ID   Mem VCPUs      State   Time(s)
Domain-0                                     0  2140     8     r-----   5453.5


下面是man  upgrade与dist-upgrade 

upgrade

           upgrade is used to install the newest versions of all packages currently installed on the system from the sources enumerated in /etc/apt/sources.list. Packages currently installed with new versions available are retrieved and upgraded; under no circumstances are currently installed packages removed, or packages not already installed retrieved and installed. New versions of currently installed packages that cannot be upgraded without changing the install status of another package will be left at their current version. An update must be performed first so that apt-get knows that new versions of packages are available.

            简单来说系统将现有的Package升级,如果有相依性的问题,而此相依性需要安装其它新的Package或影响到其它Package的相依性时,此Package就不会被升级,会保留下来. 

dist-upgrade

           dist-upgrade in addition to performing the function of upgrade, also intelligently handles changing dependencies with new versions of packages; apt-get has a "smart" conflict resolution system, and it will attempt to upgrade the most important packages at the expense of less important ones if necessary. So, dist-upgrade command may remove some packages. The /etc/apt/sources.list file contains a list of locations from which to retrieve desired package files. See also apt_preferences(5) for a mechanism for overriding the general settings for individual packages.

          可以聪明的解决相依性的问题,如果有相依性问题,需要安装/移除新的Package,就会试着去安装/移除它. (所以通常这个会被认为是有点风险的升级)


apt-get upgrade 和 apt-get dist-upgrade 本质上是没有什么不同的。

只不过,dist-upgrade 会识别出当依赖关系改变的情形并作出处理,而upgrade对此情形不做处理。

例如软件包 a 原先依赖 b c d,但是在源里面可能已经升级了,现在是 a 依赖 b c e。这种情况下,dist-upgrade 会删除 d 安装 e,并把 a 软件包升级,而 upgrade 会认为依赖关系改变而拒绝升级 a 软件包。

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!