当前位置:网站首页>Step by step import RHEL image to Tencent cloud
Step by step import RHEL image to Tencent cloud
2022-06-24 15:45:00 【Wang Xing】
background
Red Hat Enterprise Linux(RHEL) It's a by Red Hat Developed commercial market-oriented Linux Distribution version ,Red Hat Enterprise Linux Often referred to as RHEL. According to the IDC Statistics , To 2018 year , The market share of server operating system has reached 33.4%. at present , In the Chinese mainland market ,RHEL Mainly used by multinational enterprises or foreign capital , Many other enterprises have always put CentOS (Community Enterprise Operating System) Linux Red hat is the main operating system , But Red Riding Hood 2020 year 12 month 8 Suddenly adjust the business strategy , take CentOS Linux Switch to a CentOS Stream , This leads directly to CentOS And RHEL The relationship between upstream and downstream is changed , At the same time as CentOS Stream There will be no fixed large version release , Although there are Rocky Linux And so on , But everyone should know where the impact is , Is it possible to create a new version and solve it quickly , I won't go into details here .
Based on the above background , This article will only describe how to use the custom image method to RHEL7.9 and RHEL8.2/8.3 Import Tencent public cloud platform , At the same time, it is hereby declared that this article will not involve any commercial considerations , It is also an unofficial manual , Only for your own research and learning reference .
The process
Get ready
1. One with KVM(Kernel-based Virtual Machine) Of Linux Environmental Science ( I use Mac install VMware Fushion Then virtual Fedora 33 Environmental Science ) Or anything that can x86 Any virtual machine , It doesn't matter , If you don't mind the trouble , Theoretically Any virtual machine available , Finally, just convert the format , I'm afraid of trouble , Directly with the KVM
2. A valid Tencent cloud account , Tencent cloud object storage has been activated and a storage bucket has been created , Otherwise, you cannot create an instance for testing .
3. An effective red hat ID And valid subscriptions - It should contain at least RHEL Standard subscribe , Whether it's NFR still Self supported Or buy a subscription with real money .
step
1. By any means , It's best to get a virtual environment with KVM Of , Because this article is based on KVM For example
2. Create a virtual machine , Use the downloaded RHEL Mirror image , Stored as qcow2 A single file ,RHEL7 Distribute 5G,RHEL8 Distribute 10G ( Less than 10 Installation failed ), Don't get on with yourself , Too big , Uploading is a waste of time , Storage wastes money, Of course qcow2,vhd,vmdk,raw In fact, they can be supported , But I like it better qcow2.
3. Install and use minimal, There's no need to do GUI(RHEL8 The default choice is GUI,RHEL7 The default is minimal)
4. Enter the system to start routine inspection , Please refer to https://cloud.tencent.com/document/product/213/17814 , Although there are official documents , But I want to repeat .
1) Check OS Partition and startup mode
#parted -l /dev/sda | grep 'Partition Table'
- If the return result is msdos, That is to say MBR Partition , Please proceed to the next step .
- If the return result is gpt, That is to say GPT Partition . Currently, service migration does not support GPT Partition , Please give up
2) Execute the following command , Check that the operating system is running with EFI Mode start
#ls /sys/firmware/efi
- If there is a file , Indicates that the current operating system uses EFI Mode start , please Submit work order feedback .
- If there is no file , Please proceed to the next step .
3) Check system key files
Mainly the following documents ( By default ,RHEL7 and RHEL8 There's basically no problem ), Make sure the disk name is not used ( Such as /dev/sda1) Mounted
- /etc/grub2.cfg: kernel It is recommended to use uuid mount root, Other ways ( Such as root=/dev/sda) May cause the system to fail to start .
- /etc/fstab: Do not mount other hard disks , After migration, the system may fail to start due to missing disks .
- /etc/shadow: The authority is normal , Can read and write .
4) Uninstall software
Uninstall conflicting drivers and software ( Include VMware tools,Xen tools,Virtualbox GuestAdditions And some software with underlying drivers ), If you use KVM, These can be basically ignored .
5) Check virtio drive
Step 1: Check whether the kernel supports :
#grep -i virtio /boot/config-$(uname -r)
- If the returned result is CONFIG_VIRTIO_BLK Parameters and CONFIG_VIRTIO_NET The parameter value is m, Go straight into Step 2 -> RHEL 7 and RHEL8 This will happen
- If in the return result CONFIG_VIRTIO_BLK Parameters and CONFIG_VIRTIO_NET The parameter value is y, Indicates that the operating system contains Virtio drive , You can directly import customized images to Tencent cloud .
- If there is no CONFIG_VIRTIO_BLK Parameters and CONFIG_VIRTIO_NET Parameter information , Indicates the operating system I won't support it Import Tencent cloud .
Step 2: Check whether the temporary file system contains Virtio drive :
#lsinitrd /boot/initramfs-$(uname -r).img | grep virtio
stay RHEL7.9 On , Will meet the conditions , Return as follows :
Unfortunately , stay RHEL 8.2/8.3 On , By default , You can't see with RHEL7.9 The same thing , Need to be manually added , newly build /etc/dracut.conf.d/virtio.conf, Add the following :
add_drivers+="virtio_scsi virtio_blk virtio_net virtio_console"
Then execute the following command :
# dracut -f
The above command will create a new initramfs( Don't be intimidated by the steps of compiling the kernel on the official website , It's not that scary )
6) install cloud-init
ad locum , I have some different opinions from the official documents , Of course, this only represents my personal point of view , If you use the source package or the so-called green software method to install , I think there are at least two problems :
- According to red hat SLA, Red hat does not support any package installed with source code , So any follow-up involves cloud-init Security or configuration problems , Even if you have a regular subscription , You won't get any support , So any recommended source code package is RHEL None of the installation methods are in line with red hat's best practices , The author has worked abroad for several years , Well aware of the importance of security and technical support to large enterprises , A small bag is very likely to cause great problems , Therefore, you should be cautious about the package you install .
- Install according to the source code or green installation method , No matter in RHEL7.9 still 8.2/8.3 There will be some problems in , Red hat has many bags , It's through backport Methods to support , In order to pursue the overall system stability , Will not easily upgrade the version of the library ( If you have RHEL Upper docker, You probably know what I'm talking about ), So the installation will not be too smooth , Even if you barely install , When something goes wrong , It's going to be a lot of trouble .
So here , My point is to use RHEL Standard warehouse comes with cloud-init, Rather than some source code approach , As for the specific installation method, it is very simple , Use a subscription , Register with red hat CDN, Use it directly yum install -y cloud-init Install the latest cloud-init, After installation , Create the following users
# useradd syslog
Then you can use the cloud.cfg To replace the original file , And run the command , Activate boot up :
#systemctl enable cloud-init-local.service
#systemctl enable cloud-init.service
#systemctl enable cloud-config.service
#systemctl enable cloud-final.service
7) Change the network port to eth0
Step 1: open /etc/default/grub, stay GRUB_CMDLINE_LINUX Add at end of line :
net.ifnames=0 biosdevname=0
Be careful : Blackstone server 2.0 You may need to change the following configuration :
GRUB_CMDLINE_LINUX=“console=ttyS0,115200 net.ifnames=0 biosdevname=0”
GRUB_TERMINAL="console serial"
GRUB_SERIAL_COMMAND="serial --speed=115200 --unit=0 --word=8 --parity=no --stop=1"
Step 2: recompile grub A launch configuration
# grub2-mkconfig -o /boot/grub2/grub.cfg
Step 3: open /etc/sysconfig/network-scripts/ifcfg-xxx, Revised as follows :
NAME="eth0"
DEVICE="eth0"
preservation , At the same time to modify /etc/sysconfig/network-scripts/ifcfg-xxx To /etc/sysconfig/network-scripts/ifcfg-eth0, Here we are , The system is basically modified , To turn it off .
8) Upload the image to the object store cos
Before uploading , Make sure you have activated cos And create a bucket , Find it directly /var/lib/libvirt/images/xxx.qcow2 The file is then uploaded to the bucket , After uploading , Direct access to URL
9) Import mirror
Cloud server -> Mirror image -> Import mirror
Be careful :
- The image region should be consistent with cos The storage area of is consistent
- The import mode is normal , The system will help you check the image , Unless you really know what you're doing , Then you can choose to force , Manual configuration later
- system platform ,RHEL7 You can choose CentOS 7, RHEL8 choice CentOS 8
Click next , Wait a moment , You will be prompted whether the import was successful , If the import fails , You can see here , Contrast
https://cloud.tencent.com/document/product/213/4945
10) Create instance validation , After import , You can directly create an instance to verify
summary : As a whole , It is easy to import images to Tencent cloud using a custom image , There are many implementation methods , This article only provides some basic steps , For everyone to be bored , Import RHEL Mirror to Tencent cloud platform to try .
边栏推荐
- A full set of tutorials for interviewers from Android manufacturers teach you: prepare for the interview and get the offer smoothly!
- Flink Kubernetes Application部署
- Jenkins的便捷式安装
- Decomposition of Uber dependency injection into dig source code analysis
- Chaos mesh in Tencent -- Tencent mutual entertainment chaotic engineering practice
- Network engineers must know the network essence knowledge!
- MySQL binlog
- practice
- Security Analysis on mining trend of dogecoin, a public cloud
- 设备通过国标GB28181接入EasyCVR平台,出现断流情况该如何解决?
猜你喜欢

【我的OpenGL学习进阶之旅】OpenGL的坐标系的学习笔记

How to generate assembly code using clang in Intel syntax- How to generate assembly code with clang in Intel syntax?

Still worried about missing measurements? Let's use Jacobo to calculate the code coverage

实现领域驱动设计 - 使用ABP框架 - 领域逻辑 & 应用逻辑

如何扩展aws主机上的磁盘空间

Vim编辑器的最常用的用法

Linux record -4.22 MySQL 5.37 installation (supplementary)

CAP:多重注意力机制,有趣的细粒度分类方案 | AAAI 2021
![Software test [high frequency] interview questions sorted out by staying up late (latest in 2022)](/img/33/2c2256fd98b908ddaf5573f644ad7f.png)
Software test [high frequency] interview questions sorted out by staying up late (latest in 2022)

Solution to the problem that FreeRTOS does not execute new tasks
随机推荐
熬夜整理出的软件测试【高频】面试题大全(2022最新)
Parameterized tests guide in junit5
Jenkins的便捷式安装
Sequential representation and implementation of linear table (refer to YanWeiMin version)
高速公路服务区智能一体机解决方案
Database tools in intelij can connect but cannot display schema, tables
Phpcms upgrade editor method -- simple and effective
asciinema 搭配 asciicast2gif 实现高效的命令行终端录制能力
Improving the classification of motor imagery by combining EEG and MEG signals in BCI
如何轻松实现在线K歌房,与王心凌合唱《山海》
PHP export data as excel table
Linux record -4.22 MySQL 5.37 installation (supplementary)
10 hands-free idea plug-ins. These codes do not need to be written (the second bullet)
Logstash introduction and simple case
Design of vga/lcd display controller system based on FPGA (Part 2)
一文详解JackSon配置信息
Firefox browser uses plug-ins to set up proxy
Industry cases of successful digital transformation
Tencent cloud native intelligent data Lake Conference will be held, revealing the panoramic matrix of Tencent cloud data Lake products for the first time
Easy installation of Jenkins