CentOS semi-automated Installation

Source: Internet
Author: User
Tags time zones

CentOS semi-automated Installation

This experiment cannot be used in the production environment, because more advanced automatic installation software has been used to replace this experiment, so we only want to learn more about Linux installation from the lower layer, this experiment was conducted to deepen and understand the current knowledge.

Let's take a look at the topology!

To briefly explain the topology, first enable the http service on the server and create two directories, ks and x86_64, under the default http directory, attach the CD image to the/var/www/html/x86_64 directory, and load the created ks. copy the cfg file to the/var/www/html/ks directory. on the server side, create isolinux to boot the client (in fact, it is to extract the isolinux directory from the CD image, and re-use the command to generate an iso file ). Install CentOS 6.6 x86_64 on the local network when the client is mounted to isolinux.

(1) Create the ks. cfg file first.

After CentOS 6 is installed, a anaconda-ks.cfg file is generated under/root, this is a file generated by CentOS 6 installer anaconda based on the selection of all the keyboard types, languages, time zones, partitions, and packages during system installation.

If we want to make a anaconda-ks.cfg file, you can refer to this file on some basis to modify, you can use the system-config-kickstart program to generate the relevant file.

Install the system-config-kickstart Program

[root@node-2~]#yuminstall-ysystem-config-kickstart

Start the system-config-kickstart Program

Use xshell 4 to remotely connect to the terminal and start system-config-kickstart. We recommend that you install XmanagerEnterprise 4 to enable the software in Linux on the local terminal. Enter the system-config-kickstart command in the command line.

After the modification, select Save in the File menu, enter the ks. cfg name at the top, select the Save location, and click Save.

View the generated file and add some content, because some commands need to be manually added. For more information, see REHL official documents.

[root@node-2~]#cat/var/www/html/ks/ks.cfg#platform=x86,AMD64,orIntelEM64T#version=DEVEL#Firewallconfigurationfirewall--disabled# Select firewall off when you restart the initialization system after installation#InstallOSinsteadofupgradeinstall# Select "Install" as the installation type#Usenetworkinstallationurl--url="http://172.16.9.21/x86_64/"# The Http service used for network installationrepo--name="CentOS"--baseurl=http://172.16.9.21/x86_64/--cost=100#repo--name="FedoraEPEL"--baseurl=http://172.16.0.1/fedora-epel/6/x86_64/--cost=1000#Rootpasswordrootpw--iscrypted$1$jLn8z9P1$ff07gV9CfXmz1Q0NEOmAw/# The administrator root password, which is encrypted for storage#Systemauthorizationinformationauth--useshadow--passalgo=sha512# Authentication method. The sha512 encryption method is used.#Usegraphicalinstallgraphical# Installation using graphical interfacesfirstboot--disable#Systemkeyboardkeyboardus# The selected keyboard type is us.#Systemlanguagelangen_US# English Language#SELinuxconfigurationselinux--disabled# Disable selinux#DonotconfiguretheXWindowSystemskipx# Ignore XWindowSystem configurations#Installationlogginglevellogging--level=info# The startup level is text#Rebootafterinstallationreboot# Restart the system after installation#SystemtimezonetimezoneAsia/Shanghai# The system time zone is Asia/Shanghai#Networkinformation#network--bootproto=dhcp--device=eth0--onboot=on# Systembootloaderconfiguration # indicates passing Kernel Parametersbootloader--append="crashkernel=autocrashkernel=autorhgbquiet"--location=mbr--driveorder="sda"#Partitionclearinginformationclearpart--all# The following operations are performed on disks. The LVM is used here.zerombr# No partitions on the disk.part/boot--fstype=ext4--size=200partpv.008002--size=61440volgroupvg0--pesize=8192pv.008002logvol/--fstype=ext4--name=root--vgname=vg0--size=20480logvolswap--name=swap--vgname=vg0--size=2048logvol/usr--fstype=ext4--name=usr--vgname=vg0--size=10240logvol/var--fstype=ext4--name=var--vgname=vg0--size=20480%post# Script to be executed after installation%end# Script Terminator%packages# Packages and program packages to be installed during installation@base@basic-desktop@chinese-support@client-mgmt-tools@core@desktop-platform@fonts@general-desktop@graphical-admin-tools@legacy-x@network-file-system-client@perl-runtime@remote-desktop-clients@x11-ibus-table-cangjie-ibus-table-erbi-ibus-table-wubi%end# Package and Program Package group Terminator

(2) install and start the http service

[root@node-2~]# Yuminstallhttpd-y # Install the httpd service[root@node-2~]# Servicehttpdstart # Start the http serviceStartinghttpd:[OK][root@node-2~]# Netstat-ntlp | grep80 # Check the startup status. The http port is tcp port 80.tcp00:::80:::*LISTEN2008/httpd

(3) attach a CD image

Put the CD image into the optical drive. If you are using a virtual machine, add the CD file to the optical drive of the Virtual Machine and enable it.

[root@node-2~]# Mkdir/var/www/html/{ks, x86_64} # create ks, x86_64 directory[root@node-2~]# Mount-r/dev/dvd/var/www/html/x86_64/# mount the disc image to/var/www/html/x86_64/in read-only mode/[root@node-2~]# Mount | tail-1 # view mounting information/dev/sr0on/var/www/html/x86_64typeiso9660(ro)

(4) copy the ks. cfg file to the/var/www/html/ks directory.

[root@node-2~]#cp/root/ks.cfg/var/www/html/ks/[root@node-2~]#ls/var/www/html/ks/ks.cfg

(5) Create an isolinux boot Guide

Create a cdrom directory in/tmp/, copy the isolinux image in the CD image to the/tmp/cdrom directory, and run the mkisofs command to generate the iso file.

[root@node-2~]# Cd/tmp/# Switch the/tmp directory[root@node-2tmp]# Cp-r/var/www/html/x86_64/isolinux // tmp/cdrom/# copy isolinux to the/tmp/cdrom directory[root@node-2tmp]# Lstcrom/# view the copy resultisolinux[root@node-2tmp]# Mkisofs-R-J-T-v -- no-emul-boot -- boot-load-size4 -- boot-info-table-V "Centos6.6X86 _ 64 bootdisk"-bisolinux/isolinux. bin-cisolinux/boot. cat-o/root/boot. isocdrom/# create boot. iso file[root@node-2tmp]# Ll/root/boot. iso # view the iso file creation status-rw-r--r--1rootroot39866368Apr1713:39/root/boot.iso

(6) download the created boot. iso file to a local computer. You may drag the boot. iso file to the desktop through the Xftp file that comes with Xshell 4.

(7) create a new virtual machine with a disk space of 120 GB. iso loaded to the virtual machine drive, select "connection at startup", open the new virtual machine, press F2 to enter the BIOS, move to the Boot option to modify the first Boot item to CD-ROM Driver, press F10 to save and exit. The VM will be restarted.

(8) The CentOS installation and selection page appears, as shown in.

Press ESC, because we only have one boot and there is no package required by the installation program. We want to manually specify ks. use the http service to remotely install CentOS 6 x86_64.

Enter the linux ip address = 172.16.9.34 netmask = 255.255.255.0.0 gateway = 172.16.0.1ks = http: // 172.16.9.21: 80/ks at the boot command prompt. cfg. Press enter to start loading vmlinux and initrd. imgfile to start automatic installation of CentOS.

Tip:

Run the linux Command in the command line prompt of the boot command to install CentOS in a graphical manner. A memory larger than MB is required;

Ip, netmask, and gateway are used to specify the ip address, mask, and gateway of the local Nic,

Ks indicates the location where the ks. cfg file is located. You can use http, ftp, nfs, https, and DVD Driver. The addresses of different services may be different:

DVD drive ks = cdrom:/path/to/kickstart_file

HTTP Server ks = http: // server_ip: port/path/to/kickstart_file

HTTPS Server ks = https: // server_ip: port/path/to/kickstart_file

FTP Server ks = ftp: // server_ip: port/path/to/kickstart_file

NFS Server ks = nfs: server_ip:/path/to/kickstart_file

Install CentosAdvanced:

Through the above installation, you find that we need to specify the IP address, subnet mask, Gateway and ks every time. cfg file path. Can we set ks. make the cfg file into the isolinux boot. Assume that there is already a DHCP server in the network environment where the host can automatically obtain the IP address. In this way, we only need to put the CD made by isolinux into the optical drive, then wait. Centos 6 x86_64 has been installed. Draw a simple image:

We only need to modify the above to implement it, and make the following changes;

(1) copy the ks. cfg file to the/tmp/cdrom/directory.

[root@node-2tmp]#cp/var/www/html/ks/ks.cfg/tmp/cdrom/ks.cfg[root@node-2tmp]#ls/tmp/cdrom/isolinuxks.cfg

(2) modify the DHCP service enabled for the NIC in the ks. cfg file so that it can automatically obtain the IP address and add the following line:

#Networkinformationnetwork--bootproto=dhcp--device=eth0--onboot=on# In the preceding ks. cfg file, cancel the previous;

(3) switch to the/tmp/cdrom/isolinux/directory and modify the isolinux. cfg file.

[Root @ node-2 ~] # Cd/tmp/cdrom/isolinux/# Switch to the/tmp/cdrom/isolinux/directory

[Root @ node-2 isolinux] # chmod u + w * # Add modification permissions to all files

[Root @ node-2 isolinux] # vimisolinux. cfg # compile the isolinux. cfg file and add ks = cdrom:/ks. cfg to the append file.

Label linux

Menu label ^ Install or upgrade an existingsystem

Menu default

Kernel vmlinuz

Append initrd = initrd. imgks = cdrom:/ks. cfg

(4) recreate the isolinux Boot Image

[root@node-2isolinux]# Cd/tmp # Switch to the/tmp directory[root@node-2tmp]#mkisofs-R-J-T-v--no-emul-boot--boot-load-size4--boot-info-table-V"Centos6.6X86_64bootdisk"-bisolinux/isolinux.bin-cisolinux/boot.cat-o/root/boot.isocdrom/

(5) download/root/boot. iso to the local desktop, restart the virtual machine used to Install the system, and select the "Install or upgrade an existing system" label to automatically Install CentOS6.6 x86_64.

Tip: ks. the cfg file is specified as ks/ks in the http service when creating the isolinux boot image. cfg file, you can also put ks. the cfg file can be installed automatically on the CD of the release version as needed.

Summary:

This experiment has not been used in the production environment. It is just to understand the CentOS installation process, so that you can manually create isolinux to boot and provide CentOS installation images and ks through the http service. cfg file, so as to achieve a semi-automated installation of CentOS system, for a better understanding of fully automated installation of CentOS in the future, familiarize yourself with the installation process in the early stage.

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.