非root用户编译安装
终极版本
经过编译源码等等痛苦的过程
碰到编译出错 连不上网络等等问题
仍然没有解决
最终通过以下方法解决
安装成功
root@ubuntu:/# gcc --version
gcc (Ubuntu 4.8.5-4ubuntu8) 4.8.5
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
若是提示没有找到这个包
则在/etc/apt/sources.list
中添加以下两个源
deb http://dk.archive.ubuntu.com/ubuntu/ xenial main
deb http://dk.archive.ubuntu.com/ubuntu/ xenial universe
更新源 重新下载即可
1 下载gcc-4.8
打开terminal依次输入以下命令即可
sudo apt install linux-libc-dev
sudo apt-get -f install
sudo apt install gcc-4.8
若输入gcc --version
显示的不是gcc4.8 继续以下步骤
2 更改软链接
1) 查看存在的gcc
ll /usr/bin/gcc*
若默认软链接不是gcc4.8
继续以下步骤
2) 删除默认软链接
sudo rm /usr/bin/gcc
3) 修改软链接
sudo ln -s /usr/bin/gcc-4.8 /usr/bin/gcc
4) 查看gcc版本
gcc --version
修改成功
root@ubuntu:/# gcc --version
gcc (Ubuntu 4.8.5-4ubuntu8) 4.8.5
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
问题记录
1 -bsah:make:command not found
由于安装的虚拟机没有安装make vim等功能
所以需要重新安装
直接使用sudo apt-get install make
安装则会出现下一个问题
2 E:Package make has no installation candidate
这个时候要更新软件源与升级
sudo apt-get update
sudo apt-get upgrade
这个时候又会出现下一个问题
3 Could not resolve ‘archive.ubuntu.com’
通过修改软件源解决以上问题
sudo gedit /etc/apt/sources.list
打开文件后,在文件最前面添加中科大的镜像源和清华的镜像源
中科大
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
清华
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
修改完成 保存文件
再次输入更新命令
sudo apt-get update
sudo apt-get upgrade
然后下载make
sudo apt-get install make
成功 问题解决