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.
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:
Restart network service
# service network restart
To change system hostname modify file:
# vi /etc/hostname
Logout and login for changes to take effect. Check the hostname with one of the commands:
# echo $HOSTNAME
Update system with yum command:
# yum update
# yum install links
# yum install gcc
# yum install vsftpd
# service vsftpd start
# yum install nmap
# nmap 127.0.01
# yum install wget
# yum install tcpdump
# yum -y install net-snmp net-snmp-utils
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.
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
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.
# yum groupinstall 'Development Tools'
# 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).