VPS下如何由Debian5升级到Debian6
Debian GNU/Linux 6.0 “Squeeze”于昨天正式发布,附带软件包版本与Ubuntu 10.04大致相同,使用内核2.6.32,值得升级一试。不过对于VPS用户,升级就有点麻烦了,研究了半天,终于找到方法,记录下来以供大家参考下。
1,修改更新列表,已获得Debian 6更新源:
编辑“/etc/apt/sources.list”,将所有地址用“#”注释掉:
#deb http://ftp2.de.debian.org/debian lenny main contrib non-free
#deb http://ftp2.de.debian.org/debian-security lenny/updates main contrib non-free
lenny是Debian 5 中所用的版本,Debian 6之后,我们要选用Squeeze 版本作为升级源。从以下地址选择离你最快的Debian6更新地址:
# 这个ftp的源速度很快(将http改为ftp也可)
deb http://ftp.debian.org/debian/ squeeze main non-free contrib
deb http://ftp.debian.org/debian/ squeeze-proposed-updates main non-free contrib
deb http://ftp.us.debian.org/debian/ squeeze main non-free contrib
deb http://ftp.us.debian.org/debian/ squeeze-proposed-updates main non-free contrib
# 官方安全更新的源
deb http://security.debian.org/ squeeze/updates main
# 这个多媒体的源需要额外的公钥,请参考它的官网页面一开头的说明,
# 地址:http://www.debian-multimedia.org/
deb http://ftp.debian-multimedia.org/ squeeze main non-free
# 这个台湾的源速度一直就很不错
deb http://debian.nctu.edu.tw/debian/ squeeze main non-free contrib
deb http://debian.nctu.edu.tw/debian/ squeeze-proposed-updates main non-free contrib
# 另一个台湾的源
deb http://ftp.tw.debian.org/debian/ squeeze main non-free contrib
deb http://ftp.tw.debian.org/debian/ squeeze-proposed-updates main non-free contrib
deb http://ftp.tw.debian.org/debian-multimedia/ squeeze main non-free
# 上海交大的源
deb http://ftp.sjtu.edu.cn/debian/ squeeze main non-free contrib
deb http://ftp.sjtu.edu.cn/debian/ squeeze-proposed-updates main non-free contrib
deb http://ftp.sjtu.edu.cn/debian-security/ squeeze/updates main non-free contrib
# 163的源
deb http://mirrors.163.com/debian/ squeeze main non-free contrib
deb http://mirrors.163.com/debian/ squeeze-proposed-updates main non-free contrib
deb http://mirrors.163.com/debian-security/ squeeze/updates main non-free contrib
柒月的测试VPS离第一个最近最快,所以直接选择了第一个。
添加完毕后,保存“/etc/apt/sources.list”并退出。
2,使用Debian升级命令对系统进行升级:
apt-get update
apt-get install apt dpkg aptitude
apt-get dist-upgrade
一路选择默认、回车即可。网上有人反映apt-get 升级系统版本后,很容易使系统崩溃,如果发生错误,可以使用“aptitude”升级系统:
aptitude update
aptitude upgrade && aptitude install
aptitude dist-upgrade
reboot
3,重启后,验证是否升级成功:
1)查看Debian版本是否升级成功:
lsb_release -a
2)查看所需端口是否正常开启:
netstat -tulpn
3)安装后,VPS会多出一些不必要的程序,删除即可:
apt-get remove portmap bind9 dbus
4)内核升级:
OpenVZ内核是无法升级的,XEN或独服可以参考:Ubuntu 内核升级
Debian 内核版本号查看命令:uname -r