Deploying a cloud-based Linux image doesn't have to be challenging. Here's are step-by-step instructions on how to do it.
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
- 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.
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
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).
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:
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:
- SSH into your Linode
- Add the new user with the command useradd -m USERNAME (Where USERNAME is the name of the user you want to add)
- Give the new user a password with the command passwd USERNAME (Again, where USERNAME is the name of the user you just added)
- 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:
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.
- Cloud is cheaper than VMs and containers for most new applications (TechRepublic)
- Red Hat earnings suggest hybrid cloud is here to stay (TechRepublic)
- Amazon Web Services: The smart person's guide (TechRepublic)
- The real reason Amazon killed off unlimited cloud storage in Drive (TechRepublic)
- The Complete Guide to LPIC 1 Linux Administrator Exam (TechRepublic Academy)
- How to manage vendors in a cloud-first world (ZDNet)