Network-based automated installation of Linux systems

Source: Internet
Author: User
Tags get ip file transfer protocol

    Ann It is a very troublesome thing for an ordinary person to install an operating system. And for a professional, it should be a very easy thing to do. However, such a situation is limited to a limited number of installations. In practice, we often encounter situations in which a large number of computers need to install Linux at the same time, or if you want to install Linux but the computer does not have an optical drive, or it is installed by CD-ROM. This installation is not only inefficient, but also not conducive to future maintenance. This time you need to take advantage of the power of the network. It can help you to complete the automatic installation based on the network, the middle does not need to intervene manually. This is the Cobbler service .

The Cobbler service is a fast network-installed Linux operating system service. It supports a wide variety of Linux distributions: Red Hat, Fedora, CentOS, Debian, Ubuntu, and SuSE, and can also support network installation of Windows. It also provides a form of page management for both the CLI and the Web.

The network-based system automation installation scheme mentioned in this paper mainly uses the following protocols and technologies:

--PXE (Preboot execution Environment/remote boot technology)

--DHCP (Dynamic Host config Protocol/ActiveSync Configuration Protocol)

--TFTP (Trivial file Transfer Protocol/Normal document Transfer Protocol)

--HTTP (Hyper Text Transfer protocal/Hypertext Transfer Protocol)

Cobbler Workflow:

1, the client bare metal configuration after booting from the network, after the boot will broadcast the message request the DHCP server (cobbler server) for it to send an assigned IP address

2. The DHCP server (Cobbler server) will return a Responese, including its assigned IP address, upon receipt of the request

3, client bare metal to get IP and then send a request to Cobbler server to install the OS boot file

4. Cobbler server tells the bare metal os boot file The name and the TFTP server IP and port

5, the client bare metal through the above notification of the TFTP server communication address, download the boot file

6. Client bare metal Executes the boot file, determines the loading information, selects the OS to install, and then requests the kickstart file and OS image to cobbler server.

7. Cobbler server responds again to the requested kickstart and OS iamge file location
8. Client Bare Metal Loading kickstart file
9. Client bare metal receive OS image, install the OS image

10. Client-initiated

Here are the steps to configure cobbler:

First, install the Cobbler, DHCP service, and open the corresponding service (installed on CentOS 7)

       Yum install-y Cobbler DHCP (install cobbler and DHCP)

       Systemctl Enable Cobblerd (set cobbler service to start)
Systemctl start Cobblerd (open cobbler Service)
Systemctl Enable TFTP (set the TFTP service to start)
Systemctl start tftp (open TFTP service)
Systemctl Enable httpd (set httpd service to start)
Systemctl start httpd (open httpd Service)

Second, check the configuration file of cobbler

Cobbler Check: This step checks whether the Cobbler configuration file is complete. There will be a lot of error reporting for the first execution, and we need to follow these bug reports to change it step-by-step.

According to the Cobbler check, we will step by step to improve it.

1) Modify the configuration file

Vim/etc/cobbler/setting

All we need to do is change around,

Find this line: default_password_crypted: "$1$8ckh4frm$aylsgqi85bi8nt5gj4drj/" Here the password is to be changed

Use the OpenSSL passwd-1 to generate the password, and then replace the generated password with this random number
This line: next_server:127.0.0.1 here to change the IP address of your local machine (he is to provide TFTP repo source file location address)
This line: manage_dhcp:0 here 0 to 1 (means to open DHCP to assign IP addresses to the client)
This line: server:1172.0.0.1 here to its own native IP (12.168.35.5) address (representing the host address that provides the Cobbler service for the client)

2) Change the TFTP configuration file

This is prompted to modify the disabled in/etc/xinetd.d/tftp to ON

Vim/etc/xinetd.d/tftp

3) Configuring the DHCP service template

Vim/etc/cobbler/dhcp.template

      

Change two places here: Subnet 192.168.25.0 netmask 255.255.255.0 {
Range DYNAMIC-BOOTP 192.168.25.100 192.168.25.254;

Restart the Cobbler service after the modification is complete and synchronize the Cobbler configuration file

Systenctl Restart Cobbler

Cobbler Sync

This allows the DHCP file to be configured to open the DHCP service.

Systemctl Enable DHCPD (set DHCP to boot)

Systemctl Start dhcpd (open DHCP service)

4) Prepare the boot file and menu style files

If the host is connected to the Internet then it's good to do it, we just need one step to
Cobbler Get-loaders (execute this command, he will automatically connect to the Web to download the required boot file and menu interface)

He'll put the downloaded files in the/var/lib/cobbler/loaders directory.

5) Turn off SELinux and firewalls on this computer so that external network requests can not be received without being rejected by these policies

Setenforce 0 (Turn off selinux policy)

Iptables-f (firewall off)

Of course, these methods are temporary, and if you want to change them for a long time, you need to change their profile. Of course it's not safe, so here's a temporary change.

6) The hints of rsync, Debmirrior and fencing tools can be ignored, as we don't have it here.

Then restart the Cobbler service:

Systemctl Reestart cobblerd (restart service)

Cobbler sync (reload config file)

Third, configure the installation system of the Yum source required

This requires that the files in the CD-ROM be imported into the Cobbler Service directory to prepare the files for the installation of the system.

Cobbler Import--PATH=/MISC/CD--name=centos7_test--arch=x86_64 (import disc file)
Cobbler distro List (you can then view the name of the Yum library generated by the imported file)

Iv. Generating Kickstart boot files

Here we are going to import their own installation of the boot file, the boot file we need to install according to the package we need to manually create, but also according to the system generated files to be modified can also. The following is a KS boot file modified according to the system configuration file Ks.cfg

Vim/anaconda-ks.cfg

    
       

To this kickstart file editing complete

We're going to import this file into the Cobbler service path.

CP anaconda-ks.cfg/var/lib/cobbler/kickstarts/ks7.cfg (Copy this prepared file to cobbler directory)

chmod +r ks7.cfg (Remember to change the permissions of this file, otherwise the other person is not authorized to view the boot file)

Cobbler profile Add--name=centos7_hello--distro=centos7_test--kickstart=/var/lib/cobbler/kickstarts/ks7.cfg (Import ks The. cfg file is the boot file under the Centos7_hello menu)

Systemctl Restart Cobblerd (restart this service again)

Cobbler sync (sync config file)

The configuration of the server is ready to complete.

Five, configure the client. Connect the client to the network, power up, select menu

      

In the installation:

      

After the installation is complete, you can log into the system as root, and its password is the password that was set in the Ks.cfg file. After logging in, you can do all sorts of things.

Network-based automated installation of Linux systems

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.