Configuring CentOS 7 Virtual Machines on VMware Workstation
Prerequisites and Initial Setup
To begin, ensure you have VMware Workstation installed and a CentOS 7 ISO image available. When creating a new virtual machine, follow the standard wizard prompts. If the installation fails due to an Intel VT-x error, access your computer's BIOS/UEFI setings, locate the Virtualization Technology parameter, and ensure it is enabled.
Network Configuration
By default, VMs use DHCP for IP assignment. To assign a static IP address, modify the network configuration file. Identify your interface name first (e.g., ens33 or eno16777736) and edit the corresponding file in /etc/sysconfig/network-scripts/.
# Edit the interface config file
vi /etc/sysconfig/network-scripts/ifcfg-ens33
Apply the following parameters to ensure a static configuration:
BOOTPROTO=static
ONBOOT=yes
IPADDR=192.168.1.50
PREFIX=24
GATEWAY=192.168.1.1
DNS1=8.8.8.8
DNS2=8.8.4.4
After saving, apply the changes by restarting the network service:
systemctl restart network
Granting Sudo Privileges
To allow a standard user to execute commands with root permissions, modify the sudoers configuration. Log in as root, then invoke the editor:
visudo
Locate the user privilege specification section and add the following line, replacing username with your account name:
username ALL=(ALL) ALL
Hostname Modification
Updating the hostname is essential for network identification and cluster setups. In CentOS 7, utilize the hostnamectl utility:
hostnamectl set-hostname node-01
For the changes to take effect, perform a system rebooot:
reboot
Mapping IP Addresses to Hostnames
To simplify communication between servers, map your IP addresses to specific hostnames by editing the local hosts file:
vi /etc/hosts
Append the entry for you're server:
192.168.1.50 node-01
SSH Remote Access
To enable remote administration using tools like Xshell or OpenSSH client, verify that the SSH daemon is installed and active:
# Check for installed SSH packages
rpm -qa | grep openssh
# Install missing packages if necessary
yum install openssh-server openssh-clients
# Start and enable the service
systemctl start sshd
systemctl enable sshd
Once the service is running, verify the connection from your host machine using the configured IP address.