当前位置:网站首页>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 .
边栏推荐
- Why is it easy for enterprises to fail in implementing WMS warehouse management system
- Differential privacy
- CIA security model - use PGP to describe privacy and integrity of network security CIA model
- MySQL development specification
- 安装ImageMagick7.1库以及php的Imagick扩展
- 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
- The cold winter can't stop the determination to enter the big factory. The Android interview has a complete knowledge structure, and everything you need to master in the interview is here!
- Remember: never use UTF-8 in MySQL
- The future of robots -- deep space exploration
- MongoDB入门实战教程:学习总结目录
猜你喜欢

使用阿里云RDS for SQL Server性能洞察优化数据库负载-初识性能洞察
![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)
![clang: warning: argument unused during compilation: ‘-no-pie‘ [-Wunused-command-line-argument]](/img/f0/42f394dbc989d381387c7b953d2a39.jpg)
clang: warning: argument unused during compilation: ‘-no-pie‘ [-Wunused-command-line-argument]

刚刚阿里面软件测试回来,3+1面任职阿里P7,年薪28*15薪

Linux record -4.22 MySQL 5.37 installation (supplementary)

The catch-up of domestic chips has scared Qualcomm, the leader of mobile phone chips in the United States, and made moves to cope with the competition

高速公路服务区智能一体机解决方案

为什么企业实施WMS仓储管理系统很容易失败

设备通过国标GB28181接入EasyCVR平台,出现断流情况该如何解决?

Still worried about missing measurements? Let's use Jacobo to calculate the code coverage
随机推荐
【我的OpenGL学习进阶之旅】OpenGL的坐标系的学习笔记
How to achieve long-term development of voice social source code?
Is it safe to open an account for flush stock on mobile phone!
Recommend several super practical data analysis tools
Junit5中的参数化测试(Parameterized Tests)指南
10 hands-free idea plug-ins. These codes do not need to be written (the second bullet)
How to generate assembly code using clang in Intel syntax- How to generate assembly code with clang in Intel syntax?
VNC Viewer方式的远程连接树莓派
QTreeWidget作为单例模式以dll返回的两个问题
如何轻松实现在线K歌房,与王心凌合唱《山海》
leetcode 139. Word Break 单词拆分(中等)
MySQL 开发规范
Attacked! Cloud development monitoring alarm practice
Use tuples
Poor remote code execution in Alien Swarm
还在担心漏测吗?快来使用jacoco统计下代码覆盖率
Analysis of dompurify
Istio practical tips: Customize Max_ body_ size
FPGA based analog I ² C protocol system design (Part 2)
Network engineers must know the network essence knowledge!