分享工作和学习中的点点滴滴,包括前端、后端、运维、产品等各个方面,欢迎您来关注订阅!
分类: LINUX
2021-04-03 15:41:59
本文档详细介绍 Docker 实战之 7 系统环境配置,为后期安装 Docker 做准备。 |
直接复制以下代码,优化环境,如果执行了一下代码,那么接下来的1和2步骤可以不用再操作了。
sed -i 's/SE=enforcing/SELINUX=disabled/' /etc/selinux/config &> /dev/null setenforce 0 systemctl stop firewalld systemctl disable firewalld iptables -F systemctl stop NetworkManager &> /dev/null systemctl disable NetworkManager &> /dev/null
[root@Docker ]# vim /etc/selinux/config SELINUX=disabled [root@Docker ]# setenforce 0 [root@Docker ]# getenforce Permissive
[root@Docker ]# systemctl stop firewalld [root@Docker ]# systemctl disable firewalld [root@Docker ]# systemctl status firewalld [root@Docker ]# iptables -F
[root@Docker ]# mv /etc/yum.repos.d/Cent* /tmp [root@Docker ]# vim /etc/yum.repos.d/CentOS7.repo [aliyun-os] name=aliyun-os baseurl= enabled=1 gpgcheck=0 [aliyun-epel] name=aliyun-epel baseurl= enabled=1 gpgcheck=0 [aliyun-extra] name=aliyun-extra baseurl= enabled=1 gpgcheck=0 [root@Docker ]# yum clean all && yum makecache
[root@Docker ]# yum install epel-release -y
[root@Docker ]# yum install -y yum-utils [root@Docker ]# yum-config-manager --add-repo [root@Docker ]# cat /etc/yum.repos.d/docker-ce.repo [docker-ce-stable] name=Docker CE Stable - $basearch baseurl= enabled=1 gpgcheck=1 gpgkey= [docker-ce-stable-debuginfo] name=Docker CE Stable - Debuginfo $basearch baseurl= enabled=0 gpgcheck=1 gpgkey= [docker-ce-stable-source] name=Docker CE Stable - Sources baseurl= enabled=0 gpgcheck=1 gpgkey= [docker-ce-edge] name=Docker CE Edge - $basearch baseurl= enabled=0 gpgcheck=1 gpgkey= [docker-ce-edge-debuginfo] name=Docker CE Edge - Debuginfo $basearch baseurl= enabled=0 gpgcheck=1 gpgkey= [docker-ce-edge-source] name=Docker CE Edge - Sources baseurl= enabled=0 gpgcheck=1 gpgkey= [docker-ce-test] name=Docker CE Test - $basearch baseurl= enabled=0 gpgcheck=1 gpgkey= [docker-ce-test-debuginfo] name=Docker CE Test - Debuginfo $basearch baseurl= enabled=0 gpgcheck=1 gpgkey= [docker-ce-test-source] name=Docker CE Test - Sources baseurl= enabled=0 gpgcheck=1 gpgkey= [docker-ce-nightly] name=Docker CE Nightly - $basearch baseurl= enabled=0 gpgcheck=1 gpgkey= [docker-ce-nightly-debuginfo] name=Docker CE Nightly - Debuginfo $basearch baseurl= enabled=0 gpgcheck=1 gpgkey= [docker-ce-nightly-source] name=Docker CE Nightly - Sources baseurl= enabled=0 gpgcheck=1 gpgkey= [root@Docker ]# yum clean all && yum makecache
[root@Docker ]# vim /etc/hostname Docker
[root@Docker ]# vim /etc/hosts 127.0.0.1 localhost localhost.localdomain localhost4 localhostlocaldomain4 ::1 localhost localhost.localdomain localhost6 localhost6.localdomain6 192.168.10.7 Docker [root@Docker ]# ping $HOSTNAME
[root@Docker ]# find / -name Shanghai /usr/share/zoneinfo/Asia/Shanghai /usr/share/zoneinfo/posix/Asia/Shanghai /usr/share/zoneinfo/right/Asia/Shanghai [root@Docker ]# cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime cp: overwrite ‘/etc/localtime’? y [root@Docker ]# yum install -y ntp ntpdate [root@Docker ]# systemctl enable ntpd [root@Docker ]# systemctl start ntpd [root@Docker ]# ntpdate cn.pool.ntp.org [root@Docker ]# ntpdate 0.rhel.pool.ntp.org
手动改时间: date -s "2019-09-09 19:19"
[root@Docker ]# mkdir /.pip [root@Docker ]# vim /.pip/pip.conf #写入下以内容 [global] index-url = [install] trusted-host=mirrors.aliyun.com
[root@Docker ]# vim /etc/sysconfig/network-scripts/ifcfg-ens33 TYPE=Ethernet PROXY_METHOD=none BROWSER_ONLY=no BOOTPROTO=static DEFROUTE=yes IPV4_FAILURE_FATAL=no NAME=ens33 DEVICE=ens33 ONBOOT=yes IPADDR=192.168.10.7 GATEWAY=192.168.10.2 NETMASK=255.255.255.0
以上的操作就是 CentOS7 系统环境配置的过程,为安装 Docker 做好准备。想看怎么安装 Docker 的朋友请持续关注我的文章,希望我的文章能给大家带来帮助。