Why?


Search This Blog

Friday, July 22, 2016

Centos 7 create vm template

Centos 7 create vm template

Using ESXi 6.0

First create a quest image then convert it to template.

I do a fresh min install using DHCP for interface and EFI for BIOS.

After OS is layed down i do the following.

Disable selinux

vi /etc/sysconfig/selinux
    selinux=diabled
   
reboot   

Disable and turn off firewalld
   
systemctl disable firewalld
systemctl stop firewalld

yum -y update

reboot

---begin if you want to use the old eth0 naming convention       
       
vi /etc/default/grub
            Search for the line “GRUB_CMDLINE_LINUX” and append the following: net.ifnames=0 biosdevname=0

you can also turn off the screensaver for your console by adding consoleblank=0

My line is now:

GRUB_CMDLINE_LINUX="crashkernel=auto rd.lvm.lv=centos_nas/swap rd.lvm.lv=centos_nas/root net.ifnames=0 biosdevname=0 consoleblank=0"

grub2-mkconfig -o /boot/grub2/grub.cfg

grub2-mkconfig -o /boot/efi/EFI/centos/grub.cfg   

mv /etc/sysconfig/network-scripts/ifcfg-enp????? /etc/sysconfig/network-scripts/ifcfg-eth0   

vi /etc/sysconfig/network-scripts/ifcfg-eth0
    NAME=eth0
    DEVICE=eth0

---end     if you want to use the old eth0 naming convention

---turn off NetworkManage     

systemctl stop NetworkManager
systemctl disable NetworkManager
systemctl stop NetworkManager-wait-online
systemctl disable NetworkManager-wait-online
systemctl enable network
chkconfig network on
systemctl start network


reboot

do sanity check

systemctl status NetworkManager
systemctl status network

---end turn off NetworkManager

Create text file /root/list with packge list below in it
do not include the --begin list or the --end list lines in the file

--begin list   
bind-utils
traceroute
net-tools
ntp*
gcc
glibc
glibc-common
gd
gd-devel
make
net-snmp
openssl-devel
xinetd
unzip
libtool*
make
patch
perl
bison
flex-devel
gcc-c++
ncurses-devel
flex
libtermcap-devel
autoconf*
automake*
autoconf
libxml2-devel
cmake
sqlite*
wget
ntp*
lm_sensors
ncurses-devel
qt-devel
hmaccalc
zlib-devel
binutils-devel
elfutils-libelf-devel
wget
bc
gzip
uuid*
libuuid-devel
jansson*
libxml2*
sqlite*
openssl*
lsof
NetworkManager-tui
mlocate
yum-utils
kernel-devel
nfs-utils
tcpdump
--end list

yum -y install $(cat list)

yum -y groupinstall "Development Tools"

yum -y update

reboot

---tune 10Gb CNA if needed

service irqbalance stop
service cpuspeed stop
chkconfig irqbalance off
chkconfig cpuspeed off
systemctl disable irqbalance
systemctl disable cpuspeed

vi /etc/sysconfig/network-scripts/ifcfg-eth???
MTU="9000"

vi /etc/sysctl.conf
# -- tuning -- #
# Increase system file descriptor limit
fs.file-max = 65535

# Increase system IP port range to allow for more concurrent connections
net.ipv4.ip_local_port_range = 1024 65000

# -- 10gbe tuning from Intel ixgb driver README -- #

# turn off selective ACK and timestamps
net.ipv4.tcp_sack = 0
net.ipv4.tcp_timestamps = 0

# memory allocation min/pressure/max.
# read buffer, write buffer, and buffer space
net.ipv4.tcp_rmem = 10000000 10000000 10000000
net.ipv4.tcp_wmem = 10000000 10000000 10000000
net.ipv4.tcp_mem = 10000000 10000000 10000000

net.core.rmem_max = 524287
net.core.wmem_max = 524287
net.core.rmem_default = 524287
net.core.wmem_default = 524287
net.core.optmem_max = 524287
net.core.netdev_max_backlog = 300000

reboot and test speed.

on linux client pointing to server with ip 192.168.90.100

# iperf3 -c 192.168.90.100 -p 5201

on linux server with IP 192.168.90.100

iperf3 -s -p 5201 -B 192.168.90.100

---end tune 10Gb CNA if needed


*********After the image is complete

poweroff

Go to vSphere client and right in image and conver to template

You can now right clik on template and create new image from template

After you create new image from template then

vi /etc/hostname
    make sure your hostname is in there. i use name.domain.com

vi /etc/hosts
    make sure your hotname is in there. I both name and name.domain.com
   
vi /etc/resolv.conf
        search yourdomain.com
        nameserver 192.168.10.1 or what ever you use for DNS
       

Edit your /etc/sysconfig/network-scripts/ifcfg-eth0 file
Remove DHCP and set for static

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

No comments:

Post a Comment