一.Ubuntu简介


Ubuntu Linux是由南非人马克·沙特尔沃思(Mark Shuttleworth)创办的基于Debian Linux的操作系统,于2004年10月公布Ubuntu的第一个版本(Ubuntu 4.10“Warty Warthog”)。Ubuntu适用于笔记本电脑、桌面电脑和服务器,特别是为桌面用户提供尽善尽美的使用体验。Ubuntu几乎包含了所有常用的应用软件:文字处理、电子邮件、软件开发工具和Web服务等。用户下载、使用、分享未修改的原版Ubuntu系统,以及到社区获得技术支持,无需支付任何许可费用。

官方网站:企业开源和Linux | Ubuntu

镜像下载地址:https://mirrors.sdu.edu.cn/ubuntu-releases/24.04.1/ubuntu-24.04.1-desktop-amd64.iso

二.Ubuntu的安装详解

选择安装ubuntu

下面依次选择

选择方式选择交互安装

应用选择默认

三.Ubuntu的用户使用

3.1.Ubuntu用户常规登录方式

在系统中root是无法直接登录的,因为root用户权限过大会导致安全问题

如果需要使用root用户权限可以使用sudo+需要的命令

需要切换root用户

root@shilei:~# vi /etc/pam.d/gdm-password

 设置root用户密码就可以登录root用户


root@shilei:~# passwd root
新的密码: 
重新输入新的密码: 
passwd:已成功更新密码

3.2.ubuntu用户密码破解

系统默认安装完成后grub启动时间为0,建议改为5s,否则启动太快无法修改参数

root@shilei:~# vim /etc/default/grub

root@shilei:~# grub-mkconfig > /boot/grub/grub.cfg 

当密码忘记时

开机后按e

将这个文件倒数第二行内容改为如下

此时按下ctrl+x

输入想输入的密码重新登陆就可以

四.Ubuntu的软件管理

4.1.dpkg命令

4.1.1列出系统中已经安装的软件包信息

root@shilei:~# dpkg -l
期望状态=未知(u)/安装(i)/删除(r)/清除(p)/保持(h)
| 状态=未安装(n)/已安装(i)/仅存配置(c)/仅解压缩(U)/配置失败(F)/不完全安装(H)/触>
|/ 错误?=(无)/须重装(R) (状态,错误:大写=故障)
||/ 名称                                           版本                        >
+++-==============================================-============================>
ii  accountsservice                                23.13.9-2ubuntu6            >
ii  acl                                            2.3.2-1build1               >
ii  adduser                                        3.137ubuntu1                >
ii  adwaita-icon-theme                             46.0-1                      >
ii  alsa-base                                      1.0.25+dfsg-0ubuntu7        >
ii  alsa-topology-conf                             1.2.5.1-2                   >
ii  alsa-ucm-conf                                  1.2.10-1ubuntu5             >
ii  alsa-utils                                     1.2.9-1ubuntu5              >
ii  amd64-microcode                                3.20231019.1ubuntu2.1       >
ii  anacron                                        2.3-39ubuntu2               >
ii  apg                                            2.2.3.dfsg.1-5build3        >
ii  apparmor                                       4.0.1really4.0.0-beta3-0ubun>
ii  apport                                         2.28.1-0ubuntu3.1           >
ii  apport-core-dump-handler                       2.28.1-0ubuntu3.1           >
ii  apport-gtk                                     2.28.1-0ubuntu3.1           >
ii  apport-symptoms                                0.25                        >
ii  appstream                                      1.0.2-1build6               >
ii  apt                                            2.7.14build2                >
ii  apt-config-icons                               1.0.2-1build6               >
ii  apt-config-icons-hidpi                         1.0.2-1build6               >
ii  apt-utils                                      2.7.14build2                >
ii  aptdaemon                                      1.1.1+bzr982-0ubuntu44      >
ii  aptdaemon-data                                 1.1.1+bzr982-0ubuntu44      

 4.1.2安装deb包


root@shilei:~# wget https://dldir1.qq.com/qqfile/qq/QQNT/Linux/QQ_3.2.13_241121_amd64_01.deb
--2024-11-29 19:35:36--  https://dldir1.qq.com/qqfile/qq/QQNT/Linux/QQ_3.2.13_241121_amd64_01.deb
正在解析主机 dldir1.qq.com (dldir1.qq.com)... 43.141.132.99
正在连接 dldir1.qq.com (dldir1.qq.com)|43.141.132.99|:443... 已连接。
已发出 HTTP 请求,正在等待回应... 200 OK
长度: 151024692 (144M) [application/octet-stream]
正在保存至: ‘QQ_3.2.13_241121_amd64_01.deb’

QQ_3.2.13_241121_am 100%[===================>] 144.03M  3.95MB/s    用时 32s   

2024-11-29 19:36:08 (4.51 MB/s) - 已保存 ‘QQ_3.2.13_241121_amd64_01.deb’ [151024692/151024692])


root@shilei:~# dpkg -i QQ_3.2.13_241121_amd64_01.deb
正在选中未选择的软件包 linuxqq。
(正在读取数据库 ... 系统当前共安装有 178709 个文件和目录。)
准备解压 QQ_3.2.13_241121_amd64_01.deb  ...
正在解压 linuxqq (3.2.13-29927) ...
正在设置 linuxqq (3.2.13-29927) ...
正在处理用于 hicolor-icon-theme (0.17-2) 的触发器 ...
正在处理用于 gnome-menus (3.36.0-1.1ubuntu3) 的触发器 ...
正在处理用于 desktop-file-utils (0.27-2build1) 的触发器 ...


4.1.3查看软件包信息

root@shilei:~# dpkg -L linuxqq
/.
/opt
/opt/QQ
/opt/QQ/LICENSE.electron.txt
/opt/QQ/LICENSES.chromium.html
/opt/QQ/chrome-sandbox
/opt/QQ/chrome_100_percent.pak
/opt/QQ/chrome_200_percent.pak
/opt/QQ/chrome_crashpad_handler
/opt/QQ/icudtl.dat

root@shilei:~# dpkg -s linuxqq
Package: linuxqq
Status: install ok installed
Priority: optional
Section: default
Installed-Size: 522146
Maintainer: Tencent <QQ-Team@tencent.com>
Architecture: amd64
Version: 3.2.13-29927
Depends: libgtk-3-0, libnotify4, libnss3, libxss1, libxtst6, xdg-utils, libatspi2.0-0, libuuid1, libsecret-1-0
Recommends: libappindicator3-1
Description: 
  QQ
License: unknown
Vendor: Tencent <QQ-Team@tencent.com>
Homepage: https://im.qq.com

4.1.4卸载deb软件

root@shilei:~# dpkg -r linuxqq  #删除软件主体,保留配置文件
root@shilei:~# dpkg -p linuxqq  #彻底删除软件包

4.2.管理软件仓库

编辑文件

root@shilei:~# cd /etc/apt
root@shilei:/etc/apt# ls
apt.conf.d   keyrings       preferences.d.save  sources.list.d
auth.conf.d  preferences.d  sources.list        trusted.gpg.d
root@shilei:/etc/apt# vim sources.list

挂载镜像

root@shilei:/etc/apt# mount /dev/sr0 /media
mount: /media: WARNING: source write-protected, mounted read-only.

更新测试

root@shilei:~# apt update
获取:1 file:/media noble InRelease
忽略:1 file:/media noble InRelease
获取:2 file:/media noble Release [1,072 B]
获取:2 file:/media noble Release [1,072 B]
命中:4 http://mirrors.tuna.tsinghua.edu.cn/ubuntu noble InRelease              
获取:5 http://mirrors.tuna.tsinghua.edu.cn/ubuntu noble-updates InRelease [126 kB]
获取:6 http://mirrors.tuna.tsinghua.edu.cn/ubuntu noble-backports InRelease [126 kB]
获取:7 http://security.ubuntu.com/ubuntu noble-security InRelease [126 kB]
获取:8 http://mirrors.tuna.tsinghua.edu.cn/ubuntu noble-updates/main amd64 Packages [673 kB]
获取:9 http://mirrors.tuna.tsinghua.edu.cn/ubuntu noble-updates/main i386 Packages [337 kB]
获取:10 http://mirrors.tuna.tsinghua.edu.cn/ubuntu noble-updates/main Translation-en [158 kB]
获取:11 http://mirrors.tuna.tsinghua.edu.cn/ubuntu noble-updates/main amd64 Components [131 kB]
获取:12 http://mirrors.tuna.tsinghua.edu.cn/ubuntu noble-updates/restricted amd64 Components [212 B]
获取:13 http://mirrors.tuna.tsinghua.edu.cn/ubuntu noble-updates/universe amd64 Packages [719 kB]
获取:14 http://mirrors.tuna.tsinghua.edu.cn/ubuntu noble-updates/universe i386 Packages [442 kB]
获取:15 http://mirrors.tuna.tsinghua.edu.cn/ubuntu noble-updates/universe Translation-en [214 kB]
获取:16 http://mirrors.tuna.tsinghua.edu.cn/ubuntu noble-updates/universe amd64 Components [310 kB]
获取:17 http://mirrors.tuna.tsinghua.edu.cn/ubuntu noble-updates/multiverse amd64 Components [940 B]
获取:18 http://mirrors.tuna.tsinghua.edu.cn/ubuntu noble-backports/main amd64 Components [208 B]
获取:19 http://mirrors.tuna.tsinghua.edu.cn/ubuntu noble-backports/restricted amd64 Components [216 B]
获取:20 http://mirrors.tuna.tsinghua.edu.cn/ubuntu noble-backports/universe i386 Packages [5,664 B]
获取:21 http://mirrors.tuna.tsinghua.edu.cn/ubuntu noble-backports/universe amd64 Packages [10.7 kB]
获取:22 http://mirrors.tuna.tsinghua.edu.cn/ubuntu noble-backports/universe Translation-en [10.8 kB]
获取:23 http://mirrors.tuna.tsinghua.edu.cn/ubuntu noble-backports/universe amd64 Components [11.7 kB]
获取:24 http://mirrors.tuna.tsinghua.edu.cn/ubuntu noble-backports/universe Icons (48x48) [7,475 B]
获取:25 http://mirrors.tuna.tsinghua.edu.cn/ubuntu noble-backports/universe Icons (64x64) [10.4 kB]
获取:26 http://mirrors.tuna.tsinghua.edu.cn/ubuntu noble-backports/multiverse amd64 Components [212 B]
获取:27 http://security.ubuntu.com/ubuntu noble-security/main i386 Packages [204 kB]
获取:28 http://security.ubuntu.com/ubuntu noble-security/main amd64 Packages [498 kB]
获取:29 http://security.ubuntu.com/ubuntu noble-security/main Translation-en [102 kB]
获取:30 http://security.ubuntu.com/ubuntu noble-security/main amd64 Components [7,232 B]
获取:31 http://security.ubuntu.com/ubuntu noble-security/restricted amd64 Components [212 B]
获取:32 http://security.ubuntu.com/ubuntu noble-security/universe i386 Packages [355 kB]
获取:33 http://security.ubuntu.com/ubuntu noble-security/universe amd64 Packages [562 kB]
获取:34 http://security.ubuntu.com/ubuntu noble-security/universe Translation-en [150 kB]
获取:35 http://security.ubuntu.com/ubuntu noble-security/universe amd64 Components [51.8 kB]
获取:36 http://security.ubuntu.com/ubuntu noble-security/multiverse amd64 Components [212 B]
已下载 5,351 kB,耗时 7秒 (817 kB/s)                                           
正在读取软件包列表... 完成
正在分析软件包的依赖关系树... 完成
正在读取状态信息... 完成                 
有 136 个软件包可以升级。请执行 ‘apt list --upgradable’ 来查看它们。

Logo

技术共进,成长同行——讯飞AI开发者社区

更多推荐