30 Things to Do After Minimal RHEL/CentOS 7 Installation

[‘

n

CentOS is a Industry Standard Linux Distribution which is a derivative of RedHat Enterprise Linux. You may start using the OS as soon as you install it, but to make the most out of your system you need to perform a few updates, install a few packages, configure certain services and application.

n

This article aims at “30 Things to Do After Installing RHEL/CentOS 7”. The post is written keeping in mind you have installed RHEL/CentOS Minimal Install which is preferred in Enterprise and production environment, if not you can follow below guide that will show you minimal installations of both.

n

    n

  1. Installation of CentOS 7 Minimal
  2. n

  3. Installation of RHEL 7 Minimal
  4. n

n

The following are the list of important things, which we’ve covered in this guide based on industry standard requirements. We hoping that, these things will be very helpful in setting up your server.

n

n

n

n

n

n

n

n

n

n

n

n

n

n

n

n

n

n

n

n

n

n

n

n

n

n

n

n

n

n

n

1. Register and Enable Red Hat Subscription

n

After minimal RHEL 7 installation, it’s time to register and enable your system to Red Hat Subscription repositories and perform a full system update. This is valid only if you have a valid RedHat Subscription. You need to register your in order to enable official RedHat System repositories and update the OS from time-to-time.

n

We have already covered a detailed instructions on how to register and active RedHat subscription at the below guide.

n

    n

  1. Register and Enable Red Hat Subscription Repositories in RHEL 7
  2. n

n

Note: This step is only for RedHat Enterprise Linux having a valid subscription. If you are running a CentOS server immediately move to further steps.

n

2. Configure Network with Static IP Address

n

The first thing you need to do is to configure Static IP address, Route and DNS to your CentOS Server. We will be using ip command the replacement of ifconfig command. However, ifconfig command is still available for most of the Linux distributions and can be installed from default repository.

n

# yum install net-tools             [Provides ifconfig utility]rn

n

Install ifconfig in Linux

n

But as I said we will be using ip command to configure static IP address. So, make sure you first check the current IP address.

n

# ip addr showrn

n

Check IP Address i n CentOS

n

Now open and edit file /etc/sysconfig/network-scripts/ifcfg-enp0s3 using your choice of editor. Here, I’m using Vi editor and make sure you must be root user to make changes…

n

# vi /etc/sysconfig/network-scripts/ifcfg-enp0s3rn

n

Now we will be editing four fields in the file. Note the below four fields and leave everything else untouched. Also leave double quotes as it is and enter your data in between.

n

IPADDR = “[Enter your static IP here]” rnGATEWAY = “[Enter your Default Gateway]”rnDNS1 = “[Your Domain Name System 1]”rnDNS2 = “[Your Domain Name System 2]”rn

n

After making the changes ‘ifcfg-enp0s3‘, looks something like the image below. Notice your IP, GATEWAY and DNS will vary, please confirm it with your ISP. Save and Exit.

n

Network Details
Network Details

n

Restart service network and check the IP is correct or not, that was assigned. If everything is ok, Ping to see network status…

n

# service network restartrn

n

Restart Network Service
Restart Network Service

n

After restarting network, make sure to check the IP address and network status…

n

# ip addr showrn# ping -c4 google.comrn

n

Verify IP Address
Verify IP Address

n

Check Network Status
Check Network Status

n

3. Set Hostname of Server

n

The next thing to do is to change the HOSTNAME of the CentOS sever. Check the currently assigned HOSTNAME.

n

# echo $HOSTNAMErn

n

Check System Hostname
Check System Hostname

n

To set new HOSTNAME we need to edit ‘/etc/hostsname‘ and replace old hostname with the desired one.

n

# vi /etc/hostnamern

n

Set Hostname in CentOS
Set System Hostname

n

After setting hostname, make sure to confirm hostname by logout and login again. After login check new hostname.

n

$ echo $HOSTNAMErn

n

Confirm New Hostname
Confirm New Hostname

n

Alternatively you may use command ‘hostname‘ command to view your current hotsname.

n

$ hostnamern

n

4. Update or Upgrade CentOS Minimal Install

n

This will not install any new packages other than updating and installing the latest version of installed packages and security updates. Moreover Update and Upgrade are pretty same except the fact that Upgrade = Update + enable obsoletes processing during updates.

n

# yum update && yum upgradern

n

Update Minimal CentOS Server
Update Minimal CentOS Server

n

Important: You can also run the below command which will not prompt for the packages update and you do not need to type ‘y‘ for accepting the changes.

n

However it is always a good idea to review the changes which is going to take place on the sever specially in production. Hence using the below command may automate the update and upgrade for you but it is not recommended.

n

# yum -y update && yum -y upgradern

n

5. Install Command Line Web Browser

n

In most cases, specially in production environment, we usually install CentOS as command line with no GUI, in this situation we must have a commandline browsing tool to check websites via terminal. For this, we going to install a most famous tool called ‘links‘.

n

# yum install linksrn

n

Install Commandline Browser
Links: Commandline Web Browsing

n

For usage and examples to browse web sites u links tool, read our article Command Line Web Browsing with Links Tool

n

6. Install Apache HTTP Server

n

No matter for what purpose you will be using the server, in most of the cases you need a HTTP server to run websites, multimedia, client side script and many other things.

n

# yum install httpdrn

n

Install Apache on CentOS
Install Apache Server

n

If you would like to change default port (80) of Apache HTTP Server to any other port. You need to edit the configuration file ‘/etc/httpd/conf/httpd.conf‘ and search for the line that starts typically like:

n

LISTEN 80 rn

n

Change port number ‘80‘ to any other port (say 3221), save and exit.

n

Change Apache Port on CentOS
Change Apache Port

n

Add the port you just opened for Apache through the firewall and then reload the firewall.

n

Allow service http through firewall (Permanent).

n

# firewall-cmd --add-service=httprn

n

Allow port 3221 through firewall (Permanent).

n

# firewall-cmd --permanent --add-port=3221/tcprn

n

Reload firewall.

n

# firewall-cmd --reloadrn

n

After making all above things, now it’s time to restart Apache HTTP server, so that the new port number is taken into effect.

n

# systemctl restart httpd.servicern

n

Now add the Apache service to system-wide to start automatically when system boots.

n

# systemctl start httpd.servicern# systemctl enable httpd.servicern

n

Now verify the Apache HTTP Server by using links command line tool as shown in the below screen.

n

# links 127.0.0.1rn

n

Verify Apache Status
Verify Apache Status

n

tt

‘]