当前位置:网站首页>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 .
边栏推荐
- 国产芯片的赶超,让美国手机芯片龙头高通害怕了,出招应对竞争
- Tencent cloud native intelligent data Lake Conference will be held, revealing the panoramic matrix of Tencent cloud data Lake products for the first time
- Motion planning of floating base robot
- Use list
- 【我的OpenGL学习进阶之旅】OpenGL的坐标系的学习笔记
- Mongodb introductory practical tutorial: learning summary directory
- This website teaches you to imitate more than 100 well-known websites!
- Jenkins 镜像无法更新插件中心的3种解决方法
- How to use nested tags in thymeleaf3 Tags
- 【Prometheus】6. Prometheus and kubernetes (incomplete)
猜你喜欢

Wi-Fi 7 来啦,它到底有多强?

MongoDB入门实战教程:学习总结目录
![[my advanced OpenGL learning journey] learning notes of OpenGL coordinate system](/img/21/48802245fea2921fd5e4a9a2d9ad18.jpg)
[my advanced OpenGL learning journey] learning notes of OpenGL coordinate system

The equipment is connected to the easycvr platform through the national standard gb28181. How to solve the problem of disconnection?

Jenkins 镜像无法更新插件中心的3种解决方法
![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)

Linux record -4.22 MySQL 5.37 installation (supplementary)

MySQL binlog

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

The penetration of 5g users of operators is far slower than that of 4G. The popularity of 5g still depends on China Radio and television
随机推荐
Junit5中的参数化测试(Parameterized Tests)指南
Working with collections
【Kubernetes】1
Sequential representation and implementation of linear table (refer to YanWeiMin version)
Why is the blackmail virus that shut down half of America's energy system terrible? Interpretation of authoritative reports
MySQL toolset: the official export tool mysqlpump
The equipment is connected to the easycvr platform through the national standard gb28181. How to solve the problem of disconnection?
Linux记录-4.22 MySQL5.37安装(补充)
[my advanced OpenGL learning journey] learning notes of OpenGL coordinate system
Database tools in intelij can connect but cannot display schema, tables
Recommend several super practical data analysis tools
如何轻松实现在线K歌房,与王心凌合唱《山海》
Remember: never use UTF-8 in MySQL
Flink Kubernetes Application部署
The 30 pictures bring the network protocol layer by layer to life. It's really fragrant!
Reference to junit5 test framework in gradle
Wi-Fi 7 来啦,它到底有多强?
"Industry outlook" analysis of five major trends in China's security video surveillance industry
[tke] multiple ingress controllers are used in the cluster
VNC Viewer方式的远程连接树莓派