Ubuntu的使用和配置

安装

安装vim

sudo apt install vim

更换国内软件源

国内源:

更换清华源

  1. 备份原文件
    进入路径cd /ect/apt,备份文件sudo cp sources.list sources.list_bak
  2. 在最后添加清华源地址
    sudo vim sources.list
    1
    2
    3
    4
    deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ noble main restricted universe multiverse
    deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ noble-updates main restricted universe multiverse
    deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ noble-backports main restricted universe multiverse
    deb http://security.ubuntu.com/ubuntu/ noble-security main restricted universe multiverse

更新软件包列表
sudo apt update
更新所有软件包
sudo apt upgrade

启用SSH服务

按照ssh服务,按照完成会自动启动
sudo apt install openssh-server
查看ssh是否启动
sudo systemctl status ssh
手动启动
sudo systemctl start ssh
系统启动时启动
sudo systemctl enable ssh

软件安装

安装Chrome

下载安装包.deb
sudo dpkg -i xxx.deb
搜索安装的软件
sudo dpkg -l *xxx*
卸载软件,xxx可以用tab补全
sudo dpkg -r xxx

安装anaconda

下载:https://www.anaconda.com/download/success
安装:bash Anaconda3-xxx-Linux-x86_64.sh
全部选择yes
配置环境变量:
vim ~/.bashrc
末尾追加:
export PATH=/home/cmyang/anaconda3/bin:$PATH
立即生效:
source ~/.bashrc

安装docker

sudo apt install docker.io docker-compose

常用命令

切换用户

切换到root sudo su
切换到普通用户 sudo su - cmyang