This guide will walk you through the steps for setting up a firewall using iptables in Ubuntu 16.04. We’ll show you some common commands for manipulating the firewall, and teach you how to create your own rules.
Sometimes you might forget to renew the domain names before they expire. Unfortunately, this can be a time where a domain brokers purchases you domain name. These are agencies who take popular sites and purchase with the intent of holding the domain until their inflated price is met. As unfortunate as this may be, sometimes it is best to purchase a new domain name for cost efficiency.
Benefits to using a Fully Qualified Domain Name for your Hostname
It is good practice to use your FQDN “Fully Qualified Domain Name” as your hostname. Following this practice creates more options for securing your hostname with an SSL. This will allow services like email to function using a secured connection. Using a hostname with a registered domain will allow you to add a corresponding DNS entry. This will prevent unpredictable behavior by some services that use the hostname. This would allow you to set up a reverse lookup DNS entry. It can be very important especially with services like email verfication. For example, when an email is sent the receiving server runs a reverse lookup on the sender’s hostname. The reverse lookup allows receivers server to ensure the hostname resolves to the matching IP address. This is just one preventive measure servers now use to reduce email spoofing incidents.
By using a unique domain name, you can reduce editing time. You may have a script that calls to the servers IP, instead of the hostname, to correctly function. Best practice is to use the hostname because future migrations may change IP addresses/ranges. Using the hostname can save you a lot of time in the long run, depending on your infrastructure and coding.
Using SSH for Windows 10, 7/8, and Mac OS X
We’ll need to connect to your server. For this article, we will be using SSH “Secure Shell” to access the server and issues commands. SSH is a powerful tool that will allow us to establish a secure connection with your server, diagnose, and issue remote commands. For more information on the SSH protocol, you can visit the following links.
There are a few ways to use SSH depending on your operating system. We’ve have included some examples below followed by links with more information.
Unfortunately, for older versions of Windows, it is not exactly possible to set up an SSH natively to connect to your server. Thankfully, applications were created to assist. We like to use MobaXterm, but Putty is a safe choice as well. Both of these applications are free to use and simple to set up. We’ve included links below with more information on these applications.
Mac OS X
Newer Mac operating systems come with an excellent utility to access SSH called Terminal. To access Terminal navigate to your Applications folder >> Utilities folder >> Terminal.
In case Terminal is inefficient for your preference, there are other options available in the App store or through a quick search on Google . Putty is also available on Mac!
Changing the Hostname in Ubuntu 16.04
At this point, you should be able to access your server using SSH. Once you have accessed your server, you will want to either switch to the root user or run these commands using sudo. The files you will be accessing are owned by root. Because of this, you will need root privileges.
To start things off, we will want to edit /etc/hostname and the /etc/hosts files. You can do so by using a text editor of your choice. We will demonstrate how to accomplish this task using the text editor called VIM. Some of these command line text editors can seem complicated, we will include the “sed” command to make things even easier.
Switching to root user:
# su – root
Editing the hostname and hosts file:
# vim /etc/hostname
# vim /etc/hosts
Once you have opened these files, you will need to change your hostname as follows:
- Press the i key to insert. This will allow you to edit. You will notice the editor says “Insert” at the bottom of the page.
- Use the arrow keys to navigate the cursor to your old hostname.
- Backspace to delete single characters
- Replace with the new hostname. Be sure the syntax is correct.
- When done editing hit the ESC key to exit insert mode.
- Then hold shift andpress the : key
- Finally, type wq and press enter key. This will write to the file and quit the editor
- Repeat for /etc/hostname
As we mentioned earlier, the command line text editors can appear to be overly complicated, especially when you’re used to programs like Word and the Window’s text editor. Because of this, we have included the command below.
# sed -i 's/host.example.com/host.newhostname.com/g' /etc/hosts
# sed -i 's/host.example.com/host.newhostname.com/g' /etc/hostname
After editing these files, you’ll need to reboot the server. If you wish to reboot at a later time but still want your new hostname to take immediate effect click on this sentence to skip ahead. Otherwise, you can do so by running
Your SSH session should be terminated. Depending on your server it can take a few minutes to boot back up. Once the server is back online you can check your changes by running the following command:
If all went well, the terminal should output your new hostname.
If you wish to reboot at a later time but still want your new hostname to take immediate effect, you can use the hostname command to temporarily set the hostname until the next reboot. From there, the changes in /etc/hosts and /etc/hostname will take permanent effect.
# hostname host.newhostname.com
There is also an alternative available. The hostnamectl command is default for both Desktop and Server versions. They combine setting the hostname via the hostname command, editing /etc/hostname and setting the static hostname. Unfortunately, editing /etc/hosts still has to be done separately.
# hostnamectl set-hostname host.newhostname.com
Common Issue after Hostname Update
The “Failed to start hostname.service: Unit hostname.service is masked” error can happen when there is a syntax error within the /etc/hostname, or /etc/hosts file, or when the hostname does not match between these two files. Be sure to check both of these files for mistakes and correct them as needed. In newer versions of Ubuntu, you will also want to use the hostnamectl command mentioned earlier.
# hostnamectl set-hostname host.newhostname.com
Once corrected, be sure to start the hostname service to see if the issue has been corrected. You can do so by running the command that we have included below. Afterward, we would recommend rebooting your server. This is not always necessary, but in some cases, it is required.
# systemctl restart hostname
Similar to Dropbox and Google Drive, Nextcloud is self-hosting software that allows you to share files, contacts, and calendars. But, unlike Dropbox and Google Drive, your files will be private and stored on your server instead of a third party server. Nextcloud is HIPAA and GDPR compliant, so your files will be encrypted along with the ability to audit. For this tutorial, we’ll be installing our Nextcloud instance on our Ubuntu 18.04 LTS server. Continue reading “How to Install Nextcloud 15 on Ubuntu 18.04”
Working with a database can be intimidating at times, but phpMyAdmin can simplify tasks by providing a control panel to view or edit your MySQL or MariaDB database. In this quick tutorial, we’ll show you how to install phpMyAdmin on an Ubuntu 18.04 server. Continue reading “How to Install phpMyAdmin on Ubuntu 18.04”
Sites with SSL are needed more and more every day. It’s ubiquitious enforcement challenges website encryption and is even an effort that Google has taken up. Certbot and Let’s Encrypt are popular solutions for big and small businesses alike because of the ease of implementation. Certbot is a software client that can be downloaded on a server, like our Ubuntu 18.04, to install and auto-renew SSLs. It obtains these SSLs by working with the well known SSL provider called Let’s Encrypt. In this tutorial, we’ll be showing you a swift way of getting HTTPS enabled on your site. Let’s get started! Continue reading “How to Setup Let’s Encrypt on Ubuntu 18.04”
MariaDB is a drop in replacement for MySQL, and its popularity makes for several other applications to work in conjunction with it. If you’re interested in a MariaDB server without the maintenance, then check out our high-availability platform. Otherwise, we’ll be installing MariaDB 10 onto our Liquid Web Ubuntu server, let’s get started! Continue reading “How to Install MariaDB on Ubuntu 18.04”
Apache is the most popular web server software in use today. Its popularity is earned through its stability, speed, and security. Most likely if you are building out a website or any public facing app, you’ll be using Apache to display it. At the time of this writing, the most current offering of Apache is 2.4.39, and it is the version we will be using to install on our Ubuntu 18.04 LTS server. Let’s get started! Continue reading “How to Install Apache 2 on Ubuntu 18.04”
After spinning up a new Ubuntu server you may find yourself looking for a guide of what to do next. Many times the default setting do not provide the top security that your server should have. Throughout this article, we provide you security tips and pose questions to help determine the best kind of setup for your environment.
Apache Tomcat is an accessible, open-source application server used to house many of today applications. It’s free, stable, lightweight and is utilized to render Java coding as well a range of other applications.
Today we will be focusing on how to install Apache Tomcat 9 on our Liquid Web Ubuntu server, specifically Ubuntu 18.04 LTS. Continue reading “How to Install Apache Tomcat 9 on Ubuntu 18.04”
When choosing a server operating system, there are a number of factors and choices that must be decided. An often talked about and referenced OS, Ubuntu, is a popular choice and offers great functionality with a vibrant and helpful community. However; if you’re unfamiliar with Ubuntu and have not worked with either the server or desktop versions, you may encounter differences in common tasks and functionality from previous operating systems you’ve worked with. I’ve been a system administrator and running my own servers for a number of years, almost all of which were Ubuntu, here are the top four lessons I’ve learned while running Ubuntu on my server.