How to initialize the CentOS server

  

Linux users are certainly no stranger to the CentOS server, but how to initialize the CentOS server before using the CentOS server? Since the CentOS server is also subdivided into Alibaba Cloud servers and other servers, some users are concerned about whether their initial settings are different. But don't worry, it's almost the same. Now Xiaobian teaches you how to initialize the CentOS server.

Setting method:

mount the hard drive

1, disk partition

fdisk -l # viewing device, the device name can be seen in general For /dev/xvdb

fdisk /dev/xvdb #Partition the disk

Enter n#Create a new partition

Enter p#Create a primary partition

Enter 1 #Create the first primary partition

Enter w#Save and execute the above command to create the partition

After the above command is executed, use fdisk -l to view it. Similar

Partition of /dev/xvdb1

Indicates that the partition was successful.

2, disk formatting

mkfs.ext4 /dev/xvdb1 #Format the partition

Description: ext4 is the default partition format of CentOS6.x, CentOS5. xPlease use ext3

After the format is completed (depending on the partition size, the time required for formatting is different, please be patient), mount the partition

3. Mount the disk

For example: mount /dev/xvdb1 to the /data directory

mkdir -p /data #create directory

mount /dev/xvdb1 /data #mount

df -h #View Mount Results

vi /etc/fstab #Set boot automount, enter the following code on the last line

/dev/xvdb1 /data ext4 defaults 0 0

:wq! #SaveExit

mount -a # Make partition settings take effect immediately

The above is the method of initializing the CentOS server. It is not clear how to initialize the CentOS server. Just follow the steps above to set it up.

Copyright © Windows knowledge All Rights Reserved