第八周-day33-综合架构准备

第八周-day33-综合架构准备

linux的第一阶段结束了,让我们一起开始第二阶段的架构之旅。Let’s Go

第一阶段必要掌握的:

各种基础命令70-80个
错误提示及排错流程
知识点
面试题
基础不牢 地动山摇
一定要记住 出来混迟早要还的!

第二阶段目前要准备到的:

一步步告诉你 网站背后的结构
流程 过程
	搭建流程
	记录错误及排错
自学的能力

第二阶段准备

在学习的时候我们要先走通路 再变通

常用工具和进阶优化
IT大牛链接—https://www.jianshu.com/p/b462820f7fe5

一、首先就是一台全新虚拟机
2块网卡
	NAT 模拟公网
	LAN区段 模拟局域网 172.16.1.0/24

	磁盘给100G左右,如果紧张给20G也可以

第八周-day33-综合架构准备

CentOS 6 VS 7的区别

https://www.jianshu.com/p/fff040a44a3f

1.\color{red}{1.网卡配置}

eth0
vim /etc/sysconfing/network-scripts/ifcfg-eth0
	TYPE=Ethernet
	BOOTPROTO=none
	NAME=eth0
	DEVICE=eth0
	ONBOOT=yes
	IPADDR=10.0.0.201
	PREFIX=24
	GATEWAY=10.0.0.254
	DNS1=10.0.0.254
eth1
vim /etc/sysconfing/network-scripts/ifcfg-eth1
	TYPE=Ethernet
	BOOTPROTO=static   \\静态
	IPADDR=172.16.1.201
	PREFIX=24
	NAME=eth1
	DEVICE=eth1
	ONBOOT=yes

内网不需要配置DNS和网关
重启网卡生效:systemctl restart network

2.\color{red}{2.关闭服务}

查看是否在运行,是否开机自启动
systemctl is-enabled firewalld NetworkManager
systemctl is-active firewalld NetworkManager

1.关闭firewalld

systemctl stop firewalld(关闭)
systemctl disable firewalld(永久关闭)

2.关闭selinux

vim /etc/selinux/config == SELINUX=disabled
或者执行setenforce 0 ,getenforce查看

3.关闭NetworkManager

systemctl stop NetworkManager
systemctl disable NetworkManager

3.\color{red}{3.检查定时任务是否开机自启动}

crond定时任务
  systemctl status crond
  systemctl is-active crond 是否运行中
  systemctl is-enable crond 是否开机自启动

4.yumepel\color{red}{4.修改yum源与epel源}
修改yum源与epel源 https://opsx.alibaba.com/mirror 阿里云开源镜像网址
repo 源的意思

yum源:

1.备份

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

2.下载新的CentOS-Base.repo到/etc/yum.repos.d/

wget -O /etc/yum.repos.d/CentOS-Base.
repo http://mirrors.aliyun.com/repo/Centos-7.repo
或者
curl -o /etc/yum.repos.d/CentOS-Base.
repo http://mirrors.aliyun.com/repo/Centos-7.repo

yum.repos.d  系统yum源的存放位置(格式:xxx.repo)
运行yum repolist 查看yum源是否修改成功

epel源:

1.备份(如有配置其他EPEL源)

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

2,下载新repo到/etc/yum.repos.d/

epel 安装wget

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

3.查看yuum源:yum repolist

[16:34 [email protected] ~]# yum repolist 
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirrors.aliyun.com
 * extras: mirrors.aliyun.com
 * updates: mirrors.aliyun.com
repo id             repo name                                         status
!base/7/x86_64      CentOS-7 - Base - mirrors.aliyun.com              10,019
!epel/x86_64        Extra Packages for Enterprise Linux 7 - x86_64    13,190
!extras/7/x86_64    CentOS-7 - Extras - mirrors.aliyun.com               413
!updates/7/x86_64   CentOS-7 - Updates - mirrors.aliyun.com            1,862
repolist: 25,484	

5.\color{red}{5.安装常用软件工具}

yum install -y tree vim wget bash-completion   bash-completion-extras
  lrzsz net-tools sysstat iotop iftop htop unzip nc nmap telnet bc psmisc

6./etc/ssh/sshd.config79115sshd\color{red}{6.修改/etc/ssh/sshd.config 79行和115行 然后重启sshd服务}
1.修改sshd.config文件

vim /etc/ssh/sshd_config  进入后输入“/”可查找
79 GSSAPIAuthentication yes
115 UseDNS no

2.查看修改状态

[16:48 [email protected] ~]# egrep -n '^(GSSAPIA|UseDNS)' /etc/ssh/sshd_config 
79:GSSAPIAuthentication no
115:UseDNS no

3.重启sshd

[16:48 [email protected] ~]# systemctl restart sshd

7./etc/profile\color{red}{7.配置变量别名/etc/profile}

1. export PS1="\[\e[37;40m\][\[\e[32;40m\]\A \u\[\e[36;40m\]@\h \[\e[31;40m\]\\w\[\e[0m\]]\\$ "
2. alias rm='rm -i'

3.添加网卡别名:
	eth0  alias eth0='cat /etc/sysconfig/network-scripts/ifcfg-eth0'
	eth1  alias eth1='cat /etc/sysconfig/network-scripts/ifcfg-eth1'
	

8.oldboy,sudo\color{red}{8.添加新用户oldboy,配置sudo权限}

useradd oldboy  创建一个用户

visudo或vim /etc/sudoers  第100行左右100dd添加sudo权限
    oldboy  ALL=(ALL)       NOPASSWD:ALL

检查:grep oldboy /etc/sudoers

9.\color{red}{9.配置定时任务更新时间}

[19:38 [email protected] ~]# crontab -e
\#/bin/bash-date
*/5 * * * *  sh ntpdate ntp.aliyun.com >/dev/null 2>&1	

#仔细检查所有的优化成功后 关机拍摄快照

10.\color{red}{10.克隆虚拟机}

1.完整克隆
占用比较多磁盘空间
俩个机器之间没有关系

2.链接克隆
占用比较少磁盘空间
模板机删掉链接克隆机都不能用

克隆2台虚拟机器,进入修改第1张和第2张网卡IP地址

1.	backup	10.0.0.41	172.16.1.41

2.	nfs01	10.0.0.31	172.16.1.31

12.IP\color{red}{12.开机修改主机名和IP地址}

第一台10.0.0.41
  修改主机名:hostnamectl set-hostname backup  su - 刷新

  修改网卡名:
	eth0 IPADDR=10.0.0.41
	eth1 IPADDR=172.16.1.41
	网卡重启生效 systemctl restart network

第二台10.0.0.31
  修改主机名:hostnamectl set-hostname nfs01  su - 刷新

  修改网卡名:
	eth0 IPADDR=10.0.0.31
	eth1 IPADDR=172.16.1.31
	网卡重启生效 systemctl restart network		

未完待续…