Disclosure of Invention
Aiming at the problems in the related art, the invention provides a method and a device for installing an operating system, which can realize automatic installation and setting in the whole installation process of the operating system, thereby saving human resources and time resources.
The technical scheme of the invention is realized as follows:
according to one aspect of the present invention, a method of installing an operating system is provided.
The method for installing the operating system comprises the following steps: sending a downloading request to the server, and receiving a system installation program, a first script and a second script returned by the server; assembling the RAID according to the first script, and automatically installing an operating system according to a system installation program; and configuring the operating system according to the second script.
According to one embodiment of the invention, assembling the disk array RAID according to the first script includes: judging whether an SAS card or an RAID card is installed; assembling a first disk array RAID under the condition that an SAS card is installed; and assembling the second disk array RAID under the condition that the RAID card is installed.
According to an embodiment of the present invention, assembling the first disk array RAID with the SAS card mounted includes: judging the number of hard disks related to the SAS card; assembling the hard disks into RAID1 under the condition that the number of the hard disks is not less than a threshold value; and when the number of the hard disks is less than the threshold value, assembling the disk array RAID is not carried out.
According to an embodiment of the present invention, the assembling of the second disk array RAID with the RAID card installed includes: acquiring first configuration information of a first configuration file; and assembling the disk array for the hard disk connected with the RAID card according to the first configuration information.
According to an embodiment of the present invention, configuring the operating system according to the second script includes: acquiring second configuration information of a second configuration file, wherein the second configuration information comprises a data network IP address and a management network IP address; setting the data network IP address according to the data network IP address; and setting the management network IP address according to the management network IP address.
According to another aspect of the present invention, there is provided an apparatus for installing an operating system.
The device for installing the operating system comprises: the download receiving module is used for sending a download request to the server and receiving a system installation program, a first script and a second script returned by the server; the installation module is used for assembling the RAID according to the first script and automatically installing the operating system according to a system installation program; and the configuration module is used for configuring the operating system according to the second script.
According to one embodiment of the invention, a mounting module comprises: the first judgment module is used for judging whether an SAS card or an RAID card is installed or not; the first assembling module is used for assembling the RAID of the first disk array under the condition that the SAS card is installed; and the second assembling module is used for assembling the second disk array RAID under the condition that the RAID card is installed.
According to one embodiment of the invention, the first assembly module comprises: the second judgment module is used for judging the number of the hard disks related to the SAS card; the first assembling submodule is used for assembling the hard disks into the RAID1 under the condition that the number of the hard disks is not less than a threshold value; and the second assembling submodule is used for not assembling the RAID under the condition that the number of the hard disks is less than the threshold value.
According to an embodiment of the present invention, the second assembly module includes: the first acquisition module is used for acquiring first configuration information of a first configuration file; and the third assembling submodule is used for assembling the disk array on the hard disk connected with the RAID card according to the first configuration information.
According to one embodiment of the invention, the configuration module comprises: the second obtaining module is used for obtaining second configuration information of a second configuration file, wherein the second configuration information comprises a data network IP address and a management network IP address; the first setting module is used for setting the data network IP address according to the data network IP address; and the second setting module is used for setting the management network IP address according to the management network IP address.
The invention has the following beneficial effects:
according to the invention, the downloading request is sent to the server, the system installation program, the first script and the second script returned by the server are received, then the RAID is assembled according to the first script, the operating system is automatically installed according to the system installation program, and finally the operating system is configured according to the second script, so that the automatic installation and setting are realized in the whole operating system installation process, thereby saving human resources and time resources.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments that can be derived by one of ordinary skill in the art from the embodiments given herein are intended to be within the scope of the present invention.
According to an embodiment of the present invention, a method of installing an operating system is provided.
As shown in fig. 1, a method of installing an operating system according to an embodiment of the present invention includes:
step S101, sending a downloading request to a server, and receiving a system installation program, a first script and a second script returned by the server;
step S103, assembling the RAID according to the first script, and automatically installing an operating system according to a system installation program;
and step S105, configuring the operating system according to the second script.
According to the scheme of the invention, the downloading request is sent to the server, the system installation program, the first script and the second script returned by the server are received, then the RAID is assembled according to the first script, the operating system is automatically installed according to the system installation program, and finally the operating system is configured according to the second script, so that the automatic installation and setting are realized in the whole operating system installation process, the human resources and the time resources are saved, in addition, the problem caused by manual operation is avoided due to the reduction of manual intervention, and the production efficiency and the production through rate of a factory are greatly improved.
According to one embodiment of the invention, assembling the disk array RAID according to the first script includes: judging whether an SAS card or an RAID card is installed; assembling a first disk array RAID under the condition that an SAS card is installed; and assembling the second disk array RAID under the condition that the RAID card is installed.
According to an embodiment of the present invention, assembling the first disk array RAID with the SAS card mounted includes: judging the number of hard disks related to the SAS card; assembling the hard disks into RAID1 under the condition that the number of the hard disks is not less than a threshold value; and when the number of the hard disks is less than the threshold value, assembling the disk array RAID is not carried out.
According to an embodiment of the present invention, the assembling of the second disk array RAID with the RAID card installed includes: acquiring first configuration information of a first configuration file; and assembling the disk array for the hard disk connected with the RAID card according to the first configuration information.
According to an embodiment of the present invention, configuring the operating system according to the second script includes: acquiring second configuration information of a second configuration file, wherein the second configuration information comprises a data network IP address and a management network IP address; setting the data network IP address according to the data network IP address; and setting the management network IP address according to the management network IP address.
In order to better describe the present invention, the following detailed description is given by way of specific examples.
As shown in fig. 2, the present invention uses a server as a carrier, where the server is a PXE (Preboot execution Environment) server, downloads two scripts (raid.sh and autoset ip.sh) from the server by using an FTP (File Transfer Protocol) Protocol and a startup script configuration File (namely, KS File) through an Initrd (Linux initial RAM disk) temporary root File system at a client, performs RAID assembly through the script.
The installation of the operating system is generally divided into two parts: RAID assembly and setting of system data network IP address and management network IP address, as shown in fig. 3, the system automatically determines whether the client has an SAS card and an RAID card, and if the client is installed as an SAS card, the processing flow is as follows:
the client side can automatically judge the number of the SAS card associated hard disks, if the number of the hard disks is more than or equal to 2, the client side can assemble the first two hard disks of the physical address and assemble the hard disks into RAID1 (independent disk array), wherein RAID1 realizes data redundancy through disk data mirroring, and data which are mutually backed up are generated on paired independent disks; if the number of hard disks is <2, the client does not need to do RAID.
Further, as shown in fig. 3, in the case of being installed as the RAD card, the processing flow is as follows:
the method comprises the steps of supporting an N + N mode, namely supporting the combination of a plurality of RAD cards and a plurality of hard disks, and judging the number of the RAD cards and the hard disks; and assembling the corresponding disk array RAID according to the requirements of the configuration file by using all hard disks connected with the RAID card pair, wherein the disk array RAID can be set to different levels.
Further, as shown in fig. 3, the operating system is directly installed without the SAS card and the RAID card.
In addition, as shown in fig. 4, after the operating system is installed, the client automatically downloads the autoset ip.sh and the configuration file (configuration file) from the server after the system is installed, and automatically runs the autoset ip.sh after the downloading is completed, and after the autoset ip.sh is run, the following steps are performed:
the system can automatically judge that the network port connected with the network cable is an Ethernet port;
the system will read the configuration file to judge the IP address of each server, wherein the file needs to be written manually, the writing order is written according to the format of SN (server serial number), data network IP address, management network IP address, HOSTNAME, such as 01234567891.1.1.11.2.1.1 Node1 (Node 1), wherein the server serial number is 0123456789, the solid IP of the data network is 1.1.1.1, the solid IP of the management network is 1.2.1.1, the HOSTNAME is Node 1;
according to the configuration file, the system modifies the IP of the port of the corresponding data network;
according to the configuration file, the system configures the corresponding management IP for the port of the management network.
Furthermore, the protocol of the present invention can be compared to the protocol of the prior art, as shown in table 1.
TABLE 1
If 100 servers are configured at the same time, as shown in table 1, the configuration of 100 servers by the conventional method is as follows:
when the disk array RAID is manually built, the method comprises the following steps: 5 minutes 100 ═ 500 minutes;
when the operating system is manually installed: 40 min 100-4000 min;
when the data IP is manually configured and the network IP is managed: 6 min 100-600 min;
to sum up, when the server 100 is configured by the conventional method: (500+4000+600)/60 ═ 85 hours.
As shown in table 1, the configuration of 100 servers according to the present invention is as follows:
and meanwhile, when RAID (redundant array of independent disk) of 100 servers is performed: 10 seconds;
when the system is installed for 100 servers at the same time: 1800 seconds;
when the configuration of data IP and management network IP is carried out on 100 servers at the same time: 10 seconds;
to sum up, when the method of the present invention is used to configure 100 servers: (10+1800+10)/3600 ═ 0.51 hours.
Therefore, the comparison of 100 servers shows that the traditional method needs 85 hours, but the method only needs 0.51 hour, and in the whole installation process, the automatic setting is completely realized, the time and the labor are saved, meanwhile, the problems of manual setting errors and the like are avoided due to the reduction of manual intervention, and the production efficiency and the production first pass rate of a factory are greatly improved.
According to an embodiment of the invention, an apparatus for installing an operating system is also provided.
As shown in fig. 5, an apparatus for installing an operating system according to an embodiment of the present invention includes:
thedownload receiving module 51 is configured to send a download request to the server, and receive a system installation program, a first script, and a second script returned by the server; theinstallation module 52 is used for assembling the RAID according to the first script and automatically installing the operating system according to the system installation program; and aconfiguration module 53, configured to configure the operating system according to the second script.
According to one embodiment of the present invention, theinstallation module 52 includes: a first judgment module (not shown) for judging whether an SAS card or a RAID card is mounted; a first assembling module (not shown) for assembling the first disk array RAID with the SAS card installed; and a second assembling module (not shown) for assembling the second disk array RAID with the RAID card installed.
According to one embodiment of the invention, the first assembly module comprises: a second judging module (not shown) for judging the number of hard disks associated with the SAS card; a first assembling submodule (not shown) for assembling the hard disks into RAID1 in a case where the number of hard disks is not less than a threshold value; and a second assembling submodule (not shown) for not assembling the disk array RAID in the case where the number of hard disks is less than the threshold value.
According to an embodiment of the present invention, the second assembly module includes: a first obtaining module (not shown) for obtaining first configuration information of the first configuration file; and a third assembling submodule (not shown) for assembling the disk array to the hard disk connected with the RAID card according to the first configuration information.
According to one embodiment of the invention, theconfiguration module 53 comprises: a second obtaining module (not shown) configured to obtain second configuration information of a second configuration file, where the second configuration information includes a data network IP address and a management network IP address; a first setting module (not shown) for setting the data network IP address according to the data network IP address; and a second setting module (not shown) for setting the management network IP address according to the management network IP address.
In summary, according to the above technical solution of the present invention, a download request is sent to a server, a system installation program, a first script, and a second script returned by the server are received, then, according to the first script, RAID is assembled, according to the system installation program, an operating system is automatically installed, and finally, according to the second script, configuration of the operating system is performed, so that in the whole operating system installation process, automatic installation and setting are achieved, thereby saving human resources and time resources, and in addition, because manual intervention is reduced, problems caused by manual operation are avoided, and production efficiency and production throughput of a factory are greatly improved.
The above description is only for the purpose of illustrating the preferred embodiments of the present invention and is not to be construed as limiting the invention, and any modifications, equivalents, improvements and the like that fall within the spirit and principle of the present invention are intended to be included therein.