Getting Started with Linux CVM
Last updated: 2019-07-25 18:53:25PDF
- Step 1: Prepare and Select Model
- Step 2: Create a Linux-based CVM
- Step 3: Log in to Linux CVM
- Step 4: Partition and Format Data Disk
This document describes how to create and configure a Linux-based CVM instance.
Step 1: Prepare and Select Model
Sign up for a Tencent Cloud account
Specify the region and availability zone
How to select region:
- Be close to your users
Choose the region closest to your end users, so as to reduce the network latency and increase the access speed. For example, if most of your users are in North America, then Toronto is a good choice.
- In the same region
CVMs in the same region are interconnected with each other via a private network, but those in different regions cannot communicate with each other via a private network. Users who communicate with each other using multiple CVMs via a private network should choose the same region.
CVMs in the same region can communicate with each other via a private network free of charge.
CVMs in different regions cannot communicate with each other via a private network but only via Internet with a charge.
Select CVM Model
Choose a billing method
Tencent Cloud supports pay-as-you-good billing method. For more information, see Billing Methods.
Step 2: Create a Linux-based CVM
Please follow the steps below to create a Linux-based CVM.
Log in to the Tencent Cloud, select Products -> Cloud Compute & Network -> Cloud Virtual Machine, then click Get Started to enter the CVM purchase page, and click Create to start the purchase.
Select a region and model. Choosing a region close to your users can minimize network latency and improve download speed.
Select an image. Select a Linux operating system that meets your requirement.
Complete storage configuration and set the internet bandwidth. If you do not need to connect to the internet, set the bandwidth value to 0.
Set the security group, account name and login method.
Confirm the settings of the CVM and select quantity.
For more information on how to view internal messages, see the next step.
Step 3: Log in to Linux CVM
This section describes how to log in to the CVM on the console. For more information on other login methods, see Log in to Linux Instance.
Log into the CVM with the admin account.
- Admin account ID: "root" for Linux instances ("ubuntu" for Ubuntu system)
- Password: If you choose "quick configuration", the initial password is randomly assigned by the system. You can check the password in internal message and email
For more information, see Login Password.
Checking CVM information
After a CVM is purchased and launched, we will send you information of this CVM (including the instance name, public IP, private IP, login name, initial login password) via Tencent Cloud Internal Message.
Log in to CVM console, and you can see the public IP, private IP, and other information.
Click Internal Message at the upper right corner.
The new CVM and its information such as login name and password can be found in the Internal Message page, as shown in areas highlighted in yellow.
Log in to the CVM through the console
Click the Log In button in the operation column on the CVM list page to log in to the Linux CVM:
Enter the account ID "root" (or the username you set) and the initial password from the internal message (or the modified password) to log in.
Step 4: Partition and Format Data Disk
- Users who have purchased a data disk need to format it before use, and those who have not purchased a data disk can skip this step.
- Make sure you have completed Step 3 to log in to the CVM.
- Mount data disks larger than 2 TB using GPT method. For more information, see Partitioning and Formatting Data Disk with GPT Partition Table.
Partition the data disk
Log in to your Linux CVM by following the method described in Step 3.
It only supports partitioning the data disk, but not the system disk. Forced partitioning of the system disk may lead to system crash or other serious problems, for which Tencent Cloud shall not be held liable.
Enter the command
fdisk -lto check the data disk information.
In this example, a 54 GB data disk
(/vdb)needs to be mounted.
df -hcommands are used to check the data disk information. However, using the command
df -hdoes not display the information of the data disk if it has not been partitioned and formatted.
Partition the data disk. Perform the operations below by following the instructions on the page:
(1) Enter `fdisk /dev/vdb` (partition the data disk), and press Enter.
n(create a new partition), and press Enter.
p(create an extended partition), and press Enter.
1(use the first primary partition), and press Enter.
(5) Press Enter (use default settings).
(6) Press Enter again (use default settings).
wq(save partition table), and press Enter to start partitioning.
In this example, we only create one partition. Developers can create multiple partitions according to their own needs.
Use the command
fdisk -lto check that the new partition vdb1 has been created.
Format the data disk
Format the new partition
The new partition needs to be formatted. You can use a file system format based on your own needs, such as ext2 or ext3. In this example, ext3 is used.
Use the following command to format the new partition:
Mount the partition
Use the following command to create a mydata directory and mount the partition under this directory:
mkdir /mydata mount /dev/vdb1 /mydata
Use the following command to view the status of mounting:
The information of vdb1 shown in the red box indicates that the mounting is successful and the data disk is displayed.
Configure auto mount upon startup
To allow your CVM to be automatically mounted with the data disk when it is restarted or started up, add the partition information to
Use the following command to add partition information:
echo '/dev/vdb1 /mydata ext3 defaults 0 0' /etc/fstab
Use the following command to make a check:
The information of vdb1 shown in the red box indicates that the partition information has been successfully added.
Now, you have completed the creation and basic configuration of a Linux CVM.