0% found this document useful (0 votes)
6 views27 pages

CC Record

Uploaded by

panduy.ent
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views27 pages

CC Record

Uploaded by

panduy.ent
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 27

EXPERIMENT-1

Title of Experiment: Install Virtual Box/VMware and Execute a Sample Program


on Linux.

Step 1: VirtualBox Installation

1. Download VirtualBox
o Visit VirtualBox Official Site and download the installer for your OS.
o Install VirtualBox by following the setup wizard.
2. Download Linux ISO
o Choose a lightweight Linux distro like Ubuntu, Debian, or Fedora from their
official websites.
3. Create a Virtual Machine
o Open VirtualBox and click "New".
o Set a name (e.g., Ubuntu VM) and choose Linux as the type.
o Allocate RAM (at least 2GB recommended).
o Create a Virtual Hard Disk (at least 10GB).
o Attach the Linux ISO file and start the VM.
4. Install Linux on VirtualBox
o Follow on-screen instructions to install Linux.

Step 2: VMware Installation

1. Download VMware Workstation Player


o Get it from VMware Official Site.
o Install it and restart your system.
2. Create a Virtual Machine
o Open VMware and select "Create a New Virtual Machine".
o Choose the Linux ISO and allocate system resources.
o Install Linux following the instructions
Steps to Execute a Python Program in Linux VM

1. Start your Linux VM (Virtual Box/VMware).


2. Open the terminal.
3. Create a Python file:

sh
nano hello.py

4. Write the following Python code:

python
CopyEdit
print("Hello, Linux Virtual Machine!")

5. Save the file (Press CTRL + X, then Y, and Enter).


6. Run the Python program:

sh
python3 hello.py

7. Output:

Hello, Linux Virtual Machine!


EXPERIMENT-2

Title of Experiment: Build and Execute a Modular Program using make in Linux.

Step 1: Create the Project Directory

Open the terminal and create a new directory:

sh
mkdir my_python_project && cd my_python_project

Step 2: Create Python Modules

1. Create math_functions.py (Module File)

sh
nano math_functions.py

Code:

python
def add(x, y):
return x + y

def subtract(x, y):


return x - y

2. Create main.py (Main Script)

sh
nano main.py

Code:

python
CopyEdit
from math_functions import add, subtract

a, b = 10, 5
print("Sum:", add(a, b))
print("Difference:", subtract(a, b))
Step 3: Create a Makefile
sh
nano Makefile

Content of Makefile:

make
CopyEdit
PYTHON = python3
TARGET = main.py

run:
$(PYTHON) $(TARGET)
clean:
rm -f *.pyc pycache /*
Step 4: Execute Using make

1. Run the program

sh
make run

Output:

makefile
Sum: 15
Difference: 5

2. Clean cache files

sh
make clean
EXPERIMENT-3

Title of Experiment: Transfer Files between Virtual Machines using Shared


Folders.

In VirtualBox:

1. Enable Shared Folder:


o Go to Settings > Shared Folders > Add Folder
o Choose a folder, enable Auto-mount and Make Permanent
2. Access in Linux VM:
o Open the terminal and run:

sh
ls /media

o If not visible, mount it manually:

sh
sudo mount -t vboxsf shared_folder_name /mnt

In VMware:

1. Enable Shared Folder:


o Go to Settings > Options > Shared Folders
o Select Always Enabled and add a folder
2. Access in Linux VM:
o Open the terminal and run:

sh
ls /mnt/hgfs/

o If not visible, mount it manually:

sh
sudo mount -t fuse.vmhgfs-fuse .host:/ /mnt/hgfs -o allow_other
EXPERIMENT-4

Title of Experiment: Launch and Perform Basic VM Operations using Try Stack (OpenStack
Demo)

Step 1: Access TryStack

1. Go to TryStack: https://trystack.org (May require a Facebook login).


2. Log in and navigate to the OpenStack Dashboard (Horizon UI).

Step 2: Launch a Virtual Machine (VM)

1. Go to Instances > Launch Instance.


2. Enter a name for the VM.
3. Select an image (e.g., Ubuntu, CentOS).
4. Choose a flavor (VM size).
5. Add a key pair for SSH access.
6. Click Launch.

Step 3: Perform Basic VM Operations

1. Check VM Status

Navigate to Instances to see your running VM.

2. Connect to the VM (via SSH)

If using Linux, run:

sh
ssh -i your_key.pem ubuntu@<VM_IP>

For Windows, use PuTTY with the private key.

3. Restart, Stop, or Delete VM

 Restart: Click Reboot in the dashboard.


 Stop: Click Shut Down to power off the VM.
 Delete: Click Terminate to remove the VM.

OUTPUT:

Name Status Task Power State IP Address


MyVM Active None Running 192.168.1.100

$ openstack server list

+ + + + + +

| ID | Name | Status | Networks | Image |

+ + + + + +

| abc12345-xyz67890 | MyVM | ACTIVE | private=192.168.1.100 | Ubuntu 20.04 |

After deleting, the server list will be empty:

sh
$ openstack server list No
servers found.
EXPERIMENT-5

Title of Experiment: Install Git and Perform Basic Version Control Commands (clone,
commit, push, pull, reset, delete).

1. Install Git

Run this command in the terminal:

sudo apt update


sudo apt install git -y

Output:

Reading package lists... Done


Building dependency tree
Reading state information... Done
The following NEW packages will be installed: git
...
Setting up git (2.34.1) ...

Check if Git is installed:


git --version

Output:

git version 2.34.1

2. Configure Git

Set your user details:

git config --global user.name "Your Name"


git config --global user.email "[email protected]"

Check configuration:

git config --list

Output:

user.name=Your Name
[email protected]
3. Clone a Repository

Copy a remote repository to your system:

git clone https://github.com/user/repo.git

Output:

Cloning into 'repo'...


remote: Enumerating objects: 50, done.
Receiving objects: 100% (50/50), 10.2 MiB | 1.5 MiB/s, done.

4. Check Repository Status

Move into the repository and check status:

cd repo
git status

Output:

On branch main
Your branch is up to date with 'origin/main'.
nothing to commit, working tree clean

5. Add and Commit Changes

Create a file and add it to Git:

echo "Hello World" > file.txt


git add file.txt
git commit -m "Added file.txt"

Output:

[main abc1234] Added file.txt


1 file changed, 1 insertion(+)
create mode 100644 file.txt

6. Push Changes to Remote Repository


git push origin main
Output:

Enumerating objects: 3, done.


Writing objects: 100% (3/3), 250 bytes | 250.00 KiB/s, done.

7. Pull Latest Changes


git pull origin main

Output:

Already up to date.

8. Reset Changes

Undo last commit:

git reset --hard HEAD~1

Output:

HEAD is now at abc1234 Added file.txt

9. Delete a Branch

Locally:

git branch -d branch_name

Output:

Deleted branch branch_name (was abc1234).

Remotely:

git push origin --delete branch_name

Output:

To https://github.com/user/repo.git
- [deleted] branch_name
EXPERIMENT-6

Title of Experiment: Hosting a Web Application Locally with XAMPP

1. Install XAMPP

Download and install XAMPP on Linux.

wget https://www.apachefriends.org/xampp-files/8.2.4/xampp-linux-x64-8.2.4-0-
installer.run
sudo chmod +x xampp-linux-x64-8.2.4-0-installer.run
sudo ./xampp-linux-x64-8.2.4-0-installer.run

Output:

Installation finished.
You can now start XAMPP by calling '/opt/lampp/lampp start'.

2. Start XAMPP

sudo /opt/lampp/lampp start

Output:

Starting XAMPP for Linux 8.2.4...


XAMPP: Starting Apache...ok.
XAMPP: Starting MySQL...ok.
XAMPP: Starting ProFTPD...ok.

3. Place Your Web Application in htdocs

Move your project folder to the htdocs

directory. sudo mv your_project


/opt/lampp/htdocs/

Go to htdocs:

cd /opt/lampp/htdocs/your_project

4. Access Your Web Application

Open a browser and go to:


http://localhost/your_project
You should see your web application homepage.

5. Manage XAMPP

Stop XAMPP:

sudo /opt/lampp/lampp stop

Output:

Stopping XAMPP for Linux 8.2.4...


XAMPP: Stopping Apache...ok.
XAMPP: Stopping MySQL...ok. XAMPP:
Stopping ProFTPD...ok.

Restart XAMPP:

sudo /opt/lampp/lampp restart

Output:

Restarting XAMPP for Linux 8.2.4...


XAMPP: Stopping Apache...ok.
XAMPP: Stopping MySQL...ok. XAMPP:
Stopping ProFTPD...ok. XAMPP:
Starting Apache...ok. XAMPP:
Starting MySQL...ok.
XAMPP: Starting ProFTPD...ok.
EXPERIMENT-7

Title of Experiment: Build a Simple FAST API with python

Sure! Here's a simplified version of building a FastAPI application:

1. Install FastAPI and Uvicorn

First, install FastAPI and Uvicorn:

pip install fastapi uvicorn

2. Create a Python File (main.py)

Create a new file named main.py and add this code:

from fastapi import FastAPI

app = FastAPI()

@app.get("/")
def
read_root():
return {"message": "Hello, FastAPI!"}

3. Run the Application

In the terminal, run the following command to start the app:

python -m uvicorn main:app --reload

4. Open the App in Your Browser

Go to this URL in your browser:


http://127.0.0.1:8000

You will see:

{
"message": "Hello, FastAPI!"
}
5. Stop the Server

To stop the server, press CTRL + C in the terminal.

Output:
EXPERIMENT-8

Title of Experiment: Install and configure a MinIO server:

1. Install MinIO

1. Download MinIO:
o Go to the MinIO download page.
o Download the minio.exe file.
2. Move minio.exe to a folder:
o Place minio.exe in a folder like C:\minio\.
3. Verify Installation:
o Open Command Prompt and navigate to the folder where you placed
minio.exe:
o cd C:\minio
o Run the following command to check if MinIO is installed:
o minio.exe --version
o You should see output like this:
o MinIO version: RELEASE.2021-12-16T23-56-58Z

2. Start MinIO Server

1. Run the MinIO server:


o In the Command Prompt, navigate to the folder where minio.exe is located
and run:
o minio.exe server C:\minio\data
o This will start the MinIO server and store files in the C:\minio\data directory
(you can change this path).
2. MinIO Web Interface:
o Once the server starts, open your browser and go to:
o http://127.0.0.1:9000
o The default credentials are:
 Access Key: minioadmin
 Secret Key: minioadmin
3. Create Buckets and Upload File

1. Login to the Web Interface:


o Use the default access and secret keys to log in.
2. Create Buckets:
o After logging in, you can create a new bucket by clicking the "Create Bucket"
button.
3. Upload Files:
o Click on the bucket you created, and then click "Upload" to add files.

4. Run MinIO as a Windows Service

To have MinIO run automatically as a service in the background:

1. Download and install NSSM (Non-Sucking Service Manager):


o Go to NSSM download page and download the appropriate version for your
system.
o Extract the nssm.exe file.
2. Create a Windows Service for MinIO:
o Open Command Prompt as Administrator.
o Use NSSM to create a service:
o nssm install MinIO
o This will open a window where you need to set the Path to minio.exe (e.g.,
C:\minio\minio.exe) and the Arguments to:
o server C:\minio\data
o Click Install Service.
3. Start the MinIO Service:
o Once installed, you can start the service using:
o nssm start MinIO
4. Verify Service:
o You can check the service status and stop/start it using the Windows Services
app.
EXPERIMENT-9

Title of Experiment: Upload and Download Objects in MinIO server

1. Access MinIO Web Interface

1. Start the MinIO server if it isn't already running:


2. minio.exe server C:\minio\data
3. Open a web browser and go to:
4. http://127.0.0.1:9000
5. Login with the default credentials:
o Access Key: minioadmin
o Secret Key: minioadmin

Sample output:

Successfully logged in to MinIO Web Interface.

2. Upload Objects (Files) to MinIO

1. After logging in, create a bucket if you haven’t already:


o Click on the “+” or “Create Bucket” button.
o Provide a name for your bucket (e.g., mybucket) and click Create.

Sample output (after bucket creation):

Bucket 'mybucket' created successfully.

2. To upload files:
o Click on the bucket you created (e.g., mybucket).
o Click the Upload button.
o Select the files from your computer to upload and click Upload.

Sample output (on successful upload):

File 'file.txt' uploaded successfully to 'mybucket'.

3. Download Objects (Files) from MinIO

1. Navigate to the bucket where your files are stored (e.g., mybucket).
2. Find the file you want to download.
3. Click on the three dots next to the file name (or right-click on the file).
4. Select Download.
Sample output (on successful download):

Download started for file 'file.txt'.

4. (Optional) Upload/Download Using MinIO Client (mc)

Install MinIO Client (mc):

1. Download mc from MinIO GitHub releases or use the Windows installer.


o Make sure to extract mc.exe and place it in a folder accessible from the
command line.

Configure mc to connect to your MinIO server:

1. Open Command Prompt and run:


2. mc alias set myminio http://127.0.0.1:9000 minioadmin minioadmin

Sample output:

Added new alias 'myminio'.

Upload File Using mc:

2. To upload a file to your MinIO bucket:


3. mc cp C:\path\to\your\file.txt myminio/mybucket/

Sample output:

C:\path\to\your\file.txt: Upload started. C:\


path\to\your\file.txt: Upload complete.

Download File Using


mc:

3. To download a file from the MinIO bucket:


4. mc cp myminio/mybucket/file.txt C:\path\to\download\directory\

Sample output:

myminio/mybucket/file.txt: Download started.


myminio/mybucket/file.txt: Download complete.
EXPERIMENT-10

Title of Experiment: Setup your own server with Nextcloud.

Step 1: Install XAMPP

1. Download XAMPP from https://www.apachefriends.org/index.html.


2. Run the installer and follow the prompts to install XAMPP.

Sample output:

XAMPP installed successfully.

3. Open XAMPP Control Panel and start Apache and MySQL.

Sample output:

Apache: Running
MySQL: Running

Step 2: Download Nextcloud

1. Go to the Nextcloud download page and download the latest version of Nextcloud for
manual installation.
2. Extract the downloaded zip file to the htdocs directory of your XAMPP installation
(usually located in C:\xampp\htdocs).

Sample path:

C:\xampp\htdocs\nextcloud
Step 3: Set Up Database for Nextcloud

1. Open phpMyAdmin by visiting http://localhost/phpmyadmin/ in your web browser.


2. Log in using the default MySQL credentials:
o Username: root
o Password: Leave it blank (default setting).
3. Create a new database for Nextcloud:
o Click on Databases in the top menu.
o Under Create database, enter nextcloud and click Create.

Sample output:

Database 'nextcloud' created successfully.

Step 4: Configure Nextcloud

1. In your web browser, go to http://localhost/nextcloud.


2. The Nextcloud setup page will appear. Fill in the following details:
o Data Folder: Leave it as default or specify a directory for storing files (e.g.,
C:\xampp\htdocs\nextcloud\data).

o Database user: root


o Database password: Leave it blank (default).
o Database name: nextcloud
3. Click Finish setup.

Sample output:

Nextcloud is successfully installed and ready to use.


Step 5: Access Nextcloud

1. After successful installation, you can access Nextcloud by visiting


http://localhost/nextcloud in your browser.
2. Log in with the admin credentials you created during setup.

Sample output:

Nextcloud Dashboard is ready.


EXPERIMENT-11

Title of Experiment: Creating a Simple Database-Driven Application with XAMPP

Step 1: Install XAMPP

1. Download XAMPP from https://www.apachefriends.org/index.html.


2. Run the installer and follow the prompts to install XAMPP.

Step 2: Start Apache and MySQL

1. Open the XAMPP Control Panel.


2. Start Apache and MySQL by clicking the "Start" buttons next to each service.

Sample output:

Apache: Running
MySQL: Running

Step 3: Create a Database

1. Open phpMyAdmin by navigating to http://localhost/phpmyadmin in your browser.


2. Log in with the default credentials:
o Username: root
o Password: (leave it blank)
3. Create a new database:
o Click on Databases in the top menu.
o Enter sampledb as the name of the database and click Create.

Sample output:

Database 'sampledb' created successfully.

4. Create a table in the sampledb database:


o Go to the newly created sampledb database.
o Create a table named users with the following columns:
 id (INT, AUTO_INCREMENT, PRIMARY KEY)
 name (VARCHAR(50))
 email (VARCHAR(100))

Sample SQL query for creating the table:

CREATE TABLE users (


id INT AUTO_INCREMENT PRIMARY KEY,
name VARCHAR(50),
email VARCHAR(100)
);

Sample output:

Table 'users' created successfully.

5. Insert some sample data into the users table:


6. INSERT INTO users (name, email) VALUES ('John Doe',
'[email protected]');
7. INSERT INTO users (name, email) VALUES ('Jane Smith',
'[email protected]');

Step 4: Create a PHP Application

1. Go to the htdocs directory in your XAMPP installation (usually C:\xampp\htdocs).


2. Create a new folder, e.g., myapp.
3. Inside myapp, create a new file index.php with the following content:

<?php
// Database connection
$servername = "localhost";
$username = "root";
$password = "";
$dbname = "sampledb";

// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);

// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}

// Fetch data from database


$sql = "SELECT id, name, email FROM users";
$result = $conn->query($sql);

// Display data in a simple table


echo "<h1>User List</h1>";
echo "<table border='1'>
<tr>
<th>ID</th>
<th>Name</th>
<th>Email</th>
</tr>";

if ($result->num_rows > 0) {
while($row = $result->fetch_assoc())
{ echo "<tr>
<td>".$row["id"]."</td>
<td>".$row["name"]."</td>
<td>".$row["email"]."</td>
</tr>";
}
echo "</table>";
} else {
echo "0 results";
}

$conn->close();
?>
Step 5: Run the Application

1. Open a web browser and navigate to http://localhost/myapp/index.php.


2. You should see a simple table displaying the users from the users table in the database.

Output:

User List
+ + + +
| ID | Name | Email |
+ + + +
| 1 | Tom | [email protected] |
| 2 | Sam | [email protected] |
+ + + +
EXPERIMENT-12

Title of Experiment: Creating and Using Object Storage (Swift) using Openstack swift

Step 1: Install and Configure Swift Client

Open Command Prompt (cmd) as Administrator and run:

pip install python-swiftclient

Output:

Successfully installed python-swiftclient-4.0.0

Create a file openrc.sh and add:

export OS_AUTH_URL=https://openstack.example.com:5000/v3
export OS_USERNAME=your_username
export OS_PASSWORD=your_password
export OS_PROJECT_NAME=your_project
export OS_USER_DOMAIN_NAME=Default
export OS_PROJECT_DOMAIN_NAME=Default
export OS_IDENTITY_API_VERSION=3

Run:

source openrc.sh

Step 2: Authenticate and Create Storage Container

swift stat
swift post mycontainer

Output:

Account: AUTH_xxxxx
Containers: 0
Objects: 0
Bytes: 0
Container mycontainer created successfully.

Step 3: Upload, List, and Download Objects

swift upload mycontainer example.txt


swift list mycontainer
swift download mycontainer example.txt

Output:

example.txt uploaded to container mycontainer.


example.txt
example.txt downloaded successfully.

Step 4: Delete Objects and Container

swift delete mycontainer example.txt


swift delete mycontainer

Output:

example.txt deleted successfully.


Container mycontainer deleted successfully.

You might also like