Programster's Blog

Tutorials focusing on Linux, programming, and open-source

Getting Started With CentOS 7

This tutorial is targeted at Ubuntu users getting started with CentOS 7. There are a few things that really need to be pointed out.

Get an IP

After installing from a mini.iso (because its the easiest method) you need to manually run sudo dhclient in order to get an IP. We will take care of automating this later so you don't have to in future.

Get the IP

Now you have an IP (and thus internet access), the first thing you will probably want to do is find out what that address is so that you can SSH into the box to run the rest of the commands. CentOS doesn't have ifconfig, instead you will need to execute:

sudo ip addr

Update

The next thing you will want to do is update the machine by running:

sudo yum upgrade -y

Install Vim

The next thing we are going to do is install vim because we don't have it by default!? This will allow us to edit configuration files later.

sudo yum install vim -y

Grab IP on Boot

Next, we need to configure our interface to automatically run dhcp to get internet access.

sudo vim /etc/sysconfig/network-scripts/ifcfg-enp0s3

You should see:

TYPE=Ethernet
BOOTPROTO=dhcp
DEFROUTE=yes
PEERDNS=yes
PEERROUTES=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_PEERDNS=yes
IPV6_PEERROUTES=yes
IPV6_FAILURE_FATAL=no
NAME=enp0s3
UUID=6be86097-6e4f-455e-a3c6-02fbcbae3395
DEVICE=enp0s3
ONBOOT=no

Change the last line, ONBOOT=no to ONBOOT=yes

Install EPEL repository

Next, we will install the epel repository. This is because it seems that this is where everything you want is.

sudo yum install epel-release

Install Byobu

Now we've installed the epel repositories, we can install byobu to manage multiple sessions easily.

sudo yum install byobu -y

Optional - Disable Selinux

sudo sed -i 's/enforcing/disabled/g' /etc/selinux/config /etc/selinux/config

You will need to reboot for the change to take effect. Whilst it is impossible to disable selinux without a reboot, you can run setenforce 0 to set it o permissive mode which will just warn you whenever something is "wrong".

Optional - Granting Users Sudo

It may be a good idea to add users with sudo privileges and then disable root login over SSH.

Conclusion

There you have it! You are now up and running in CentOS.

References

Last updated: 16th August 2018
First published: 16th August 2018

This blog is created by Stuart Page

I'm a freelance web developer and technology consultant based in Surrey, UK, with over 10 years experience in web development, DevOps, Linux Administration, and IT solutions.

Need support with your infrastructure or web services?

Get in touch