Remote Linux upgrade

Source: Internet
Author: User
Article Title: Remote Linux upgrade. Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.
This article briefly introduces how to use kickstart and network installation functions of Red Hat LINUX to quickly upgrade your LINUX system. The example in this article is to remotely upgrade from Red Hat 7.2 to Red Hat 9.0.
  
Since version 5.2, Red Hat LINUX has added a feature called kickstart, mainly to reduce the interactive system parameter input during installation and improve installation efficiency. It is especially suitable for applications that require rapid installation of hundreds of LINUX workstations in a short period of time. Menlo Park at Stanford University has a wonderful article, [1] is not described here.
  
1. System check before Upgrade
  
Before upgrading the system, some problems that are easy to ignore may interrupt the kickstart process. These problems are generally because the system configuration does not meet the minimum installation requirements, therefore, it is best to perform a full test before the automatic upgrade. Since the development of Red Hat LINUX, it has not been as smooth as 386 (Red Hat 9 cannot run on machines smaller than 586 ), therefore, it is necessary to fully check the system before the upgrade, including the following:
  
Whether the storage space is sufficient. Red Hat 9 requires a minimum of 32 MB of memory and a hard disk of 472 mb. The memory is generally not a problem, but I failed to install a system on a 500 M hard disk, of course, the hard disks are still relatively large and can be fully installed. LINUX system files are mainly stored in/usr, and some of the files below/. Generally, if the X system and large software are not installed, /usr can work well with 1 GB space and 500 mb space. My system is upgraded from 7.2 to 9.0, and the usage of/usr and/is about 30% more than before the upgrade, therefore, if your/usr and/usage are not too high, the disk space limit is generally not a problem.
  
Whether the swap partition space is sufficient. A hard-to-find difference between Red Hat 9 and 7.2 Is that 7.2 of the system can use swap partitions with less than twice the physical memory capacity, two or more times of physical memory swap partitions are recommended, while Red Hat 9 must use two or more times of physical memory swap partitions, therefore, if your LINUX system only has less than two times of swap partitions, you can only divide one swap partition or add another swap file, you can also dial your memory to make the system swap partition more than twice the physical memory. I suggest adding a swap partition, and adding swap files cannot be implemented in kickstart, as for allocating the memory, there is no way to dial the memory for remote upgrade.
Miscellaneous. The system will detect a series of hardware during the automatic upgrade process. If you select graphical interface for installation, but there is no mouse, the system will prompt you to use text for installation; or if the system only has 32 MB of memory, graphical interface installation is not allowed. You can modify these settings in the Automatic Installation configuration file to prevent them from occurring, however, recording down all the hardware configurations of the system to make a list will be of great help to make an automatic configuration file.
  
2. How to start the installer
  
Start with the installation program started in Red Hat LINUX. From the official installation and installation manual of Red Hat LINUX, we can see several main startup Methods: CDROM, soft drive, and dosutils \ autoboot running on the CD from the dos environment. bat files in three ways, for us this is still not enough, our LINUX workstation is not a soft drive and optical drive, of course, there is no dos. Analyze the boot * in the/images directory of the first disc of each release *. the img file shows that there are only two main startup image files: vmlinuz kernel and initrd. img, initrd. img is a compressed file system [2]. Extract these two files to the existing LINUX/boot directory, and add the corresponding configuration lines to the system bootloader (usually LILO or GRUB) configuration file to start the installation program. Take Red Hat 7.2 and GRUB for example (use the network of Red Hat 8.0 to start the image file ):
  
[Root @ client mnt] # mount-o loop-o ro/mnt/nfs/psyche/cd1/images/bootnet. img bootnet
[Root @ client mnt] # cd bootnet/
[Root @ client bootnet] # ls
Boot. msg initrd. img options.msgrescue.msgsplash.lsssyslinux.png
General. msgldlinux. sysparam. msgsnake. msgsyslinux. Program vmlinuz
[Root @ client bootnet] # cp vmlinuz/boot/vmlinuz8
[Root @ client bootnet] # cp initrd. img/boot/initrd8
[Root @ client bootnet] # vi/boot/grub/menu. lst
  
Add the following three rows:
  
Title Upgrade to Psyche via NFS
Kernel/boot/vmlinuz8 ro
Initrd/boot/initrd8
  
Note: There is no configuration for the/boot partition. If there is a/boot partition, the previous/boot is not required. See the NOTICE section in the GRUB configuration file.
  
After restarting, you can select a network upgrade. The effect is the same as that of booting the system with a bootnet floppy disk. Here, we will use another Startup File of Red Hat 9, which is also the boot. iso file that appears only recently in the Red Hat release. After loading the ISO image file of the first CD of Red Hat 9 release, we found that the images directory under it has a boot larger than the 7 Series release. iso file (the first CD root directory in 8.0 also contains a similar directory). After loading the file, it is found that it contains a large kernel and initrd file, the initrd contains a hardware driver that is often used to install the system. When started using this file, I can automatically identify the video card of the PM133 board and the rarely seen adaptec ANA-6911TX card (starfire. o), so we strongly recommend that you use boot. automatic iso upgrade saves the trouble of driving. It is worth mentioning that Red Hat 9 is no longer in boot. img has its own NIC Driver, while Red Hat 8 is in bootnet. img drivers with some common NICs (intel 55X series, tulip, 8139, etc.). If you are interested, refer to the methods mentioned in [2] to decompress bootnet. initrd. the img file can be seen in the lib directory.
  
3. Where to install
  
To upgrade the system, the source file of the release version of the new system is required. The release version can be in a variety of forms, that is, it can be a CD or a CD image file (ISO format ), it can also be a copy set of a CD file. In Red Hat 9, the available installation modes include local CDROM, local hard disk, NFS image, FTP, and HTTP. From the CD installation has the best compatibility and ease of operation, suitable for personal installation, bulk and remote upgrade is not applicable; local hard disk is a good method, fast, it also does not require frequent replacement of CDs, but it is not suitable for mass installation. Each workstation saves a copy of the released image, which is a waste of storage space, what's worse is that my machine has no space to put down such a huge file. NFS is a mature method, to install the system through NFS, you only need to share the CD image file in ISO format. Unlike FTP and HTTP, you need to consider the directory tree structure [2]. in addition, you can select a graphical interface for NFS installation (only the text interface can be used for FTP and HTTP), which is faster than FTP and HTTP. Therefore, we recommend that you use NFS for network installation. Creating an NFS to install an image server is simple. You only need to share the image file of the released CD through NFS.
  
[Root @ server root] $ cat/etc/exports/data/shrike 192.168.0.42/31 (ro)
[Root @ server shrike] # ls
Ks, cfgshrike-i386-disc1.isoshrike-i386-disc2.isoshrike-i386-disc3.iso
  
4. Make kickstart
  
The next step is to create a kickstart file. the kickstart technology has been updated many times since its earliest launch. The configuration syntax is also different, and later versions are not fully compatible with the old version syntax, it cannot be said that this is also a pity. Here I strongly recommend using the Red Hat 9 Official Document [3] For kickstart configuration so that nothing can be done. The configuration file contains the following content:
  
1) ks. cfg file location. Obviously, the installer needs to read the ks configuration file for automatic installation. The ks configuration file can be read in the following ways: Start a floppy disk, start a CD, hard disk, and network.
  
It is relatively simple to read the ks configuration file from a floppy disk. Place ks. cfg in the root directory of the soft disk. Enter linux ks = floppy to start ks installation;
  
To read the ks configuration file from the disc, add the ks. cfg configuration file to the root directory when creating the boot disc. Then, enter linux ks = cdrom:/ks. cfg to start ks installation;
  
The ks configuration file read from the hard disk is usually directed from the optical drive, and then read the ks configuration file in the hard disk (this may not be supported by the soft drive or network). After the hard disk is started, enter linux ks = hd: fd0: /ks. cfg. The condition is that the hard disk partition must be VFAT or EXT2;
The ks configuration file is read from the network in a lot of ways. Generally, the NFS and HTTP methods are used. The formats are ks = nfs: server:/path and ks = http: // <server>/<path>. Note that ks is read through the network. when the cfg file is used, the LAN can automatically allocate IP addresses because ks is not obtained in the kernel. before the cfg configuration file, the system does not know how to configure the IP address. In this case, you must first obtain an IP address through DHCP and read ks through the network. cfg configuration file. In an environment with network conditions, I strongly recommend using the network to provide ks. cfg configuration file. You can configure different kickstart configuration files [1] [3] for a large number of workstations by using the DHCP and ks parameter setting function, and automatically install systems with different functions. I used NFS to read the ks. cfg file.
  
[Root @ server shrike] # ls
Ks, cfgshrike-i386-disc1.isoshrike-i386-disc2.isoshrike-i386-disc3.iso
  
Add the ks configuration statement to the GRUB configuration file:
  
Kernel/boot/vmlinuz9 ro ks = nfs: 192.168.0.19:/data/shrike/ks. cfg
  
2) After testing, the system requires a relatively small number of ks configuration parameters, and the specific configuration parameters are not described in detail. The UNIX style is KISS. Take my configuration as an example:
  
Reboot
Upgrade
Lang en_US
Keyboard us
Mouse none
Text
Skipx
Network -- device = eth0 -- bootproto = static -- ip = 192.168.0.42 -- netmask = 255.255.255.0 -- gateway = 192.168.0.253 -- nameserver = 192.168.0.4 -- hostname = huter.xtu.edu.cn
Nfs -- server = 192.168.0.19 -- dir =/data/shrike
Zerombr yes
Bootloader -- location = mbr
  
% Post
Chkconfig -- level 345 sshd on
  
3) check that all configurations are correct and you can start remote system upgrade! After the system is restarted, run the ping command to ping the IP address of the upgraded system. If no problem exists, the IP address is larger.
Related Article

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.