架构-环境准备-01

架构环境

127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
172.16.1.5      lb01
172.16.1.6      lb02
172.16.1.7      web01
172.16.1.8      web02
172.16.1.31     nfs01
172.16.1.41     backup
172.16.1.51     db01 db01.etiantian.org
172.16.1.61     m01

存放于backup /etc/hosts
集群架构系统基础环境准备
1.安装全新centos 7系统 配置2块网卡 eth0 eth1命名
2.第二块网卡为NAL模式(公网环境),配置网段为10.0.0.0网段,配置网段为172.16.1.0网段
3.优化安装好的centos 7的虚拟机,安装常用软件·关闭防火墙
优化步骤

1.匹配yum仓库

先备份

      mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup

1、下载网址:https://opsx.alibaba.com/mirror

2、Ctrl + f 网页搜索epel,点击操作列的“帮助”

3、备份(如有配置其他epel源)

mv /etc/yum.repos.d/epel.repo /etc/yum.repos.d/epel.repo.backup
mv /etc/yum.repos.d/epel-testing.repo /etc/yum.repos.d/epel-testing.repo.backup

4、下载新repo 到/etc/yum.repos.d/

wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo

注:配置epel源,需要先安装wget,yum install -y wget

2.安装基础软件包

yum install  -y  net-tools  vim  tree  htop  iftop  iotop lrzsz sl wget unzip  telnet nmap nc psmisc dos2unix  bash-completion bash-completion-extra sysstat  rsync nfs-utils httpd-tools -y

3.关闭防火墙 firewalld

1>临时关闭防火墙(重启服务器失效)

systemctl stop firewalld(start开启)

2>永久关闭防火墙(重启服务器失效)

systemctl disable firewalld(enable永久开启)

3>检查防火墙

扫描二维码关注公众号,回复: 6521605 查看本文章
systemctl status firewalld(检查防火墙的状态)

注:如果在工作中,服务器无法重启的时候,临时和永久都要修改

4.关闭selinux

1>操作前备份 操作后检查

cp /etc/selinux/config /etc/selinux/config.bak

2>临时关闭SELinux(重新登录系统失效)

getenforce 查看SELinux状态
setenforce 修改SELinux状态
setenforce 0 修改SELinux状态

3>永久关闭SELinux(会在服务器重启之后生效)
修改配置文件

 /etc/selinux/config中SELINUX=disabled
enforcing   

SELinux开启
permissive
SELinux关闭 还会有警告信息
disabled
SELinux彻底关闭

4>检查SELinux状态

grep '=disabled' /etc/selinux/config
SELINUX=disabled

注:如果在工作中,服务器无法重启的时候,临时和永久都要修改

5.调整单个进程最大能打开文件的数量

 echo  '* - nofile 65535' >>/etc/security/limits.conf

6. 修改字符集

永久修改:

localectl set-locale LANG=en_US.utf-8

检查:echo $LANG
显示他表示成功:en_US.UTF-8

sed -i 's/#UseDNS yes/UseDNS no/g' /etc/ssh/sshd_config                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    

7.修改环境变量-字体颜色

修改PS1变量
临时修改:export

PS1="[\[\e[34;1m\]\u@\[\e[0m\]\[\e[32;1m\]\H\[\e[0m\] \[\e[31;1m\]\w\[\e[0m\]]\\$  "
  永久修改 echo export
 PS1="[\[\e[34;1m\]\u@\[\e[0m\]\[\e[32;1m\]\H\[\e[0m\] \[\e[31;1m\]\w\[\e[0m\]]\\$ " >>/etc/profile
检查 echo $PS1

1.对优化完毕的虚拟机进行克隆

1.选择连接克隆(被克隆虚拟机出现问题 克隆虚拟机无法使用)
2.完整克隆(完完全全复制一份 占用空间)

2.对克隆虚拟机进行以下操作

1.修改主机名
2.修改ip地址
3.重启服务器

3.创建xshell 标签--测试是否能连接成功.

转载于:https://www.jianshu.com/p/4e96763c6439

猜你喜欢

转载自blog.csdn.net/weixin_33933118/article/details/91328122