1.修改终端用户颜色
vim /etc/profile
添加以下代码到最后一行
PS1='[\[\e[32;1m\]\u\[\e[0m\]@\[\e[31;1m\]\h\[\e[0m\] \[\e[33;1m\]\W\[\e[0m\]]\$'
保存退出后更新文件
source /etc/profile
2.修改hostname
在root权限下,使用以下代码可永久更改hostname
hostnamectl set-hostname newname
临时更改:
hostname newname
3.更改yum源
以更改阿里源为例,先备份:
mv /etc/yum.repos.d/CentOS-Base.repo{,.bak}
下载新的CentOS-Base.repo
wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo
或
curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo
修改文件
sed -i s/http/https/ /etc/yum.repos.d/CentOS-Base.repo
更新yum
yum update
需要清理之前的缓存并重新生成新的
yum clean all
yum makecache
非阿里云ECS用户会出现 Couldn't resolve host 'mirrors.cloud.aliyuncs.com' 信息,不影响使用。用户也可自行修改相关配置:
sed -i -e '/mirrors.cloud.aliyuncs.com/d' -e '/mirrors.aliyuncs.com/d' /etc/yum.repos.d/CentOS-Base.repo
4.更改系统语言
修改文件vim /etc/locale.conf
LANG="zh_CN.UTF-8" //中文
或
LANG="en_US.UTF-8" //英文
重启系统即可