Website Setup on Virtual Machine (VM)

Website Setup on Virtual Machine (VM)

Steps to Set up Website on a VM (Virtual Machine)

Prerequisite: You must have the Oracle Virtual Box and centos operating systems should be running.

# Create a Directoy in the VM Folder
mkdir wavecafe

Now get the centos7 VM box from the Vagrant Cloud

Now navigate to the wave cafe folder and enter the following command to create the VM.

#Make sure you are in wavecafe folder
vagrant init geerlingguy/centos7

Now Edit the Vagrantfile using the following command

vim Vagrantfile

(i) you must have the static IP address :

Note: Static IP address should not overlap with your system IP address

(ii) get the dynamic (bridge) IP address

(iii) Increase the Ram of the VM to 1GB at least (optional)

Now Save the VagrantFile and exit the Vim editor

  1. First Disable the insert mode by pressing Esc on Keyboard

  2. Type :wq to save and exit the vim editor

Now it's the time to start the Virtual Machine

vagrant up

Login to VM using ssh command

vagrant ssh

Now go to root directory using sudo command

sudo -i

Install the Following dependencies

httpd and unzip

yum install httpd wget unzip -y

Now start and enable the httpd

systemctl start httpd
systemctl enable httpd

Check the IP Addresses

ip addr show

Now if you copy and paste the IP address into the browser you may see something like this

Server data is always stored in the var directory so navigate to the following directory and create the sample page.

cd /var/www/html

vi index.html

Now Restart the VM

systemctl restart httpd

Now if you check the IP address in the browser

Now we need to Host our HTML Template

Now in the terminal Navigate to the tmp directory

cd /tmp/

Now use the following command to extract the template

wget https://www.tooplate.com/download/2108_dashboard

Now UnZip the template

 unzip 2121_wave_cafe.zip

Navigate to the template directory

cd 2121_wave_cafe

Now Copy all the files to the /var/www/html directory

cp -r * /var/www/html/

Now reload the httpd

systemctl restart httpd

Here we go!

Our Website is Up.

Any suggestion or recommendation will be highly appreciated.

Did you find this article valuable?

Support Know Cloud Community by becoming a sponsor. Any amount is appreciated!