Centos6.x安装之后的9件事

Centos6.x安装之后的9件事

这些不是必须都做的,只不过是我个人的习惯,在此记录一下。

1.修改yum源到国内

CentOS系统更换软件安装源
  1. 备份你的原镜像文件,以免出错后可以恢复。
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.bak
  1. 下载新的CentOS-Base.repo 到/etc/yum.repos.d/
CentOS 5
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-5.repo
CentOS 6
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo
  1. 生成缓存
   yum clean all
   yum makecache
   yum update

2.防火墙设置

# 临时关闭防火墙
service iptables stop

# 永久关闭防火墙
chkconfig iptables off

3.设置ssh免密登陆

ssh免密登陆设置教程

4.添加man

yum -y install man

5.修改目录颜色

注意:先安装zsh后再执行,不然安装zsh后又变回原来的样子了

# 方法一:
# 在~/.bash_profile文件中添加LS_COLORS
export LS_COLORS='no=00:fi=00:di=01;33:ln=01;36:pi=40;33:so=01;35:bd=40;33;01:cd=40;33;01:or=01;05;37;41:mi=01;05;37;41:ex=01;35:*.cmd=01;35:*.exe=01;35:*.com=01;35:*.btm=01;35:*.bat=01;35:*.sh=01;35:*.csh=01;35:*.tar=01;31:*.tgz=01;31:*.arj=01;31:*.taz=01;31:*.lzh=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.gz=01;31:*.bz2=01;31:*.bz=01;31:*.tz=01;31:*.rpm=01;31:*.cpio=01;31:*.jpg=01;35:*.gif=01;35:*.bmp=01;35:*.xbm=01;35:*.xpm=01;35:*.png=01;35:*.tif=01;35:'


# 方法二:
# 拷贝/etc/DIR_COLORS文件为当前主目录的 .dir_colors
cp /etc/DIR_COLORS ~/.dir_colors
# 修改~/.dir_colors中DIR对应的颜色
vim ~/.dir_colors
# 把DIR 01;34(01:粗体,34:蓝色)修改为 DIR 01;33(01:粗体,33:黄色)
# eval `dircolors /etc/DIR_COLORS`

6.个性化Vim

:set nu
:noh
set ignorecase
set shortmess=atI
syntax on
autocmd InsertLeave * se nocul
set ruler
set showcmd
set foldenable
set foldmethod=manual
set autowrite
set cursorline
set confirm
set autoindent
set cindent
set tabstop=4
set softtabstop=4
set shiftwidth=4
set noexpandtab
set smarttab
set hlsearch
set incsearch
set enc=utf-8
set fencs=utf-8,ucs-bom,shift-jis,gb18030,gbk,gb2312,cp936
set langmenu=zh_CN.UTF-8
set showmatch
set smartindent

7.删除配置文件中以'#'开始的注释

# 删除~/.zshrc文件中以#开头的注释行
sed -i -e '/#/d' ~/.zshrc

# 删除~/.zshrc文件中的空行
sed -i -e '/^\s*$/d' ~/.zshrc

8.zsh

# 安装zsh
yum install zsh

# 下载oh-my-zsh
sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"

# 修改主题
vim ~/.zshrc
# 修改第10行为
ZSH_THEME="agnoster"
# 保存退出后
source ~/.zshrc

# !!如果出现乱码的话,请自行安装PowerLineII字体~

9.zsh插件

# 自动提示插件
git clone git://github.com/zsh-users/zsh-autosuggestions $ZSH_CUSTOM/plugins/zsh-autosuggestions

# 修改自动提示的颜色
vim ~/.oh-my-zsh/custom/plugins/zsh-autosuggestions/zsh-autosuggestions.zsh

# 找到 ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE='fg=8' 修改为
ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE='fg=6'

# 高亮插件
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ~/.oh-my-zsh/custom/plugins/zsh-syntax-highlighting

# vim ~/.zshrc 并找到plugins
plugins=(git zsh-autosuggestions zsh-syntax-highlighting)

source ~/.zshrc

猜你喜欢

转载自www.cnblogs.com/tdg-yyx/p/9484406.html
今日推荐