回复
#冲刺创作新星# 制作centos镜像 原创
GabrielWu
发布于 2022-9-26 10:49
浏览
0收藏
字符集优化:删除中英文之外的其它语言
#先检查是否有安装中文语言 # locale -a
localedef --list-archive |egrep -v ^"en_US|zh" |xargs localedef --delete-from-archive
mv -f /usr/lib/locale/locale-archive /usr/lib/locale/locale-archive.tmpl
build-locale-archive
镜像构建所需yum源文件 >>CentOS7-Base-163.repo
# CentOS-Base.repo
[base]
name=CentOS-$releasever - Base - 163.com
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os
baseurl=http://mirrors.163.com/centos/$releasever/os/$basearch/
gpgcheck=1
gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-7
#released updates
[updates]
name=CentOS-$releasever - Updates - 163.com
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates
baseurl=http://mirrors.163.com/centos/$releasever/updates/$basearch/
gpgcheck=1
gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-7
#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras - 163.com
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras
baseurl=http://mirrors.163.com/centos/$releasever/extras/$basearch/
gpgcheck=1
gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-7
#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus - 163.com
baseurl=http://mirrors.163.com/centos/$releasever/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-7
Dockerfile
FROM centos:7
MAINTAINER Gabriel Wu
# Set correct environment variables.
ENV HOME /root
RUN mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
COPY CentOS7-Base-163.repo /etc/yum.repos.d
#RUN yum clean all && \
# yum makecache
#RUN yum update -y && \
# yum install -y epel-release && \
# yum install -y unzip tar curl wget less net-tools telnet openssh-clients p7zip p7zip-plugins && \
# yum install -y kde-l10n-Chinese && \
# yum clean all
RUN yum update -y && \
yum install -y epel-release && \
yum install -y unzip tar curl wget openssh-clients p7zip p7zip-plugins && \
yum clean all
COPY locale-archive /usr/lib/locale
ENV LANG=zh_CN.UTF-8
RUN echo "LANG=\"zh_CN.UTF-8\"" >/etc/locale.conf
#update system timezone
RUN ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
#update application timezone
RUN echo "Asia/Shanghai" >> /etc/timezone
©著作权归作者所有,如需转载,请注明出处,否则将追究法律责任
分类
赞
收藏
回复
相关推荐