You are on page 1of 41

KOLEJ PROFESIONAL MARA INDERA MAHKOTA

DIPLOMA IN COMPUTER NETWORKING

COURSE NAME : UNIX AS NETWORK OPERATING SYSTEM


COURSE CODE : CSC2833
ACADEMIC SESSION : SESI 3 2022/2023
TYPE OF ASSESSMENT : FINAL PROJECT
DURATION : 3 WEEKS

3. CLO 3 : Propose relevant Linux services for small to medium scale


networking environment. (A3, PLO5)

INSTRUCTION TO CANDIDATES:

1. This final project consists of one (1) sections.


2. Your groups need to demonstrate and submit complete documentation.
3. Cheating or plagiarizing will be severely penalized.

Personal Details Section/ Marks


Question No.

1) WAN AHMAD QAYYIM


Name
BIN WAN YAZMAN

2) AHMAD MUHAIMIN
BIN MOHD TAMIZI

I/D 1) ICN21-07-037
Number
2) ICN21-07-012
DCN 5A
Class
ZUL FAKHRI ZOLKEFLI
Lecturer

Total /
Table of Contents
TASK ................................................................................................................................................................ 3
SUMMARY ....................................................................................................................................................... 3
SECTION 1: VIRTUALBOX INSTALLATION ................................................................................................................ 4
INTRODUCTION TO VIRTUALBOX ............................................................................................................................... 4
INSTALLING VIRTUALBOX ON WINDOWS .................................................................................................................... 4
SECTION 2: CENTOS INSTALLATION AND CONFIGURATION .................................................................................. 7
INSTALLATION OF CENTOS 9..................................................................................................................................... 7
SECTION 3: WEB SERVER INSTALLATION AND CONFIGURATION .............................................................................. 20
STEP 1: CONFIGURATION IN THE SERVER BEFORE INSTALLING WEB SERVER ..................................................................... 20
STEP 2: INSTALL MARIADB .................................................................................................................................... 22
STEP 3: INSTALL PHP ............................................................................................................................................ 24
STEP 4: INSTALL WORDPRESS ................................................................................................................................. 25
STEP 5: CREATE A MARIADB DATABASE AND USER FOR WORDPRESS ........................................................................... 26
STEP 6: SEARCH THE WEB SERVER IP ADDRESS ON THE CLIENT COMPUTER .................................................................... 26
SECTION 4: DNS SERVER INSTALLATION AND CONFIGURATION ................................................................................... 27
STEP 1 – INSTALLING BIND EXTENSION .................................................................................................................... 27
STEP 2 – CONFIGURE DNS SERVER......................................................................................................................... 28
STEP 3 – CREATE AND CONFIGURE ZONE FILE ........................................................................................................... 29
STEP 4 – ENABLE AND START THE DNS SERVICE ....................................................................................................... 30
STEP 5 – FIREWALL CONFIGURATION ...................................................................................................................... 30
STEP 6 – APPLYING DNS SERVER TO WEBSITE .......................................................................................................... 31
STEP 7 – TESTING DNS SERVER ............................................................................................................................. 31
SECTION 5: SAMBA FILE SERVER INSTALLATION AND CONFIGURATION ......................................................................... 32
STEP 1 – INSTALLING SAMBA EXTENSION ................................................................................................................. 32
STEP 2 – CONFIGURE SAMBA ................................................................................................................................ 33
STEP 3 – CREATE A SAMBA USER ........................................................................................................................... 34
STEP 4 – START SAMBA SERVICE ............................................................................................................................ 35
STEP 5 – CONFIGURE FIREWALL ............................................................................................................................. 36
STEP 6 – CONNECT FROM WINDOWS CLIENT............................................................................................................... 37
STEP 7 – TESTING SERVER AND CLIENT FILE SHARING ................................................................................................ 38
REFERENCES........................................................................................................................................................ 0
TASK

Our pairing team has been tasked the final project for the Unix as Operating System subject on Kolej
Professional Mara that focus on identifying and exploring the most suitable Linux OS server for use in
both personal and professional settings. The project involved evaluating different Linux server options
and has to implement three essential services on the Linux Server that we choose.

SUMMARY

The final project aimed to demonstrate our knowledge of Linux operating systems, server
administration, and web development. It is also involved a thorough evaluation of various
Linux OS servers to identify the most suitable option for our implementation. After
considering the features and performance of different options, my team has selected CentOS
9, an open-source community-supported server. CentOS 9 is a Linux distribution that offers a
stable and secure platform for running servers and hosting web applications.

To further explore CentOS 9, we have implemented three essential and one backup services
on the server. The first service involved setting up a Web Server with LAMP stack and
WordPress. LAMP is an acronym for Linux, Apache, MySQL, and PHP, which are widely used
in web application development. By installing LAMP and WordPress on CentOS 9, we
demonstrate our ability to configure a web server and install a content management system
(CMS).

The second service involved setting up a Database Server using MySQL which is mariadb
server to be exact. MySQL is a widely used open-source database management system that
is popular among web developers. By setting up a MySQL database on CentOS 9, we
demonstrate our knowledge of database administration and management.

The third service include installing and configuring a DNS Server on CentOS 9. DNS stands for
Domain Name System and is responsible for mapping domain names to IP addresses. By
setting up a DNS server, you demonstrated your understanding of network administration
and configuration.

Finally, you've explored Samba file sharing services, which allow you to share files between
Linux and Windows machines. This can be a useful service for businesses that need to share
files between different operating systems.
SECTION 1: VIRTUALBOX INSTALLATION
Introduction to VirtualBox

Sun Microsystems' VirtualBox, which is now owned by Oracle, can simulate a standalone
computer. Each standalone computer (also known as a virtual appliance) is self-contained
and can run its own operating system (guest OS). The appliances can communicate with one
another and be part of your home network, but they will be treated as a separate system.
Because of these and other features, VirtualBox enables you to test different operating
systems without making permanent changes to your host OS. You could use VirtualBox to
test these operating systems before deciding on one. Alternatively, you can run your server
operating system or media server from your VirtualBox instance 24 hours a day, 7 days a
week. For example, run a 24/7 Ubuntu Home, media, or file server guest OS from within
your windows laptop

Installing VirtualBox on Windows


First, head over to the VirtualBox download page on your browser, scroll down, and find the
latest version (currently 6.0.24). Click on the latest version number and make sure to
download the file that compatible with your OS version (my PC running Windows), and
download it to a known location on your windows computer.

Figure 1 - VirtualBox download webpage


Once VirtualBox Windows installer is downloaded, run the executable file and follow
through onscreen instructions to install VirtualBox on Windows. VirtualBox installs virtual
network adapters and therefore you may lose network connectivity temporarily during
installation.
After VirtualBox installation finishes, you will have to restart your computer. After reboot,
VirtualBox should be available on your computer. You can now run VirtualBox and create a
Windows virtual machine with almost any OS you can think of.

Figure 2 – VirtualBox starting screen

The figure above shows what on the screen when you open VirtualBox app, which is the
starting screen of VirtualBox. To start, users need to click the add button to install any OS they
wish to simulate in it.
Next, we need to go machine tab on our VirtualBox, and then pick the setting, go to the
Network tab, and change adapter 1 attached to “Bridged adapter”

Figure 3 - Network setting of VirtualBox


SECTION 2: CENTOS INSTALLATION AND CONFIGURATION

Installation of CentOS 9

CentOS (short for Community Enterprise Operating System) is a free and open-source Linux
distribution that is based on the source code of Red Hat Enterprise Linux (RHEL). It is
developed and maintained by the CentOS Project, and, in this section, I will show how to
install CentOS. Firstly, user need to click on the NEW icon to create a new machine-like in
the figure below

Download the CentOS 9 ISO file from the official website


(https://www.centos.org/download/). Choose the appropriate architecture (32-bit or 64-
bit) depending on your system.

Figure 4 - Starting page of VirtualBox


Open VirtualBox and click on the "New" button to create a new virtual machine.

Figure 4 - Starting page of VirtualBox

Give your virtual machine a name and select "Linux" as the type and "Red Hat (64-bit)" as the
version. Click "Next" to continue.
We'll use Expert Mode (see below) instead of guided mode because it's much faster. The
user is shown in the figure selecting a descriptive name for their new virtual machine and
destination folder. They must then select CentOS as the type and Ubuntu (64-bit) as the
version.

Figure 5 - Choosing hardware for CentOS 9


Next comes the turn of allocating RAM. The more memory you can afford to allocate, the
better. We will be settling for 4096MB in this example. Finally, you need to create a virtual
disk. Select the “Create a virtual hard disk now” option and click on Create to continue. We
will be setting the disk type to VDI as in the figure below and the size to be 50GB

Figure 6 - Selecting hard disk type


Select the newly created VM and click Start. The VM console window will pop up along
with an additional window asking the user to specify what start-up disk you wish to use
(Since the virtual hard disk is not yet bootable). Click on the folder icon and from their
file explorer select the CentOS stream 9 ISO file which they downloaded earlier.

Figure 7 - Inserting ISO file to install


Once the CentOS 7 installer has booted up, you will see the installer welcome screen. Choose the
"Install CentOS 7" option to start the installation process.

Figure 8 – Installation progress

Next, user is prompted to choose their preferred language.

Figure 9 - Keyboard configuration screen

Then click the network and hostname to assign the servers static ip address to the server
and the server’s hostname.

Figure 10 - Setup network & hostname


To configure network, click on the "Configure" button.

Figure 11 - network configuration menu


After that , assign the ip address to 172.20.10.5 for server , net mask , and default gateway.

Figure 12 – Setup the network address


After finish the network configuration. We need to go back to the home page and click on
"Begin Installation" to start the installation process. While the installation is in progress,
you can set the root password and create a user account by clicking on the "Root
Password" and "User Creation" options respectively.

Figure 13 – root password for user admin


Then create user because when you log in as the root user, you have administrative
privileges and can perform any system-level tasks, including modifying critical system
files. By creating a user account with limited privileges, you can reduce the risk of
unauthorized access or accidental modifications to the system.

Figure 14 – create user account


Next, return to the installation summary page and select installation destination and
you will be prompted to select the destination disk for CentOS 9 installation. If you
have multiple disks, choose the disk on which you want to install CentOS 9. You will
need to decide on a partitioning scheme. If you are unsure, you can choose the
"Automatic" option.

Figure 15 – installation destination


Finally, once the installation is complete, click on "Reboot" to restart the virtual machine.
After the virtual machine restarts, you can log in with the user account that you created
during the installation. You can then perform additional configurations and install any
required packages to customize the system as per your needs as shown below.

Figure 16 – Successful log in to Centos 9


SECTION 3: WEB SERVER INSTALLATION AND CONFIGURATION

Step 1: Configuration in the server before installing Web Server

before we install the web server, we have changed the dhcp ip to static by using the
command “sudo vi /etc/sysconfig/network-scripts/ifcfg-172.20.10.5 and then we add the
following lines to set the IP address, net mask, gateway, and DNS servers for our network
and restart the network service by running the “sudo systemctl restart network” command.

Figure 18 – Change dhcp to static IP


Next, we install the apache web server by running the “sudo dnf install httpd” command to
making it available for us to use a web server.

Figure 19 – Installation web server

Next, once the installation is complete, we start the Apache service by running “sudo
systemctl start httpd” and we enable the Apache service to start automatically at boot
time by running the “sudo systemctl enable httpd” command.

Figure 20 - web server installation


Step 2: Install MariaDB

MariaDB is a popular open-source relational database management system that is


compatible with MySQL. We install it on CentOS 9 with the following command below

Figure 21 – MariaDB installation

Figure 22 - Update system packages and repositories


With the installation complete, now we should start the mariadb service by running the
“sudo systemctl start mariadb” command and Enable the MariaDB service to start
automatically at boot time by running the “sudo systemctl enable mariadb” command.

Figure 24 – Enable MariaDB service

Now we run the security script to secure the MariaDB installation using a “sudo
mysql_secure_installation” command. This script will prompt us to set the root password,
remove anonymous users, disable remote root login, and delete the test database.

Figure 25 – Security script for MariaDB


Step 3: Install PHP

PHP is a popular server-side scripting language for creating dynamic websites so the
command that we use to install PHP on CentOS 9 is “sudo dnf install php php-common
php-mysqlnd php-gd php-mxi php-cli php-opcache php-mbstring”

Figure 26 – Installation of PHP

Finally, our PHP is successfully installed, after the installation process, we restart the Apache
service to apply the changes using sudo systemctl restart httpd

Figure 27 – PHP installation


Step 4: Install WordPress

WordPress is a popular open-source content management system for creating blogs,


websites, and online stores. We can download the most recent version of WordPress from
its official website using “wget https://wordpress.org/latest.tar.gz” command.

Figure 28 – Install latest version WordPress

Next After the extraction process, we set the appropriate ownership and permissions to
the WordPress directory by running the “sudo chown -R apache:apache
/var/www/html/wordpress” and “sudo chmod -R 755 /var/www/html/wordpress”

Figure 29 – Creating permission to wordpress


Step 5: Create a MariaDB Database and User for WordPress

Before you can install WordPress, you need to create a MariaDB database and user for it.
Log in to the MariaDB shell as the root user using “sudo MySQL –u root -p” command.

Figure 30 – Create a MariaDB database and user for WordPress.

Step 6: Search the Web Server IP Address on The Client Computer

Before you can install WordPress, you need to create a MariaDB database and user for it.
Log in to the MariaDB shell as the root user using “sudo MySQL –u root -p” command.

Figure 31 – Search the Web Server IP Address.


SECTION 4: DNS SERVER INSTALLATION AND CONFIGURATION
STEP 1 – Installing Bind extension

The bind package provides the named daemon, which is a Domain Name System (DNS) server
implementation. In CentOS 9, the bind package is available in the default package repositories
and can be installed using the package manager, dnf.

Install and configure BIND (Berkeley Internet Name Domain) on your CentOS 9 server:

Figure 41 - Installing Bind Extension


STEP 2 – Configure DNS Server

Open the BIND configuration file /etc/named.conf using a text editor:

Figure 42 - Configure named file


STEP 3 – Create and Configure Zone File

Create forward zone files which sudo vi /var/named/matkpmim.com.zone and reverse


zone files is sudo vi /var/named/ 10.20.172.in-addr.arpa.zone

Figure 43 – Create Forward Zone File

Figure 44 – Create Reverse Zone File


STEP 4 – Enable and Start the DNS Service

Start, enable, restart and show status of the DNS service

Figure 45 – Start the DNS Service

STEP 5 – Firewall Configuration

We must allow the DNS service default port 53 through firewall.

Figure 46 – Configure and Restart DNS Firewall


STEP 6 – Applying DNS Server to website

Add the following virtual host configuration to the vhosts.conf file:

Figure 47 – Add VirtualHost to Apache default page

The above configuration sets up a virtual host for your website on port 80 (HTTP) and
specifies the server’s name, document root directory, error log file, and access log file for
your website.

STEP 7 – Testing DNS Server

Add the following virtual host configuration to the vhosts.conf file:

Figure 48 – Nslookup and dig DNS


SECTION 5: SAMBA FILE SERVER INSTALLATION AND CONFIGURATION
STEP 1 – Installing Samba extension

Binary packages of Samba are included in almost any Linux distribution. We install the samba
package from the terminal in CentOS with the following code “sudo dnf install samba samba-
client samba-common”.

Figure 52 - Installing Samba


STEP 2 – Configure Samba

The next step is Create a backup of the original Samba configuration file using “sudo cp
/etc/samba/smb.conf /etc/samba/smb.conf.bak” and then we open the samba
configuration file using a text editor. The command is “sudo vi /etc/samba/smb.conf”.

Figure 53 - Configuring Samba


STEP 3 – Create a Samba User

We can complete this by using the command “sudo useradd -M -s /sbin/nologin


yoidashi/min”.Next we set a password for the use account using “sudo smbpasswd –a
sambauser” and enter the password when prompted.

Figure 54 – Create a Samba User


STEP 4 – Start Samba Service

We can complete this by using the command “sudo systemctl start smb”. Then, enable the
samba service to start automatically on system boot using “sudo systemctl enable smb”.

Figure 55 – Start Samba Service


STEP 5 – Configure Firewall

Allow Samba traffic through the firewall by typing “sudo firewall-cmd --add-service=samba
--permanent”. After that, we need to reload the firewall rules using “sudo firewall-cmd –
reload” command.

Figure 56 - Adding configuration to smb.conf


STEP 6 – Connect from Windows Client

Lastly, on the Windows client, we must open File Explorer and type the address bar
\\172.20.10.5\matkpmim and we can enter the Samba user account and password that we
created earlier.

Figure 57 – Connect from windows Client


STEP 7 – Testing Server and Client File Sharing

First, we go to our Window client and open This PC directory. Then right-click on This PC on
the left side of the screen and choose map network drive option. Then, we choose any
drive from the list and type “//ipaddress/share/” and press ‘Finish’ afterward.

Figure 58 - Mapping network drive for Samba

Now our screen will be the same as the figure below. From here we can add or remove a file,
as the same can be done on our server and it is shown here.

Figure 59 - Share drive in Windows client


REFERENCES

1. Negus, Christopher. Linux Bible, 9th Edition. John Wiley & Sons, 2015.

2. Blum, Richard, and Christine Bresnahan. Linux Command Line and Shell Scripting Bible.
John Wiley & Sons, Inc., 2021.

3. Unixmen. (2014, September 2). Setting up DNS server in CentOS 7. Unixmen.


https://www.unixmen.com/setting-dns-server-centos-7/
4. Tecmint. (2019, September 16). How to Install WordPress with Apache on
CentOS/RHEL/Fedora. Tecmint. https://www.tecmint.com/install-wordpress-with-
apache-on-centos-rhel-fedora/
5. Server World. (n.d.). Samba server installation on CentOS Stream 9. Retrieved March 7,
2023, from https://www.server-
world.info/en/note?os=CentOS_Stream_9&p=samba&f=1
6. DigitalOcean. (n.d.). How to install Linux, Apache, MariaDB, PHP (LAMP) stack on CentOS
8. Retrieved March 7, 2023, from
https://www.digitalocean.com/community/tutorials/how-to-install-linux-apache-
mariadb-php-lamp-stack-on-centos-8
7. Kingsolver, S. (2019, November 19). How to set up quick and easy file sharing with Samba.
TechRepublic. https://www.techrepublic.com/article/how-to-set-up-quick-and-easy-
file-sharing-with-samba/
APPENDIX A

NAME : WAN AHMAD QAYYIM BIN WAN YAZMAN


ID NUMBER: ICN21-07-039
CLASS: DCN 5A
JOB OF DESCRIPTION:

Date Detail

19/2/2023 1) Analyze the questions and divide the task among the group
members.

21/2/2023 1) Discuss among the group members and download which Linux
distribution to use.

26/2/2023 1) Conduct research on essential services for its installation and


configuration on CentOS 9

1) Do research about webserver and dns services.


27/2/2023 Install and configure apache and bind on server.
Try run the apache and bind on server.

5/3/2023 1) Finalize other services and start doing the documentation and
compile.

6/3/2023 1) Print the documentation

1
APPENDIX B

NAME : AHMAD MUHAIMIN BIN MOHD TAMIZI


ID NUMBER: ICN21-07-042
CLASS: DCN 5A
JOB OF DESCRIPTION:

Date Detail

19/2/2023 1) Assess the questions and assign tasks to group members.

21/2/2023 2) Discuss which Linux distribution to use with the group


members and download it.

25/2/2023 3) Conduct research on CentOS 9 and its installation and


configuration

2) Do research about samba file sharing services.


26/2/2023 Install and configure samba on server.
Try run the samba on server.

3/3/2023 1) Edit the wordpress website.

4/3/2023 1) Start do the documentation

5/3/2023 1) Print the report

You might also like