I posted before about AWS, Azure and OCI but this time i am trying to cover Alibaba , in this post i will show you how to setup your first Compute instance whatever OS you want CentOS or Ubuntu depeds on what you want
What you need ?
- A valid Alibaba Cloud account., create free one with 300$ credit
- An ECS instance running CentOS 7 or whatever OS you want.
- A root password for your server.
Connect to your Alibaba Cloud
Locate the Internet IP address (Public IP address) associated with your Alibaba Cloud ECS Instance.
If you are running Linux or Mac, use a terminal application to connect to the instance via SSH. If you are on Windows, you can use PuTTy.
Change the Hostname
The hostname is a default identifier when you communicate to a Linux server. It is like a computer name that is associated with your home PC or laptop. Naming your CentOS 7 server with a descriptive hostname helps you to differentiate your machines especially if you are running a bunch of them.
check the update
$ sudo yum update
check your hostname
change your hostname, we need to install nano text editor using the command below:
$ sudo yum install nano
Then, edit the /etc/cloud/cloud.cfg file and find the entry preserve_hostname. Change its value from false to true.
$ sudo nano /etc/cloud/cloud.cfg preserve_hostname true
Then, edit the /etc/hostname file using a nano editor by typing the command below:
$ sudo nano /etc/hostname
You will need to add two entries on this file just below the 127.0.0.1 localhost entry. The first entry you are adding uses the loopback interface address 127.0.1.1. Please note that this is different from the address 127.0.0.1 which have a ‘localhost’ value in the same file.
Reboot your Alibaba Cloud ECS instance for the changes to take effect by typing the command below:
$ sudo reboot
Also you can create non root user by
$ sudo adduser
For instance, to add a user identified as osama on your server, use the command below:
$ sudo adduser osama
Next, we assign a password to the user we have created above:
$ sudo passwd osama
now assign the administrative task to this user
$ sudo gpasswd -a osama wheel