This post is mainly for my information since my brain is like a sieve when it comes to linux file locations. Basically any Centos file that I need to edit / view more than once will be going in here for reference:
Eth0 Interface File:
/etc/sysconfig/network-scripts/ifcfg-eth0
Network Card Hardware File:
/etc/udev/rules.d/70-persistent-net.rules
iptables File:
/etc/sysconfig/iptables
Showing posts with label Linux. Show all posts
Showing posts with label Linux. Show all posts
Tuesday, 28 May 2013
Saturday, 18 May 2013
Creating a Centos vCenter Template
Since I'm going to start learning puppet I figured I'm going to be building and destroying a lot of linux VM's so I might as well create a template. Following my previous post I create a base template VM with the minimal install of Centos and all the required updates. Once created you need to edit the following file to remove IP and MAC address details:
vi /etc/sysconfig/network-scripts/ifcfg-eth0
Remove the following entries then save and exit:
HWADDR="xx:xx:xx:xx:xx:xx"
IPADDR=xxx.xxx.xxx.xxx
NETMASK=xxx.xxx.xxx.xxx
GATEWAY=xxx.xxx.xxx.xxx
Now edit the following file and remove all entries that have a MAC address then save and exit:
vi /etc/udev/rules.d/70-persistent-net.rules
an example would be to remove the following text:
# PCI device 0x15ad:0x07b0 (vmxnet3)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="xx.xx.xx.xx.xx.xx", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"
Once completed power off the VM and remove and re-add the network adapter from the VM (This ensures that a new MAC address is generated). Finally convert the VM to a template and test. Once you have created a new VM from the template you will need to do the following:
Change the hostname (including domain name i.e. server.domain.local)
Add IP address information including the new MAC address as per this post
vi /etc/sysconfig/network-scripts/ifcfg-eth0
Remove the following entries then save and exit:
HWADDR="xx:xx:xx:xx:xx:xx"
IPADDR=xxx.xxx.xxx.xxx
NETMASK=xxx.xxx.xxx.xxx
GATEWAY=xxx.xxx.xxx.xxx
Now edit the following file and remove all entries that have a MAC address then save and exit:
vi /etc/udev/rules.d/70-persistent-net.rules
an example would be to remove the following text:
# PCI device 0x15ad:0x07b0 (vmxnet3)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="xx.xx.xx.xx.xx.xx", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"
Once completed power off the VM and remove and re-add the network adapter from the VM (This ensures that a new MAC address is generated). Finally convert the VM to a template and test. Once you have created a new VM from the template you will need to do the following:
Change the hostname (including domain name i.e. server.domain.local)
Add IP address information including the new MAC address as per this post
Centos linux minimal install config
I'm planning on attempting to learn Puppet which requires a linux operating system. I'm competent enough to get around linux and perform basic tasks but I'm by no means an expert or even intermediate. My linux distro of choice is the minimal install of Centos. The minimal install is exactly what it says, the minimal install of binaries that are required to get the system up and running. All other binaries will have to be manually installed. This post shows how to set a static IP address and install the VMware tool into a minimal install of Centos. I'm not going to show you how to install Centos as it's a simple next next type of installation.
Once you have the minimal install up log in and use vi to edit the eth0 interface file:
vi /etc/sysconfig/network-scripts/ifcfg-eth0
Enter the required IP information and then save and exit:
BOOTPROTO="static"
IPADDR=xxx.xxx.xxx.xxx
NETMASK=xxx.xxx.xxx.xxx
GATEWAY=xxx.xxx.xxx.xxx
ONBOOT="yes"
To add your internal DNS servers edit the resolv.conf file:
vi /etc/resolv.conf
Enter the required DNS servers then save and exit:
nameserver xxx.xxx.xxx.xxx
Finally restart the network service:
service network restart
You should now be able to ping the server by IP address and also ping form the server via DNS. Remember to add both forward and reverse A host entries into your DNS server. You should also now be able to SSH into the server rather than using the console. Next step is to update the server (Ensure your server has access to the internet):
yum upgrade -y
This may take a while depending on how many updates are required. Once it has finished just perform the same command again to ensure there are no more updates required.
The final step is to install the VMware tools as per VMware's best practice Start by initiating the VMware tools install via the vSphere Web Client / GUI and then perform the following commands:
yum -y install perl
mkdir /mnt/cdrom
mount /dev/cdrom /mnt/cdrom
cp /mnt/cdrom/VMwareTools-*.tar.gz /tmp
umount /mnt/cdrom
End VMware Tools install via the vSphere Web Client / GUI and the continue:
tar -zxf /tmp/VMwareTools-*.tar.gz -C /tmp
cd /
./tmp/vmware-tools-distrib/vmware-install.pl --default
rm -f /tmp/VMwareTools-*.tar.gz
rm -rf /tmp/vmware-tools-distrib
Once finished the VMware tools should be running and current. If you have any issues with the vmware-tools service the commands to start | stop | restart | status are:
status vmware-tools
start vmware-tools
stop vmware-tools
restart vmware-tools
Once you have the minimal install up log in and use vi to edit the eth0 interface file:
vi /etc/sysconfig/network-scripts/ifcfg-eth0
Enter the required IP information and then save and exit:
BOOTPROTO="static"
IPADDR=xxx.xxx.xxx.xxx
NETMASK=xxx.xxx.xxx.xxx
GATEWAY=xxx.xxx.xxx.xxx
ONBOOT="yes"
To add your internal DNS servers edit the resolv.conf file:
vi /etc/resolv.conf
Enter the required DNS servers then save and exit:
nameserver xxx.xxx.xxx.xxx
Finally restart the network service:
service network restart
You should now be able to ping the server by IP address and also ping form the server via DNS. Remember to add both forward and reverse A host entries into your DNS server. You should also now be able to SSH into the server rather than using the console. Next step is to update the server (Ensure your server has access to the internet):
yum upgrade -y
This may take a while depending on how many updates are required. Once it has finished just perform the same command again to ensure there are no more updates required.
The final step is to install the VMware tools as per VMware's best practice Start by initiating the VMware tools install via the vSphere Web Client / GUI and then perform the following commands:
yum -y install perl
mkdir /mnt/cdrom
mount /dev/cdrom /mnt/cdrom
cp /mnt/cdrom/VMwareTools-*.tar.gz /tmp
umount /mnt/cdrom
End VMware Tools install via the vSphere Web Client / GUI and the continue:
tar -zxf /tmp/VMwareTools-*.tar.gz -C /tmp
cd /
./tmp/vmware-tools-distrib/vmware-install.pl --default
rm -f /tmp/VMwareTools-*.tar.gz
rm -rf /tmp/vmware-tools-distrib
Once finished the VMware tools should be running and current. If you have any issues with the vmware-tools service the commands to start | stop | restart | status are:
status vmware-tools
start vmware-tools
stop vmware-tools
restart vmware-tools
Subscribe to:
Posts (Atom)