debian 5升級debian 6
由於需求要使用xen 4.0提供虛擬化,所以需要將線上一些debian 5系統升級為debian 6. www.2cto.com
1.修改源為debian 6
1
[email protected]:~# cat /etc/debian_version
2
5.0.2
3
[email protected]:~# vim /etc/apt/sources.list
4
deb http://mirrors.163.com/debian squeeze main non-free contrib
2.更新源,這裡使用dist-upgrade,而沒有使用upgrade,稍後解釋.
1
[email protected]:~# apt-get dist-upgrade
之後就是安裝升級包,基本上一路按默認提示安裝即可.
最後裝完,查看版本
1
[email protected]:~# cat /etc/debian_version
2
6.0.2
3.既然系統已升級為debian6,之後就可以裝xen4.0
1
[email protected]:~#apt-get install linux-image-2.6.32-5-amd64 linux-headers-2.6.32-5-amd64
2
[email protected]:~#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
01
更改到xen內核 由於重啟使用ipmi抓屏 需要注意加上console=tty0 console=ttyS1,115200
02
[email protected]:~#vi /boot/grub/grub.cfg
03
default=8
04
05
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 {
06
insmod part_msdos
07
insmod ext2
08
set root='(hd0,msdos1)'
09
search --no-floppy --fs-uuid --set 3e896e08-d01a-43fa-b6b5-c265e526913c
10
echo 'Loading Linux 2.6.32-5-xen-amd64 ...'
11
multiboot /boot/xen-4.0-amd64.gz placeholder
12
module /boot/vmlinuz-2.6.32-5-xen-amd64 placeholder root=UUID=3e896e08-d01a-43fa-b6b5-c265e526913c console=tty0 console=ttyS1,115200 ro
13
echo 'Loading initial ramdisk ...'
14
module /boot/initrd.img-2.6.32-5-xen-amd64
15
}
16
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 {
17
insmod part_msdos
18
insmod ext2
19
set root='(hd0,msdos1)'
20
search --no-floppy --fs-uuid --set 3e896e08-d01a-43fa-b6b5-c265e526913c
21
echo 'Loading Linux 2.6.32-5-xen-amd64 ...'
22
multiboot /boot/xen-4.0-amd64.gz placeholder
23
module /boot/vmlinuz-2.6.32-5-xen-amd64 placeholder root=UUID=3e896e08-d01a-43fa-b6b5-c265e526913c console=tty0 console=ttyS1,115200 ro single
24
echo 'Loading initial ramdisk ...'
25
module /boot/initrd.img-2.6.32-5-xen-amd64
26
}
重啟機器,更改biso 打開虛擬化選項.
1
[email protected]:~# xm list
2
Name ID Mem VCPUs State Time(s)
3
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 軟件包。