ubuntu基础配置

郭幸坤 / 2023-05-19 / 原文

ubuntu虚拟机配置

1.更换镜像源

ubuntu安装完成后在执行所有操作之前先更换镜像源,国内建议选择清华源或阿里源。(视个人情况换源,有些同学会出现换了源反倒完全apt-get不出来的现象。所以务必做好备份

 #备份镜像源设置文件
 sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak
 #编辑镜像源设置文件
 sudo gedit /etc/apt/sources.list
 #复制下面的所有内容替换掉原文件中的所有内容(一次只可以选一个镜像源,根据你的情况选)
 #  阿里源
 deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
 deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
 deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
 deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
 deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
 deb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
 deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
 deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
 deb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
 deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
 # 清华源
 deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic main restricted universe multiverse
 deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic main restricted universe multiverse
 deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
 deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
 deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
 deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
 deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
 deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
 deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse
 deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse
 #  中科大源
 deb https://mirrors.ustc.edu.cn/ubuntu/ bionic main restricted universe multiverse
 deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic main restricted universe multiverse
 deb https://mirrors.ustc.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
 deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
 deb https://mirrors.ustc.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
 deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
 deb https://mirrors.ustc.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
 deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
 deb https://mirrors.ustc.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse
 deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse
 
 #保存退出

2.执行必要的软件更新

刚安装好的系统很多软件都是陈旧的需要执行更新才能够有良好的使用体验。

 #从服务器获得全部可用的最新软件包列表并缓存到本地
 sudo apt-get update
 #对比前面的列表中的信息如果软件版本太低则帮你更新(upgrade不会帮你删除列表中没有的软件包也不会安装有依赖需求但尚未安装依赖的软件包)
 sudo apt-get upgrade
 #自动清除文件缓存
 sudo apt-get autoremove
 #重启
 reboot
 #### 3.安装中文语言包和fixct输入法支持框架
#进入语言设置中下载安装中文简体语言包
 #修复依赖,其实就是把需要的依赖安装
 sudo apt --fix-broken install
 #安装fcixt
 sudo apt-get install fcitx
 #刷新软件源并升级fcixt
 sudo apt-get update
 sudo apt-get upgrade
#vim
sudo apt-get install vim
#gcc
sudo apt-get install gcc
#g++
sudo apt-get install g++
#cmake
sudo apt install cmake
#python
sudo apt-get install python3
#python3-pip
sudo apt-get install python3-pip
pip install --upgrade pip
#docker
curl -fsSL https://get.docker.com | bash -s docker --mirror Aliyun
#安装docker之后,暂时只能用root权限使用,根据提示,需要使用以下命令让普通用户可以使用
dockerd-rootless-setuptool.sh install
#操作完成之后可能还需要添加环境变量(以命令行上的提示为准),将以下命令添加到~/.bashrc文件里
export PATH=/usr/bin:$PATH
export DOCKER_HOST=unix:///run/user/1000/docker.sock
docker run hello-world

国密算法

下载源码

  • https://www.openssl.org/source/openssl-1.1.1-pre4.tar.gz
  • https://www.openssl.org/source/openssl-1.1.1-pre5.tar.gz
tar xzvf openssl-1.1.1-pre4.tar.gz
tar xzvf openssl-1.1.1-pre5.tar.gz
cd openssl-1.1.1-pre5
./config
make
sudo make install
export LD_LIBRARY_PATH=`pwd`
 
./apps/openssl version
OpenSSL 1.1.1-pre5 (beta) 17 Apr 2018
echo -n "abc" | ./apps/openssl dgst -SM3
./apps/openssl ecparam -list_curves | grep SM2
./apps/openssl enc -ciphers
openssl
gmssl

中文输入法

  • 设置fcitx
  • 设置语言为中文
  • 下载搜狗输入法
  • 更新三件套:
sudo apt-get update
sudo apt-get upgrade
reboot
  • 若不奏效,焚香祷告,然后参考:https://blog.csdn.net/ccsodefhy/article/details/123122200