centerOS7真机安装

1、出现这种超时错误

图片发自简书App

原因是找不到u盘的路径

  • 修改u盘名为CENTOS


    image.png
  • 编辑文件 u盘盘符:\isolinux\isolinux.cfg,将名字替换为CENTOS


    image.png

append initrd=initrd.img inst.stage2=hd:LABEL=CENTOS

default vesamenu.c32
timeout 600

display boot.msg

# Clear the screen when exiting the menu, instead of leaving the menu displayed.
# For vesamenu, this means the graphical background is still displayed without
# the menu itself for as long as the screen remains in graphics mode.
menu clear
menu background splash.png
menu title CentOS 7
menu vshift 8
menu rows 18
menu margin 8
#menu hidden
menu helpmsgrow 15
menu tabmsgrow 13

# Border Area
menu color border * #00000000 #00000000 none

# Selected item
menu color sel 0 #ffffffff #00000000 none

# Title bar
menu color title 0 #ff7ba3d0 #00000000 none

# Press [Tab] message
menu color tabmsg 0 #ff3a6496 #00000000 none

# Unselected menu item
menu color unsel 0 #84b8ffff #00000000 none

# Selected hotkey
menu color hotsel 0 #84b8ffff #00000000 none

# Unselected hotkey
menu color hotkey 0 #ffffffff #00000000 none

# Help text
menu color help 0 #ffffffff #00000000 none

# A scrollbar of some type? Not sure.
menu color scrollbar 0 #ffffffff #ff355594 none

# Timeout msg
menu color timeout 0 #ffffffff #00000000 none
menu color timeout_msg 0 #ffffffff #00000000 none

# Command prompt text
menu color cmdmark 0 #84b8ffff #00000000 none
menu color cmdline 0 #ffffffff #00000000 none

# Do not display the actual menu unless the user presses a key. All that is displayed is a timeout message.

menu tabmsg Press Tab for full configuration options on menu items.

menu separator # insert an empty line
menu separator # insert an empty line

label linux
  menu label CENTOS
  kernel vmlinuz
  append initrd=initrd.img inst.stage2=hd:LABEL=CENTOS     quiet

label check
  menu label Test this ^media & install CentOS 7
  menu default
  kernel vmlinuz
  append initrd=initrd.img inst.stage2=hd:LABEL=CENTOS     rd.live.check quiet

menu separator # insert an empty line

# utilities submenu
menu begin ^Troubleshooting
  menu title Troubleshooting

label vesa
  menu indent count 5
  menu label Install CentOS 7 in ^basic graphics mode
  text help
    Try this option out if you're having trouble installing
    CentOS 7.
  endtext
  kernel vmlinuz
  append initrd=initrd.img inst.stage2=hd:LABEL=CENTOS     xdriver=vesa nomodeset quiet

label rescue
  menu indent count 5
  menu label ^Rescue a CentOS system
  text help
    If the system will not boot, this lets you access files
    and edit config files to try to get it booting again.
  endtext
  kernel vmlinuz
  append initrd=initrd.img inst.stage2=hd:LABEL=CENTOS     rescue quiet

label memtest
  menu label Run a ^memory test
  text help
    If your system is having issues, a problem with your
    system's memory may be the cause. Use this utility to
    see if the memory is working correctly.
  endtext
  kernel memtest

menu separator # insert an empty line

label local
  menu label Boot from ^local drive
  localboot 0xffff

menu separator # insert an empty line
menu separator # insert an empty line

label returntomain
  menu label Return to ^main menu
  menu exit

menu end

  • 然后启动电脑进入U盘安装界面------>按e编辑,同样替换为CENTOS -------->编辑完后按ctrl+x启动
vmlinuz initrd=initrd.img
inst.stage2=hd:LABEL=CentOS\x207\x20x86_64 rd.live.check quiet
改为:
vmlinuz initrd=initrd.img
inst.stage2=hd:/dev/CENTOS quiet
Ctrl+X保存即可

2、配置网卡

  • 进入目录编辑网卡配置文件
    cd /etc/sysconfig/network-scripts
    vi ifcfg-enp2s0
image.png
image.png
TYPE="Ethernet"
BOOTPROTO="dhcp"
DEFROUTE="yes"
PEERDNS="yes"
PEERROUTES="yes"
IPV4_FAILURE_FATAL="no"
IPV6INIT="yes"
IPV6_AUTOCONF="yes"
IPV6_DEFROUTE="yes"
IPV6_PEERDNS="yes"
IPV6_PEERROUTES="yes"
IPV6_FAILURE_FATAL="no"
NAME="ens33"
UUID="2c655c9f-0354-483c-a45e-5f603dee60e4"
DEVICE="ens33"
ONBOOT="yes"
  • 使用ip addr 查看ip,如果刚修改完配置。使用ping验证后可以上网。但是无法得到ipv4地址。请reboot重启下


    image.png
  • 然后使用xshell连了

  • 可以设置静态ip
    cd /etc/sysconfig/network-scripts
    vi ifcfg-ens33

TYPE="Ethernet"
PROXY_METHOD="none"
BROWSER_ONLY="no"
#BOOTPROTO="dhcp"
BOOTPROTO="static"
IPADDR="192.168.10.11"   # 设置的静态IP地址
NETMASK="255.255.255.0"    # 子网掩码
GATEWAY="192.168.10.1"   # 网关地址
#DNS1="192.168.241.2"       # DNS服务器
DEFROUTE="yes"
IPV4_FAILURE_FATAL="no"
IPV6INIT="yes"
IPV6_AUTOCONF="yes"
IPV6_DEFROUTE="yes"
IPV6_FAILURE_FATAL="no"
IPV6_ADDR_GEN_MODE="stable-privacy"
NAME="ens33"
UUID="2c655c9f-0354-483c-a45e-5f603dee60e4"
DEVICE="ens33"
ONBOOT="yes"

重启网络
service network restart

3、安装后的配置

  • 安装vim
    yum install vim
  • 安装wge

yum -y install wget

  • 使用阿里巴巴提供的DNS域名解析

vi /etc/resolv.conf

# Generated by NetworkManager
nameserver 8.8.8.8
nameserver 223.5.5.5
nameserver 223.6.6.6
  • 更换yum源为国内

备份原镜像文件,便于后期恢复
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup

下载新的CentOS-Base.repo 到/etc/yum.repos.d/ Centos7地址:
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo

清除缓存 yum clean all

生成缓存 yum makecache

更新 sudo yum update

  • 关闭防火墙和SELinux

systemctl status firewalld.service (查看防火墙状态)
systemctl stop firewalld.service (关闭防火墙)

这只是简单的关闭防火墙,电脑再重启后依然会自动开启的,所以要想永久的关闭防火墙就必须:
systemctl disable firewalld.service
然后还有就是center os自带了一个安全软件SELinux我们还需要将它关闭,避免以后操作会出现莫名的错误。

vi /etc/selinux/config
将SELINUX=******改为SELINUX=disabled然后保存就可以。

  • 安装 unzip
    yum install -y unzip zip

  • 安装端口工具
    yum -y install net-tools
    可通过netstat -lnp|grep 88 查看端口

  • 安装lrzsz,配合xshell使用 rz命令上传文件
    yum -y install lrzsz

  • 同步网络时间

yum install ntpdate -y
ntpdate -u ntp.api.bz

4、安装docker
centerOs条件:

必须是 64 位操作系统
建议内核在 3.8 以上
查看内核版本

uname -r

查看版本
  docker version
启动
  service docker start

添加开启自启动
sudo systemctl enable docker

  • docker启动失败,报错 Error starting daemon: SELinux is not supported with the overlay2 graph driver on this kernel. Either boot into a newer kernel or disable selinux in docker (--...-enabled=false)

vi /etc/sysconfig/docker
将配置文件的“--selinux-enabled”改成“--selinux-enabled=false”,然后再重启docker。


image.png

重启docker
systemctl restart docker
systemctl status docker.service

  • 这个也是安装docker必须要做的
    修改vi /etc/docker/daemon.json这个文件
{

"registry-mirrors": ["https://registry.docker-cn.com"]

}


5、docker-compose安装
https://github.com/docker/compose/releases

6、docker和docker-compose 安装的批处理
https://www.cnblogs.com/devops-ITboge/p/11012846.html

最后编辑于 :
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

友情链接更多精彩内容