【UBUNTU】随手记

目录

  • [1. 更新软件到最新版本](#1. 更新软件到最新版本)
    • [1.1 CMAKE [U20]](#1.1 CMAKE [U20])
    • [1.2 GIT](#1.2 GIT)
    • [1.3 WIRESHARK](#1.3 WIRESHARK)
    • [1.4 LLVM](#1.4 LLVM)
  • [2. 设置代理](#2. 设置代理)
    • [2.1 APT](#2.1 APT)
    • [2.2 GIT](#2.2 GIT)
    • [2.3 WGET](#2.3 WGET)
    • [2.4 PIP](#2.4 PIP)

1. 更新软件到最新版本

1.1 CMAKE [U20]

参考:https://apt.kitware.com/

bash 复制代码
# 1. 更新基础库
sudo apt-get update

# 2. 安装可能需要的工具
sudo apt-get install ca-certificates gpg wget

# 3. 获取签名
wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/null | gpg --dearmor - | sudo tee /usr/share/keyrings/kitware-archive-keyring.gpg >/dev/null

# 4. 添加正式版仓库与更新
echo 'deb [signed-by=/usr/share/keyrings/kitware-archive-keyring.gpg] https://apt.kitware.com/ubuntu/ focal main' | sudo tee /etc/apt/sources.list.d/kitware.list >/dev/null
sudo apt-get update
sudo apt-get upgrade cmake

# 5. 签名同步
sudo rm /usr/share/keyrings/kitware-archive-keyring.gpg
sudo apt-get install kitware-archive-keyring

# 6. 【可选操作】添加开发板仓库与更新
echo 'deb [signed-by=/usr/share/keyrings/kitware-archive-keyring.gpg] https://apt.kitware.com/ubuntu/ focal-rc main' | sudo tee -a /etc/apt/sources.list.d/kitware.list >/dev/null
sudo apt-get update
sudo apt-get upgrade cmake

1.2 GIT

bash 复制代码
sudo add-apt-repository ppa:git-core/ppa
sudo apt update
sudo apt upgrade git

1.3 WIRESHARK

bash 复制代码
sudo apt-add-repository ppa:wireshark-dev/stable
sudo apt-get update
sudo apt upgrade wireshark

# 普通用于运行配置
sudo dpkg-reconfigure wireshark-common

1.4 LLVM

参考:https://apt.llvm.org/

bash 复制代码
wget https://apt.llvm.org/llvm.sh
chmod +x llvm.sh
sudo ./llvm.sh 17 all

2. 设置代理

2.1 APT

  • 添加配置

    bash 复制代码
    # 1. 打开apt.conf配置文件
    sudo vim /etc/apt/apt.conf
    # 2. 在配置文件中添加以下内容
    Acquire::http::Proxy  "http://127.0.0.1:7890";
    Acquire::https::Proxy "http://127.0.0.1:7890";
    # 3. 保存退出
  • 命令别名

    bash 复制代码
    # 1. 打开配置文件
    vim ~/.bashrc
    
    # 2. 设置命令别名
    alias apt_proxy_on=" sudo sed -i 's/^#//g' /etc/apt/apt.conf"  # 开启
    alias apt_proxy_off="sudo sed -i 's/^/#/g' /etc/apt/apt.conf"  # 关闭
    alias apt_proxy_cat="sudo cat              /etc/apt/apt.conf"  # 查看
    
    # 3. 保存退出
    # 4. 更新
    source ~/.bashrc
    
    # 5. 别名使用
    apt_proxy_on
    apt_proxy_off
    apt_proxy_cat

2.2 GIT

bash 复制代码
# 1. 打开配置文件
vim ~/.bashrc

# 2. 设置命令别名
alias git_proxy_on="git config --global http.proxy 127.0.0.1:7890 && git config --global https.proxy 127.0.0.1:7890" # 开启
alias git_proxy_off="git config --global --unset http.proxy && git config --global --unset https.proxy" # 关闭
alias git_proxy_cat="git config --global --get http.proxy && git config --global --get https.proxy" # 查看

# 3. 保存退出
# 4. 更新
source ~/.bashrc

# 5. 别名使用
apt_proxy_on
apt_proxy_off
apt_proxy_cat

2.3 WGET

bash 复制代码
wget -e "http_proxy=http://127.0.0.1:7890"  http://...
wget -e "http_proxy=https://127.0.0.1:7890" https://...

2.4 PIP

bash 复制代码
sudo pip3 --proxy http://127.0.0.1:7890/ install pip -U
sudo pip3 --proxy http://127.0.0.1:7890/ install meson ninja
相关推荐
likfishdn1 分钟前
Linux的文件与目录管理
linux·运维·服务器
chian-ocean21 分钟前
Linux 文件缓冲区:高效数据访问的幕后推手
linux·运维·服务器
加油=^_^=22 分钟前
【Linux】进程优先级 | 进程调度(三)
linux·运维·服务器
若云止水32 分钟前
Ubuntu 下 nginx-1.24.0 源码分析 - ngx_init_cycle 函数 - 详解(4)
数据库·nginx·ubuntu
吃汤圆的抹香鲸1 小时前
GoLand 安装包 绿色版 Win,Mac,Linux 包含IntelliJ全家桶 专为Go语言设计的集成开发环境(IDE)
linux·windows·macos·go·intellij-idea·go1.19
追寻光1 小时前
Cannot find a valid baseurl for repo: base/7/x86_64
linux
元气满满的热码式1 小时前
Docker数据卷操作实战
linux·运维·docker·云原生·容器
陆沙1 小时前
deepseek-r1-centos-本地服务器配置方法
linux·服务器·centos
北京耐用通信1 小时前
航空装配自动化神器Ethercat转profient网关搭配机器人精准控制
运维·机器人·自动化
吃汤圆的抹香鲸1 小时前
Rider 安装包 绿色版 Win/Mac/Linux 适合.NET和游戏开发者使用 2025全栈开发终极指南:从零配置到企业级实战
linux·运维·windows·sql·游戏·macos·.net