CentOS7 最小化安装 – 核心安装与配置的补全

发布时间: 更新时间: 总字数:621 阅读时间:2m 作者: IP属地: 分享 复制网址

Centos7在使用最小化安装的时候,一些RPM包并没有安装到我们的系统,于是定义系统,将成为我们的一大挑战。

anaconda-ks.cfg

我们安装时的文件是依照/root/anaconda-ks.cfg这个应答文件:

[root@xiexianbin_cn ~]# cat/root/anaconda-ks.cfg
#version=DEVEL
# System authorization information
auth --enableshadow --passalgo=sha512
# Use CDROM installation media
cdrom
# Use graphical install
graphical
# Run the Setup Agent on first boot
firstboot --enable
ignoredisk --only-use=sda
# Keyboard layouts
keyboard --vckeymap=us --xlayouts='us'
# System language
lang en_US.UTF-8

# Network information
network  --bootproto=dhcp --device=eno16777736 --onboot=off --ipv6=auto
network  --hostname=localhost.localdomain

# Root password
rootpw --iscrypted $6$LrcNXywonZHepgGA$Ps/wTCKYn7.6ZRv.IgQSBKiQlSCH1py.Aa/IUL6bcviMTbs7HSWM.N/nCV6QSDyJsMjxADhw.RQsG9TBFUh100
# System services
services --disabled="chronyd"
# System timezone
timezone Asia/Shanghai --isUtc --nontp
# System bootloader configuration
bootloader --append=" crashkernel=auto" --location=mbr --boot-drive=sda
autopart --type=lvm
# Partition clearing information
clearpart --none --initlabel

%packages
@^minimal
@core
kexec-tools

%end

%addon com_redhat_kdump --enable --reserve-mb='auto'

%end

我们发现系统默认的最小化安装有core没有base。而我们需要的那些基础的命令是打包在base内的,下面讲解如何安装base。

base的安装

在bash界面输入下面命令:

[root@xiexianbin_cn yum.repos.d]# mount /dev/cdrom /mnt/disk
mount: /dev/sr0 is write-protected, mounting read-only

或将iso挂载:

mount -o loop *.iso /mnt/disk
mount -t iso9660 loop *.iso /mnt/disk

配置yum源:

[root@xiexianbin_cn yum.repos.d]# vi CentOS-dvd.repo
[centos-dvd]
name=CentOS7
baseurl=file:///mnt/disk #这个是mount的指定目录
enabled=1
gpgcheck=0

[root@xiexianbin_cn yum.repos.d]# ls
CentOS-Base.repo.bak       CentOS-dvd.repo          CentOS-Vault.repo.bak
CentOS-Debuginfo.repo.bak  CentOS-Sources.repo.bak

为了方便我们yum.repos.d下以repo的文件都改为bak的后缀,之后新添加CentOS-dvd.repo文件并设置相关路径而其他四个文件的具体内容可自行百度,其实我也不太明白,只是将他们的后缀改完,再新建会更靠谱点,你们可以尝试下直接添加CentOS-dvd.repo这个文件并配置它,看是否能成功修改完毕输入下面指令

[root@xiexianbin_cn ~]# yum clean all
Loaded plugins: fastestmirror
Cleaning repos: centos-dvd
Cleaning up everything
Cleaning up list of fastest mirrors
[root@xiexianbin_cn yum.repos.d]# yum groupinstall base
...
Transaction Summary
===========================================================================================================
Install  69 Packages (+107 Dependent packages)

Total download size: 52 M
Installed size: 144 M
Is this ok [y/d/N]:
...

下面会出现我们需要安装的包,安装即可。然后yum,ifconfig,pvcreate,vim,wget等命令都可正常使用。

Home Archives Categories Tags Statistics
本文总阅读量 次 本站总访问量 次 本站总访客数