Things to do after CentOS 7 installation

So you installed minimalistic version of CentOS 7 and now you need to get it up and running - configure network and install additional software. This article describes how I confgure CentOS 7 for my development environment.

Enable network interface and set static IP address

If you instaled CentOS 7 in as virtual machine then first set network adapter to Bridged adapter. In this mode CentOS will get its own IP address instead of sharing host's network adapter (NAT).

Check network interfaces

# ip addr

Enable the default network interface

# ifup enp0s3

Install net-tools which includes ifconfig tool

# yum install net-tools

Configure static IP address

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

Configure BOOTPROTO, IPADDR, PREFIX, GATEWAY=192.168.1.254, DNS1 and DNS2 parameters. The file should look similar like this:

TYPE=Ethernet
BOOTPROTO=none
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
IPV6_ADDR_GEN_MODE=stable-privacy
NAME=enp0s3
UUID=2299be7e-722c-4a08-ad74-06eed4fe4619
DEVICE=enp0s3
ONBOOT=yes
IPADDR=192.168.1.107
PREFIX=24
GATEWAY=192.168.1.254
DNS1=212.103.128.66
DNS2=212.103.128.67

Restart network service

# service network restart

Change hostname

To change system hostname modify file:

# vi /etc/hostname

mycentos7.myhomedomain

Logout and login for changes to take effect. Check the hostname with one of the commands:

# echo $HOSTNAME
# hostname

Update the system

Update system with yum command:

# yum update

Install Command Line Web Browser

# yum install links

Install GCC (GNU Compiler Collection)

# yum install gcc

Install vsftpd (ftp server)

# yum install vsftpd

# service vsftpd start

Install Nmap to Monitor Open Ports

# yum install nmap

# nmap 127.0.01

Install wget

# yum install wget

Install tcpdump

# yum install tcpdump

Install Net-SNMP

# yum -y install net-snmp net-snmp-utils

My startup script

I usually create a bash script that customizes some system properties, eg. set paths. The script must be stored in /etc/profile.d directory to be automatically executed at startup. Typically Java path is set in my startup script.

For example see next article.

Install Java - my way

Download and unpack jdk package (6, 7 or 8) to /opt directory (or wherever you like).

# tar zxf jdk-8u111-linux-x64.tar.gz

Create a symbolic link ‘java’ that points to custom jdk directory:

# ln -s /opt/jdk1.8.0_111 /opt/java

Create myStartupScript.sh inside /etc/profile.d directory:

# vi /etc/profile.d/myStartupScript.sh


#!/bin/bash

JAVA_HOME=/opt/java
export JAVA_HOME

PATH=$PATH:$JAVA_HOME/bin
export PATH

Change the script permissions to executable:

# chmod a+x /etc/profile.d/myStartupScript.sh

JAVA_HOME is now pointing to symbolic link /opt/java, so the JAVA_HOME can easily be changed just by changing the symbolic link (remove and create new):

# rm /opt/java

# ln -s /opt/jdk1.7.0_80 /opt/java

Check which java version is active:

# java -version

Remark: If you install java with yum (openjava) then path might be written in some other files and java -version will return different version as set with script above. But the JAVA_HOME will still point to /opt/java symbolic link.

Install Development tools

# yum groupinstall 'Development Tools'

Install GNOME Desktop

# yum groupinstall 'X Window System'
# yum groupinstall 'GNOME Desktop'

Remark: OpenJava 7 and 8 will be installed. Java -version will display version of installed OpenJava, but JAVA_HOME will still point to /opt/java. This is no problem since the applications (eg. JBOSS server) use java version that is defined in JAVA_HOME).