CentOS7 | 常用操作合集
CentOS7 | 常用操作合集
🔶修改网卡名为eth0的形式
安装界面中,按TAB键进入到内核参数配置界面,并手工输入如下参数,输入完毕后按回车键继续:
net.ifnames=0 biosdevname=0
🔶配置网络
nmtui
cat /etc/sysconfig/network-scripts/ifcfg-enp0s3
sed -i 's#ONBOOT=no#ONBOOT=yes#g' /etc/sysconfig/network-scripts/ifcfg-enp0s3
systemctl restart network
🔶yum 换源&升级
vi /etc/yum/pluginconf.d/fastestmirror.conf
#修改内容
enabled = 0
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
curl -s -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
curl -s -o /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
yum clean all && yum makecache
yum -y install epel-release
yum -y update
yum国内源
#阿里云
http://mirrors.aliyun.com/repo/Centos-7.repo
http://mirrors.aliyun.com/repo/Centos-6.repo
http://mirrors.aliyun.com/repo/Centos-5.repo
#网易源
http://mirrors.163.com/.help/CentOS7-Base-163.repo
http://mirrors.163.com/.help/CentOS6-Base-163.repo
http://mirrors.163.com/.help/CentOS5-Base-163.repo
#中科大
https://lug.ustc.edu.cn/wiki/_export/code/mirrors/help/centos?codeblock=3
https://lug.ustc.edu.cn/wiki/_export/code/mirrors/help/centos?codeblock=2
https://lug.ustc.edu.cn/wiki/_export/code/mirrors/help/centos?codeblock=1
🔶安装常用软件
yum -y install psmisc net-tools bash-completion vim-enhanced tree bzip2 wget git gcc gcc-c++ lrzsz mlocate fish
🔶设置vim
vim /etc/vimrc
打开文件后,按 i 进入编辑模式,然后找一个位置添加如下代码
"显示行号
set nu
"命令行显示vim当前模式
set showmode
"命令行显示输入的命令
set showcmd
"显示标尺
set ruler
"自动对齐
set smartindent
set autoindent
set cindent
"语法高亮
syntax on
"鼠标可用
set mouse=a
"tab缩进
set tabstop=4
set shiftwidth=4
set expandtab
set smarttab
"高亮查找匹配
set hlsearch
"显示匹配
set showmatch
"去除vi的一致性,使用vim的键盘模式
set nocompatible
"允许折叠
"set foldenable
"set fdm=syntax
"启动显示状态行
set laststatus=2
"浅色显示当前行
autocmd InsertLeave * se nocul
"用浅色高亮当前行
autocmd InsertEnter * se cul
"被分割窗口之间显示空白
set fillchars=vert:/
set fillchars=stl:/
set fillchars=stlnc:/
"从不备份
set nobackup
"禁止生成临时文件
set noswapfile
"粘贴不缩进
set paste
"设置字符集
set fileencodings=utf-8,ucs-bom,gb18030,gbk,gb2312,cp936
set termencoding=utf-8
set encoding=utf-8