Minimal安装CentOS 6.7之后要做的基本配置
系统版本:# cat /etc/redhat-release
CentOS release 6.7 (Final)
# uname -r
2.6.32-573.el6.x86_64
1、配置网络连接
# vi /etc/sysconfig/network-scripts/ifcfg-eth0
ONBOOT=yes
BOOTPROTO=static
IPADDR=192.168.16.61
NETMASK=255.255.255.0
BROADCAST=192.168.16.255
NETWORK=192.168.16.0
GATEWAY=192.168.16.2
#修改或添加以上内容
# vi /etc/resolv.conf
nameserver 8.8.8.8
#修改DNS
# service network restart
#重启网络连接
2、安装vim和wget
# yum -y install vim wget
# vim /etc/vimrc
set tabstop=4
#设置vim编辑器的tab缩进为4个空格
#如果是CentOS7系统,也要执行该操作
3、配置阿里yum源
# mv /etc/yum.repos.d/CentOS-Base.repo{,.bak}
#备份原来的repo文件
#如果是CentOS7系统,也要执行该操作
# wget -O /etc/yum.repos.d/CentOS-Base.repo \
http://mirrors.aliyun.com/repo/Centos-6.repo
# wget -O /etc/yum.repos.d/epel.repo \
http://mirrors.aliyun.com/repo/epel-6.repo
#下载阿里的repo文件
## wget -O /etc/yum.repos.d/CentOS-Base.repo \
http://mirrors.aliyun.com/repo/Centos-7.repo
## wget -O /etc/yum.repos.d/epel.repo \
http://mirrors.aliyun.com/repo/epel-7.repo
#CentOS7下载上面两个文件
# vim /etc/yum.repos.d/CentOS-Media.repo
enabled=0
#确保不启用CentOS-Media.repo
# yum clean all
# yum makecache
#生成缓存;CentOS7也要执行
4、安装bash-completion,以支持增强Tab补全
# yum -y install bash-completion
## yum -y install bash-completion{,-extras}
#CentOS7加装extras
# reboot
5、安装lrzsz,以支持使用Xshell传输文件
# yum -y install lrzsz
# rz
#可使用rz命令,通过Xshell在Windows系统与CentOS系统之间传输文件
## yum -y install vim wget net-tools tcpdump mailx psmisc tree httpd-tools lftp unzip \
nss curl lbzip2 bzip2 git
#CentOS7加装程序包
6、配置hostname和hosts
# vim /etc/sysconfig/network
HOSTNAME=centos67n1
#修改为自己的hostname
## hostnamectl set-hostname centos71d3
#CentOS7使用hostnamectl set-hostname设置主机名
# vim /etc/hosts
127.0.0.1 localhost centos67n1 localhost4 localhost4.localdomain4
#将第3个字段修改为上面所配置的hostname
#CentOS7也要执行该操作
# reboot
#重启系统,使配置生效
7、修改命令提示符样式
# vim .bashrc
PS1="\[\e[\[\e\u@\h \[\e\A \[\e\w\[\e]\\$ "
#增加以上一行
# source .bashrc
#重读配置文件,立即生效
#
8、临时关闭selinux和防火墙
# vim /etc/selinux/config
SELINUX=disabled
# chkconfig iptables off
## systemctl disable firewalld
#CentOS7则关闭firewalld
# reboot
9、安装配置NTP,自动对时,确保时间的准确性
# yum -y install ntp
# vim /etc/ntp.conf
server 0.centos.pool.ntp.org iburst
server 1.centos.pool.ntp.org iburst
server 2.centos.pool.ntp.org iburst
server 3.centos.pool.ntp.org iburst
#在以上4行前面加“#”注释,或删除以上4行
server 2.cn.pool.ntp.org iburst
server 1.cn.pool.ntp.org iburst
#添加以上两行
## vim /etc/chrony.conf
#CentOS7则修改/chrony.conf文件
# chkconfig ntpd on
#设置开机自动启动NTP服务
## systemctl start chronyd.service
## systemctl enable chronyd.service
#CentOS7则启动chronyd服务
# reboot
# service ntpd status
ntpd (pid1347) is running...
#重启系统,确认NTP服务自动启动
# ntpq -p
remote refid st t when poll reach delay offsetjitter
==============================================================================
*85.199.214.100.GPS. 1 u 22 64347203.883 -4.243 6.467
+ntp.wdc1.us.lea 130.133.1.10 2 u 40 64337228.033 -1.87515.322
#NTP自动校对时间生效
## chronyc sources -v
#CentOS7则使用chronyc命令测试
此外,在安装系统时,注意不要勾选System clock uses UTC,UTC(Universe time coordinated)即世界协调时间,也就是0时区的时间。
http://i2.运维网.com/images/blog/201806/26/b01b29c8900361823eb5f25050a85e3f.png
页:
[1]