Whether ali Cloud or Tencent cloud, the first thing after we buy a new server is to do some regular configuration.

Switching the domestic mirror source

I have covered this in the previous article, see Ubuntu switching to domestic image source

Initialize the software source

This is to automatically fix some bugs, as well as update software source information to avoid odd problems when deploying the service.

sudo apt update \
    && sudo apt dist-upgrade \
    && sudo apt autoremove \
    && sudo apt clean
Copy the code

Modifying hosts Information

192.168.0.1 your_hostname cat /etc/hosts # change the hostname to 192.168.0.1 your_hostname Easy to identify your_hostname reboot # Changing hostname takes effect after a restartCopy the code

Mount data disks

Ali Cloud data disk is not mounted by default, we need to manually operate

The following example demonstrates mounting a 1000Gib data disk to the /data directory

# mount data set, such as ali cloud data plate https://help.aliyun.com/document_detail/25446.html sudo fdisk - l # view instance data on the Disk Disk/dev/VDB: 1000 GiB, 1073741824000 bytes, 2097152000 sectors sudo fdisk -u /dev/vdb Command (m for help): n ... Command (m for help): W # # https://help.aliyun.com/document_detail/108501.html more reference sudo fdisk - lu/dev/VDB Device Boot Sectors Start End Size Id Type /dev/vdb1 2048 2097151999 2097149952 1000G 83 Linux sudo mkfs.ext4 /dev/vdb1 # Create a file system on the new partition cp /etc/fstab Bak # Backs up etc/fstab echo /dev/vdb1 /data ext4 defaults 0 0 >> /etc/fstab # writes new partition information to /etc/fstab sudo mkdir /data sudo mount /dev/vdb1 /data # Mount file system df -h /dev/vdb1 985G 72M 935G 1% /dataCopy the code

If this blog has been helpful to you, please remember to leave a comment + like + bookmark.

I am Chen, on the road of technology we forge ahead together!