ubuntu 环境变量配置、源修改

一:设置环境变量的三种方法

1.1 临时设置

export PATH=/home/yan/share/usr/local/arm/3.4.1/bin:$PATH

1.2 当前用户的全局设置

打开~/.bashrc,添加行:

vim ~/.bashrc
export PATH=/home/yan/share/usr/local/arm/3.4.1/bin:$PATH

使生效:

source .bashrc

1.3 所有用户的全局设置

$ vim /etc/profile

在里面加入:

export PATH=/home/yan/share/usr/local/arm/3.4.1/bin:$PATH

使生效

source profile

二: 查看当前的环境变量

echo $PATH
或
env

三: 修改源

1.在终端的命令窗口中输入下面的命令

sudo cp /etc/apt/sources.list /etc/apt/sources.list.bcakup

#先将需要配置的文件sources.list拷贝更名为sources.list.bcakup

2.在终端的窗口输入下面的命令使用gedit工具进行软件镜像源的数据编辑。(附清华源链接,将链接复制到sources.list,并注释掉原链接)

sudo gedit /etc/apt/sources.list

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

3.在终端上执行以下命令更新软件列表,检测出可以更新的软件:

sudo apt-get update

4.在终端上执行以下命令进行软件更新:

sudo apt-get upgrade

 

上一篇:Ubuntu各种操作


下一篇:【python】Django中配置 MySQL 数据库