作者:【吴业亮】
博客:http://blog.csdn.net/wylfengyujiancheng
1、配置本地源
mkdir /etc/yum.repos.d/bak_repo_bak
mv /etc/yum.repos.d/*.repo /etc/yum.repos.d/bak_repo_bak
cat <<END >/etc/yum.repos.d/repo.repo
[repo]
name=repo
baseurl=http://172.16.8.7/CentOS7.3-Mini-Ha-Pike/
gpgcheck=0
enabled=1
proxy=_none_
END
cat <<END > /etc/yum.repos.d/CentOS-Base.repo
[base]
name=CentOS-7 - Base
baseurl=http://172.16.8.200/repos/centos/7/os/x86_64/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
[updates]
name=CentOS-7 - Updates
baseurl=http://172.16.8.200/repos/centos/7/updates/x86_64/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
[extras]
name=CentOS-7 - Extras
baseurl=http://172.16.8.200/repos/centos/7/extras/x86_64/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
END
注意:172.16.8.200为局域网本地源服务器
更新系统
yum update –y
删除文件
rm -rf /etc/yum.repos.d/CentOS-*
2、关闭防火墙和selinux
service firewalld stop
chkconfig firewalld off
sed -i "s/^SELINUX=enforcing/SELINUX=disabled/g" /etc/selinux/config
sed -i -e 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/sysconfig/selinux
setenforce 0
3、修改主机名
hostnamectl set-hostname node1
hostnamectl set-hostname node2
hostnamectl set-hostname node3
hostnamectl set-hostname computer1
hostnamectl set-hostname computer2
hostnamectl set-hostname computer3
修改hosts文件
# cat <<"EOF">/etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
172.16.8.60 node1
172.16.8.61 node2
172.16.8.62 node3
172.16.8.63 computer1
172.16.8.64 computer2
172.16.8.65 computer3
EOF
配置本地源
4、时间同步NTP
采用局域网NTP
# echo '* * * * * /usr/sbin/ntpdate NTP服务器地址 ' >/var/spool/cron/root
如果控制节点可以上网:
# echo '* * * * * /usr/sbin/ntpdate 202.108.6.95' >/var/spool/cron/root
5、安装一些工具
# yum install -y vim net-tools
# yum install openstack-selinux –y
# yum install openstack-selinux python-openstackclient yum-plugin-priorities -y
# yum install -y openstack-utils
6、重启机器
reboot
以为update过程升级了内核,需要重启下使内核生效
附录:
ntp服务器配置
# yum -y install ntp
修改配置文件/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
server 127.127.1.0
fudge 127.127.1.0 stratum 0
启动服务并设置开机启动
# systemctl start ntpd
# systemctl enable ntpd
查看ntp状态
# ntpq -p