20-CP-09 SP Assignment 2
20-CP-09 SP Assignment 2
Taxila
System Programming
Assignment # 02
SUBMITTED TO:
Dr. Zahid Mehmood
SUBMITTED BY:
MUHAMMAD UBAID ASHRAF 20-CP-09
Semester: 8th
Questions
Question 1:
You need to configure the Squid server in the RedHat Enterprise CENTOS LINUX
platform for the following given scenarios:
Part a)
Set the hostname of your CENTOS LINUX pc as your name along with uet e.g.
aliuet.
Answer:
Part b)
Install two LAN cards in your CENTOS LINUX PC and configure one LAN card (Use
for Squid Internal Network) with any class B network of your choice and configure a
second LAN card (Use for Squid External Network) with any class A network of
your choice.
Answer:
Power off the machine, open network settings to add adapters. In our case, adapter are
already setup.
We setup first adapter as internal network which will be used as squid internal
network:
For the second adapter, we setup it as bridged which will be used as squid external
network.
Part c)
Verify that the Squid server is installed and running on your PC at system startup
automatically (install Squid server if it is not installed after querying at RedHat
Enterprise LINUX platforms).
Answer:
Install squid server:
Then verify if it’s running:
Part d)
Add Squid Server port in LINUX Firewall.
Answer:
Part e)
Configure the squid server so that it can share the internet on clients' computers
according to the requirements of part b of Q1.
Answer:
Edit the squid configuration file:
gedit /etc/squid/squid.conf
There we add, acl internal_network src 172.16.0.0/24
Then we create some rules for our squid server in the confguration fle:
Setting up the proxy on port 3128, we get access to the sites and the blocked sites are
blocked:
Question 3:
Deploy an Asterisk voice-over IP (VOIP) server that provides a calling feature
between two IP softphone clients. (10)
Answer:
Following are the steps to install Asterisk Server on Centos7:
Step 1: Installing necessary packages:
Command:
yum install gcc gcc-c++ php-xml php php-my php-pear php-mbstring
mariadb-devel mariadb-server mariadb ite-devel lynx bison gmime-devel psmisc
tftp-server httpd make ncurses-devel libtermcap-devel sendmail sendmail-cf caching-
nameserver sox newt-devel libxml2-devel libtiff-devel audiofile-devel gtk2-devel
uuid-
devel libtool libuuid-devel subversion kernel-devel kernel-devel-$(uname -r) git
subversion kernel-devel php-process crontabs cronie cronie-anacron wget vim
Output:
Step 2. Installing jansson library
Jansson package is not available with yum utility so we need to download its zip file
manually
from digip.org website.
Command:
wget http://www.digip.org/jansson/releases/jansson-2.7.tar.gz
Output:
Step 3. Extracting Jansson Package
Command:
tar -zxvf jansson-2.7.tar.gz
Output:
Step 4. Change directory and Configure the Jansson package
Command: cd jansson-2.7/
Command: ./configure –prefix=/usr
Output:
Step 5. Make Jansson
Command: make
Output:
Command: make && make install
Command: ldconfig
Output:
ssh-keygen
Follow the prompts and keep the default options. This will create a public key (id_rsa.pub) and a
private key (id_rsa) in the ~/.ssh directory.
Copy the public key to the receiving Linux PC using the ssh-copy-id command:
ssh-copy-id username@remote_host
You'll be prompted to enter the password for the remote host. Once done, SSH key-based
authentication will be set up.
Transfer Files Using SCP:
With SSH and SCP set up, you can now transfer files securely between the Linux PCs using the
SCP command. The basic syntax for SCP is:
scp /path/to/local/file username@remote_host:/path/to/destination
Replace /path/to/local/file with the path to the file you want to transfer.
Replace username with the username on the remote Linux PC.
Replace remote_host with the IP address or hostname of the remote Linux PC.
Replace /path/to/destination with the path where you want to save the file on the remote Linux
PC.
Example of Using SCP in a Script:
You can create a script to automate file transfers using SCP. For example, create a file named
transfer_files.sh and add the following content:
#!/bin/
# Define variables
local_file="/path/to/local/file"
remote_username="username"
remote_host="remote_host"
remote_destination="/path/to/destination"
User Accounts:
Create five user accounts on the CentOS Linux platform using the useradd command. For
example:
Install Samba:
Install Samba on the CentOS Linux platform using the package manager. For example, on
CentOS, you can run:
path = /shared_folder1
valid users = user1
read only = yes
[share2]
path = /shared_folder2
valid users = user2
read only = no
[share3]
path = /shared_folder3
valid users = user3
read only = no
writable = yes
[share4]
path = /shared_folder4
valid users = user4,user5
read only = no
writable = yes
[share5]
path = /shared_folder5
valid users = user5
read only = no
writable = yes
Join Samba Server to Active Directory (Continued):
After installing the necessary packages and configuring the Samba server, you can join it to the
Active Directory domain using the realm command. Make sure to replace example.com with
your actual domain name and provide the appropriate administrative credentials: