安装wget(一般ubuntu会自带)
cpp
sudo apt-get install wget
更换国内软件源
先备份原来的/etc/apt/source.list⽂件
cpp
sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak
防止修改错误 导致无可挽回
将下列国内镜像源 写入原来的/etc/apt/source.list⽂件(注意格式 防止格式出错)
cpp
deb http://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse
#添加清华源
deb 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 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
新增完毕后,更新源
cpp
sudo apt-get update
安装lrzsz传输⼯具
cpp
sudo apt-get install lrzsz
rz --version
安装编译器gcc/g++
cpp
sudo apt-get install gcc g++
安装项⽬构建⼯具make
cpp
sudo apt-get install make
安装调试器gdb
cpp
sudo apt-get install gdb
安装git
cpp
sudo apt-get install git
git --version
安装cmake
cpp
sudo apt-get install cmake
cmake --version
安装jsoncpp
cpp
sudo apt-get install libjsoncpp-dev
安装Muduo
cpp
git clone https://github.com/chenshuo/muduo.git
Muduo库克隆的时候可能会有点慢
但是我替换了软件源 感觉挺快的
安装依赖环境
cpp
sudo apt-get install libz-dev libboost-all-dev
我在安装依赖环境的时候出现 依赖包的依赖关系问题
我参考了以下文章
当然,你遇到的问题也许不是我所遇到的。
运⾏脚本编译安装
cpp
unzip muduo-master.zip
./build.sh
./build.sh install
没有安装unzip需要去安装
cpp
sudo apt-get install unzip