This post will walk you through getting your analytics server based on Ubuntu Server OS up and running.
Building the system
You’ve already seen how i chose the components for by build. Now putting them together is quite easy for someone who has built PCs many times before. But for someone who’s doing this for the first time it can be a little intimidating. So to help I’ve linked a video below that uses many of the components in my build and walks through the process. Of course it’s not exactly the same components but it’s close enough to help.
A couple of things to remember when you build:
- Static electricity can affect components. So touch some metal to discharge any current before you touch the components. This is especially important if you’re building on carpet and the humidity in the air is low like in winter.
- All the components are standardized. Which means that RAM modules across all manufacturers will fit on a motherboard. Of course you will have to make sure that your motherboard supports that type of component but once you do, components with the same spec from multiple manufacturers will fit. The reason i say that is these components will fit into the motherboard in only one way. So if a component doesn’t go into the motherboard easily then check if you’ve aligned the components (notches etc) correctly. Don’t try to force them in.
- Air flow across components are vital to keep them cool during operation. Try to keep the cables in your case as tidy as possible. It does help.
Installing Ubuntu Server
Ubuntu comes in multiple flavors. I decided to go with the server edition because I intended for it to be headless a.k.a no monitor or keyboard. I would connect to it using my laptop running Windows 10.
You can use any version of Ubuntu but go for it’s latest LTS (Long Term Support) edition. These LTS editions are supported for 5 years from launch.
As you can see it’s currently 16.04 but I decided to install 17.10 which is a standard release (Released in Oct 2017, hence 17.10). The reason i did that was kernel support. With the new Ryzen CPUs we will need an updated kernel to manage the CPU otherwise there are chances it would crash. I could have installed 16.04 and updated the kernel but i chose 17.10 which had the updated kernel as part of the base install itself. I also plan to upgrade the LTS version 18.04 a few months after it comes out in April 2018.
I’ve included a few links below to articles that will walk you through the install.
- The official Ubuntu install tutorial: https://tutorials.ubuntu.com/tutorial/tutorial-install-ubuntu-server#0
- Another step by step install guide for Ubuntu server 17.10: https://www.howtoforge.com/tutorial/ubuntu-minimal-server-install/
Once you’re done with your install you should be at a similar screen on your monitor.
At this point you should have your monitor and keyboard connected.
Setting up a static IP address in Ubuntu
So why do you need a static IP address? Usually when you connect your device to your network (wifi or wired) the router assigns an IP address based on what’s available. This means your computer could have different IP addresses on different days. So every time you wanted to connect to it remotely you would have to figure out what the IP address was. To keep this from happening you’ll have to go through and change some settings.
One thing you should do before setting up a static IP is to prevent an IP address conflict. Here’s what could happen: When you check for wifi networks at home and connect to your network, router assigns an IP address to your machine so it knows where to route network (including the internet) traffic. So let’s say your phone connects and gets the IP address 192.168.1.35 and you’ve also configured the static IP address to the same value. That would result in a conflict and you may not be able to connect to your server.
Depending on your router you may have to go to the admin page and find the section that lists the IP address ranges your router uses to assign to connected devices. You’ll see something similar to “Starting IP Address” and “Ending IP Address”. Leave the Ending IP address as is. Assuming your router is accessed at 192.168.1.1, change the IP address to start from 192.168.1.100 instead of 192.168.1.2. Save and reboot the router. This will make sure that any device connecting to your network gets IP addresses from 192.168.1.100 onwards. So you can use IP addresses 192.168.1.2 to 192.168.1.99 for static IP addresses.
Here’s an example for Netgear’s Nighthawk router: https://kb.netgear.com/24089/How-do-I-specify-the-pool-of-IP-addresses-assigned-by-my-Nighthawk-router
Once you’ve changed the starting IP address on your router you can proceed to setting up the static IP. One thing that has changed from Ubuntu 16.04 to 17.10 is the way you set up a static IP address. Follow this link to learn how to set it up. https://websiteforstudents.com/configuring-static-ips-ubuntu-17-10-servers/
Configuring SSH
Setting up ssh is needed for you to login to your headless server from your laptop. Setting it up is straightforward enough. Just type in the following command and you’re all set.
sudo apt install openssh-server
Once this is run the main thing to do is change the default configuration so that you can make it more secure. First type in the following command. This assumes you have the nano editor installed.
sudo nano /etc/ssh/sshd_config
There are a lot of configurations you can change but there are 3 changes i will recommend you do. Add/update the following lines in the file.
- The first is to change the port from the default one that is 22. Let’s say you want to change it to port 12345. Change
#Port 22
to
Port 12345
- Make sure only certain users can ssh into your server. Let’s say your username was myname. Insert the following line
AllowUsers myname
- Prevent root from ssh access
PermitRootLogin no
There are a lot of other settings you can add to harden your ssh security. I found a good list here: https://devops.profitbricks.com/tutorials/secure-the-ssh-server-on-ubuntu/#secure-the-ssh-configuration-file
Finally restart the SSH service by typing in the following
sudo service ssh restart
Configuring a SSH client
By now you’ve set up all the things needed for your Ubuntu server. The final step is to connect to the server using a SSH client. The usual recommended option for a SSH client is Putty. But I’ve found MobaXterm home edition to also work very well for my needs.
You can download them here:
- Putty: https://www.chiark.greenend.org.uk/~sgtatham/putty/
- MobaXterm: https://mobaxterm.mobatek.net/download-home-edition.html
Remember the static IP address and Port you set up earlier? You’ll need those now.
- Type in the IP address
- Enter the port number
- Make sure SSH is selected
- Hit Open
This should connect you to the server and prompt you for your username and password. Before that it may put up a message asking if you want to accept/store the server key. Say yes.
Once you’ve confirmed that you can login then you’re all set. You can disconnect your monitor and keyboard from your server.
Congratulations! You now have a working headless Ubuntu Server!