Ubuntu操作系统-02-Ubuntu查看系统信息和配置网络和Yum

Ubuntu操作系统-02-Ubuntu查看系统信息和配置网络和Yum插图

一:查看系统信息命令

1.uname -a :查看到操作系统的发行版号和操作系统版本

root@hehao-virtual-machine:~# uname -a Linux hehao-virtual-machine 5.11.0-25-generic #27~20.04.1-Ubuntu SMP Tue Jul 13 17:41:23 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux root@hehao-virtual-machine:~# 

2.uname -v:操作系统版本号

root@hehao-virtual-machine:~# uname -v #27~20.04.1-Ubuntu SMP Tue Jul 13 17:41:23 UTC 2021 root@hehao-virtual-machine:~# 

3.lsb_release -a :可以查看操作系统的发行版号

root@hehao-virtual-machine:~# lsb_release -a No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 20.04.3 LTS Release: 20.04 Codename: focal root@hehao-virtual-machine:~# 

4.cat /etc/issue

  • /etc/issue文件是Linux系统开机启动时在命令行界面弹出的欢迎语句文件
  • Ubuntu中记录了发行版本名,但CentOS没有
root@hehao-virtual-machine:~# cat /etc/issue Ubuntu 20.04.3 LTS \n \l root@hehao-virtual-machine:~# 

5.cat /proc/version

  • 查看显示内存中kernel相关的版本、编译等信息
  • Ubuntu和CentOS通用,可以显示内核版本同时显示发行版本
root@hehao-virtual-machine:~# cat /proc/version Linux version 5.11.0-25-generic (buildd@lgw01-amd64-038) (gcc (Ubuntu 9.3.0-17ubuntu1~20.04) 9.3.0, GNU ld (GNU Binutils for Ubuntu) 2.34) #27~20.04.1-Ubuntu SMP Tue Jul 13 17:41:23 UTC 2021 root@hehao-virtual-machine:~# 

6.cat /etc/os-release 包含操作系统标识数据的文件

root@hehao-virtual-machine:~# cat /etc/os-release NAME="Ubuntu Kylin" VERSION="20.04 (Focal Fossa)" ID=ubuntu ID_LIKE=debian PRETTY_NAME="Ubuntu 20.04.3 LTS" VERSION_ID="20.04" HOME_URL="https://www.ubuntu.com/" SUPPORT_URL="https://help.ubuntu.com/" BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/" PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy" VERSION_CODENAME=focal UBUNTU_CODENAME=focal root@hehao-virtual-machine:~# 

7.hostnamectl 主机名的命令,也可以使用这个查看Ubuntu的版本

root@hehao-virtual-machine:~# hostnamectl Static hostname: hehao-virtual-machine Icon name: computer-vm Chassis: vm Machine ID: aa9c5391c0744988a599e179e489726d Boot ID: 6a4bb71e9a4e4928a89755fcec6f9525 Virtualization: vmware Operating System: Ubuntu 20.04.3 LTS Kernel: Linux 5.11.0-25-generic Architecture: x86-64 root@hehao-virtual-machine:~# 

二:配置Ubuntu操作系统的网络问题

设置静态IP地址

root@hehao-virtual-machine:~# vim /etc/netplan/01-network-manager-all.yaml root@hehao-virtual-machine:~# cat /etc/netplan/01-network-manager-all.yaml network: version: 2 ethernets: ens33: addresses: [192.168.80.146/24] gateway4: 192.168.80.2 dhcp4: no nameservers: addresses: [8.8.8.8,114.114.114.114] root@hehao-virtual-machine:~# netplan apply #应用配置(以便生效),必要时重启管理工具 root@hehao-virtual-machine:~# /etc/init.d/networking restart #重启网卡 Restarting networking (via systemctl): networking.service. root@hehao-virtual-machine:~# ip a | grep ens33 2: ens33: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000 inet 192.168.80.146/24 brd 192.168.80.255 scope global ens33 root@hehao-virtual-machine:~# 

设置动态IP地址

root@hehao-virtual-machine:~# vim /etc/netplan/01-network-manager-all.yaml root@hehao-virtual-machine:~# cat /etc/netplan/01-network-manager-all.yaml network: version: 2 ethernets: ens33: #addresses: [192.168.80.146/24] # gateway4: 192.168.80.2 dhcp4: yes #nameservers: # addresses: [8.8.8.8,114.114.114.114] root@hehao-virtual-machine:~# netplan apply root@hehao-virtual-machine:~# /etc/init.d/networking restart Restarting networking (via systemctl): networking.service. root@hehao-virtual-machine:~# ip a | grep ens33 2: ens33: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000 inet 192.168.80.146/24 brd 192.168.80.255 scope global dynamic ens33 root@hehao-virtual-machine:~# 

三:配置Ubuntu操作系统的yum仓库

root@hehao-virtual-machine:~# vim /etc/apt/sources.list root@hehao-virtual-machine:~# cat /etc/apt/sources.list deb http://mirrors.aliyun.com/ubuntu/ focal main restricted deb http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted deb http://mirrors.aliyun.com/ubuntu/ focal universe deb http://mirrors.aliyun.com/ubuntu/ focal-updates universe deb http://mirrors.aliyun.com/ubuntu/ focal multiverse deb http://mirrors.aliyun.com/ubuntu/ focal-updates multiverse deb http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu focal-security main restricted deb http://mirrors.aliyun.com/ubuntu focal-security universe deb http://mirrors.aliyun.com/ubuntu focal-security multiverse root@hehao-virtual-machine:~# apt-get update #更新源 命中:2 http://mirrors.aliyun.com/ubuntu focal InRelease 获取:4 http://mirrors.aliyun.com/ubuntu focal-updates InRelease [114 kB] 命中:1 https://archive.ubuntukylin.com/ubuntukylin focal-partner InRelease 获取:5 http://mirrors.aliyun.com/ubuntu focal-backports InRelease [108 kB] 命中:3 https://archive.ubuntukylin.com/ubuntukylin focal InRelease 获取:6 http://mirrors.aliyun.com/ubuntu focal-security InRelease [114 kB] 获取:7 http://mirrors.aliyun.com/ubuntu focal-updates/main amd64 Packages [2,126 kB] 获取:8 http://mirrors.aliyun.com/ubuntu focal-updates/main i386 Packages [728 kB] 获取:9 http://mirrors.aliyun.com/ubuntu focal-updates/main Translation-en [376 kB] 获取:10 http://mirrors.aliyun.com/ubuntu focal-updates/main amd64 c-n-f Metadata [16.0 kB] 获取:11 http://mirrors.aliyun.com/ubuntu focal-updates/restricted amd64 Packages [1,301 kB] 获取:12 http://mirrors.aliyun.com/ubuntu focal-updates/restricted Translation-en [185 kB] 获取:13 http://mirrors.aliyun.com/ubuntu focal-updates/universe amd64 Packages [962 kB] 获取:14 http://mirrors.aliyun.com/ubuntu focal-updates/universe i386 Packages [694 kB] 获取:15 http://mirrors.aliyun.com/ubuntu focal-updates/universe Translation-en [219 kB] 获取:16 http://mirrors.aliyun.com/ubuntu focal-updates/universe amd64 c-n-f Metadata [21.6 kB] 获取:17 http://mirrors.aliyun.com/ubuntu focal-security/main i386 Packages [498 kB] 获取:18 http://mirrors.aliyun.com/ubuntu focal-security/main amd64 Packages [1,752 kB] 获取:19 http://mirrors.aliyun.com/ubuntu focal-security/main Translation-en [293 kB] 获取:20 http://mirrors.aliyun.com/ubuntu focal-security/main amd64 c-n-f Metadata [11.1 kB] 获取:21 http://mirrors.aliyun.com/ubuntu focal-security/restricted amd64 Packages [1,212 kB] 获取:22 http://mirrors.aliyun.com/ubuntu focal-security/restricted Translation-en [172 kB] 获取:23 http://mirrors.aliyun.com/ubuntu focal-security/universe amd64 Packages [735 kB] 获取:24 http://mirrors.aliyun.com/ubuntu focal-security/universe i386 Packages [564 kB] 获取:25 http://mirrors.aliyun.com/ubuntu focal-security/universe Translation-en [135 kB] 获取:26 http://mirrors.aliyun.com/ubuntu focal-security/universe amd64 c-n-f Metadata [15.1 kB] 已下载 12.4 MB,耗时 2秒 (6,222 kB/s) 正在读取软件包列表... 完成 root@hehao-virtual-machine:~# 

原文链接:https://blog.csdn.net/m0_60981735/article/details/127176759

© 版权声明
THE END
喜欢就支持一下吧
点赞0 分享