一、修改网卡名:
1. cd /etc/sysconfig/network-scripts
vim ifcfg-eth2-------ifcfg-eth2为想要修改的网卡,这里修改成想要修改成的网卡名,如eth0
2. cd /etc/udev/rules.d
vim 70-persistent-net.rules----各系统70-persistent-net.rules文件有所不同,根据实际情况选择
3. 修改完重启机器(reboot)即可
二、修改linux主机名
1. hostname tz666-----修改成想要的主机名
2. vim /etc/hostname
3.修改完重启机器(reboot)即可
三、在使用vim编辑器敲shell脚本时,不小心按到了Shift + 3, 使得选择文本高亮,看着很不舒服的解决方法
切换到命令模式:
使用命令: :noh------取消字符串的高亮显示
三、Centos7配置阿里的yum源
cd /etc/yum.repos.d
mv CentOS-Base.repo CentOS-Base.repo.bak
wget -O CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo
curl -o CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo
wget和curl两者选其一即可
yum clean all--------清除系统所有的yum缓存
yum makecache----重新生成yum缓存
yum -y update------升级所有包的同时也升级软件和系统内核,而yum -y upgrade只升级所有包,不升级软件和系统内核
四、python阿里的pip源配置(https://developer.aliyun.com/mirror/)
查看pip版本:pip -V
1.windows系统
win+R打开cmd窗口,输入%appdata%回车,新建pip文件夹,接着在pip文件夹下新建pip.ini文件,输入以下内容:
[global]
time-out=60
index-url=http://mirrors.aliyun.com/pypi/simple/
[install]
trusted-host=mirrors.aliyun.com
测试:win+R打开cmd窗口,安装requests模块:pip install requests==2.26.0
2.Linux系统
vim /root/.pip/pip.conf
[global]
time-out=60
index-url=http://mirrors.aliyun.com/pypi/simple/
[install]
trusted-host=mirrors.aliyun.com
测试:安装requests模块:pip install requests==2.26.0