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 @   MasonLee  阅读(452)  评论(0编辑  收藏  举报
    相关博文:
    阅读排行:
    · TypeScript + Deepseek 打造卜卦网站:技术与玄学的结合
    · Manus的开源复刻OpenManus初探
    · AI 智能体引爆开源社区「GitHub 热点速览」
    · 从HTTP原因短语缺失研究HTTP/2和HTTP/3的设计差异
    · 三行代码完成国际化适配,妙~啊~
    点击右上角即可分享
    微信分享提示