Thursday 19 February 2015

Things to do after installation of CentOS-7

---------------------------------------------
Things to do after installation of CentOS-7
---------------------------------------------





-------------------------------------------
1) Install Following Required Commands
-------------------------------------------


yum install net-tools # -----> Install ifconfig Command
yum install wget # -----> Install wget Command
yum install lsof # -----> Install lsof Command
yum install mlocate # -----> Install updatedb Command
yum install bind-utils # -----> Install nslookup Command
yum group install "Development Tools" # -----> Install GCC and Development Tools

yum install mailx # -----> Install mail Command


Command to list groups on a CentOS 7
# yum group list



-------------------------------------------
2) Set Hostname
-------------------------------------------
echo 192.168.1.111 test.deva.com deva >> /etc/hosts
echo test.deva.com > /etc/hostname




-------------------------------------------
3) Set Bashrc Setting
-------------------------------------------

[root@localhost ~]#vi /etc/bashrc

#-------------------------------------------
#Custome CHANGES START
#-------------------------------------------
alias c='clear'
alias df='df -Th'
export HISTSIZE=10000
export HISTTIMEFORMAT="%h %d %H:%M:%S "
export HISTFILESIZE=10000…

#-------------------------------------------
#Custome CHANGES END
#-------------------------------------------

To apply bashrc changes , lgout from server & login again OR
run follwoing command

[root@localhost ~]#. /etc/bashrc




-------------------------------------------
4) Update Kernel
-------------------------------------------
[root@localhost ~]# yum update kernel




---------------------------------------------
5)Enable iptables (instead of firewalld)
---------------------------------------------

### Stop firewalld ### 
#systemctl disable firewalld.service
#systemctl stop firewalld.service


### Install IPtables ### 
# yum install iptables-services

Re-run the command to restart the iptables:
# service iptables restart

#systemctl enable iptables.service
#systemctl start iptables.service

#systemctl enable ip6tables.service
#systemctl start ip6tables.service




-------------------------------------------
6) Change NIC Name
-------------------------------------------
Change the default network interface name to “eth0′′
CentOS7 has a default nic name as “en016.....”,



# vi /etc/default/grub
Search for the line “GRUB_CMDLINE_LINUX” and append the following: “net.ifnames=0 biosdevname=0′′


        GRUB_TIMEOUT=5
GRUB_DISTRIBUTOR="$(sed 's, release .*$,,g' /etc/system-release)"
GRUB_DEFAULT=saved
GRUB_DISABLE_SUBMENU=true
GRUB_TERMINAL_OUTPUT="console"
GRUB_CMDLINE_LINUX="vconsole.font=latarcyrheb-sun16 vconsole.keymap=us rd.lvm.lv=centos/root crashkernel=auto rhgb quiet"
GRUB_DISABLE_RECOVERY="true"


Then it Will look like this:

GRUB_TIMEOUT=5
GRUB_DISTRIBUTOR="$(sed 's, release .*$,,g' /etc/system-release)"
GRUB_DEFAULT=saved
GRUB_DISABLE_SUBMENU=true
GRUB_TERMINAL_OUTPUT="console"
GRUB_CMDLINE_LINUX="vconsole.font=latarcyrheb-sun16 vconsole.keymap=us rd.lvm.lv=centos/root crashkernel=auto rhgb quiet net.ifnames=0 biosdevname=0"
GRUB_DISABLE_RECOVERY="true"



We had just added net.ifnames=0 biosdevname=0 in second last line.



Create a new configuration based on the currently running system using grub2-mkconfig command:
        # grub2-mkconfig -o /boot/grub2/grub.cfg


Rename the interface files by renaming the file 

        # mv /etc/sysconfig/network-scripts/ifcfg-eno16777736 /etc/sysconfig/network-scripts/ifcfg-eth0


Reboot the system:
        # reboot



After reboot, check the interface name:

# ifconfig
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.1.100 netmask 255.255.255.0 broadcast 192.168.58.255
inet6 fe80::20c:29ff:fe6e:b0ae prefixlen 64 scopeid 0x20<link>
ether 00:0c:29:6e:b0:ae txqueuelen 1000 (Ethernet)
RX packets 25336 bytes 2829386 (2.6 MiB)
RX errors 0 dropped 11 overruns 0 frame 0
TX packets 172 bytes 35789 (34.9 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0




-------------------------------------------
6) Configure the static ip on the server
-------------------------------------------

Edit the interface file under /etc/sysconfig/network-scripts/ directory:


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

Here is my ifcfg-eth0 file as a sample, please change it according to your requirement:

     DEVICE="eth0"
ONBOOT=yes
BOOTPROTO=static
IPADDR=192.168.1.100
NETMASK=255.255.255.0
GATEWAY=192.168.1.1
DNS1=192.168.1.1


Stop and disable the NetworkManager service, because we don’t need it on the server:
# systemctl stop NetworkManager
# systemctl disable NetworkManager

Restart the network service(Be careful, if you are connecting remotely, because you will be disconnected after issue this command):
# service network restart






-------------------------------------------
7) Disable IPv6:(If U dont have use of IPV6)
-------------------------------------------
First check that IPv6 is enabled or not:

[root@localhost ~]# lsmod | grep -i ipv6

nf_conntrack_ipv6      18738  5 
nf_defrag_ipv6         34651  1 nf_conntrack_ipv6
nf_nat_ipv6            13279  1 ip6table_nat
nf_nat                 21798  4 nf_nat_ipv4,nf_nat_ipv6,ip6table_nat,iptable_nat
nf_conntrack          101024  8 nf_nat,nf_nat_ipv4,nf_nat_ipv6,xt_conntrack,ip6table_nat,iptable_nat,nf_conntrack_ipv4,nf_conntrack_ipv6





Edit the grub file:
# vi /etc/default/grub

Search for the line “GRUB_CMDLINE_LINUX” and add the following at the beginning: “ipv6.disable=1′′ Will look like this:


GRUB_TIMEOUT=5
GRUB_DISTRIBUTOR="$(sed 's, release .*$,,g' /etc/system-release)"
GRUB_DEFAULT=saved
GRUB_DISABLE_SUBMENU=true
GRUB_TERMINAL_OUTPUT="console"
GRUB_CMDLINE_LINUX="vconsole.font=latarcyrheb-sun16 vconsole.keymap=us rd.lvm.lv=centos/root crashkernel=auto  rhgb quiet"
GRUB_DISABLE_RECOVERY="true"



GRUB_TIMEOUT=5
GRUB_DISTRIBUTOR="$(sed 's, release .*$,,g' /etc/system-release)"
GRUB_DEFAULT=saved
GRUB_DISABLE_SUBMENU=true
GRUB_TERMINAL_OUTPUT="console"
GRUB_CMDLINE_LINUX="ipv6.disable=1 vconsole.font=latarcyrheb-sun16 vconsole.keymap=us rd.lvm.lv=centos/root crashkernel=auto  rhgb quiet"
GRUB_DISABLE_RECOVERY="true"




Create a new configuration based on the currently running system using grub2-mkconfig command:
# grub2-mkconfig -o /boot/grub2/grub.cfg


Reboot the system:
# reboot

Once again, check the IPv6 on the system:
lsmod | grep -i ipv6





                    -------------------
                      End Of Document
                    -------------------

No comments:

Post a Comment