云主机访问互联网必须绑定公网IP

为解决其他主机不联网安装软件问题,内网yum源

在华为云主页搜索栏查询----centOSyum

两个yum仓库

一个指向huawei_yum

另一个在跳板机(ecs-proxy)上自定义yum源 ansible管理主机

配置跳板机

1,配置yum源

rm -rf /etc/yum.repos.d/*.repo      #删除源仓库

curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirro rs.myhuaweicloud.com/repo/CentOS-Base- 7.repo    #下载仓库

yum clean all    #清缓存

yum makecache #更新

yum install -y net-tools lftp rsync psmisc vim-enhance d tree vsftpd bash-completion createrepo lrzsz iproute    #下载让软件包

net-tools 命令 ifconfig

lftp 命令

rsync 同步拷贝软件

psmisc 命令 PStree

vim-enhanced vim

bash-completion tab 键

mkdir /var/ftp/localrepo #创建目录

cd /var/ftp/localrepo #进入

createrepo .

createrepo --update . #更新

systemctl enable --now vsftpd #开启ftp服务

2、优化系统服务

[root@ecs-proxy ~]# systemctl stop postfix atd tuned #停止其他服务

[root@ecs-proxy ~]# yum remove -y postfix at audit tuned kexec-tools firewalld-* #删除其他软件包

[root@ecs-proxy ~]# vim /etc/cloud/cloud.cfg #修改配置文件

manage_etc_hosts: localhost 注释掉这一行

[root@ecs-proxy ~]# reboot #重启

3.配置ansible管理主机

将ansible_centos7.tar.gz传到主机

[root@ecs-proxy ~]# ls             #查看ansible_centos7.tar.gz

[root@ecs-proxy ~]# tar zxf ansible_centos7.tar.gz         #解压

[root@ecs-proxy ~]# yum install -y ansible_centos7/*.rpm     #安装

[root@ecs-proxy ~]# ssh-keygen -t rsa -b 2048 -N '' -f /root/.ssh/id_rsa       #生成密钥 -t: 加密方式 -b:密码长度 -N:密码 -f:指定路径

[root@ecs-proxy ~]# chmod 0400 /root/.ssh/id_rsa #修改权限

[root@ecs-proxy ~]# ssh-copy-id -i /root/.ssh/id_rsa 192.168.1.120

#将密钥传给模板主机 -i:指定密钥

/usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/root/.ssh/id_rsa.pub" The authenticity of host '192.168.1.120 (192.168.1.120)' can't be established. ECDSA key fingerprint is SHA256:bAN62Ciq2dAM1s7TNsgqe8FdlJhp8ftOgdDfw2HSBXc. ECDSA key fingerprint is MD5:c7:3e:d3:6e:c3:63:ee:89:4a:f2:01:3e:53:9c:1c:9e. Are you sure you want to continue connecting (yes/no)? yes

/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed /usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys root@192.168.1.120's password:

Number of key(s) added: 1

Now try logging into the machine, with: "ssh '192.168.1.120'" and check to make sure that only the key(s) you wanted were added.

[root@ecs-proxy ~]# ssh 192.168.1.120                 #测试远程管理

Welcome to Huawei Cloud Service

[root@ecs-host ~]# exit

logout Connection to 192.168.1.120 closed.

模板镜像配置

1,配置yum源

[root@ecs-host ~]# rm -rf /etc/yum.repos.d/*.repo     #删除之前仓库

[root@ecs-host ~]# curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.myhuaweicloud.com/repo/CentOS-Base-7.repo #下载仓库

[root@ecs-host ~]# vim /etc/yum.repos.d/local.repo #编写本地仓库

[local_repo]                          #标识

name=CentOS-$releasever – Localrepo      #名字

baseurl=ftp://192.168.1.252/localrepo            #跳板机IP

enabled=1          #默认=1

gpgcheck=0          #检测

[root@ecs-host ~]# yum clean all #清缓存

[root@ecs-host ~]# yum makecache #更新仓库

[root@ecs-host ~]# yum repolist #查看

[root@ecs-host ~]# yum install -y net-tools lftp rsync psmisc vim-enhanced tree lrzsz bash-completion iproute #下载软件

2、优化系统服务

[root@ecs-host ~]# systemctl stop postfix atd tuned #停止其他服务

[root@ecs-host ~]# yum remove -y postfix at audit tuned kexec-tools firewalld-* #删除其他软件包 [root@ecs-host ~]# vim /etc/cloud/cloud.cfg       #修改配置文件

manage_etc_hosts: localhost 注释掉这一行

[root@ecs-host ~]# yum clean all #查看yum

[root@ecs-host ~]# poweroff #关机

关机以后把主机系统盘制作为模板

将真机五阶段所有软件包传到跳板机上 proxy

网站云平台部署

购买三台云主机 软件素材在云盘的 public/web_install 目录下webhome.tar.gz

[root@ecs-proxy ~]# mkdir -p web-site #创建目录

[root@ecs-proxy ~]# cd web-site #进入目录

[root@ecs-proxy web-site]# vim ansible.cfg #编写脚本

[defaults]

inventory = hostlist #主机清单

host_key_checking = False #遇到yes时,直接yes,不需要手动输入

[root@ecs-proxy web-site]# vim hostlist #编写主机清单文件

[web]

192.168.1.[11:13] #11,12,13三台云主机

[root@ecs-proxy web-site]# vim web_install.yaml #编写ansible执行脚本

-   -   -
- name: web 集群安装hosts: web tasks:
- name: 安装 apache 服务 yum: name: httpd,php state:latest update_cache: yes
- name: 配置 httpd 服务 service: name: httpd state: started enabled: yesname: 部署网站网页 unarchive: src: files/webhome.tar.gzdest: /var/www/html/ copy: yesowner: apache group: apache

[root@ecs-proxy web-site]# mkdir files #创建files目录

[root@ecs-proxy web-site]# ls ansible.cfg files hostlist web_install.yaml

[root@ecs-proxy files]# cd files

[root@ecs-proxy files]# pwd #查看当前所在目录

/root/web-site/files

[root@ecs-proxy ~]# ls #查看当前目录下有没有webhome.tar.gz 软件包 ansible_centos7 ansible_centos7.tar.gz webhome.tar.gz web-site webhome.tar.gz

#将public/web_install 目录下的webhome.tar.gz 拷贝到/root/web-site/files目录下

[root@ecs-proxy files]# cd

[root@ecs-proxy ~]# cp -r webhome.tar.gz /root/web-site/files/   #拷贝到/root/web-site/files目录下

[root@ecs-proxy ~]# cd web-site        #进到写有ansible执行脚本的目录

[root@ecs-proxy web-site]# ansible-playbook web_install.yaml       #执行ansible执行脚本

PLAY [web 集群安装] ***************************

TASK [Gathering Facts] ************************ ok: [192.168.1.13] ok: [192.168.1.11] ok: [192.168.1.12]

TASK [安装 apache 服务] *************************** changed: [192.168.1.13] changed: [192.168.1.12] changed: [192.168.1.11]

TASK [配置 httpd 服务] ************************ changed: [192.168.1.13] changed: [192.168.1.12] changed: [192.168.1.11]

TASK [部署网站网页] ***************************** changed: [192.168.1.13] changed: [192.168.1.11] changed: [192.168.1.12]

PLAY RECAP **************************** 192.168.1.11 : ok=4 changed=3 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0 192.168.1.12 : ok=4 changed=3 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0 192.168.1.13 : ok=4 changed=3 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0

购买负载均衡

选择共享型负载均衡

解决单一主机访问

listen接收用户请求 前端接收

分摊请求 后端转发

将web三台主机添加到负载均衡中

首先标位异常,然后逐台检测,大约1分钟,正常标记正常

购买公网IP

绑定负载均衡

浏览器访问公网IP测试

跳板机配置,镜像创建,网站云平台部署相关推荐

  1. 基于AWS 平台跳板机配置

    很多用户通过跳板机对部署在AWS平台的应用系统进行日常维护,为管理私有网络的服务器提供便利,最小化了应用系统的安全风险,从而有利于提升整体架构的安全. 为达到更好的安全性,需要进行恰当的规划,通常可以 ...

  2. [arduino]ESP8266配置连接IoT阿里云平台(arduino D1 mini)

    [arduino]ESP8266配置连接IoT阿里云平台(arduino D1 mini) 前言 ESP8266配置(基础) ESP8266头文件配置 安装AliyunIoTSDK库 安装Arduin ...

  3. linux 文件 跳板机_linux跳板机配置

    1.IP配置############### 跳板机IP:192.168.10.128 Server1IP:192.168.10.133 Server2IP:192.168.10.132 Server3 ...

  4. 手把手教你创建阿里云平台

    手把手教你创建阿里云平台 创建: 1.打开阿里云平台官网https://account.aliyun.com/,注册账号 2.登录账号,找到产品界面并创建产品 3.新建产品,设置如下 4.产片创建成功 ...

  5. 《Python分布式计算》 第5章 云平台部署Python (Distributed Computing with Python)

    序言 第1章 并行和分布式计算介绍 第2章 异步编程 第3章 Python的并行计算 第4章 Celery分布式应用 第5章 云平台部署Python 第6章 超级计算机群使用Python 第7章 测试 ...

  6. ZStack实践汇 | 基于ZStack云平台部署FortiGate

    2019年国际知名信息安全峰会RSA Conference在美国旧金山举行,在所有演讲主题中,云安全超过网络安全和数据安全,成为热门关键词第一.ZStack实践汇这次带来的是<基于ZStack云 ...

  7. K8S云平台部署过程说明

    近期由于工作原因,在项目支持的过程中,进行了一次K8S的基础环境部署,云平台一直是公司的重要底座,而我由于一系列原因,一直没有亲自尝试,通过本次的机会,让我重新做了一遍,也找到了和以前部署传统环境一样 ...

  8. 原生Kubernetes云平台部署

    Kubernetes云平台部署 注意事项: 1.Linux系统CentOS_7.5.1804系统,并保持网络通畅 2.docker的版本是Docker 18.09 3.硬件配置:2GB或更多RAM,2 ...

  9. 在云平台部署flask项目

    云平台部署flask项目----以收截图小项目为例 因为我的阿里云(Windows server 2012)之前从未配置过python的环境,所以只能从零开始,直入主题 1.安装python3.6 直 ...

最新文章

  1. Scheme来实现八皇后问题(2)
  2. MVC界面开发包Essential Studio for ASP.NET MVC发布2017 v3丨附下载
  3. using 指令是不需要的和其他两个C#错误
  4. 最牛啤的java,没有之一~
  5. SQL SERVER 判断是否存在并删除某个数据库、表、视图、触发器、储存过程、函数
  6. wxWidgets:wxSizerFlags类用法
  7. python 用元类 type 实现对数据库的ORM 映射
  8. android matrix 缩放,android – 如何获取任意矩阵的缩放值?
  9. java开发实战经典学习笔记第2部分
  10. python递归函数查询表_python利用递归函数输出嵌套列表的每个元素
  11. Atitit web 之道 艾龙著 Atitit web 之道 艾龙艾提拉著v2 saa.docx Atitit web开发之道 attilax著 Web应用 1. 第1章 Web编程基础知识 (
  12. 更改eclipse炫酷主题
  13. word文档在线预览解决方案
  14. 【记Unexpected token】
  15. 野火PID上位机通信移植
  16. FreeBSD-12.2 安装GNOME3桌面视频教程
  17. oracle remote diagnostic agent,Oracle数据库收集、分析工具RDA(RemoteDiagnostic Agent)下载
  18. 搞Java的年薪 40W 是什么水平? 1
  19. 连载:中国最早的一代官派留学生--留美幼童 (结尾)
  20. 个人申请微信公众号步骤(含截图)

热门文章

  1. cos三次方积分_cos(t)的3次方公式是什么?
  2. 什么是ASEMI二极管SFF3006反向恢复
  3. [zz from newsmth]王大牛的Memory Model白话系列(2)
  4. 正点原子LCD转接板与最小系统板的连接
  5. 前端诡异参数start
  6. Hive中小表与大表关联(join)的性能分析
  7. Hive SQL 小表与大表Join 原理与实操
  8. R语言-ggplot基础绘图参数设置
  9. Firebird数据库的安装配置与使用
  10. Phenix图文流程:使用docking解决Cryo-EM数据的结构问题