Just setup a new instance in AWS – a redhat installation. I ran the standard installation and connected via SSH then.
When I first get on a system, there are some things I should check out. A good start are things like: What system am I on? As I know, I installed some redhat, I will determine the exact version. Every distribution has it’s own way to store these information, so you might want to google for others, than redhat:
[firstname.lastname@example.org ~]# cat /etc/redhat-release Red Hat Enterprise Linux Server release 7.2 (Maipo)
More important might be the kernel version. This is something you should be able to run on most distributions the same way:
[email@example.com ~]# uname -srv Linux 3.10.0-327.el7.x86_64 #1 SMP Thu Oct 29 17:29:29 EDT 2015
So, these are some basic information you can work with.
Especially, if you work with multiple machines, it makes sense to give them hostnames, you can easily identify. Also i don’t like to work on a system, which has some insane combination of digits as a name. Technically seen it does not matter at all, but for overview and documentation reasons (yeah, I recommend documenting your own stuff), setting a meaningful (for you) hostname makes sense.
Step one should be deterimining the hostname:
[firstname.lastname@example.org ~]# hostname -s ip-xxx.xxx.xxx.xxx [email@example.com ~]# hostname -f ip-xxx.xxx.xxx.xxx.eu-central-1.compute.internal
Option s gives you the short hostname, option f the full qualified domain name (aka FQDN).
You may change the hostname with the hostname command too. This instantly changes the name without any service restart, etc.
Note that changing the hostname this way will most likely be not permanent (a lot of distributions use a file to set the hostname) and it will flushes the FQDN in this case. The FQDN should be provided by a DNS service – if you want a nice FQDN, without setting up a DNS for your system, you may configure it within your hosts file. For sure this will then only apply to your system. No other system will know the IP for this FQDN. The better way to change the hostname of a current linux system is this:
[root@annuminas ~]# vi /etc/sysconfig/network NETWORKING=yes NOZEROCONF=yes HOSTNAME="annuminas"
So add or change the line containing “HOSTNAME”. As the editor “vi” is installed on every linux i ever worked with, it is good to know how to use this very basic editor. There are several others out there, which are also quite better, faster and easier, but you might have to install them first.
For editing a file with vi, use the above command first. To instert things, just press “i”. The bottom line will change from
~ ~ "/etc/sysconfig/network" 2L, 220C
~ ~ -- INSERT --
Now you are able to change stuff. Navigate with the arrows and create a new line with hitting “enter”. Add what to add and then press “escape” which brings you back to the “menu” of vi. Write “:wq!” and hit enter again. This will save the changes (w for write), quit (q) and force it, if you override an existing file.
As this does not instantly change the hostname, you’ll have to restart the network:
[root@annuminas ~]# /etc/init.d/network restart Restarting network (via systemctl): [ OK ]
In both cases, you will have to log out and back in to see the change in the command line.
Next I would check the time:
[root@annuminas ~]# date Fri Mar 18 08:25:00 EDT 2016
In my case the timezone is incorrect, so I’ll need to change that.
First I’ll check out, which timezones are available. As I am located in Innsbruck, we usually refer to Vienna in timezones.
[root@annuminas ~]# timedatectl list-timezones |grep Vienna Europe/Vienna
Timedatectl works for redhat 7 (a reason, why I determined first, which version is running). As with everything in Linux, there are hundred ways to do things and google is full of it.
[root@annuminas ~]# timedatectl set-timezone Europe/Vienna [root@annuminas ~]# date Fri Mar 18 16:33:23 CET 2016