Cloud

How to create a Linode cloud instance of Linux

Deploying a cloud-based Linux image doesn't have to be challenging. Here's are step-by-step instructions on how to do it.

linodehero.jpg
Image: Jack Wallen

You've finally decided it's time to extend your data center into the cloud and make use of Linux. To achieve that, there are quite a number of avenues to success (such as Amazon AWS, Microsoft Azure, Google Cloud). Once you get beyond those massive companies, you'll find a host of more cost-effective solutions that offer similar features. One such company is Linode, who offers high-performance SSD Linux servers, ready to meet your infrastructure needs. Their plans start at $5 USD/month and are used by the likes of:

  • Creative Commons
  • SQLite
  • The Onion
  • Dark Sky
  • WP Engine

Linode offers 24x7 support, backups, Node Balancers, APIs, StackScripts, 40Gbps network connections, shell access, and (in typical IT fashion) a 99.9% guaranteed uptime.

I wanted to walk you through the process of spinning up an instance of Linux on Linode, to show you just how easy it is. This will assume you already have your Linode account and can log in. With that squared away, you're ready to deploy your first Linux image.

Deploying an image

The first thing you need to do (after logging into your account) is click on the Linodes tab and then the Dashboard tab. From there (Figure A), click on Deploy an Image.

Figure A

Figure A

Deploying your first image on Linode.

In the resulting window (Figure B), you must:

  • Select the image to deploy (select from Arch Linux, Debian 8 or 9, Fedora 24 or 25, Gentoo, openSUSE Leap, Slackware, Ubuntu 16.04/16.10/17.04, or CentOS 6 or 7)
  • Select the image size (in MB)
  • Select a swap disk (use existing swap or 128, 256, 512MB)
  • Set a root password

Figure B

Figure B

Configuring your Linode image to be deployed.

Click deploy and your image will begin the process of spinning up (it takes between 2-5 minutes at most). Once the image has been deployed, it will appear on your Linodes | Dashboard tab (Figure C).

Figure C

Figure C

Your new image is ready to use.

Accessing your newly deployed image

As you might expect, there's no way of accessing your image via the web-based interface. Most of these images are server-based and don't include a GUI, so access is limited to secure shell. If you click on the Remote Access tab, you will be given a public-facing IP address you can use. Copy that IP address, open up either your Linux terminal (or your Window's ssh-enabled gui tool) and log in. For those using the Linux terminal, the command to log into your Linode image will be:

ssh -v root@IMAGE_IP

Where IMAGE_IP is the actual IP address of your newly created image.

If you want to make this a bit easier, you can add an entry in your /etc/hosts file (on your local Linux machine). Open that file for editing (using your favorite text editor) and add an entry like:

SERVER_IP	linode

Where SERVER_IP is the actual IP address of your Linode image (found in the Remote access tab in your Linode Dashboard).

Once you've saved that file, you can access your Linode Linux image with the command:

ssh -v root@linode

At this point, you can do whatever you need with your Linode image: Install a LAMP stack, Docker...the sky's the limit. I would suggest creating a new user, adding them to the sudoers group, and then disabling root access to ssh. Here's how:

  1. SSH into your Linode
  2. Add the new user with the command useradd -m USERNAME (Where USERNAME is the name of the user you want to add)
  3. Give the new user a password with the command passwd USERNAME (Again, where USERNAME is the name of the user you just added)
  4. Add the user to the sudo group with the command usermod -aG sudo USERNAME (Where USERNAME is the name of the user you just added)

Before you continue on, it is crucial to make sure you are able to ssh into your server with the newly created user. Once you have verified that is possible, you can disable root login with ssh by opening up the /etc/ssh/sshd_config file (with your favorite text editor) and change the following line from:

PermitRootLogin yes

To

PermitRootLogin no

Save and close the file. Before the change takes effect, you must restart sshd with the command:

sudo systemctl restart sshd

Once the service restarts, anytime anyone attempts to log into that Linode image with the root user, they will see the Permission denied, please try again error and will not be granted access.

Cloud linux made simple

Linode does a great job of making the process of deploying a Linux image incredibly simple. Make sure to check out their feature/pricing matrix to see if they have a plan that'll suit your needs.

Also see

About Jack Wallen

Jack Wallen is an award-winning writer for TechRepublic and Linux.com. He’s an avid promoter of open source and the voice of The Android Expert. For more news about Jack Wallen, visit his website jackwallen.com.

Editor's Picks

Free Newsletters, In your Inbox