前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >实验环境配置

实验环境配置

作者头像
耕耘实录
发布2019-07-02 14:39:04
5370
发布2019-07-02 14:39:04
举报
文章被收录于专栏:耕耘实录耕耘实录耕耘实录

版权声明:本文为耕耘实录原创文章,各大自媒体平台同步更新。欢迎转载,转载请注明出处,谢谢。联系本人:ecsboy(微信),136625317(QQ) https://cloud.tencent.com/developer/article/1454628

实验环境配置

一 默认环境

1.1 操作系统

[root@gysl-DevOps ~]# cat /etc/centos-release
CentOS Linux release 7.6.1810 (Core)

2.1 Swap 设置

[root@gysl-DevOps ~]# free -h
              total        used        free      shared  buff/cache   available
Mem:           972M        182M        175M        7.6M        615M        571M
Swap:            0B          0B          0B

为了后期 Kubernetes 实验,在安装系统的时候关闭了 Swap 。

二 更改默认配置

安装Docker Engine,修改相关内核参数,关闭防火墙,禁用SELinux,安装EPEL,重启机器。脚本如下:

#!/bin/bash
UserName='gysl'
PassWord='drh123'
# Install the Docker engine. This needs to be executed on every machine.
curl http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo -o /etc/yum.repos.d/docker-ce.repo>&/dev/null
if [ $? -eq 0 ] ;
    then
        yum remove docker \
                      docker-client \
                      docker-client-latest \
                      docker-common \
                      docker-latest \
                      docker-latest-logrotate \
                      docker-logrotate \
                      docker-selinux \
                      docker-engine-selinux \
                      docker-engine>&/dev/null
        yum list docker-ce --showduplicates|grep "^doc"|sort -r
        yum -y install docker-ce-18.09.3-3.el7
        rm -f /etc/yum.repos.d/docker-ce.repo
        systemctl enable docker --now && systemctl status docker
    else
        echo "Install failed! Please try again! ";
        exit 110
fi
# Modify related kernel parameters. 
cat>/etc/sysctl.d/kubernetes.conf<<EOF
net.ipv4.ip_forward = 1
net.bridge.bridge-nf-call-ip6tables = 1
net.bridge.bridge-nf-call-iptables = 1
EOF 
sysctl -p /etc/sysctl.d/kubernetes.conf>&/dev/null 
# Turn off and disable the firewalld.  
systemctl stop firewalld  
systemctl disable firewalld  
# Disable the SELinux.  
sed -i.bak 's/=enforcing/=disabled/' /etc/selinux/config  
# Disable the swap.  
sed -i.bak 's/^.*swap/#&/g' /etc/fstab
# Install EPEL/vim/git.  
yum -y install epel-release vim git
yum repolist
# Add a docker user.
useradd $UserName
echo $PassWord|passwd $UserName --stdin
usermod $UserName -aG docker  
# Reboot the machine.  
reboot
本文参与 腾讯云自媒体分享计划,分享自作者个人站点/博客。
原始发表:2019年03月17日,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • 实验环境配置
    • 一 默认环境
      • 1.1 操作系统
      • 2.1 Swap 设置
    • 二 更改默认配置
    相关产品与服务
    容器镜像服务
    容器镜像服务(Tencent Container Registry,TCR)为您提供安全独享、高性能的容器镜像托管分发服务。您可同时在全球多个地域创建独享实例,以实现容器镜像的就近拉取,降低拉取时间,节约带宽成本。TCR 提供细颗粒度的权限管理及访问控制,保障您的数据安全。
    领券
    问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档