CentOS 7核心安装及基本配置

CentOS操作系统安装和配置

规划设计:

    CentOS 764bit最小化安装利用应答文件,安装为核心安装,配置好CentOS基本应用和网络。为后期基本服务器的安装做准备。(本安装为虚拟机安装)

准备:

    VMware 10 CentOS 7.0的镜像文件,安装的应答文件

    应答文件位置:http://192.168.188.1/mini.txt

最小化安装

1、通过kickstart文件来简化管理

   (系统安装应答文件)

# CentOS 7 64bit 用于生产环境的最小安装14:57 2014/8/8

# System authorization information

auth --enableshadow --passalgo=sha512

 

# Use CDROM installation media

cdrom

text

# 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=eno16777728 --onboot=no --ipv6=auto

network --onboot yes --device eno16777728--bootproto dhcp --noipv6

network --hostname=localhost.localdomain

# Root password

rootpw 123456

 

firewall --disable

selinux --disable

 

# System timezone

timezone --utc Asia/Shanghai

# System bootloader configuration

bootloader --location=mbr --boot-drive=sda

autopart --type=lvm

# Partition clearing information

clearpart --none --initlabel

 

reboot

%packages

@core

@base

net-tools

%end

安装过程

新建虚拟机

wKiom1P0arLxKtUSAAG_J2_yL3I906.jpg

wKioL1P0a8uTG5T1AAF_09QIOys761.jpg

选择稍后安装系统

wKiom1P0arPzQm4oAAFRttKuY-I940.jpg

选着CentOS 7 64位版本

wKioL1P0a8uSJT5SAAEgs4_wja4390.jpg

选择保存路径

wKiom1P0arPAT68RAAElzGErxGE524.jpg

虚拟机的基本设置

wKioL1P0a8yzrlmVAAEvbiqQFIE377.jpg

编辑虚拟机设置添加镜像文件

wKiom1P0arTSMBhkAAEQT9kJKvQ780.jpg

wKioL1P0a8yTLfjlAADVuKt26Ho402.jpg

wKiom1P0arXQ-qA4AAJHwcoyLNA143.jpg

wKiom1P0asjBcg2VAAJcCP1qC1w319.jpg

CentOS 7的配置

查看版本是否为核心安装

#vi /root/anaconda-ks.cfg

#version=RHEL7

# Systemauthorization information

auth--enableshadow --passalgo=sha512

 

# UseCDROM installation media

cdrom

# Runthe Setup Agent on first boot

firstboot--enable

ignoredisk--only-use=sda

#Keyboard layouts

keyboard--vckeymap=us --xlayouts='us'

# Systemlanguage

langen_US.UTF-8

 

#Network information

network  --bootproto=dhcp --device=eno16777728--onboot=off --ipv6=auto

network  --hostname=localhost.localdomain

# Rootpassword

rootpw--iscrypted$6$KhmzmAaNjyIUkdcz$LuLpRinp9xPHnUTfDas0t0E/sKu6iw/eNgiqDzR2cu6vUSHnoTcSk5xH2BqSCpcQpIg7D4hvzbsNH6sTO/2zy1

# Systemtimezone

timezoneAmerica/New_York --isUtc

# Systembootloader configuration

bootloader--location=mbr --boot-drive=sda

autopart--type=lvm

#Partition clearing information

clearpart--none --initlabel

 

%packages

@core

 

%end

网络命令查看IP

# ifconfig

-bash: ifconfig: command not found             //没有发现这个命令

 

# find /-name ifconfig                          //查询这个命令对应的目录

没有这个文件

 

RHEL 6.4上查看一下ifconfig属于那个包

# rpm -qf/sbin/ifconfig                          //查看这个命令所依赖的包

net-tools-1.60-110.el6_2.x86_64

 

CentOSMini最小化安装@core中没有包含net-tools

 

# mount/dev/cdrom /mnt/cdrom/                   //挂载光驱到目录

# cd/mnt/cdrom/Packages/                        //进入目录

# rpm -ivhnet-tools-2.0-0.17.20131004git.el7.x86_64.rpm  //安装包

warning:net-tools-2.0-0.17.20131004git.el7.x86_64.rpm: Header V3 RSA/SHA256 Signature,key ID f4a80eb5: NOKEY

Preparing...                         ################################# [100%]

Updating / installing...

  1:net-tools-2.0-0.17.20131004git.el#################################[100%]

 

# ifconfig                                          //再次查看

eno16777728: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500

       inet 192.168.188.135  netmask 255.255.255.0  broadcast 192.168.188.255

       inet6 fe80::20c:29ff:feda:bd96 prefixlen 64  scopeid0x20<link>

       ether 00:0c:29:da:bd:96 txqueuelen 1000  (Ethernet)

       RX packets 326  bytes 31288 (30.5KiB)

       RX errors 0  dropped 0  overruns 0 frame 0

       TX packets 297  bytes 45257 (44.1KiB)

       TX errors 0  dropped 0 overruns0  carrier 0  collisions 0

 

lo:flags=73<UP,LOOPBACK,RUNNING>  mtu65536

        inet 127.0.0.1  netmask 255.0.0.0

        inet6 ::1  prefixlen 128 scopeid 0x10<host>

        loop txqueuelen 0  (Local Loopback)

        RX packets 0  bytes 0 (0.0 B)

       RX errors 0  dropped 0  overruns 0 frame 0

       TX packets 0  bytes 0 (0.0 B)

       TX errors 0  dropped 0 overruns0  carrier 0  collisions 0

 

 

# cd/etc/sysconfig/network-scripts/         //进入网络配置目录

# ls

ifcfg-eno16777728 ifdown-Team      ifup-post

ifcfg-lo          ifdown-TeamPort  ifup-ppp

ifdown            ifdown-tunnel    ifup-routes

ifdown-bnep       ifup             ifup-sit

ifdown-eth        ifup-aliases     ifup-Team

ifdown-ippp       ifup-bnep        ifup-TeamPort

ifdown-ipv6       ifup-eth         ifup-tunnel

ifdown-isdn       ifup-ippp        ifup-wireless

ifdown-post       ifup-ipv6        init.ipv6-global

ifdown-ppp        ifup-isdn        network-functions

ifdown-routes     ifup-plip       network-functions-ipv6

ifdown-sit        ifup-plusb

 

# viifcfg-eno16777728                            //修改网络配置文件

HWADDR=00:0C:29:DA:BD:96

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=eno16777728

UUID=084273bf-9ad7-4a16-bb0f-1464f48ee355

ONBOOT=no  <--  修改为yes

 

 

 

Tip 可以通过ipa s命令来查看本机IP地址

# ip a s

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdiscnoqueue state UNKNOWN

   link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00

    inet127.0.0.1/8 scope host lo

      valid_lft forever preferred_lft forever

    inet6::1/128 scope host

      valid_lft forever preferred_lft forever

2: eno16777728:<BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen1000

   link/ether 00:0c:29:da:bd:96 brd ff:ff:ff:ff:ff:ff

    inet192.168.188.135/24 brd 192.168.188.255 scope global dynamic eno16777728

      valid_lft 1550sec preferred_lft 1550sec

    inet6fe80::20c:29ff:feda:bd96/64 scope link

      valid_lft forever preferred_lft forever

 

# service network restart                               //重启网络服务

重启CentOS 7 基本配置完成

总结:

CentOS的核心安装也是他的最小化安装,这样可以为基本服务器的安装提供一个干净的实验环境。另外也可以让我们后期的试验中了解CentOS 7的功能,让和我一样的菜鸟了解个多的东西。


你可能感兴趣的:(centos,7,安装及配置)