Group Name: SubuhArmy
Section: 2
Team Mates:
- NABIL BIN MUHD NORDIN and 2210859
- MUHAMAD HASIFF BIN BADROL and 2210801
- FAHIM NURHAZIQ BIN FADZIL and 2216513
- You are allowed to have 3 group members. Exception is allowed IFF (if and only if) you are allowed to have 4 group members if you are a multinational or a multigender group.
- When you complete the project, make sure to submit the repository link of your cloned project. Make sure all the files are as what you aspect in your repository.
- Answer all questions in the README.md, in your own repository. Either use the online VSCode, terminal or github to edit. Answers are expected where you see Fill answer here.
- Learn how to use markdown. https://www.w3schools.io/file/markdown-introduction/
-
First thing you need in doing this project is to have a github account. Make sure to sign up at https://www.github.com
-
The second thing you need is to fork the OS project repository in your own github account.
- Go to https://github.com/joeynor/OSProject and click fork to copy the project into your own repository
- Make sure that the new fork is now in your own repository
Questions:
- What is the link of the fork OSProject in your repository. (1 mark)
- How many files and folders are in this repository. (1 mark)
- There are 1 folder and 1 file containing 6 files.
- The next thing that we will be doing is exploring codespaces. First of all, read about codespaces https://docs.github.com/en/codespaces/overview#what-is-a-codespace
- Then go to the link https://github.com/codespaces and we shall start a new codespace.
- Click on New codespace.
- Choose your own OSProject repository to start your codespace.
- Once you have created you codespace, you will see the following. You might already be familiar with this, since it will look similar to VSCode.
- You will see the README file file. One is a preview of how it looks like on the web, and the other is the editing view in markdown language.
- Edit the README file. Make sure you have your group details correct, ie, group name, section and team members along with their matric IDs.
- Once you have finish editing, click File->Save or ctrl-s to save it.
- After saving, you will notice an M or U next to your file. You will need to commit any changes, whenever you make changes so that it is uploaded to the github repository.
- Click on the source control, hint: its on the left side panel, and it will list down the files that have been modified or updated. Click on commit. It will then ask you "Would you like to stage all your changes and commit them directly?" Just say yes, and a new tab will appear. Type a message to log what you have done, and click on the check mark.
- After that, sync the changes to the main repository.
- Make sure to commit and sync your files to the main repository, or else, your work will be lost since it is not saved into the main repository when you submit your project.
Questions:
- What is default OS used to run the virtual environment for codespaces. (1 mark)
- The default OS used to run is by Ubuntu Linux Image.
- What are the two options of ram, disk and vcpu configuration you can have in running codespaces . (1 mark)
- The first option: 2-Core CPU, 8GB RAM and 32GB Storage.
- The 2nd option: 4-Core CPU, 16GB RAM and 32GB Storage.
- Why must we commit and sync our current work on source control? (1 mark)
- We must commit and sync so that our work will not be saved in the main repository when submitting the project.
- Look at the TERMINAL tab. Explore and run commands according to the questions below.
- You can include your answers as images, or cut and paste the output here. If you are cutting and pasting your answers, wrap your answers in the codeblock clause in markdown. For example, if i run the command whoami the the output would look like the one below.
@joeynor ➜ /workspaces/OSProject (main) $ whoami
codespaceQuestions:
Look at the TERMINAL tab. Run the following commands and provide the output here.
- Run the command pwd . (1 mark)
@Fertlas ➜ /workspaces/OSProject (main) $ pwd
/workspaces/OSProject- Run the command cat /etc/passwd . (1 mark)
@Fertlas ➜ /workspaces/OSProject (main) $ cat /etc/passwd
root:x:0:0:root:/root:/bin/bash
daemon:x:1:1:daemon:/usr/sbin:/usr/sbin/nologin
bin:x:2:2:bin:/bin:/usr/sbin/nologin
sys:x:3:3:sys:/dev:/usr/sbin/nologin
sync:x:4:65534:sync:/bin:/bin/sync
games:x:5:60:games:/usr/games:/usr/sbin/nologin
man:x:6:12:man:/var/cache/man:/usr/sbin/nologin
lp:x:7:7:lp:/var/spool/lpd:/usr/sbin/nologin
mail:x:8:8:mail:/var/mail:/usr/sbin/nologin
news:x:9:9:news:/var/spool/news:/usr/sbin/nologin
uucp:x:10:10:uucp:/var/spool/uucp:/usr/sbin/nologin
proxy:x:13:13:proxy:/bin:/usr/sbin/nologin
www-data:x:33:33:www-data:/var/www:/usr/sbin/nologin
backup:x:34:34:backup:/var/backups:/usr/sbin/nologin
list:x:38:38:Mailing List Manager:/var/list:/usr/sbin/nologin
irc:x:39:39:ircd:/var/run/ircd:/usr/sbin/nologin
gnats:x:41:41:Gnats Bug-Reporting System (admin):/var/lib/gnats:/usr/sbin/nologin
nobody:x:65534:65534:nobody:/nonexistent:/usr/sbin/nologin
_apt:x:100:65534::/nonexistent:/usr/sbin/nologin
systemd-timesync:x:101:101:systemd Time Synchronization,,,:/run/systemd:/usr/sbin/nologin
systemd-network:x:102:103:systemd Network Management,,,:/run/systemd:/usr/sbin/nologin
systemd-resolve:x:103:104:systemd Resolver,,,:/run/systemd:/usr/sbin/nologin
messagebus:x:104:105::/nonexistent:/usr/sbin/nologin
codespace:x:1000:1000::/home/codespace:/bin/bash
sshd:x:105:65534::/run/sshd:/usr/sbin/nologin- Run the command df . (1 mark)
@Fertlas ➜ /workspaces/OSProject (main) $ df
Filesystem 1K-blocks Used Available Use% Mounted on
overlay 32847680 13642924 17510660 44% /
tmpfs 65536 0 65536 0% /dev
shm 65536 0 65536 0% /dev/shm
/dev/root 30298176 22945848 7335944 76% /vscode
/dev/sda1 46127956 132 43752248 1% /tmp
/dev/loop3 32847680 13642924 17510660 44% /workspaces- Run the command du . (1 mark)
@Fertlas ➜ /workspaces/OSProject (main) $ du
64 ./.git/hooks
4 ./.git/branches
8 ./.git/info
8 ./.git/objects/ab
8 ./.git/objects/0b
16 ./.git/objects/52
8 ./.git/objects/0d
8 ./.git/objects/71
8 ./.git/objects/b2
12 ./.git/objects/70
8 ./.git/objects/cd
8 ./.git/objects/4b
8 ./.git/objects/3f
8 ./.git/objects/74
8 ./.git/objects/81
8 ./.git/objects/49
1820 ./.git/objects/pack
8 ./.git/objects/fd
8 ./.git/objects/04
12 ./.git/objects/ff
12 ./.git/objects/72
12 ./.git/objects/d2
8 ./.git/objects/93
8 ./.git/objects/e9
12 ./.git/objects/2e
8 ./.git/objects/86
8 ./.git/objects/cb
8 ./.git/objects/d8
4 ./.git/objects/info
12 ./.git/objects/e5
8 ./.git/objects/fe
12 ./.git/objects/44
8 ./.git/objects/f3
8 ./.git/objects/91
8 ./.git/objects/83
8 ./.git/objects/a3
12 ./.git/objects/62
12 ./.git/objects/3d
8 ./.git/objects/f2
12 ./.git/objects/17
8 ./.git/objects/b9
8 ./.git/objects/60
8 ./.git/objects/47
8 ./.git/objects/fc
8 ./.git/objects/20
16 ./.git/objects/fb
8 ./.git/objects/b6
8 ./.git/objects/7b
12 ./.git/objects/1c
8 ./.git/objects/fa
8 ./.git/objects/4f
8 ./.git/objects/4a
12 ./.git/objects/b5
12 ./.git/objects/64
8 ./.git/objects/eb
12 ./.git/objects/af
12 ./.git/objects/73
8 ./.git/objects/e7
8 ./.git/objects/1b
16 ./.git/objects/14
8 ./.git/objects/24
8 ./.git/objects/f6
8 ./.git/objects/c6
8 ./.git/objects/96
8 ./.git/objects/a6
8 ./.git/objects/c3
8 ./.git/objects/58
2408 ./.git/objects
4 ./.git/lfs/tmp
8 ./.git/lfs
4 ./.git/refs/tags
12 ./.git/refs/remotes/origin
16 ./.git/refs/remotes
8 ./.git/refs/heads
32 ./.git/refs
12 ./.git/logs/refs/remotes/origin
16 ./.git/logs/refs/remotes
8 ./.git/logs/refs/heads
28 ./.git/logs/refs
36 ./.git/logs
2596 ./.git
1972 ./images
4588 .- Run the command ls . (1 mark)
@Fertlas ➜ /workspaces/OSProject (main) $ ls
README.md images- Run the command ls -asl . (1 mark)
@Fertlas ➜ /workspaces/OSProject (main) $ ls -asl
total 32
4 drwxrwxrwx+ 4 codespace root 4096 Jan 27 11:50 .
4 drwxr-xrwx+ 5 codespace root 4096 Jan 27 11:50 ..
4 drwxrwxrwx+ 9 codespace root 4096 Jan 28 10:18 .git
16 -rw-rw-rw- 1 codespace root 15759 Jan 29 15:37 README.md
4 drwxrwxrwx+ 2 codespace root 4096 Jan 27 11:50 images- Run the command free -h . (1 mark)
@Fertlas ➜ /workspaces/OSProject (main) $ free -h
total used free shared buff/cache available
Mem: 7.7Gi 1.4Gi 272Mi 1.0Mi 6.1Gi 6.0Gi- Run the command cat /proc/cpuinfo . (1 mark)
@Fertlas ➜ /workspaces/OSProject (main) $ cat /proc/cpuinfo
processor : 0
vendor_id : AuthenticAMD
cpu family : 25
model : 1
model name : AMD EPYC 7763 64-Core Processor
stepping : 1
microcode : 0xffffffff
cpu MHz : 2944.842
cache size : 512 KB
physical id : 0
siblings : 2
core id : 0
cpu cores : 1
apicid : 0
initial apicid : 0
fpu : yes
fpu_exception : yes
cpuid level : 13
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt pdpe1gb rdtscp lm constant_tsc rep_good nopl tsc_reliable nonstop_tsc cpuid extd_apicid aperfmperf pni pclmulqdq ssse3 fma cx16 pcid sse4_1 sse4_2 movbe popcnt aes xsave avx f16c rdrand hypervisor lahf_lm cmp_legacy svm cr8_legacy abm sse4a misalignsse 3dnowprefetch osvw topoext invpcid_single vmmcall fsgsbase bmi1 avx2 smep bmi2 erms invpcid rdseed adx smap clflushopt clwb sha_ni xsaveopt xsavec xgetbv1 xsaves clzero xsaveerptr rdpru arat npt nrip_save tsc_scale vmcb_clean flushbyasid decodeassists pausefilter pfthreshold v_vmsave_vmload umip vaes vpclmulqdq rdpid fsrm
bugs : sysret_ss_attrs null_seg spectre_v1 spectre_v2 spec_store_bypass srso
bogomips : 4890.86
TLB size : 2560 4K pages
clflush size : 64
cache_alignment : 64
address sizes : 48 bits physical, 48 bits virtual
power management:
processor : 1
vendor_id : AuthenticAMD
cpu family : 25
model : 1
model name : AMD EPYC 7763 64-Core Processor
stepping : 1
microcode : 0xffffffff
cpu MHz : 3109.287
cache size : 512 KB
physical id : 0
siblings : 2
core id : 0
cpu cores : 1
apicid : 1
initial apicid : 1
fpu : yes
fpu_exception : yes
cpuid level : 13
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt pdpe1gb rdtscp lm constant_tsc rep_good nopl tsc_reliable nonstop_tsc cpuid extd_apicid aperfmperf pni pclmulqdq ssse3 fma cx16 pcid sse4_1 sse4_2 movbe popcnt aes xsave avx f16c rdrand hypervisor lahf_lm cmp_legacy svm cr8_legacy abm sse4a misalignsse 3dnowprefetch osvw topoext invpcid_single vmmcall fsgsbase bmi1 avx2 smep bmi2 erms invpcid rdseed adx smap clflushopt clwb sha_ni xsaveopt xsavec xgetbv1 xsaves clzero xsaveerptr rdpru arat npt nrip_save tsc_scale vmcb_clean flushbyasid decodeassists pausefilter pfthreshold v_vmsave_vmload umip vaes vpclmulqdq rdpid fsrm
bugs : sysret_ss_attrs null_seg spectre_v1 spectre_v2 spec_store_bypass srso
bogomips : 4890.86
TLB size : 2560 4K pages
clflush size : 64
cache_alignment : 64
address sizes : 48 bits physical, 48 bits virtual
power management:- Run the command top and type q to quit. (1 mark)
top - 15:57:23 up 32 min, 0 users, load average: 0.40, 0.33, 0.34
Tasks: 21 total, 1 running, 20 sleeping, 0 stopped, 0 zombie
%Cpu(s): 2.2 us, 5.4 sy, 0.0 ni, 92.2 id, 0.0 wa, 0.0 hi, 0.2 si, 0.0 st
MiB Mem : 7930.0 total, 138.0 free, 1565.3 used, 6226.6 buff/cache
MiB Swap: 0.0 total, 0.0 free, 0.0 used. 6048.4 avail Mem
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
504 codespa+ 20 0 21.1g 331076 46336 S 2.3 4.1 0:17.79 node
1196 codespa+ 20 0 715704 62928 39040 S 1.3 0.8 0:00.77 node
484 codespa+ 20 0 957616 97900 42368 S 1.0 1.2 0:03.76 node
1 codespa+ 20 0 1136 640 640 S 0.0 0.0 0:00.02 docker-init
7 codespa+ 20 0 7236 1792 1792 S 0.0 0.0 0:00.01 sleep
22 root 20 0 12192 3608 2688 S 0.0 0.0 0:00.00 sshd
354 codespa+ 20 0 2616 1536 1536 S 0.0 0.0 0:00.01 sh
460 root 20 0 2616 1664 1664 S 0.0 0.0 0:00.00 sh
476 codespa+ 20 0 2620 1536 1536 S 0.0 0.0 0:00.01 sh
519 codespa+ 20 0 849188 54272 38656 S 0.0 0.7 0:00.20 node
596 codespa+ 20 0 2616 1408 1408 S 0.0 0.0 0:00.00 sh
645 root 20 0 2616 1408 1408 S 0.0 0.0 0:00.00 sh
1179 codespa+ 20 0 614264 63820 38400 S 0.0 0.8 0:01.23 node
1207 codespa+ 20 0 16628 11392 3328 S 0.0 0.1 0:00.16 bash
1757 root 20 0 1610544 78728 49664 S 0.0 1.0 0:00.15 dockerd
1767 root 20 0 1208944 44368 30336 S 0.0 0.5 0:00.14 containerd
1980 codespa+ 20 0 2616 1664 1664 S 0.0 0.0 0:00.00 sh
2020 root 20 0 2616 1408 1408 S 0.0 0.0 0:00.00 sh
4684 codespa+ 20 0 10880 3712 3200 R 0.0 0.0 0:00.00 top
4728 codespa+ 20 0 2620 1408 1408 S 0.0 0.0 0:00.00 sh
4729 codespa+ 20 0 8628 3072 2816 S 0.0 0.0 0:00.00 cpuUsage.sh - Run the command uname -a. (1 mark)
@Fertlas ➜ /workspaces/OSProject (main) $ uname -a
Linux codespaces-5a1edb 6.2.0-1018-azure #18~22.04.1-Ubuntu SMP Tue Nov 21 19:25:02 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux- What is the available free memory in the system. (1 mark)
- 272 MB
- What is the available disk space mounted on /workspace. (1 mark)
- 17 GB
- Name the version and hardware architecture of the linux Virtual environment. (1 mark)
- Linux codespaces-5a1edb 6.2.0-1018-azure #18~22.04.1-Ubuntu SMP Tue Nov 21 19:25:02 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
- What is the difference between ls vs ls -asl. (1 mark)
- The "ls" command used to list files and directories in a directory.
- The "ls -asl" command used to provide a more detailed listing such as file permissions, size and last modified time.
- What is the TLB size of the Virtual CPU. (1 mark)
- CPU 0: 2560 4K pages
- CPU 1: 2560 4K pages
- What is the CPU speed of the Virtual CPU. (1 mark)
- CPU 0: 2944.842 MHz
- CPU 1: 3109.287 MHz
- What is the top running process that consumes the most CPU cycles. (1 mark)
- PID = 504, user = codespa+
- At the terminal, run a linux instance. By typing the following command.
docker pull debian
docker run --detach -it debian
- This will run the debian container. To check if the debian container is running, type
@joeynor ➜ /workspaces/OSProject (main) $ docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
f65be1987f84 debian "bash" 4 minutes ago Up 4 minutes romantic_jackson- Keep note of the name used by your container, this is usually given random names unless you specify your own name. Now run a bash command on the container. Make sure you use the name of your container instead of the one shown here.
docker exec -i -t romantic_jackson /bin/bash- Create a file on the container. First you must make sure you are in the bash command prompt of the container. The container is new, and does not have any software other than the debian OS. To create a new file, you will need an editor installed. In the bash shell of the container, run the package manager apt-get to install nano text editor.
root@f65be1987f84:~# apt-get update
root@f65be1987f84:~# apt-get install nano
root@f65be1987f84:~# cd /root
root@f65be1987f84:~# nano helloworld.txt-
Edit your helloworld.txt, create your messsage and save by typing ctrl-X. Once saved, explore using the container to see where the file is located. Then exit the shell, by typing exit.
-
Stop the container and run docker ps -a, and restart the container again. Is your file in the container still available?
@joeynor ➜ /workspaces/OSProject (main) $ docker stop romantic_jackson
@joeynor ➜ /workspaces/OSProject (main) $ docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
f65be1987f84 debian "bash" 19 minutes ago Exited (137) 18 seconds ago romantic_jackson
@joeynor ➜ /workspaces/OSProject (main) $ docker restart romantic_jackson- Stop the container and delete the container. What happened to your helloworld.txt?
@joeynor ➜ /workspaces/OSProject (main) $ docker stop romantic_jackson
@joeynor ➜ /workspaces/OSProject (main) $ docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
f65be1987f84 debian "bash" 19 minutes ago Exited (137) 18 seconds ago romantic_jackson
@joeynor ➜ /workspaces/OSProject (main) $ docker rm romantic_jacksonQuestions:
- Are files in the container persistent. Why not?. (1 mark)
- No it's not persistent because once you remove the file, the file will not be saved.
- Can we run two, or three instances of debian linux? . (1 mark)
- Yes you can.
- In the previous experiment, you might have notice that containers are not persistent. To make storage persistent, you will need to mount them. At the terminal, create a new directory called myroot, and run a instance of debian linux and mount myroot to the container. Find out the exact path of my root, and mount it as the root folder in the debian container.
- Create a file in /root on the container, the files should also appear in myroot of your host VM.
@joeynor ➜ /workspaces/OSProject (main) $ mkdir myroot
@joeynor ➜ /workspaces/OSProject (main) $ cd myroot/
@joeynor ➜ /workspaces/OSProject/myroot (main) $ pwd
/workspaces/OSProject/myroot
@joeynor ➜ /workspaces/OSProject/myroot (main) $ docker run --detach -it -v /workspaces/OSProject/myroot:/root debianQuestions:
- Check the permission of the files created in myroot, what user and group is the files created in docker container on the host virtual machine? . (2 mark)
- User ID (UID) = '0' (root)
- Group ID (GID) = '0' (root)
- Can you change the permission of the files to user codespace. You will need this to be able to commit and get points for this question. (2 mark)
//use sudo and chown
sudo chown -R codespace:codespace myroot
- Yes, here are the codes for this question;
@Hasiff100303 ➜ /workspaces/OSProject (main) $ sudo chown -R codespace:codespace myroot
@Hasiff100303 ➜ /workspaces/OSProject (main) $ ls -l /workspaces/OSProject/myroot
total 0
@Hasiff100303 ➜ /workspaces/OSProject (main) $ ls -la /workspaces/OSProject/myroot
total 8
drwxrwxrwx+ 2 codespace codespace 4096 Jan 30 13:59 .
drwxrwxrwx+ 5 codespace root 4096 Jan 30 13:59 ..
@Hasiff100303 ➜ /workspaces/OSProject (main) $ id
uid=1000(codespace) gid=1000(codespace) groups=1000(codespace),106(ssh),107(docker),988(pipx),989(python),990(oryx),991(golang),992(sdkman),993(rvm),994(php),995(conda),996(nvs),997(nvm),998(hugo),999(dotnet)
@Hasiff100303 ➜ /workspaces/OSProject (main) $ - Create a directory called webpage in your host machine
- Inside the directory, create a page index.html, with any content you would like
- Then, run the apache webserver and mount the webpage directory to it. Hint:
## the -p 8080:80 flag points the host port 8080 to the container port 80
docker run --detach -v /workspaces/OSProject/webpage:/usr/local/apache2/htdocs/ -p 8080:80 httpd- If it works, codespace will trigger a port assignment and provide a URL for you to access your webpage like the one below.
-
You can also see the Port in the PORTS tab, next to the terminal tab.
-
You can then access your website by adding an index.html towards the end of your url link, like the one below.
Questions:
- What is the permission of folder /usr/local/apache/htdocs and what user and group owns the folder? . (2 mark)
- Permission: 'drwxrwxrwx+'
- User ID (UID): '1000'
- Group ID (GID): '1000'
- What port is the apache web server running. (1 mark)
- port 80
- What port is open for http protocol on the host machine? (1 mark)
- port 8080
- Make sure to commit all changes on your source control, and make sure your source control is sync to the repository.
- Check your repository link, to see if all the files and answers are included in the repository.
- Submit through italeem, by providing the link to your repository.
- Due by 31 January, 2024





