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

在这里插入图片描述

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

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

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

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

第二阶段准备

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

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

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

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

CentOS 6 VS 7的区别

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

1. 网 卡 配 置 \color{red}{1.网卡配置} 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.关闭服务} 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.检查定时任务是否开机自启动} 3.

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

4. 修 改 y u m 源 与 e p e l 源 \color{red}{4.修改yum源与epel源} 4.yumepel
修改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 root@oldboyedu ~]# 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.安装常用软件工具} 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. 修 改 / e t c / s s h / s s h d . c o n f i g 79 行 和 115 行 然 后 重 启 s s h d 服 务 \color{red}{6.修改/etc/ssh/sshd.config 79行和115行 然后重启sshd服务} 6./etc/ssh/sshd.config79115sshd
1.修改sshd.config文件

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

2.查看修改状态

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

3.重启sshd

[16:48 root@oldboyedu ~]# systemctl restart sshd

7. 配 置 变 量 别 名 / e t c / p r o f i l e \color{red}{7.配置变量别名/etc/profile} 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. 添 加 新 用 户 o l d b o y , 配 置 s u d o 权 限 \color{red}{8.添加新用户oldboy,配置sudo权限} 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.配置定时任务更新时间} 9.

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

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

10. 克 隆 虚 拟 机 \color{red}{10.克隆虚拟机} 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. 开 机 修 改 主 机 名 和 I P 地 址 \color{red}{12.开机修改主机名和IP地址} 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		

未完待续…

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值