vitess基础镜像构建流程Centos

以下列出了构建vitess使用的Centos镜像的简单流程,由于较早基础版本是Centos7.2的,重新构建可以基于最新的Centos版本构建

1.基础镜像拉取

1
2
3
#拉取官方版本
docker pull centos:7.2.1511
官方镜像地址: https://hub.docker.com/_/centos/

2. 修改镜像源,可以选择阿里云的源地址或者内部源地址

CentOS-7.2-Base.repo

1
2
3
4
5
6
7
8
9
10
11
12
[CentOS]
name=CentOS-7.2 - Base
 
#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos/$releasever/extras/$basearch/
        http://mirrors.aliyuncs.com/centos/$releasever/extras/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras
gpgcheck=1
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7

epel.repo

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
[epel]
name=Extra Packages for Enterprise Linux 7 - $basearch
#baseurl=http://download.fedoraproject.org/pub/epel/7/$basearch
metalink=https://mirrors.fedoraproject.org/metalink?repo=epel-7&arch=$basearch
failovermethod=priority
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7
[epel-debuginfo]
name=Extra Packages for Enterprise Linux 7 - $basearch - Debug
#baseurl=http://download.fedoraproject.org/pub/epel/7/$basearch/debug
metalink=https://mirrors.fedoraproject.org/metalink?repo=epel-debug-7&arch=$basearch
failovermethod=priority
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7
gpgcheck=1
[epel-source]
name=Extra Packages for Enterprise Linux 7 - $basearch - Source
#baseurl=http://download.fedoraproject.org/pub/epel/7/SRPMS
metalink=https://mirrors.fedoraproject.org/metalink?repo=epel-source-7&arch=$basearch
failovermethod=priority
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7
gpgcheck=1

3. 依赖程序安装

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
#安装vim
yum install vim -y
   
#安装wget
yum install wget -y
   
#安装rzsz
yum install lrzsz -y
   
#安装ssh
yum install openssh-server -y
   
#安装net-tools(包含netstat)
yum install net-tools -y
   
#重置镜像默认密码
echo root:xxxxxxxxxxxxxxxx | chpasswd
   
#安装sudu权限
yum install sudo -y
   
#添加操作用户admin
useradd admin
   
#修改admin默认密码
echo admin:xxxxxxxxxxxx | chpasswd
   
#添加jeduser用户sudu权限
#在vim /etc/sudoers文件中root下面添加一行,增加admin的sudo权限
#root    ALL=(ALL)       ALL
admin ALL=(ALL)       ALL
   
#由于ssh需要依赖于一些key,需要更新key否则ssh无法启动
#Could not load host key: /etc/ssh/ssh_host_rsa_key
#Could not load host key: /etc/ssh/ssh_host_ecdsa_key
#Could not load host key: /etc/ssh/ssh_host_ed25519_key
ssh-keygen -t rsa -b 2048 -f /etc/ssh/ssh_host_rsa_key
ssh-keygen -t ecdsa -f /etc/ssh/ssh_host_ecdsa_key -N ""
ssh-keygen -t dsa -f /etc/ssh/ssh_host_ed25519_key
   
#安装tcpdump
yum install tcpdump -y
  
#安装lsof
yum install lsof -y
   
#安装dstat
yum install dstat -y
   
#安装scp
yum install openssh-clients
   
#安装perf
yum install perf -y
   
#安装sysstat
yum install sysstat -y
   
#安装perl相关
yum install perl-DBI -y
yum install perl-DBD-MySQL -y
yum install perl-Time-HiRes -y
yum install perl-IO-Socket-SSL
   
#安装percona-toolkit
yum install perl-TermReadKey -y
yum install perl-Digest-MD5 -y
#官网下载最新版本
#https://www.percona.com/downloads/percona-toolkit/LATEST/
wget https://www.percona.com/downloads/percona-toolkit/3.0.5/binary/redhat/7/x86_64/percona-toolkit-3.0.5-1.el7.x86_64.rpm
rpm -i percona-toolkit-3.0.5-1.el7.x86_64.rpm
   
#安装percona-xtrabackup
yum install percona-xtrabackup -y
  
#安装bzip2
yum install bzip2 -y
   
#安装jq,解析json工具
yum install jq
  
#安装mysql
wget https://repo.mysql.com/mysql57-community-release-el7-11.noarch.rpm
yum localinstall mysql57-community-release-el7-11.noarch.rpm
yum install mysql-community-server.x86_64 -y
  
   
#安装python-setuptools
yum install python-setuptools -y
   
#安装orzdba
   
#处理ssh启动脚本
#由于debian和centos文件位置不一致,所以这里直接在centos中加入/etc/init.d/ssh脚本,通过脚本调用/usr/sbin/sshd,确保两个系统调用一致;这样调用模板就可以统一<br>#以下内容根据需要选择
#ssh脚本内容如下
/usr/sbin/sshd

4 添加证书

1
2
3
4
5
6
7
8
9
#根据需要添加需要的证书,如果不需要就忽略
#切换到admin
su admin
   
#添加信任证书
echo ssh-rsa xxxxxxxxxxxxxxxxxxxxxxxxxxxxx >> /home/admin/.ssh/authorized_keys
     
#修改证书授权文件权限
chmod 644 /home/admin/.ssh/authorized_keys

5. 提交镜像

1
2
3
构建完镜像之后直接获取镜像ID然后提交成基础镜像
提交后可以压缩镜像大小
docker commit 7541391ae047 vitesss/centos:7.2.1511

  

  

 

posted @   davygeek  阅读(867)  评论(0编辑  收藏  举报
编辑推荐:
· AI与.NET技术实操系列:基于图像分类模型对图像进行分类
· go语言实现终端里的倒计时
· 如何编写易于单元测试的代码
· 10年+ .NET Coder 心语,封装的思维:从隐藏、稳定开始理解其本质意义
· .NET Core 中如何实现缓存的预热?
阅读排行:
· 分享一个免费、快速、无限量使用的满血 DeepSeek R1 模型,支持深度思考和联网搜索!
· 25岁的心里话
· 基于 Docker 搭建 FRP 内网穿透开源项目(很简单哒)
· ollama系列01:轻松3步本地部署deepseek,普通电脑可用
· 按钮权限的设计及实现
历史上的今天:
2015-04-03 【转】C/CPP之static
点击右上角即可分享
微信分享提示