this is obsolete doc -- see http://doc.nethence.com/ instead

RHEL6 post-installation 

 

Once RHEL6 Minimal has been installed, 

  ifconfig -a 

  dhclient eth0 

and login remotely. 

 

Eventually disable firewalling, 

  chkconfig --list | grep tables 

  service iptables stop 

  service ip6tables stop 

  chkconfig iptables off 

  chkconfig ip6tables off 

 

Eventually disable SElinux (permissive is enough so you might re-enable it), 

getenforce 

setenforce 0 

vi /etc/sysconfig/selinux 

SELINUX=permissive 

 

Setup network, 

ps aux | grep -i networkmanager (should NOT be running) 

cd /etc/sysconfig/ 

vi network 

NETWORKING=yes 

HOSTNAME=long 

GATEWAY=10.0.0.X 

vi ../hosts 

10.0.0.XX short short.example.local 

10.0.0.XX long long.example.local 

vi ../resolv.conf 

domain example.net 

nameserver x.x.x.x 

nameserver x.x.x.x 

nameserver x.x.x.x 

cp ../resolfv.conf ../resolv.conf.bkp 

cd network-scripts/ 

cp ifcfg-eth0 DIST.ifcfg-eth0 

vi ifcfg-eth0 

DEVICE=eth0 

BOOTPROTO=static 

IPADDR=10.0.0.X 

NETMASK=255.255.252.0 

ONBOOT=yes 

Note. using short form as HOSTNAME and using domain in resolv.conf. 

 

Eventually add you SSH key, 

cd /root/ 

grep PermitRoot /etc/ssh/sshd_config 

mkdir -p .ssh/ 

cd .ssh/ 

vi authorized_keys 

(paste your public key) 

you should now be able to relogin without a password. 

 

Configure a repository e.g. (or use the default one pointing to the internet), 

cd /etc/yum.repos.d/ 

mkdir .trash/ 

mv * .trash/ 

cat > centos67.repo <<EOF 

[srvinstall] 

name=srvinstall install server 

baseurl=http://srvinstall/CentOS6.7/ 

enabled=1 

gpgcheck=1 

gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6 

EOF 

yum -y install screen ksh 

and install vmware tools if it's a virtual machine ($ escaped), 

cd /etc/yum.repos.d/ 

cat > vmware_rhel6.repo <<EOF 

[vmware-tools] 

name=VMware Tools for Red Hat Enterprise Linux \$releasever – \$basearch 

baseurl=http://packages.vmware.com/tools/esx/latest/rhel6/\$basearch 

enabled=1 

gpgcheck=1 

gpgkey=http://packages.vmware.com/tools/keys/VMWARE-PACKAGING-GPG-RSA-KEY.pub 

EOF 

yum -y install vmware-tools-esx-nox 

ls -l /etc/init/vmware-tools-services.conf 

reboot 

Ref. Installing VMware tools on Centos 6 via yum: http://www.virtualtothecore.com/en/installing-vmware-tools-on-centos-6-via-yum/ 

 

Install a few more packages, 

yum -y groupinstall Base 

rpm -q mailx man man-pages screen wget lynx lftp ntp vim-enhanced sysstat | grep ^package 

yum -y install \ 

screen \ 

lynx \ 

lftp \ 

mutt \ 

ksh 

Note. sendmail vs mailx on rhel6 

 

Switch to the new network configuration, 

screen 

ifconfig 

service network restart 

ps aux | grep dhclient 

pkill dhclient 

ps aux | grep dhclient 

hostname 

hostname --long 

ping google.com 

you can now connect to the real IP and, 

  screen -ls 

  screen -rd 

 

Configure the root and eventually admin user mail aliases, 

cd /etc/ 

cp aliases aliases.dist 

vi aliases 

root: root@example.net 

newaliases 

date | mail -s rootalias root 

tail /var/log/maillog 

 

Disable listen on port 25, 

cd /etc/postfix/ 

cp master.cf master.cf.dist 

vi master.cf 

#smtp inet n - n - - smtpd 

  service postfix restart 

and check outgoing email still works, 

date | mail -s postfixnolisten root 

tail /var/log/maillog 

 

Enable NTP, 

vi /etc/ntp.conf 

server YOUR_NTP_SERVER 

server ntp.obspm.fr 

chkconfig --list | grep ntp 

service ntpd start 

chkconfig ntpd on 

ntpq -p 

 

Eventually configure gnu screen, 

cd /etc/ 

mv -i screenrc screenrc.dist 

wget http://pbraun.nethence.com/configs/misc/screenrc 

cd ~/ 

wget http://pbraun.nethence.com/configs/misc/.screenrc 

screen 

#^A :source /etc/screenrc 

#^A :source /root/.screenrc 

 

Eventually tune gnu bash, 

cd /etc/ 

cat >> bashrc <<EOF 

 

case "$-" in *i*) 

alias ll='ls -alkF' 

alias rm='rm -i' 

alias cp='cp -i' 

alias mv='mv -i' 

;; 

esac 

EOF 

 

Configure LDAP client if you need to. 

 

At this point you are ready to make a template out of this system, just switch to dhcp, 

cd /etc/sysconfig/network-scripts/ 

vi ifcfg-eth0 

DEVICE=eth0 

BOOTPROTO=dhcp 

#IPADDR=10.0.0.XX 

#NETMASK=255.255.252.0 

ONBOOT=yes 

also remove the persistent hardware network devices, 

  cd /etc/udev/rules.d/ 

  mkdir .trash/ 

  mv 70-persistent-net.rules .trash/ 

Ref. http://www.cyberciti.biz/tips/vmware-linux-lost-eth0-after-cloning-image.html