Linux operating system unattended installation Configuration Guide

Source: Internet
Author: User

Unattended installation of the CentOS system

Installation Order:

1. Install NFS service for Linux operating system

2. Installing the TFTP service to provide PXE boot files

3. Install the DHCP service to provide IP addresses and other information

4. configuration Kickstart, for automatic answer installation, general operating system installation complete, in the ~ directory has anaconda-ks.cfg

5. PXE boot for new server

The above 4 steps are done on the server where the system is installed, can be distributed across different servers, or all (1-4) in a single

Steps:

1.1 Installing the Software

yum install nfs-utils rpcbind tftp* dhcp*-y

1.2 Create an NFS shared directory, this directory is free to

mkdir/opt/share-p

1.3 Copy operating system (Linux) to/opt/share

---Note: You can mount or upload an ISO file to the server and then mount it.

mount/dev/cdrom1/mnt/#挂载在mnt

mount-o loop/home/user/centos-6.9-x86_64-bin-dvd1.iso/mnt #挂载iso

Cp-a/mnt/*/opt/share/#文件大需要比较久, CENTOS6 cannot use MNT as a shared directory for NFS and permissions are forbidden.

1.4 Editing an NFS configuration file

Cat/etc/exports #默认这个文件夹是空

/opt/share 172.21.100.0/24 (Ro,sync) #允许访问nfs网段

2.1 Editing TFTP files, Centos7 was previously managed through xinted

Cat/etc/xinetd.d/tftp #删除了注释部分

Service TFTP

{

Socket_type= Dgram

Protocol= UDP

wait= Yes

user= Root

Server=/usr/sbin/in.tftpd

Server_args =-s/var/lib/tftpboot #tftp目录

Disable = no #原yes改成no

Per_source= 11

Cps= 100 2

flags= IPv4

}

2.2 Copy boot file to/var/lib/tftpboot

-- Note: If there is no pxelinux.0, please yum install syslinux, or CD

bin/cp/usr/share/syslinux/pxelinux.0 /var/lib/tftpboot/

bin/cp/opt/share/images/pxeboot/initrd.img /var/lib/tftpboot/

Bin/cp/opt/share/images/pxeboot/vmlinuz /var/lib/tftpboot/

2.3 Create pxelinux.cfg Mesh Record

Mkdir/var/lib/tftpboot/pxelinux.cfg

Cd/var/lib/tftpboot/pxelinux.cfg

Cp/opt/share/isolinux/isolinux.cfg/var/lib/tftpboot/pxelinux.cfg/default

2.4 Edit Vim/var/lib/tftpboot/pxelinux.cfg/default

--Note: config file deleted comment # section

Default Local

Prompt 1

Timeout 999999

Display Boot.msg

Menu Background Splash.jpg

Menu title Welcome to CentOS 6.9!

Menu Color Border 0 #ffffffff #00000000

Menu Color SEL 7 #ffffffff #ff000000

Menu Color Title 0 #ffffffff #00000000

Menu Color tabmsg 0 #ffffffff #00000000

Menu Color Unsel 0 #ffffffff #00000000

Menu Color Hotsel 0 #ff000000 #ffffffff

Menu Color Hotkey 7 #ffffffff #ff000000

Menu Color ScrollBar 0 #ffffffff #00000000

Label Linux

Kernel Vmlinuz

Append initrd=initrd.img

Label text

Kernel Vmlinuz

Append ks=nfs:172.21.100.1 : /opt/share/kickstart/ks.cfg ksdevice=ifcfg-eth1 initrd=initrd.img Text

#ksdevice =ifcfg-eth1 multi-nic specified NIC

3.1 Editing DHCP files

---note: CENTOS6 installed default file is empty, need to manually or copy its specified configuration instance

Cat/etc/dhcp/dhcpd.conf

Allow booting;

Allow BOOTP;

Default-lease-time 21600;

Max-lease-time 43200;

option routers 172.21.100.1; #网关地址

Subnet 172.21.100.0 netmask 255.255.255.0 {

Range DYNAMIC-BOOTP 172.21.100.2 172.21.100.10;

next-server 172.21.100.1; #nfs服务器地址

filename "/opt/share/kickstart/ks.cfg"; #kickstart文件目录

next-server 172.21.100.1; #tftp服务器地址

filename "pxelinux.0"; #不要指定绝对路径, or the PXE boot error cannot find file

}

4.1 Configuring the Auto-answer Kickstart

--Note If you do not have this configuration file, please install first, the system is usually installed by default

[email protected] ~]# LL

-RW-------. 1 root root 1426 APR 8 12:06 anaconda-ks.cfg

4.2 Copy Anaconda-ks.cfg to/opt/share/

mkdir/opt/share/kickstart/-P

ll/opt/share/kickstart/ #注意权限

-rw-r--r--. 1 root root 1727 Apr 14:30 ks.cfg

4.3 Start editing ks.cfg

Cat/opt/share/kickstart/ks.cfg


# Kickstart file automatically generated by Anaconda.

#version =devel

#安装不是升级

Install

#cdrom

#启用nfs

NFS--server=172.21.100.1--dir=/opt/share

Lang en_US. UTF-8

Keyboard US

Network--onboot no--device eth0--bootproto DHCP--noipv6

#root密码默认123456, here's the encryption.

ROOTPW--iscrypted $6$fqdvzx1ycbkfty5w$vfdja8ghr7drwyqnwufcujslzkpk4yv/iv37.r0issptzwzwjfev3lzbsl/ 7crgp8k15.pyzvfwjafdrbtemi0

Firewall--service=ssh

Authconfig--enableshadow--passalgo=sha512

SELinux--disabled

TimeZone Asia/shanghai

bootloader--location=mbr--driveorder=sda--append= "Crashkernel=auto rhgb quiet"

Firstboot--disable

Logging--level=info

Zerombr

######## #分区配置 ########

Clearpart--all

Part/boot--FSTYPE=EXT4--size=500--asprimary

Part swap--size=4096

Part/--FSTYPE=EXT4--size=1--grow--asprimary

Reboot

#repo--name= "CentOS"--baseurl=cdrom:sr0--cost=100

#开始安装软件

%packages

@base

@console-internet

@core

@debugging

@directory-client

@hardware-monitoring

@java-platform

@large-systems

@network-file-system-client

@performance

@perl-runtime

@server-platform

@server-policy

@workstation-policy

@development-libs

@development-tools

Pax

Python-dmidecode

Oddjob

Sgpio

Device-mapper-persistent-data

Samba-winbind

Certmonger

Pam_krb5

Krb5-workstation

Perl-dbd-sqlite

%end




New Installation Server, boot select PXE boot, and then enter text, you need to choose to agree to install the development-tools package.

This article is from "A Recruit Apprentice" blog, please be sure to keep this source http://sadoc.blog.51cto.com/12189157/1920149

Linux operating system unattended installation Configuration Guide

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.