ubuntu 16.04 升级到 ubuntu 18.04

包相关命令:

清除无用包:apt-get clean && apt-get autoclean   #一般用apt-get autoclean就够了  
更新源:apt-get update     #同步 /etc/apt/sources.list 源的索引,这样才知道是不是有最新的包   
更新包:apt-get upgrade     #更新所有已安装的软件(upgrade只是简单的更新包,不管这些依赖,它不添不删。) 
更新包2:apt-get dist-upgrade #包与包之间存在各种依赖关系。而dist-upgrade可以根据依赖关系的变化添删包。(依赖有时会出错,建议新手谨慎使用)  
补充:在执行 upgrade or dist-upgrade 之前一定要执行 update, 这样才能获取最新  
安装软件:apt-get install XXX [--reinstall] #--reinstall 是重新安装包,一般都是用 apt-get install XXX  
修复依赖:apt-get -f install  #修复依赖,类似于win里面的缺少dll,-f之后他帮你修复安装一些依赖(安装搜狗拼音实例有用到)  
删除软件:apt-get remove XXX [--purge] #--purge 卸载的时候把配置文件也删了,完全删除包可以用这个选项:apt-get remove XXX --purge  

其他命令:(特殊环境下使用)  

搜索软件:apt-get search xxx  
检查是否有损坏的依赖:apt-get check   (偶尔想起来或者软件打不开的时候使用【有时候被清理了】)  
获取包信息:apt-cache show xxx  
有哪些依赖:apt-cache depends xxx    (比如安装一个包,修复依赖也失败,那就看看有哪些依赖,自己手动安装)  
被哪些包依赖:apt-cache rdepends xxx  (比如卸载一个包的时候,查一下被哪些包依赖)  
下载该包源代码:apt-get source xxx  
安装相关编译环境:apt-get build-dep xxx  

更新软件列表

apt-get update

升级软件

apt-get upgrade

升级当前系统版本

apt-get dist-upgrade

清理无用的包

apt-get autoclean

重启系统

reboot

安装Ubuntu update manager

更新完 系统后,运行以下命令安装update-manager-core(如果您没有安装).

sudo apt-get install update-manager-core

打开update-manager配置文件并确保提示行设置为 lts

root@pilotmt11:~# cat /etc/update-manager/release-upgrades
# Default behavior for the release upgrader.

[DEFAULT]
# Default prompting behavior, valid options:
#
#  never  - Never check for a new release.
#  normal - Check to see if a new release is available.  If more than one new
#           release is found, the release upgrader will attempt to upgrade to
#           the release that immediately succeeds the currently-running
#           release.
#  lts    - Check to see if a new LTS release is available.  The upgrader
#           will attempt to upgrade to the first LTS release available after
#           the currently-running one.  Note that this option should not be
#           used if the currently-running release is not itself an LTS
#           release, since in that case the upgrader won't be able to
#           determine if a newer release is available.
Prompt=lts   #此处应为lts
root@pilotmt11:~# 

升级到新系统版本

root@pilotmt11:~# do-release-upgrade
Checking for a new Ubuntu release
No new release found.
root@pilotmt11:~# 

(你不应该看到No new release found.)
你应该看到一个信息提示你18.04 LTS是可用的或者有许多的软件包是需要升级的(见下代码段)。
如果你没有看到可用的升级(如上代码段),然后你需要改变为如下的命令(请指定-d选项以使用开发版本):

root@pilotmt11:~#  do-release-upgrade -d

Reading cache

Checking package manager

Continue running under SSH?

This session appears to be running under ssh. It is not recommended
to perform a upgrade over ssh currently because in case of failure it
is harder to recover.

If you continue, an additional ssh daemon will be started at port
'1022'.
Do you want to continue?

Continue [yN] y

Starting additional sshd 

To make recovery in case of failure easier, an additional sshd will 
be started on port '1022'. If anything goes wrong with the running 
ssh you can still connect to the additional one. 
If you run a firewall, you may need to temporarily open this port. As 
this is potentially dangerous it's not done automatically. You can 
open the port with e.g.: 
'iptables -I INPUT -p tcp --dport 1022 -j ACCEPT' 

To continue please press [ENTER]

Reading package lists... Done
Building dependency tree        
Reading state information... Done
Hit http://cn.archive.ubuntu.com/ubuntu xenial InRelease                                                                            
Get:1 http://security.ubuntu.com/ubuntu xenial-security InRelease [107 kB]                                                          
Get:2 http://cn.archive.ubuntu.com/ubuntu xenial-updates InRelease [109 kB]                                                         
Get:3 http://cn.archive.ubuntu.com/ubuntu xenial-backports InRelease [107 kB]                                                       
Fetched 323 kB in 0s (0 B/s)                                                                                                        
Reading package lists... Done    
Building dependency tree          
Reading state information... Done

当屏幕出现升级提示是 选择y 等待所有的软件包下载...安装...到重启... 当安装完成后,你的系统就升级到最新的Ubuntu开发版本

验证升级完成

root@pilotmt11:~# lsb_release -a
No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 18.04 LTS
Release:	18.04
Codename:	bionic
root@pilotmt11:~#

How To Upgrade to Ubuntu 16.04 LTS

  • qq_43638135
    妲己再美究为妃: 博主没有想过自己接一些私活干吗?我现在还没毕业,但是我也确实听说外挂市场自动化游戏脚本市场挺火热的,并且报酬也很丰厚,但是具体的我也不是很清楚,求解答。 (1个月前 #47楼) 查看回复(2) 举报 回复
    22