Automatic installation scripts in Linux

Source: Internet
Author: User

How to make your host automatically complete the installation, automatically answer the questions asked by the system, write the automatic installation script can be implemented, the following will explain in detail the automatic script installation method.

Systemd-config-kickstart # #自动应答脚本制作工具

650) this.width=650; "Src=" Https://s3.51cto.com/oss/201711/01/b9645f8a4ef02a08816371dae97cc30f.png-wh_500x0-wm_3 -wmp_4-s_2473431251.png "style=" Float:none; "title=" 80.png "alt=" B9645f8a4ef02a08816371dae97cc30f.png-wh_ "/>

Installation is successful and Systemd-config-kickstart will make a script response during the installation process

650) this.width=650; "Src=" Https://s3.51cto.com/oss/201711/01/7b86f15d75bbb18d984ab516c54aebb8.png-wh_500x0-wm_3 -wmp_4-s_4116761578.png "style=" Float:none; "title=" 81.png "alt=" 7b86f15d75bbb18d984ab516c54aebb8.png-wh_ "/>

Choose a language selection

(1) Basic Configuration installation must be consistent time zone selection (optional, in the script is written, here to do an explanation)

650) this.width=650; "Src=" Https://s3.51cto.com/oss/201711/01/37a5355f4c48051cb7e07cf3718c8575.png-wh_500x0-wm_3 -wmp_4-s_4036625300.png "style=" Float:none; "title=" 82.png "alt=" 37a5355f4c48051cb7e07cf3718c8575.png-wh_ "/>

Root passwd fill in the root password, and confirm that two times to enter the password

Advanced Configuration selection, System version, start after installation, do not open the graphical interface (so that the installation is relatively fast)

650) this.width=650; "Src=" Https://s4.51cto.com/oss/201711/01/c77bb274e2c958622efa6968a78e4724.png-wh_500x0-wm_3 -wmp_4-s_2136148724.png "style=" Float:none; "title=" 83.png "alt=" C77bb274e2c958622efa6968a78e4724.png-wh_ "/>

(2) The way we install it is to install the network share, so we need to fill in the IP and service sharing directory of the Open service.

650) this.width=650; "Src=" Https://s5.51cto.com/oss/201711/01/a3a9f6112b4eea00a9f16590b460ae62.png-wh_500x0-wm_3 -wmp_4-s_2391442614.png "style=" Float:none; "title=" 84.png "alt=" A3a9f6112b4eea00a9f16590b460ae62.png-wh_ "/>

(3) Select partition partion information

Click the bottom corner Add to customize the Add partition

First row Select drop-down menu/boot partition, size 200M

650) this.width=650; "Src=" Https://s4.51cto.com/oss/201711/01/e48a3110eb2e6f994c4df10fc506cb86.png-wh_500x0-wm_3 -wmp_4-s_628022235.png "style=" Float:none; "title=" 85.png "alt=" E48a3110eb2e6f994c4df10fc506cb86.png-wh_ "/>

Select Add Swap partition, note in the second row to select, size is 500M

650) this.width=650; "Src=" Https://s4.51cto.com/oss/201711/01/332c0b5a0fbab7252c5170260dadb0ca.png-wh_500x0-wm_3 -wmp_4-s_4098433609.png "style=" Float:none; "title=" 86.png "alt=" 332c0b5a0fbab7252c5170260dadb0ca.png-wh_ "/>

Select the root partition, second row, note that all remaining memory is now given to the root partition

Select Fill all unused space on disk

650) this.width=650; "Src=" Https://s4.51cto.com/oss/201711/01/c01d564a7ae2ba10aa1adb7650d66f00.png-wh_500x0-wm_3 -wmp_4-s_2291480402.png "style=" Float:none; "title=" 87.png "alt=" C01d564a7ae2ba10aa1adb7650d66f00.png-wh_ "/>

(4) Select the network to be used by the installation client, DHCP assign IP to the client's service (if DHCP is not, you need to build it yourself)

650) this.width=650; "Src=" Https://s5.51cto.com/oss/201711/01/9dcc272bcfe7f55c9b1921518a47dea3.png-wh_500x0-wm_3 -wmp_4-s_2988664220.png "style=" Float:none; "title=" 88.png "alt=" 9dcc272bcfe7f55c9b1921518a47dea3.png-wh_ "/>

(5) Turn off firewall when powering on

650) this.width=650; "Src=" Https://s4.51cto.com/oss/201711/01/94be80046873fa72be84db36c362e7db.png-wh_500x0-wm_3 -wmp_4-s_109929269.png "style=" Float:none; "title=" 89.png "alt=" 94be80046873fa72be84db36c362e7db.png-wh_ "/>

(6) Do not open the image

650) this.width=650; "Src=" Https://s5.51cto.com/oss/201711/01/15d203a702b4a8459c647c5a942ab9ac.png-wh_500x0-wm_3 -wmp_4-s_1648918952.png "style=" Float:none; "title=" 90.png "alt=" 15d203a702b4a8459c647c5a942ab9ac.png-wh_ "/>

(7) will write the file ks.cfg save, click on the top left filed point open, there is an option save save, you can choose to save the location, in order to find I put it under the root

650) this.width=650; "Src=" Https://s2.51cto.com/oss/201711/01/e40a4cf078989f6de5dbc8603ae6b96e.png-wh_500x0-wm_3 -wmp_4-s_3014345244.png "style=" Float:none; "title=" 92.png "alt=" E40a4cf078989f6de5dbc8603ae6b96e.png-wh_ "/>

650) this.width=650; "Src=" Https://s2.51cto.com/oss/201711/01/e4f7225cd27cc0820ae44a35b2e7b9f3.png-wh_500x0-wm_3 -wmp_4-s_4024004001.png "style=" Float:none; "title=" 93.png "alt=" E4f7225cd27cc0820ae44a35b2e7b9f3.png-wh_ "/>

(8) Copy the generated file ks.cfg to the shared directory CP ks.cfg/var/www/html (share in the previous article was described in detail)

650) this.width=650; "Src=" Https://s2.51cto.com/oss/201711/01/69c1529475fbf8acc74bbb2889552229.png-wh_500x0-wm_3 -wmp_4-s_2113769349.png "style=" Float:none; "title=" 95.png "alt=" 69c1529475fbf8acc74bbb2889552229.png-wh_ "/>

File exists

650) this.width=650; "Src=" Https://s2.51cto.com/oss/201711/01/ed384f437a150e8a3d892a3c790bce1d.png-wh_500x0-wm_3 -wmp_4-s_2634288679.png "style=" Float:none; "title=" 96.png "alt=" Ed384f437a150e8a3d892a3c790bce1d.png-wh_ "/>

Ks.cfg configuration file, all the choices just now in the file, you can also directly modify the file to take effect

(1) Just the first step, the time zone we have no choice, here the tenth line can be changed time zone timezone Asia/shanghai

650) this.width=650; "Src=" Https://s2.51cto.com/oss/201711/01/99b7468774618d10ad326e79a4ef1e2c.png-wh_500x0-wm_3 -wmp_4-s_1995583130.png "style=" Float:none; "title=" 97.png "alt=" 99b7468774618d10ad326e79a4ef1e2c.png-wh_ "/>

650) this.width=650; "Src=" Https://s2.51cto.com/oss/201711/01/ff47f9cd919ca6c632041f418e3492c1.png-wh_500x0-wm_3 -wmp_4-s_144988970.png "style=" Float:none; "title=" 98.png "alt=" Ff47f9cd919ca6c632041f418e3492c1.png-wh_ "/>

(2) need to add at the end of the file

%packages lists the packages you want to install (for new installations only)

Lftp download tool, Access file protocol

@base Defining environment variables

%end End

650) this.width=650; "Src=" Https://s2.51cto.com/oss/201711/01/dd62d8bbf1f7162c52319cb1ea4564cd.png-wh_500x0-wm_3 -wmp_4-s_271330048.png "style=" Float:none; "title=" 99.png "alt=" Dd62d8bbf1f7162c52319cb1ea4564cd.png-wh_ "/>

Add executable permissions to the file

650) this.width=650; "Src=" Https://s1.51cto.com/oss/201711/02/9b00de64a56d9e005569f3ae08dc1138.png-wh_500x0-wm_3 -wmp_4-s_4154274761.png "title=" 99.0.png "alt=" 9b00de64a56d9e005569f3ae08dc1138.png-wh_ "/>

Ksvalidator ks.cfg See ks.cfg If this file has a syntax error

650) this.width=650; "Src=" Https://s2.51cto.com/oss/201711/01/cc11a7092d847fbf1cdc9952ffd65f1a.png-wh_500x0-wm_3 -wmp_4-s_755573902.png "style=" Float:none; "title=" 100.png "alt=" Cc11a7092d847fbf1cdc9952ffd65f1a.png-wh_ "/>

Test can be shared after the error

650) this.width=650; "Src=" Https://s2.51cto.com/oss/201711/01/4aa683cea1873afbf9d3175e9c5a2b63.png-wh_500x0-wm_3 -wmp_4-s_2037603782.png "style=" Float:none; "title=" 101.png "alt=" 4aa683cea1873afbf9d3175e9c5a2b63.png-wh_ "/>

Write the install Virtual machine script

--lacation http://172.25.254,60/rhel7.2 # #安装中镜像共享172.25.254.60/rhel7.2 in this directory

--extra-args "Ks=http://172.25.254.60/ks.cfg" # #回答安装过程中系统提出的问题, all written in the shared directory, 172.25.254.60/ks.cfg (http=/var/www/ html

650) this.width=650; "Src=" Https://s3.51cto.com/oss/201711/01/0b04102d5049ba2a756ed13e618a4ff7.png-wh_500x0-wm_3 -wmp_4-s_3151559563.png "style=" Float:none; "title=" 102.png "alt=" 0b04102d5049ba2a756ed13e618a4ff7.png-wh_ "/>

650) this.width=650; "Src=" Https://s4.51cto.com/oss/201711/01/7f945d23a1e3fed91b5922b2fedf3df1.png-wh_500x0-wm_3 -wmp_4-s_1453976236.png "style=" Float:none; "title=" 103.png "alt=" 7f945d23a1e3fed91b5922b2fedf3df1.png-wh_ "/>

Add executable permissions to the script

650) this.width=650; "Src=" Https://s4.51cto.com/oss/201711/01/b0d6a0b1544c2a50b9c9cf086d9ad491.png-wh_500x0-wm_3 -wmp_4-s_3579471200.png "style=" Float:none; "title=" 104.png "alt=" B0d6a0b1544c2a50b9c9cf086d9ad491.png-wh_ "/>

Construction of DHCP

Download DHCP software first

650) this.width=650; "Src=" Https://s4.51cto.com/oss/201711/01/3a3d91987430cef1f893fc8f94cbbae2.png-wh_500x0-wm_3 -wmp_4-s_1392975955.png "style=" Float:none; "title=" 105.png "alt=" 3a3d91987430cef1f893fc8f94cbbae2.png-wh_ "/>

To view the configuration file, there is an example in the configuration file

650) this.width=650; "Src=" Https://s1.51cto.com/oss/201711/01/e890b7bfdde4f969de4e1109cd6a0b46.png-wh_500x0-wm_3 -wmp_4-s_701128686.png "style=" Float:none; "title=" 106.png "alt=" E890b7bfdde4f969de4e1109cd6a0b46.png-wh_ "/>

This example can be copied to the configuration file, the corresponding changes can be

650) this.width=650; "Src=" Https://s4.51cto.com/oss/201711/01/8546555d7765143377ac142ea31e9a23.png-wh_500x0-wm_3 -wmp_4-s_4215241242.png "style=" Float:none; "title=" 107.png "alt=" 8546555d7765143377ac142ea31e9a23.png-wh_ "/>

vim/etc/dhcp/dhcp.conf Editing a configuration file

650) this.width=650; "Src=" Https://s4.51cto.com/oss/201711/01/e2704681ec1a6eaefd7130720b2ec7c1.png-wh_500x0-wm_3 -wmp_4-s_3041715681.png "style=" Float:none; "title=" 108.png "alt=" E2704681ec1a6eaefd7130720b2ec7c1.png-wh_ "/>

7 option Domain-name "example.org"; # #域名

8 option Domain-name-server 172.25.254.60; # #dns

Ten Default-lease-time 600;# #默认租约期

Max-lease-time 7200;# #最长租约期

Log-facility local7;# #日志级别

650) this.width=650; "Src=" Https://s4.51cto.com/oss/201711/01/38ae7241432fffdb35c6f5d0172cf710.png-wh_500x0-wm_3 -wmp_4-s_1257160099.png "style=" Float:none; "title=" 109.png "alt=" 38ae7241432fffdb35c6f5d0172cf710.png-wh_ "/>

Delete 27th, line 28

650) this.width=650; "Src=" Https://s3.51cto.com/oss/201711/01/c1ad495a6d52168bd5885b9ed0af17f4.png-wh_500x0-wm_3 -wmp_4-s_3835162857.png "style=" Float:none; "title=" 110.png "alt=" C1ad495a6d52168bd5885b9ed0af17f4.png-wh_ "/>

Delete content after 35 rows

650) this.width=650; "Src=" Https://s1.51cto.com/oss/201711/01/26381e8f47f88a461b1c483c044eabc3.png-wh_500x0-wm_3 -wmp_4-s_2243318993.png "style=" Float:none; "title=" 111.png "alt=" 26381e8f47f88a461b1c483c044eabc3.png-wh_ "/>

Subnet 172.25.254.0 netmask 255.255.255.0 {# #网段, subnet mask

Range 172.25.254.200 172.25.254.220;# #地址范围

Option Routers 172.25.254.160;# #网关

650) this.width=650; "Src=" Https://s1.51cto.com/oss/201711/01/479d3b2deb3057bd8e8c0dcb2e4777f3.png-wh_500x0-wm_3 -wmp_4-s_395926468.png "style=" Float:none; "title=" 112.png "alt=" 479d3b2deb3057bd8e8c0dcb2e4777f3.png-wh_ "/>

Systemctl Restart DHCPD # #重启dhcp服务

Systemctl Stop FIREWALLD # #关掉火墙

650) this.width=650; "Src=" Https://s1.51cto.com/oss/201711/01/eb8be534a6a4de6a21fb7b6b06ddb9db.png-wh_500x0-wm_3 -wmp_4-s_2284397963.png "style=" Float:none; "title=" 113.png "alt=" Eb8be534a6a4de6a21fb7b6b06ddb9db.png-wh_ "/>

During installation, you can use the Ctrl alt F2 to view IP, gateway, and DNS

650) this.width=650; "Src=" Https://s5.51cto.com/oss/201711/01/4a7108ee1ea253a532b6243779b564e1.png-wh_500x0-wm_3 -wmp_4-s_722748871.png "style=" Float:none; "title=" 114.png "alt=" 4a7108ee1ea253a532b6243779b564e1.png-wh_ "/>

650) this.width=650; "Src=" Https://s5.51cto.com/oss/201711/01/1afb00d9bddc3cd1716a86fa33e7c20e.png-wh_500x0-wm_3 -wmp_4-s_2884665050.png "style=" Float:none; "title=" 115.png "alt=" 1afb00d9bddc3cd1716a86fa33e7c20e.png-wh_ "/>

Non-graphical installation of only 50 packages, relatively fast

650) this.width=650; "Src=" Https://s3.51cto.com/oss/201711/01/57dc71fb064613c66c9d451690e85fa4.png-wh_500x0-wm_3 -wmp_4-s_36056583.png "style=" Float:none; "title=" 116.png "alt=" 57dc71fb064613c66c9d451690e85fa4.png-wh_ "/>



Automatic installation scripts in Linux

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.