ubuntu 配置

一、系统安装

 

二、局域网固定IP配置

第1步: 查看当前主机的网卡名,当前ip, 子网掩码,网关地址

ifconfig
route -n

如果ifconfig命令无法使用, 请运行以下命令安装net-tools

sudo apt update -y 
sudo apt install net-tools -y

查看当前主机的网卡名,当前ip, 子网掩码,网关地址

如上图所示:网卡名为 enp0s5, 当前ip 10.211.55.6, 子网掩码 255.255.255.0, 网关地址 10.211.55.1

第2步: 修改配置文件

  • 进入配置文件夹
cd /etc/netplan
  • 备份旧配置文件内容为 00-installer-config.yaml_before
sudo cp 00-installer-config.yaml  00-installer-config.yaml_before

 

00-installer-config.yaml 的内容为:

# This is the network config written by 'subiquity'
network:
  ethernets:
    enp0s5:
      dhcp4: true
  version: 2
  • 修改配置文件
sudo vim 00-installer-config.yaml
network:
    ethernets:
        ens33:
            dhcp4: no
            addresses: [192.168.1.100/24]
            optional: true
            gateway4: 192.168.1.1
            nameservers:
                    addresses: [223.5.5.5,223.6.6.6]
 
    version: 2

更新网络配置

sudo netplan apply

 

三、修改源

编辑/etc/apt/sources.list文件, 在文件最前面添加以下条目(操作前请做好相应备份):

 

清华源

# 默认注释了源码镜像以提高 apt update 速度,如有需要可自行取消注释
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-updates main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-backports main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-backports main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-security main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-security main restricted universe multiverse

 

然后执行命令:

sudo apt-get update
sudo apt-get upgrade

 

vi 快捷键

dG这是删除光标所在行到最后一行的内容(包括光标所在行的内容)

还有一个命令是  ggVG
解释是:
gg 让光标移到首行,在vim才有效,vi中无效
V   是进入Visual(可视)模式
G  光标移到最后一行
选中内容以后就可以其他的操作了,比如:
d  删除选中内容
y  复制选中内容到0号寄存器
"+y  复制选中内容到+寄存器,也就是系统的剪贴板,供其他程序用
全部删除:按esc后,然后dG
全部复制:按esc后,然后ggyG
全选高亮显示:按esc后,然后ggvG或者ggVG

要复制到别的地方,用 "+y 来复制,注意是三个字符。
gg"+yG

posted @ 2022-09-06 10:11  MasonLee  阅读(417)  评论(0编辑  收藏  举报