labfile cryptography
labfile cryptography
1. System Requirements
Before starting, ensure your system meets the following requirements:
• Processor: A 64-bit processor with virtualization support (Intel VT-x or
AMD-V enabled in BIOS).
• RAM: Minimum 8 GB (16 GB or more is recommended for running
multiple VMs).
• Disk Space: Enough free space for the VMs (at least 20 GB per VM is
recommended).
5. Install the OS
1. Follow the on-screen instructions to install the selected OS in the VM.
2. Configure the OS settings (username, password, time zone, etc.).
3. Install additional tools:
o VirtualBox Guest Additions: Enhances VM performance and
enables features like shared folders.
o VMware Tools: Improves VM performance and integration.
int main() {
printf("Hello, World!\n");
return 0;
}
3. Save the file (Ctrl+O, Enter, Ctrl+X in nano).
B. Compile the Program
• Use GCC to compile the code:
gcc hello.c -o hello
This will create an executable file named hello.
int main() {
int a, b, sum;
printf("Enter two numbers: ");
scanf("%d %d", &a, &b);
sum = a + b;
printf("Sum: %d\n", sum);
return 0;
}
2. Compile and run it as described above.
3- Install Google App Engine. Create hello world app and other
simple web applications using python/java.
Step 1: Prerequisites
1. Install Google Cloud SDK:
o Download the Google Cloud SDK from Google Cloud SDK
Downloads.
o Follow the installation instructions for your operating system
(Windows, macOS, or Linux).
2. Set Up a Google Cloud Account:
o Create an account at Google Cloud Platform.
o Create a new project in the Google Cloud Console.
3. Install a Development Environment:
o For Python: Install Python 3.x and a code editor like VS Code or
PyCharm.
o For Java: Install JDK 8+ and an IDE like IntelliJ IDEA or Eclipse.
app = Flask(__name__)
@app.route('/')
def hello():
return "Hello, World!"
3. Create an app.yaml Configuration File:
runtime: python39
entrypoint: gunicorn -b :$PORT main:app
4. Run the Application Locally:
o Install Flask:
pip install flask gunicorn
o Start the local server:
flask run
o Visit http://localhost:5000 to see "Hello, World!"
5. Deploy the Application:
o Run:
gcloud app deploy
o Visit the deployed URL provided by Google Cloud.
B. Using Java
1. Create a Project Directory:
mkdir hello-world-java
cd hello-world-java
2. Write the Application Code:
o Create a HelloWorldServlet.java file:
import java.io.IOException;
import javax.servlet.http.*;
app = Flask(__name__)
@app.route('/')
def home():
return "Hello, GAE with Cloud SDK!"
if __name__ == '__main__':
app.run(host='127.0.0.1', port=8080, debug=True)
• Create an app.yaml file:
runtime: python39
entrypoint: gunicorn -b :$PORT main:app
For Java Web Application:
• Follow the structure outlined earlier with your HelloWorldServlet.java,
web.xml, and appengine-web.xml files in the correct directories.
import java.util.List;
@Override
protected void defaultVmMapper(List<Cloudlet> cloudletList) {
for (Cloudlet cloudlet : cloudletList) {
cloudlet.setVm(getVmList().get(vmIndex));
vmIndex = (vmIndex + 1) % getVmList().size(); // Round-
robin
}
}
}
2. Integrate the Custom Broker into Your Simulation:
o Use the custom broker in your main simulation file:
import
org.cloudbus.cloudsim.allocationpolicies.VmAllocationPolicySimpl
e;
import org.cloudbus.cloudsim.core.CloudSim;
import org.cloudbus.cloudsim.datacenters.DatacenterSimple;
import org.cloudbus.cloudsim.hosts.HostSimple;
import org.cloudbus.cloudsim.resources.Pe;
import
org.cloudbus.cloudsim.utilizationmodels.UtilizationModelDynamic
;
import org.cloudbus.cloudsim.vms.Vm;
import org.cloudbus.cloudsim.cloudlets.Cloudlet;
import java.util.ArrayList;
import java.util.List;
// Create Datacenter
List<Host> hostList = new ArrayList<>();
// Add hosts
hostList.add(new HostSimple(...));
DatacenterSimple datacenter = new
DatacenterSimple(simulation, hostList, new
VmAllocationPolicySimple());
// Create custom broker
RoundRobinBroker broker = new
RoundRobinBroker(simulation);
// Create VMs
List<Vm> vmList = new ArrayList<>();
vmList.add(new Vm(...));
broker.submitVmList(vmList);
// Create cloudlets
List<Cloudlet> cloudletList = new ArrayList<>();
cloudletList.add(new Cloudlet(...));
broker.submitCloudletList(cloudletList);
// Start simulation
simulation.start();
// Print results
broker.getCloudletFinishedList().forEach(System.out::println);
}
}
Step 7: Cleanup
• Terminate instances and release resources when done to avoid
exceeding your quotas.
8-Install Hadoop single node cluster and run simple
applications like wordcount.
Installing a Hadoop single-node cluster and running a simple application
like WordCount involves several steps. Below is the detailed procedure:
Expected Output
For the sample text Hello Hadoop Hello World, the output might look
like:
Hadoop 1
Hello 2
World 1