Operation and maintenance automation system deployment

Operation and maintenance of the automated system deployment cobbler

The so-called scheduler when a user accesses a particularly large amount of time that we have a single server has been unable to provide adequate services outside the capacity, performance below standard this time we will buy a few servers, but users to access I do not know what to go visit so this time on the server needs to have a front-end scheduler to assign a user to access that server. When foreign enterprises services these servers are grouped. It has a total outside scheduler scheduling molecular layers inside the scheduler, of course, access is typically coupled to cache we can not do without.

anaconda tui Setup

Start the installation process text parsing
CD has been able to start start up it is because these two files (isolinux / boot.cat) (isolinux / isolinux.bin) also has a start function.
When installation CD to start, and there is a CD boot menu, this menu allows the user to properly install or enter rescue mode. Menu configuration file: isolinux / isolinux.cfg
each corresponding menu options:
load the kernel: isolinuz / vmlinuz
pass parameters to the kernel: append initrd = initrd.img ...
so the CD-ROM at startup is actually loaded with small linux CD has been able to start up and can start a setup wizard behind because he also launched an own kernel also start some initrd.img such files on the operating system and start a meaning. But his goal is not to start a boot operating system but to load an installation wizard. But after all the Setup Wizard is a software and this software is to go on the operating system, so just before loading the linux kernel. Later you can add some different kernel parameters
menu label ^ Install or upgrade an existing system that is setup wizard
kernel vmlinuz This is the need to load kernel file
append initrd = initrd.img This is the end of the kernel with kernel parameters required
first and menu items the third difference in rescue mode menu was essentially a rescue kernel parameters
isolinux / isolinux.cfg this document is to start menu

In addition to installing linux have time installation CD-ROM, also supports other ways to install
a number of ways to enter rescue mode: The following illustration

A manual selection input installation askmethod

He will go OK and then enter the address of the network installation package to find, but this will depend on the pre-built network share.

Loading the root file system, and start anaconda
default startup GUI interfaces
if explicitly use the TUI interfaces: the text parameter passed to the kernel
(1) press the tab key, later increasing text
(2) press the ESC key: boot: linux text
into the character Setup

anaconde manually install the system phase
manually install a system needs to provide those items during the installation process, you must put the future of automation installation manual installation of those items that gave him a specified number or it will stop at that, the lack of a will not work, so we those items should not drop the set point is ready to give him.

Must be specified during the installation process kinds of items:
1, the language you want to specify
2, the keyboard layout you want to specify
3, select the hard disk you want to specify (initialize hard disk)
4, specify the hostname
5, the card seems to be set to automatically obtain and to enable them NIC
6, select the time zone to remove UTC this time zone synchronization
7, enter the root password
8, partition by default points are automatically divided into logical volumes
9, select minimize installation
follow the automated installation must take more telling information to the installation wizard to automate installation. The above information tells how to install wizards do, is to write an answer file and this file is the answer that we want to put a variety of settings in the installation of the file written to him to go and tell the installation wizard to install in order to automate What are the options available. But though this answer file is a text file, but he is required.
Format Cnetos7 (6) the answer file requirements

The resulting answer file centos6 and centos7 not common, the answer file formats on the 7 and 6 answer file format is not the same
to generate an answer file, there are two methods, there is a way to install the operating system when the system will be installed when you the whole operation will be set up to generate a response file in the root account's home directory and named anconda-ks.cfg file when the file is actually kickstart the standard format, which is stored inside the file system originally installed how to do some settings, anaconda this document is ready to take over kickstart file to use, but the format of the configuration file is more complex and therefore we will use Xmanager way under normal circumstances.
Method (automated install linux) Centos7 minimize installation Xmanager making ks answer file
generated by the system-config-kickstart tool, but this tool is not installed by default, and he's dependencies particularly so necessary to install this tool

You can create an answer file by this graphical menu

Before installing the script is initialized before installing start and a script to do the initial work (by default do not fill)
after installation script is the operating system to automatically run a script Bahrain

This time the answer file has been generated over, may be a better way to answer file on the web. Or he made himself a http server

Of course, now inseparable from the CD but also re-enter when typing the answer file and then do not have control. Now it does is answer file 7, 7 answer file must be used to ensure that it is supporting on 7. And it has the answer file format 7 of the problem will lead to the answer file can not be used but the input ksvalidator command with an answer file that is automatically checks the script syntax

Call answer file

But this time this new machine no ip address so he would go to two places get ip
1, adding there http service, then he went back to the http service get ip
2, if not, then you need to manually go with the address
and then answer himself wrote file
if there is no service httpd, httpd will add the card service in that manual. Add good to let him install a carriage return

U disk linux automatically installed in place of the optical disc so that the disc u to automate the installation

U-Centos7 achieve minimization (Mini) automatically answer file mounting step

After the course, the future can also finish writing multiple menus to start the system include various linux system (centos6 ubantu).
But the kernel version 6 and 7 are not the same, you want to achieve 6 and 7 at the same time in the same menu you have to beat two cores. Therefore, this configuration file must separately create a different operating system kernel
at the same time automatically install 6 and 7 into a configuration file
into the / data / myiso / isolinux this directory

Of course, the same name can not be copied, so you have to create each have a separate folder to store two different kernels and other configuration files

6 But because there is no answer file, so now we must create an answer file to 6

: Http service as saying the page does not change the open. So property rights is very important.
Centso6 modify the vim / var / www / html / ksdir ks6_desktop.cfg answer file: ↓↓

Well then modified into vim /data/myiso/isolinux/isolinux.cfg after this configuration file to add the boot menu

After the configuration files are now ready to finish the entire directory engraved U disk to go. Therefore it needs to be made into iso file
string of commands may be a carved iso entire directory file: ↓↓
mkisofs -v -T -R & lt -J & lt --no-emul-Boot Load-size---boot. 4 --boot- info-table -V "CentOS boot" -b isolinux / isolinux.bin -c isolinux / boot.cat -o /root/boot.iso / data / myiso /

Then put the file boot.iso carved into the U disk

+
After doing this now U disk and then try whether the normal start, first make this machine virtual machine U disk, U disk and then pull out

In looking for a new virtual machine plug in a new hard drive.

At the same time press F10 to exit saving
DHCP Service

DHCP logical
DHCP assigned only one address field in the DHCP server, when a host got the ip addresses of the lease time is generally a term of one day. When the host does not use the shutdown, and then to the time of day and the lease will expire, the host address will be used for immediate recovery. After the recovery of this address can be used again to someone else. Virtually all computer ip to achieve a more less to use.
DHCP working process
DHCP work process is based on the UDP protocol, UDP protocol server go go 68 67 port client port.
If you want to use DHCP to obtain an address carried out to ensure that the firewall is on 67, 68 ports of course, we now have the firewall off, start adding the words do not forget to open ports 67 and 68. DHCP operation process involves eight messages

DHCP packets
first users will be issued before did not get an address to the network DISCOVER message, the message is DISCOVER declare that I do not have a network address, ask your network who is the DHCP server. The DISCOVER message is so network-based broadcast mechanism in many machines have received the requests. Upon receipt of a request to the server you need to see this happen to have my IP is a DHCP server, then I find one of my own IP address no IP address people use to divide a user. This stage is called OFFER. Assigned to the user later, when after the client receives this address, it must necessarily choose this address because there may be multiple network servers. He will choose a response to the server, I chose so and so who gave me the address of the server, naturally did not want others to see my address, DHCP can put that in the future not to address recycling. Assigned to other computers. If the server a user to look up his address. The final stage is necessary to confirm this ACKNOWLEDGE stage. After four process the client can get the address from the server. This is usually we will see the four process, this process is four more normal state.
Of course, there may also be other special DHCP message, say NAK, DECLINE, RELEASE, INFORM and so on. NAK: the server sends a client say my side no suitable address to you, you want to apply my address with no
DECLINE: the client to the server, said DHCP you give me the address of the results of this address in the network was occupied. For example, it was statically configured at this address. And I got the address of a conflict.
RELEASE (release): the client sends a request to the server, you gave me the address I do not want to, I want to give this address.
INFORM: the client to the server issued. The client says I want to get more detailed information.

                         续租IP地址
DHCP续租
    IP租约期限达到50%时,DHCP客户端会请求更新IP地址租约
    IP租约期限达到87.5%时,还没收到服务器响应,会申请重新绑定IP
    当IP地址分配的时候没有指定租期时,默认为一天。

IP address release
IP address release
if the IP address lease expires have not received the appropriate server, client stops using this IP address
if the DHCP client is not using the assigned IP address, you can also take the initiative to send to the DHCP server DHCP

renew time is valid time: this time to lease. After the lease determines when this address will expired, under normal circumstances, to obtain this address if not renewed this address to renew the expired time will
expire as expiration time: this time he is UTC time is not Beijing, that it should be converted to UTC time now and this time they were calculated.

These are broadcast
on how to build a Linux DHCP service configuration

DHCP services and other similar services are required to install the package.
How to achieve inter-network address assignment of DHCP server There are several ways
first: You can use a special router: RFC 1542
RFC1542 This feature allows the router with this particular broadcast via dhcp, if the router is in line with our RFC1542 of this standard is to allow him DHCP this package as adopted, although DHCP is a broadcast, but he allowed too, but allows broadcasters to broadcast DHCP over other life difficult. This router requires a bit high but not all routers can meet this requirement, RFC called a local solution, please help.
The second way:
we can give him is not ready at the end of a DHCP service called DHCP relay agent, called DHCPRELAY relay agent, the RELAY what he had a good job, know who the network DHCP server assumes that our server represented by A, the relay agent he usually listens on the network. She found a DHCP client to send a broadcast network, this RELAY After receiving a broadcast address to see someone apply for the network, although I am not a DHCP server but I relay agent, DHCP RELAY collects application of this, forwarding address after the DHCP help you apply for the collection of the past, this is the unicast forwarding is not broadcast, it can put forward over the user's application, users have to say a request for new addresses. Because there are a lot of configuration of the DHCP server address pool, A RELAY give a unicast address RELAY then come back and then forwarded to the user A address above. This process is unicast so you can easily pass through the router. But the relay agent address in advance should DCHP server configuration do not know who else RELAY server. Then turn point to point, which is the relay agent.

In order to solve the problem of single point of failure to prepare at least two groups of DHCP server to back up each other below.

Experiments by the DHCP service allows users to get an IP address
to do this experiment must be clear: because the DHCP assigned address is based on the broadcast. Moreover DHCP address who should not be selective allocation to DHCP to address, so who would let DHCP experiment reconfiguration of the time, must not be bridged. So this experiment the time must be a separate network segment
before to do this experiment should first look for a person with no network segment

Experiments and so will the only time this VNnet17 network in the host in order to obtain DHCPip my own configuration, and so will also have a client, the client to achieve access to the DHCP service is a must and server network segment

实验已准备完

The server acts as a host automatically get changed to dhcp

Do dhcp server static ip, then assign a dynamic address to give to others

We hope that future host another client of this segment are VMnet17 get the address, and so the server is a network segment, the range of the final configuration should also have 10 segments that range.
Dhcp installation

Dhcp details

Introduce various important files Dhcp

Start Dhcp service of
general service just installed will be able to start, but the service dhcp is rather special, because dhcp configuration file there are some missing configuration items. The reason is that dhcp configuration file in question

Host address assigned to a network segment, it is necessary to specify as a dhcp server to the terms of a service dhcp ip address range, that segment to segment the network, which means you must give yourself a specified network segment where the network card, or server do not come, since there are two network cards on the line as long as a network ip

You modify are required to restart the service

In a client to restart the network and found still can not get address

But this time the client still can not get dhcp address so have to further modify the configuration file

Set the default renewal time

View this directory can see that this gets me in the host ip

How to make clients not only get there ip gateway, DNS and other information: The following figure modify the configuration file
in this position in addition to the specified ip network segment and then he can get additional information
option routers: the so-called gateway
option domain-name-servers: DNS address
option domain-name "magedu.org"; domain suffix
which we pass these settings allow DHCP clients to obtain addresses also been the gateway address and DNS domain suffixes

Dhcp automate installation by
bear in an automated install process Dhcp is to make our clients get an IP from the server without loading the system, this is a prerequisite required to make the client has a network function, but the light has networking capabilities no use because we get an IP from the network, but also enough to make the computer starts up, I only started up in order to activate the anaconda-ks.cfg installation wizard boot files. Because the anaconda-ks.cfg file to start the installation wizard to enable subsequent installation.
Other configuration options:
filename: specify the boot file name
next-server: file server to provide the boot IP address
u Example:
filename "pxelinux.0";
the Next-Server 192.168.1.100;
u check the syntax of
service dhcpd configtest
Let's get the client after the address but also in acquiring something of which two are critical:
1: pxelinux.0
2: the Next-server
both automatic and installation-related, in order to automate the installation should let him go download key configuration files on the server. The bootlorc pxelinux.0 will provide this document, and this document in advance of need put on a server, so that the client downloaded from the server.
next-server: followed TFTP server IP. This server it is called TFTP server. TFTP server is similar to an FTP server, allows us to download files from the TFTP server, then you can download files pxelinux.0 down and this document will play a role bootlocrm After downloading the file, after the bootlocrm you can go to download a good server Download the kernel download initrd.img. And then loads a menu loaded subsequent automated installation wizard. So need to tie these two
next-server TFTP (TFTP server address)

TFTP service will allow us to load resources resources resources downloaded from the server, but not his function FTP function so powerful, TFTP is a simplified FTP-like service TFTP can also provide basic file sharing.

Set up a TFTP Service
TFTP server enables simple structures able to download small files TFTP above, tftp is a non-independent service
1, the installation of tftp software installation centos6
installed on Centos7: ↓↓

Installation on Centos6

/usr/sbin/in.tftpd This is his main program: ↓

And then start the tftp service: ↓↓

/ Var / lib / ftfpboot This directory is available for download shared resources

PXE DHCP and tftp combination of automated install linux

PXE works and experiments
of this process we need to be prepared in advance multiple servers, the first server dhcp server tftp Second, we all know that can be assigned dhcp tftp ip that can share files allows users to connect to the tftp server to download the file , with this we need to advance these two setting up the server, after setting up our client machines this is a hypothesis would like to install linux computer, and this computer the power is turned on when he will start automatically to the network issued a request, I need someone to assign addresses, hosts this time the client will issue a DHCP request message, and we just have a dhcp server in the network will be the address to the client, and not only the IP address to the client importantly, he also assigned to the TFTP client, this time the client will look for tftp server. Because the client now also need to start up the need linux kernel file to load and start menu items and the client is now a new host nothing, so he needs to get through to the address dhcp server tftp server when the client knows tftp after the address, would say to the tftp server sends a request, tftp server and now I hope that you can download from the bootlorm file download my good start, this time tftp can put what he had stored a file download function to act as bootlorm down, this is the default file pxelinux.0.
ip address of the tftp server and downloaded from the tftp server pxelinux.0 file. We need to inform the client host using the dhcp server, so we are going to just have to say something is not done to continue to improve:
PEX automated installation linux operating system Step:
How to tell the client to download files and connect via dhcp server tftp server ip address:
1, download dhcp service package

2, the server host tftp download the service pack

3, the client host tftp download the service pack

4, modify the dhcp service configuration file contents
into the dhcp service configuration file, modify the dhcp add network machine tftp server host have dhcp ip address and network folders pxelinux.0

In this add to his service tftp dhcp server's IP address. Now I want to connect to the tftp server ip tftp server is 10.0.0.1
now dhcp client service through a link up and connect the tftp server, but this time on the tftp server to the / var / lib / tftpboot to this folder Download pxelinux.0.
5, create pxelinux.0 file directory:

Command: yum search to find package. pxelinux package, you need to download this file syslinux.x86_64 because pxelinux.0 need this package to generate

Set up the DHCP
. 6, its realization centos7 install the operating system to minimize
light with no promoter. Since installing linux systems but also to obtain the relevant kernel configuration file, and after the completion of acquisition also want to pop up a menu of operating system installed, with the menu to select the menu installed in the end that, in short, DHCP work has been done, but the tftp work can have a file sharing. But then the light TFTP pxelinux.0 just get through this file is not enough, the other related to the additional kernel and boot files are copied over.

Now equipped with 6 operating system will be centos6 kernel-related files to tftp server / var / lib / tftpboot this directory
first automatically install this feature you must require the card must have a PXE function

Now in / var / lib / tftpboot this file to create a folder, then built into the file menu to go inside, the menu will copy the directory to pxelinux.cfg / default to this directory

Because we can not install a system with such a fancy background image, so we hope to use this simple and plain style picture.
To use the time we have just installed syslinux pictures

Of course, now you want to use a background image of the menu so it is imperative now the default file will just write to write clearly

Put the file with useless things can be deleted, and then write their own headline read format

Answer configuration file on the tftp server. The answer file with the http service so you have to have to make an http service

Then http service starts up, go to / var / www / html directory because this directory is the directory service http download files, give ks answer file to create a folder to make the above-ks answer files into this directory .

And then have to fight a yum source, the machine this server anything done, tftp service do, dhcp service to do, http services are also made machine to do this and then have to let the machine take a yum source. In / var / www / html to build a source yum, yum this is the source directory service format http

Then the disc 7 to hang him

Of course, this is a temporary mount, if you want to boot automatically mount will be written vim / etc / fstab configuration file

This is iso9660 format, the work is generally not a CD iso file copying but the entire directory, and then hang out iso file. And so it will be also installed 6 So now the way to put the mount 6 also get it
and then the entire first disc 6 onto the tftp server up

To open a terminal to view the file

Then the file name attached to vim / etc / fstab configuration file

Because this file and he wants to mount / var / www / html / centos / 6 / os / x86_64 / this directory in the root save and exit

View source source address of
the source yum 7 ks wrote configuration file.

Then answer the configuration file 6 plus build good yum source

Set menu startup items to add ks answer file
this will do almost the same, then back to the start menu configuration file in vim /var/lib/tftpboot/pxelinux.cfg/default

Now we know are looking vmlinuz (kernel file) and initrd startup files through the menu. But these two files do not have a copy, then you have to go. So from this it /misc/cd/isolinux/{vmlinuz,initrd.img}. Copied to the current directory. This directory is thought tftpboot tfpt service can provide a user must download directory

The /var/lib/tftpboot/pxelinux.cfg/pxelinux.cfg Reed default default menu configuration file is modified to the following figure like this: ↓↓

Then you can get a computer to implement the installation, if the computer supports PXE function can be properly installed
to find a new computer installation process requires this new computer and we have to DHCP services in a network segment to
create a new virtual machine:

Cobbler workflow

cobbler Profile

Cobbler is a Linux installation server service, you can start (PXE) way through the network to quickly install, reinstall the physical servers and virtual machines, while also managing DHCP, DNS and so on.
Cobbler can use the command line management, but also provides a Web-based interface management tool (cobbler-web), also provides API interface, convenient secondary development.
Cobbler is an upgraded version of the earlier kickstart, the advantage is relatively easy to configure, also comes with a web interface is easy to manage.
Cobbler built a lightweight configuration management system, but it also supports other configuration management and system integration, such as Puppet, is not supported SaltStack.
cobbler Integration Services

PXE服务支持
DHCP服务管理
DNS服务管理(可选bind,dnsmasq)
电源管理
Kickstart服务支持
YUM仓库管理
TFTP(PXE启动时需要)
Apache(提供kickstart的安装源,并提供定制化的kickstart配置)

cobbler profile Detailed cobbler profile directory in the / etc / cobbler
profile role in
/ etc / cobbler / settings cobbler master configuration file
/ etc / cobbler / iso / iso template configuration file
/ etc / cobbler / pxe pxe template configuration file
/ etc / cobbler / power supply configuration file
/etc/cobbler/user.conf web service authorization profile
/etc/cobbler/users.digest username and password to access the web configuration file
/etc/cobbler/dhcp.template dhcp server configuration templates
/ configuration template etc / cobbler / dnsmasq.template dns server
/etc/cobbler/tftpd.template tftp services configuration template
/etc/cobbler/modules.conf module configuration file

cobbler directory data
directory action
/ var / lib / cobbler / config / for storing distros, system, profiles and other information profile
/ var / lib / cobbler / triggers / cobbler for storing user defined commands
/ var / lib / cobbler / kickstart / kickstart file stored default
/ var / lib / cobbler / loaders / boot program and various image storage directory
/ var / www / cobbler / ks_mirror / release system of introducing all data
/ var / www / cobbler / images / import release of kernel and initrd image used for remote network boot
/ var / www / cobbler / repo_mirror / yum repository storage directory

cobbler log file
log file path name
/ var / log / cobbler / installing client installation log
/var/log/cobbler/cobbler.log cobbler log

cobbler command Detailed

cobbler check // check whether the current settings have a problem
cobbler list // list all the elements cobbler
cobbler report // list details the elements
cobbler sync // configured to synchronize data directory, change the configuration to be the next best
cobbler reposync // synchronization yum warehouse
cobbler distro // view the imported information release system
cobbler system // add view system information
cobbler profile // View configuration information

/ etc / cobbler / settings file will question cobbler do a lot of things this is a configuration file
find the line, replace the current host ip

Modify the current IP in the search next_server

In use this command to download the necessary source yum

In the execution cobbler sync

Generate an encrypted password

Find the line in the open configuration file / etc / cobbler / settings in relation password

Open the configuration file find this line automatically generates DHCP

Restart cobbler Service

Dhcp find template configuration file to modify the network

Modify these lines and the same as the current host ip

Guess you like

Origin blog.51cto.com/14451140/2436649