3 Ways to Set Up a Linux Server on Alibaba Cloud

By Bin Chen, Alibaba Cloud Tech Share Author

If you are new to Alibaba Cloud, you might wonder, “How can I purchase and set up a server on Alibaba Cloud?” Well, then this article is for you!

In this tutorial, I will be showing you three different ways that you can get a Linux server on Alibaba Cloud. Why Linux? Well, it’s just my favorite operating system (OS). You can also refer these steps to purchase a Windows server as they are almost identical. Below is a table that summarizes the different methods as well as their advantages and disadvantages.

Method 1: Alibaba Cloud Marketplace

Method 2: ECS Starter Package

Method 3: ECS Console

$300 Free Credit

ECS Console

You will then be able to see this screen.

Basic Configurations

Note: Please refer to this page for a list of regions. Not all features are services are available across all regions.

Since we are selecting Linux, let us explore some of the options provided by Alibaba Cloud. ECS supports most traditional Linux distributions: in the deb family, it supports Debian and Ubuntu; in the rpm family, it supports Open Suse and CentOs. However, Fedora and RHEL are not supported at the moment. There is also a so-called container Linux such as CoreOs, which is Gentoo based. Last but not least, there is the Alibaba Cloud developed Aliyun Linux. Each distribution has its own advantages, but I have to explore them in further detail to know more.

The choice of distribution is mostly dependent on lots of factors, such as legacy product environment, commercial support vs community support, application architecture (coreOS is a good chooice if you structure your applications as containers). In our case, it doesn’t really matters and we will choose Ubuntu version 14.04.

Networking

In the Network Billing Method item, select Assign Public IP if you want your instance to connect to the internet. Select your desired bandwidth. If you have high traffic requirements, consider purchasing the ECS Starter Package.

Security Groups are just a way to control connection requests to your server, similar to a firewall. Just go with the default one, which allows access to port 22 (required by SSH protocol) since we need it to connect to the instance. You can always reconfigure this after completing your purchase.

System Configurations

If you’re comfortable with using SSH, then you should definitely try using key pairs. You would need to create a key pair first by clicking on the link on the console.

You can also do this later by choosing Set Later, but why wait?

Give your key a name, say “myaliKey”. The console will create a key pair and automatically download a file “myaliKey.pem” to your local host. Save it for late use. Go back to the instance creating page, click the refresh icon, and find the SSH key in the drop-down list.

Server Name, Description, and Host are a few places you can provide more information to distinguish the instances. It is worth noting that the Host will be the host name after we SSH to the instance. Let’s call it “myalihost” and connect to it later.

There is Item called Advanced (based on instance RAM roles or cloud-init). This is the place you can set the instance bootstrap code, but we won’t be using it for now.

Grouping

Review and Launch

Connecting to ECS

$ chmod 600 myaliKey.pem

If you don’t set the correct permissions, you will receive the following error message.

$ ssh -i myaliKey.pem root@47.91.47.36
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ WARNING: UNPROTECTED PRIVATE KEY FILE! @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

Permissions 0644 for ‘myaliKey.pem’ are too open.

It is required that your private key files are NOT accessible by others.

This private key will be ignored.

bad permissions: ignore key: myaliKey.pem

After setting the right permissions, you are all good to go. Congratulations, you have just created a Linux (Ubuntu) instance on Alibaba Cloud! You are now able to connect to it securely using SSH from your local host. You should be able to see something like this after logging in.

$ ssh -i myaliKey.pem root@47.91.47.36

Welcome to Ubuntu 14.04.5 LTS (GNU/Linux 4.4.0–93-generic x86_64)

* Documentation:  https://help.ubuntu.com/

Welcome to Alibaba Cloud Elastic Compute Service !

root@myalihost:~# ls

Cleanup

All you need to do is to find and click on the Release Settings button. You can find this button by clicking on More.

That’s it! Now, you are free to explore other Alibaba Cloud products.

Relevant Tutorials

If you want to deploy a LEMP stack on Alibaba Cloud, I strongly suggest reading this tutorial by another Tech Share author.

Reference:

https://www.alibabacloud.com/blog/3-ways-to-set-up-a-linux-server-on-alibaba-cloud_572384?spm=a2c41.11365082.0.0

Follow me to keep abreast with the latest technology news, industry insights, and developer trends.