0% found this document useful (0 votes)
11 views33 pages

Linux Unit 4

The document provides an overview of DNS servers, explaining their function in translating human-friendly domain names into IP addresses. It details the types of DNS servers, including Primary/Master, Secondary/Slave, and caching servers, along with the DNS lookup process and steps for setting up both cache-only and primary name servers using BIND on Linux. Additionally, it outlines the configuration files and parameters necessary for establishing these servers.

Uploaded by

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

Linux Unit 4

The document provides an overview of DNS servers, explaining their function in translating human-friendly domain names into IP addresses. It details the types of DNS servers, including Primary/Master, Secondary/Slave, and caching servers, along with the DNS lookup process and steps for setting up both cache-only and primary name servers using BIND on Linux. Additionally, it outlines the configuration files and parameters necessary for establishing these servers.

Uploaded by

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

www.acuityeducare.

com
0

Acuity Educare

LINUX SYSTEM
ADMINISTRATION
SEM : V
SEM V: UNIT 4

607A, 6th floor, Ecstasy business park, city of joy, JSD


road, mulund (W) | 8591065589/022-25600622

Abhay More abhay_more


TRAINING -> CERTIFICATION -> PLACEMENT BSC IT : SEM - V : LINUX – U4

Q. What is DNS server? List and explain DNS server Types.

• Computer only understand numbers (IP address) but it is very difficult for humans to rememberIP
address.
• Domain Name System (DNS) provides solution by associating hostnames with IP addresses. It
converts the people friendly names into computer friendly numbers called IP address.
• Each time we type a Web site’s address into browser, the Domain Name System (DNS)
converts it into IP address.
The DNS Hierarchy

• DNS is a worldwide hierarchical system.


• The root domain is at the top of the DNS hierarchy. This is the domain that is not directly visiblein DNS
names but is used to connect all of the top-level domains together.
• Within DNS, a name server can be configured to administer just the servers within its domain. Often, a
name server is also configured to administer the information in subdomains. The entireportion of DNS
for which a name server is responsible is referred to as a zone.

• In above figure part of the DNS hierarchy is shown. There are a few subzones under
example.com in this hierarchy.
• For example: When we type www.example.edu in browser, first it goes to root name server for
.edu for information. The root name server then directs the search to a lower-level domainname
server.

• After we find the domain, information about that domain is provided by its local domain name
servers.

DNS Server Types

• The three types of local domain name servers are Primary/master, Secondary/slave, and
caching servers.
• Primary/Master name server:
• Every zone has at least a primary name server, also referred to as the master name server.
• This server is responsible for a zone and modifications can be made to this server.
• To increase redundancy in case the master name server goes down, zones are also often configured with
Page 1 of 32
YouTube - Abhay More | Telegram - abhay_more
607A, 6th floor, Ecstasy business park, city of joy, JSD road, mulund (W) | 8591065589/022-25600622
TRAINING -> CERTIFICATION -> PLACEMENT BSC IT : SEM - V : LINUX – U4

a secondary or slave name server.


• To keep the primary and secondary name servers synchronized, a process known as zone transfer is
used. In a zone transfer, a primary server can push its database to the secondary name server, or the
secondary name server can request updates from the primary name server.
• The master contains all the information about the domain and gives this information when
requested.
• A master server is listed as an authoritative server when it contains the information you are
searching and it can provide that information.
• Apart from authoritative name servers, there are also recursive name servers. These are name servers
that are capable of giving an answer, but they don’t get the answer from their own database and use
cache. This is possible because, by default, every DNS name server caches its most recent request.

• Secondary/Slave name server:


• The slave DNS server is used as backup.
• In case the master server goes down or is not available the slave DNS server takes its place.
• This server contains the same information as the master DNS server and provides it when requested if
the master server cannot be contacted.
• In DNS traffic, both primary and secondary name servers are considered to be authoritative name
servers. This means that if a client gets an answer from the secondary name serverabout a resource
record within the zone of that name server, it is considered to be an authoritative reply. This is because
the answer comes from a name server that has direct knowledge of the resource records in that zone.

• Cache-only name server:


• A caching server does not provide information to outside sources; it is used to provide domain
information to other servers and workstations on the local network.
• The caching server remembers the domains that are accessed previously.
Caching server speeds up searches since the domain information is already stored in memory.

Q. Explain DNS Lookup Process

• To get information from a DNS server, a client computer is configured with a DNS resolver.
• This is the configuration that tells the client which DNS server to use. If the client computer is aLinux
machine, the DNS resolver is in the configuration file /etc/resolv.conf
• In the DNS resolver, more than one name server is often configured to handle cases where thefirst
DNS server in the list is not available.
• Let’s assume that a client is in the example.com domain and wants to get the resource record for
www.google.com. The following will occur:

1. When the request arrives at the name server of example.com, this name server will check its cache. If
it has recently found the requested resource record, the name server will issue a recursive answer from
cache, and nothing else needs to be done.
2. If the name server cannot answer the request from cache, it will first check whether a forwarder has
been configured. A forwarder is a DNS name server to which requests are forwarded that cannot be
answered by the local DNS server. For example, this can be thename server of a provider that serves
many zones and that has a large DNS cache.
Page 2 of 32
YouTube - Abhay More | Telegram - abhay_more
607A, 6th floor, Ecstasy business park, city of joy, JSD road, mulund (W) | 8591065589/022-25600622
TRAINING -> CERTIFICATION -> PLACEMENT BSC IT : SEM - V : LINUX – U4

3. If no forwarder has been configured, the DNS server will resolve the name step-bystep. In the first step,
it will contact the name servers of the DNS root domain to find out how to reach the name servers of
the .com domain.
4. After finding out which name servers are responsible for the .com domain, the local DNSserver, which
still acts on behalf of the client that issued the original request, contacts a name server of the .com
domain to find out which name server to contact to obtain information about the google domain.
5. After finding the name server that is authoritative for the google.com domain, the name server can
then request the resource record it needs. It will cache this resource record and send the answer back
to the client.

Q. Explain steps for Setting Up a Cache-Only Name Server

• Domain Name System (DNS) is used for name address resolution.


• Name address resolution is the conversion of people friendly names into computer friendlynumbers
called IP address.
• The Berkeley Internet Name Domain (BIND) service is used to offer DNS services on Red Hat Enterprise
Linux.

Cache-Only Name Server

• Cache-Only name server is useful when optimizing DNS requests in your network.
• To configure a cache-only name server install the BIND service and make sure that it allows incoming
traffic.
• Once the resource record is found, BIND stores it in cache.This means that the next time a client needs
the same information, it can be provided much faster. It will do the recursion on behalf of all clients.
• Normally, A Forwarder is also configured with cache-only name servers.

Steps:

1. Open a terminal, log in as root, and run #yum install bind* on the host computer to install the bind
package.
2. With an editor, open the confi guration file /etc/named.conf.
# vi /etc/named.conf

3. Change the file to include the following parameters:


listen-on port 53 { any;
};allow-query { any; };

This opens your DNS server to accept queries on any network inter face from any client.
4. In /etc/named.conf, change the parameter
dnssec-validation; to dnsserver-validation no;

5. Finally, insert the line

Page 3 of 32
YouTube - Abhay More | Telegram - abhay_more
607A, 6th floor, Ecstasy business park, city of joy, JSD road, mulund (W) | 8591065589/022-25600622
TRAINING -> CERTIFICATION -> PLACEMENT BSC IT : SEM - V : LINUX – U4

forwarders x.x.x.x

in the same configuration file and give it the value of the IP address of the DNS server we normally use
for our Internet connection. This ensures that the DNS server of our Internet provider is used for DNS
recursion and that requests are not sent directly to the name serversof the root domain.

6. Use the service named restart command to restart the DNS server.
7. From the RHEL host, use
dig redhat.com

You should get an answer, which is sent by your DNS server. We can see this in the SERVER line in the dig
response.

Q. Explain Steps for Setting Up a Primary/Master Name Server

• Domain Name System (DNS) is used for name address resolution.


• Name address resolution is the conversion of people friendly names into computer friendly
numbers called IP address.
• The Berkeley Internet Name Domain (BIND) service is used to offer DNS services on Red Hat
Enterprise Linux.

Primary/Master Name Server


• Open a terminal, log in as root, and run #yum install bind* on the host computer to install thebind
package.
• To set up a primary name server, you’ll need to define a zone. This consists of two parts. First you’ll
need to tell the DNS server which zones it has to service, and next you’ll need to create a configuration
file for this zone.

Step 1:

• Modify the /etc/named.conf file. With an editor, open the confi guration file /etc/named.conf.
# vi /etc/named.conf
• The first line is important. It is the directory line that tells named.conf in which directory on the Linux
file system it can find its configuration. By default, it is set to /var/named.

options {
directory “/var/named”;
listen-on port 53 { any; };
allow-query { any; };
forwarders { 8.8.8.8; };
};
• To tell the DNS server which zones it has to service, you need to include a few lines in
/etc/named.conf. In these lines, you’ll tell the server which zones to service and where the
configuration files for that zone are stored. Add two zones, one for the forward lookup of server, and
one for the reverse lookup.
Page 4 of 32
YouTube - Abhay More | Telegram - abhay_more
607A, 6th floor, Ecstasy business park, city of joy, JSD road, mulund (W) | 8591065589/022-25600622
TRAINING -> CERTIFICATION -> PLACEMENT BSC IT : SEM - V : LINUX – U4

• For the forward lookup, we need to add the following.

zone “example.com” IN{ notify no;


type master;
file “example.com”;
};
• The first line, zone "example.com" IN, tells named that it is responsible for a zone with the name
example.com that is of the type IN. This means this zone is providing IP addresses.
• Next, definition of Zone in braces, the first line says don’t notify slave servers, the second line tells
named that this is the master server. The third line tells named that the configuration file is
example.com.

• For the reverse lookup we add this section:

zone “1.168.192.in-addr.arpa” IN{


notify no;
type master;
file “example.rev”;
};

• Now named knows where to find the zone configuration file, you’ll also need to create a configuration
for that zone file.

Step 2:Add two more files to complete the master configuration.

• First create the file /var/named/example.com


• A zone file consists of two parts. The first part is the header, which provides generic informationabout
the timeouts that should be used for this zone.
Two parameters very important in header. The first is $ORIGIN example.com. This
parameter tells the zone file that it is the zone file for the example.com domain. This means
that anywherea domain name is not mentioned, example.com will be assumed as the default
domain name.

The second parameter in the header file is where the SOA is defined. This line specifies which
name server is authoritative for this DNS domain:

$TTL 1D

$ORIGIN example.com.

@ IN SOA main.example.com.

hostmaster.exampl
e.com. (20120822
;

Page 5 of 32
YouTube - Abhay More | Telegram - abhay_more
607A, 6th floor, Ecstasy business park, city of joy, JSD road, mulund (W) | 8591065589/022-25600622
TRAINING -> CERTIFICATION -> PLACEMENT BSC IT : SEM - V : LINUX – U4

se
rial

3H ; refresh

15 ; retry

1W ; expire

3h ; minimum TTL

# Next add name server and mail exchange information.

IN NS
main.example.com.main
IN A 192.168.1.1

branch IN A 192.168.1.2

mailex IN A 192.168.1.3

router IN CNAME mailex

IN MX 10
mailex.example.com.IN
MX 20
mailex.provider.com.

Where,

• Next set up the reverse lookup zone file which is called /var/named/example.rev
$TTL 1D
@ IN SOA main.example.com.(

200005203; Serial
8h ;
Refre
sh

2h ; Retry

1w ; Expire

1d) ; Minimum TTL

• Next add the information about name servers and the IP addresses.NS
main.example.com

Page 6 of 32
YouTube - Abhay More | Telegram - abhay_more
607A, 6th floor, Ecstasy business park, city of joy, JSD road, mulund (W) | 8591065589/022-25600622
TRAINING -> CERTIFICATION -> PLACEMENT BSC IT : SEM - V : LINUX – U4

SOA Each zone file has only one SOA

The start of authority (SOA) is the first line in the zone file.

The SOA identifies the name server as the authoritative source for informationabout that
domain.

@ IN SOA main.example.com (

@ means “to look at this domain.”

IN means Internet.

SOA means Start of authority.


Authoritative server main.example.com.

A Address
Matches a name to an IP address

Serial The serial number of the file

Secondary servers compare this number with their stored information. If the numbers are
the same, the information has not changed, and it is not necessary
to download this file.
Refresh The amount of time the server should wait before refreshing its data

Retry The amount of time the server should wait before attempting to contact theprimary
server if the previous attempt failed

Expire If the secondary master is not able to contact a primary master during the
specified period, the data expires and should be removed.

TTL Specifies the time to live for the data. This parameter is intended for cachingname
servers and tells them how long to hold the data in their cache.
NS Name servers in domain

MX The mail exchange record. The MX record specifies the mail servers for thedomain.

CNAME Canonical name


Creates alias names for specific hosts

Page 7 of 32
YouTube - Abhay More | Telegram - abhay_more
607A, 6th floor, Ecstasy business park, city of joy, JSD road, mulund (W) | 8591065589/022-25600622
TRAINING -> CERTIFICATION -> PLACEMENT BSC IT : SEM - V : LINUX – U4

1 PTR router.example.com

Where,

NS Name servers in this domain (name server record)


Shows the names of the name servers.

PTR Pointer for address name mapping (Pointer type resource record)Used to
point to the name servers.

Q. What are DNS Zones? List and Explain different DNS Zone Types.
What is the use of zone file? Explain with suitable example.
What is zone files and reverse zone files

DNS Zone Types

• Most DNS servers are configured to service at least two zone types.

Zone:

• First there is the regular zone type that is used to find an IP address for a hostname. This is themost
common use of DNS.
• The Zone file contains the names and addresses of servers and workstations in the localdomain
and maps names to IP addresses.
In forward address resolution, we provide name to find an IP number. Forward addressresolution is
most common name resolution.

Reverse Zone:

• In some cases, it is needed to find the name for a specific IP address. This type of request is handled by
the in-addr.arpa zones.
• In in-addr.arpa zones, PTR resource records are configured. The name of the in-addr.arpazone is
the reversed network part of the IP address followed by in-addr.arpa.
• For example, if the IP address is 192.168.1.1, the in-addr.arpa zone would be 1.168.192.in- addr.arpa.
Page 8 of 32
YouTube - Abhay More | Telegram - abhay_more
607A, 6th floor, Ecstasy business park, city of joy, JSD road, mulund (W) | 8591065589/022-25600622
TRAINING -> CERTIFICATION -> PLACEMENT BSC IT : SEM - V : LINUX – U4

The name server for this zone would be configured to know the names of all IP addresses within that
zone.
• Although in-addr.arpa zones are useful, they are not always configured. The main reason isthat
DNS name resolving also works without in-addr.arpa zones; reverse name resolution is required in
specifi c cases only.
Note: Refer Step 2 of Master DNS Server for Zone files.

Q. Explain Steps for Setting Up a Secondary/ Slave Name Server

• Domain Name System (DNS) is used for name address resolution.


• Name address resolution is the conversion of people friendly names into computer friendly
numbers called IP address.
• The Berkeley Internet Name Domain (BIND) service is used to offer DNS services on Red Hat
Enterprise Linux
• After setting up a primary name server, you should add at least one secondary name server.
• A secondary server is one that synchronizes with the primary.

Slave/Secondary Name Server

Step 1: (On Master Server)

• To enable Slave DNS Server, you must first allow the primary Server to transfer data. You dothis by
setting the allow-transfer parameter for the zone.
• It’s also a good idea to set the notify yes parameter in the definition of the master zone. Thismeans
that the master server automatically sends an update to the slaves if something has changed.
• Modify the /etc/named.conf file in Master DNS Server.
options {
directory
“/var/named”; listen-on
port 53 { any; };allow-
query { any; };
forwarders { 8.8.8.8; };

allow-transfer { 192.168.1.2;};

};

• For the forward lookup, we need to add the following.


zone “example.com” IN{
notify yes;
type master;

file “example.com”;

allow-transfer { 192.168.1.2;};

};

• For the reverse lookup we add this section:


Page 9 of 32
YouTube - Abhay More | Telegram - abhay_more
607A, 6th floor, Ecstasy business park, city of joy, JSD road, mulund (W) | 8591065589/022-25600622
TRAINING -> CERTIFICATION -> PLACEMENT BSC IT : SEM - V : LINUX – U4

zone “1.168.192.in-addr.arpa” IN{


notify yes;
type master;
file “example.rev”;

allow-transfer { 192.168.1.2;};

};

Step 2: (On Slave Server)

• Open a terminal, log in as root, and run #yum install bind* on the host computer to install thebind
package.
• Modify the /etc/named.conf file. With an editor, open the confi guration file /etc/named.conf.
# vi /etc/named.conf
options {

directory
“/var/named”; listen-on
port 53 { any; };allow-
query { any; };
forwarders { 8.8.8.8; };

};

• For the forward lookup, we need to add the following.


zone "example.com" IN {
notify
no; type
slave;

file "example.com";
masters { 192.168.1.1; };

};

• For the reverse lookup we add this section:


zone “1.168.192.in-addr.arpa” {
notify no;
type slave;
file “example.rev”;
masters { 192.168.1.1; };

};

• Now named knows where to find the zone configuration file, you’ll also need to create a
configuration for that zone file.
Step 3: Same as Step 2 of Master DNS Server

Page 10 of 32
YouTube - Abhay More | Telegram - abhay_more
607A, 6th floor, Ecstasy business park, city of joy, JSD road, mulund (W) | 8591065589/022-25600622
TRAINING -> CERTIFICATION -> PLACEMENT BSC IT : SEM - V : LINUX – U4

Q. Explain the option statement of named.conf file with atleast five parameters.
Wrie a note on statement of /etc/named.conf file
Explain server statement of named.conf file

There are many types of statements which are used in /etc/named.conf

• Option statement
• Zone statement
• Server Statements etc.

General Syntax:

<statement-1> ["<statement-1-name>"] [<statement-1-class>]

<option-1>;

<option-2>;

<option-N>;

};

• Option Statement
• The options statement contains global configuration options
• Syntax: option statement
options
{

<option>;

[<option>; …]

• In /etc/named.conf file we add option statements for global configurations.

• Commonly used parameters with option statement are


allow-query Specifies which hosts are allowed to query the names server. By default allhosts
are allowd.

Blackhole Specifies which hosts are not allowed to query the nameserver. The defaultoption is
none.
This option is used when particular host floods the server with queries.
pid-file Specifies the location of the process ID file created by the named server.

Page 11 of 32
YouTube - Abhay More | Telegram - abhay_more
607A, 6th floor, Ecstasy business park, city of joy, JSD road, mulund (W) | 8591065589/022-25600622
TRAINING -> CERTIFICATION -> PLACEMENT BSC IT : SEM - V : LINUX – U4

listen-on Specifies the IPv4 netwrok interface on which the name server listens for queries.
listen-on-v6 Specifies the IPv6 network interface on which to listen for queries.
directory Specifies the working directory for the named server. The default option is
/var/named.
notify Specifies whether to notify the secondary name servers when a zone is updates.
It accepts following options
yes – the server will notify all secondary name servers.
no- the server will not notify any secondary nameserver
master-only - the server will notify primary server for the zone only.
explicit - the server will notify only the secondary servers.

Example:

Options

Listen-on {10.0.0.1;};

};

• Zone statement
• Zone statement defines the characteristics of a zone.
• Syntax:
zone<zone-name><zone-class>
{

<zone-options>;
[<zone-options>
…];

• In /etc/named.conf file we add two zones with the help of zone statements, one for the forward
lookup of server, and one for the reverse lookup.

• Commonly used parameters with zone statement are

• Defines the namespace for example.com zone file.


allow- Specifies the clients that are allowed to request information about this zone. The
query default is to allow all query requests.
Page 12 of 32
YouTube - Abhay More | Telegram - abhay_more
607A, 6th floor, Ecstasy business park, city of joy, JSD road, mulund (W) | 8591065589/022-25600622
TRAINING -> CERTIFICATION -> PLACEMENT BSC IT : SEM - V : LINUX – U4

allow- Specifies the slave servers that are allowed to request a transfer of the zone's

transfer information. The default is to allow all transfer requests.

allow- Specifies the hosts that are allowed to dynamically update information in their zone.

update The default is to deny all dynamic update requests.

notify Specifies whether named notifies the master servers when a zone is updated. This
directive accepts the following options

Yes – notifies slave servers

No – does not notify slave servers

Explicit – only nofies slave servefr specified in also-notify list.

type Define the type of zone. This directive accepts the following options
Forward – forwards all request to other name servers

Master – shows that this is the authorative server for this zone.Slave –
shows that this is the slave server for this zone.

file Specifies the name of the file in the named working directory that contains the zone
configuration data.

masters Specify the IP addresses of master server. This option is only used whe the type isslave.

Example:

For the forward lookup, we need to add the following.


zone “example.com” {
notify yes;
type slave;
file
“eg.com”;

masters { 192.168.1.1; };

};

• For the reverse lookup we add this section:


zone “1.168.192.in-addr.arpa” {
notify yes;
type
slave; file
“eg.rev”;

masters { 192.168.1.1; };

};
Page 13 of 32
YouTube - Abhay More | Telegram - abhay_more
607A, 6th floor, Ecstasy business park, city of joy, JSD road, mulund (W) | 8591065589/022-25600622
TRAINING -> CERTIFICATION -> PLACEMENT BSC IT : SEM - V : LINUX – U4

• Server Statement
• In the server statement we can set the properties of a remote server.
• We can specify whether to send queries to the remote server from the local server.
• We can set the method used for transferring information.

• Commonly used parameters with Server statement are


bogus Specify yes or no

no is the default and indicates that queries are sent to the remote server.Yes
means that the remote server is not required.
transfer Specify the number of transfers you want to allow.
transfer-format Specify whether you want one-answer or many answers.

Q. What is Dynamic Host Configuration protocol? Write a sample dhcpd.conf file.


How is DHCP client configured? Explain.
What is DHCP? Give steps to setup a DHCP Server

• The Dynamic Host Confi guration Protocol (DHCP) is used to assign IP-related configuration to hosts in
your network.
• Administrator manage IP-related configuration on a single, central location on the network, instead of
on multiple different hosts.

• When a client comes up, it will send a DHCP request on the network. This DHCP request issent as
a broadcast, and the DHCP server that receives the DHCP request will answer and assign an available
IP address. Because the DHCP request is sent as a broadcast, you can have just one DHCP server per
subnet. If multiple DHCP servers are available, there is no way to determine which DHCP server assigns
the IP addresses. In such cases, it is common to set up failover DHCP, which means that two DHCP
services together are servicing the same subnet, and one DHCP server completely takes over if
something goes wrong.
• Each client remembers by default the last IP address it has used. When sending out a DHCP request, it
will always request to use the last IP address again. If that IP address is no longer available, the DHCP
server will give another IP address from the pool of available IP addresses.

• Configuring DHCP Server

Step 1:
• Start the virtual machine, and open a root shell. From the root shell, use the following command
to install the DHCP server.
# yum install dhcp

Page 14 of 32
YouTube - Abhay More | Telegram - abhay_more
607A, 6th floor, Ecstasy business park, city of joy, JSD road, mulund (W) | 8591065589/022-25600622
TRAINING -> CERTIFICATION -> PLACEMENT BSC IT : SEM - V : LINUX – U4

Step 2:
• Open the file /etc/dhcp/dhcpd.conf with an editor, and give it the following contents.
# vi /etc/dhcp/dhcpd.conf

# The domain of DHCP Server

option domain-name "example.com";

# The IP address or Name of DNS Servers

option domain-name-servers 192.168.1.1;

# The amount of time in seconds that the host can keep the IP address.

default-lease-time 600;

#The maximum time the host can keep the IP address.

max-lease-time 1800;

#specify the subnet of DHCP Server

subnet 192.168.1.0 netmask 255.255.255.0

#The range of IP addresses that can be used.

range 192.168.1.10 192.168.1.20;

# IP address of routers/Gateways

options routers 192.168.1.1;

Step 3:

Start the DHCP server by using the command #service dhcpd start, and enable it using

#chkconfig dhcpd on.

• Configuring the DHCP Client


Step 4:
• First, you need to be sure that you NIC is properly configured and recognized by your system.After
that, it is easy to tell your system to use DHCP to obtain its IP information.

• Check if the dhcp client is installed on system. we can check for it by issuing the following
command:
o which dhclient

• If the client is on system, we will see the location of the file. If the file is not installed, we canfind
Page 15 of 32
YouTube - Abhay More | Telegram - abhay_more
607A, 6th floor, Ecstasy business park, city of joy, JSD road, mulund (W) | 8591065589/022-25600622
TRAINING -> CERTIFICATION -> PLACEMENT BSC IT : SEM - V : LINUX – U4

it on Red Hat Installation CD 1.


• Install the client using the rpm command. After we install the client software, start it by runningthe
command #dhclient
• Next Follow these steps.
1. Using a text editor, open the /etc/sysconfig/networkscripts/ifcfg-eth0 file.
2. Find the line bootproto=static.
3. Change static to dhcp.
4. Save your changes.
Restart the network by issuing the command # service network restart, and your system willreceive
its IP information from the DHCP server.

Q. Explain the components of email delivery process.


List and explain the key components that are essential for email to work. Explain in
short

Message Transfer Agent:

• If a user sends a mail message to a user on another domain on the Internet, it’s the responsibility of
the MTA to contact the MTA of the other domain and deliver the messagethere.
• To find out which MTA serves the other domain, the DNS MX record is used.
• The MTA uses the Simple Mail Transfer Protocol (SMTP) to exchange mail messages with other MTAs
on the Internet.
• When MTA receive a message, the MTA checks whether it is the final destination. If it is, it will deliver
the message to the local message delivery agent (MDA), which takes care of delivering the message
to the mailbox of the user. If the MTA itself is not the final destination, the MTA relays the message to
the MTA of the final destination.
• An MTA relay messages only for authenticated users or users who are known in some other way.
• If, for some reason, the MTA cannot deliver the message to the other MTA, it will queue it. Queuing
means that the MTA stores the message in a local directory and will try to deliver it again later. As an
administrator, you can flush the queues, which means that you can tell the MTA to send all queued

Page 16 of 32
YouTube - Abhay More | Telegram - abhay_more
607A, 6th floor, Ecstasy business park, city of joy, JSD road, mulund (W) | 8591065589/022-25600622
TRAINING -> CERTIFICATION -> PLACEMENT BSC IT : SEM - V : LINUX – U4

messages now.
• Upon delivery, it sometimes happens that the MTA, which contacted an exterior MTA and delivered the
message there, receives it back. This process is referred to as bouncing.
• In general, a message is bounced if it doesn’t comply with the rules of the receiving MTA or if the
destination user doesn’t exist.
• For example: sendmail, postfix, Qmail.

Mail Delivery Agent/ Local delivery Agent:

• When MTA receives the mail, it delivers it to the mail delivery agent.
• MDA is the software component that takes care of delivering the mail message to thedestination
user’s mailbox.
• The MDA delivers mail to the recipient’s local message store, which by default on Red Hat
Enterprise Linux is the directory /var/spool/mail/<username>.

• We can use the POP or IMAP server, which is an addition to a mail solution that makes it easierfor
users to get their messages, if they’re not on the same machine where the MDA is running.
POP server allows users to download messages on one machine whereas an IMAP
server allows users to connect to the mail server and read the messages while they are online.
• For example:
procmailMail User Agent
• Finally, the mail message arrives in the mail user agent (MUA). This is the mail client that endusers
use to read their messages or to compose new messages.
• Users install MUA which allows them to work with email on their computer, tablet, orsmartphone.
• Popular MUAa are Outlook, Evolution, and the Linux command-line Mutt tool, Pine.

Q. Explain SMTP, POP3 and IMAP4 protocols


SMTP

• Messages are sent between MTAs using SMTP.Other than SMTP there are two other protocolsused to
send mail, Post Office Protocol (POP3) and Internet Message Access Protocol (IMAP4).

• SMTP is the TCP/IP protocol for transferring e-mail messages between computers on a network.
Sometimes SMTP is known as store-and-forward protocol because messages transmitted via SMTP may
go directly from the sending to the receiving MTA or through other MTAs on other network computers.
The other MTA’s briefly store the message before they forward it to another MTA.

• The SMTP protocol can transfer only ASCII text. It can’t handle fonts, colors, graphics, or attachments.
If you want to be able to send these items, you need to add another protocol Multipurpose Internet Mail
Extensions, or MIME. MIME enables you to add colors, sounds, and graphics to your messages while
still enabling them to be delivered by SMTP. In order for MIME to work, you must have a MIME-
compliant MUA.

Page 17 of 32
YouTube - Abhay More | Telegram - abhay_more
607A, 6th floor, Ecstasy business park, city of joy, JSD road, mulund (W) | 8591065589/022-25600622
TRAINING -> CERTIFICATION -> PLACEMENT BSC IT : SEM - V : LINUX – U4

• The problem with SMTP is that it assumes the sending and receiving MTAs are alwaysconnected to the
internet.

POP3

 POP3 is the Post Office Protocol version 3. This protocol runs on a server that is connected toa network
and continuously sends and receives mail.

 The POP3 server stores any messages it receives. POP3 was developed to solve the problem of what
happens to messages when the recipient is not connected to the network.

 Without POP3, the message could not be sent to the recipient if the recipient is offline. But with POP3,
when you want to check your e-mail, you connect to the POP3 server to retrieve your messages that
were stored by the server. After you retrieve your messages, you can use the MUA on your PC to read
them.

 MUA has to understand the POP3 to be able to communicate with the POP3 server.

 With POP3 the messages you retrieve to your PC are then typically removed from the server. This means
that they are no longer available to you if you want to retrieve them to another PC.

IMAP4

• The Internet Message Access Protocol version 4 (IMAP4) provides sophisticated client/server
functionality for handling e-mail.

IMAP4 has more features than POP3. IMAP4 enables you to store your e-mail on a networked mail server,
just as POP3 does. The difference is that POP3 requires you to download your e- mail before your MUA
reads it, whereas IMAP4 enables your e-mail to reside permanently on a remote server, from which you can
access your mail. And you can do so from your office, your home, or anywhere else. MUA must understand
IMAP4 to retrieve messages from an IMAP4 server.

Q. Explain working of Mutt mail client.

Give steps to send mail messages with Mutt to the recipient on the local machine.

• Mutt is a Mail User Agent (MUA).


• It is mail client that end users use to read their messages or to compose new messages.
• It supports most mail storing formats (mbox and Maildir) and protocols (POP3, IMAP, etc.).

Page 18 of 32
YouTube - Abhay More | Telegram - abhay_more
607A, 6th floor, Ecstasy business park, city of joy, JSD road, mulund (W) | 8591065589/022-25600622
TRAINING -> CERTIFICATION -> PLACEMENT BSC IT : SEM - V : LINUX – U4

1. Log in as root, and install Mutt.


# yum -y install mutt

2. This sends an empty message to user rahul. Use command


# mail -s “hello” rahul <.

3. Use following command to become user Rahul to use Mutt.


# su –
rahul#
mutt

If we get a message that the mail directory for rahul doesn’t exist, type y to create it. You’ll now see the
Mutt interface.

4. Press Enter to open the mail message. Because it doesn’t contain any content, you’ll see the message
header.
5. Type q once you’ve finished reading the message.
6. To reply to the message, type r. Mutt will prompt us to choose which user want to send the message
and which subject line we want to use. Press Enter twice to accept the default suggestions.
7. The message composition window will open next. This is a vi window, so use o to open a new line and
start writing the message. Once we are finished writing, use the vi command :wq! to close the message-
editing interface.
8. Now you’ll see the message summary. From there, type y to send it to root. Next type q to quit Mutt.
Exit rahul’s su shell, and as root type mutt. You’ll see that rahul’s message has been delivered to inbox.

Q. Give steps to SetUp Postfix as an SMTP Server.

What is Postfix? Give Basic Configuration to Send a Message to an External User.


• Postfix is a Mail Transfer Agent (MTA).
• We can setup Postfix for two scenarios.
o Setup Postfix for local email delivery. (Refer Q3)
o set up Postfix for mail delivery to other domains on the Internet
• Postfix mail server cannot receive messages from other computers after a default installation.That
is because, by default, Postfix binds to the loopback IP address only.
To configure Postfix for basic email delivery, we need to open the server to the outside world tomake sure
that it binds to ports other than the loopback port. To do this, you’ll have to change a parameter in the
/etc/postfix/main.cf file.

Page 19 of 32
YouTube - Abhay More | Telegram - abhay_more
607A, 6th floor, Ecstasy business park, city of joy, JSD road, mulund (W) | 8591065589/022-25600622
TRAINING -> CERTIFICATION -> PLACEMENT BSC IT : SEM - V : LINUX – U4

Steps to Send a Message to an External User:

1. Open the /etc/postfix/main.cf file with an editor.


#vi /etc/postfix/main.cf

2. Find the parameter inet_interfaces = localhost, and put a hash sign in front of it.
3. Enable the parameter inet_interfaces = all by removing the pound sign in front of the line.
4. use #service postfix restart to restart the Postfix process. If a firewall is active, make sure thatpor t
25 is open on it.
5. use #su - lisa to become user lisa and start Mutt. You’ll notice that lisa still hasn’t received her
message yet.
6. As root on the host computer, type #mailq to type the current content of the mail queue.
7. Type #postfix flush to flush the mail queue. Postfix will now try to send the message again.

• For troubleshooting the message delivery process, use /var/log/maillog file. In this file, you’llfind
status information about the message delivery process.

• The mail queue is the list of messages that haven’t been sent yet because there wassome kindof
problem. As an administrator, we can use the mailq command to check the current contents of the
mail queue or use the postfix flush command to flush the entire mail queue. This means that you’ll tell
Postfix to process all messages that are currently in the mail queue and try to deliver them now.

Q. Explain different Secure Internet Configurations for Postfix.

• To make a secure Internet configuration, set parameters in the /etc/postfix/main.cf file.


• myhostname
• This parameter specifies the name of this host. If not specified, it is set to the full DNS domain name
(FQDN) of this host.
• mydomain
• This parameter specifies the domain of this host. If not set, the domain name part of the FQDN is used.
• myorigin
• This parameter determines the domain seen by the email recipient when receiving messages. The
default is to use the FQDN of this host. This means that if user rahul on server host1.example.com sends
a message, the recipient will see a message coming in from rahul@host1.example.com. use myorigin =
$mydomain.
• inet_interfaces
• This parameter specifies the IP addresses of the mail server to which it binds. By default, it is set to
localhost only, which means that our mail server cannot receive messages from the Internet. Use
inet_interfaces = all for sending mail to external users.
• mydestination
• This parameter contains a list of all domains for which this server will receive messages.
Messages that are addressed to users in other domains will be rejected.
• Make sure that this parameter contains a list of all domains serviced by this server. Change
$mydomain to on.

Page 20 of 32
YouTube - Abhay More | Telegram - abhay_more
607A, 6th floor, Ecstasy business park, city of joy, JSD road, mulund (W) | 8591065589/022-25600622
TRAINING -> CERTIFICATION -> PLACEMENT BSC IT : SEM - V : LINUX – U4

• mynetworks
• This parameter is optional. We can use it to specify the network address from which our MTA
accepts messages for relaying without further authentication.
• relayhost
• This parameter contains the name of a host that is used to relay all messages to. Use this if, for
example, we want the mail server of your ISP to take care of all message delivery.
To change any of these parameters make changes in /etc/postfix/main.cf, we can change the
configuration file by hand and restart Postfix.

Q. Explain Configuring Dovecot for POP and IMAP.


• After installing and configuring the Postfix MTA, users can connect to your server and read mail
messages using an MUA such as Mutt.
• Dovecot is the default service to provide POP and IMAP mail access that allow users to handle mail on
their own computers.
• When using POP, users can connect to the mail server and download messages to their own computers.
When using IMAP, users connect to the mail server and edit their messages on that mail server. POP
works fine for users who have one device to handle mail. IMAP works better for users who have multiple
devices to handle their mail.
• After a default installation of Dovecot, it will offer POP and IMAP. To configure POP, we can modify
/etc/dovecot/dovecot.conf file. There aren’t many changes that need to be done in thisfile.
• By default, Dovecot offers POP and IMAP over both a secure and an unsecure port. All we need to do
after installing Dovecot is to make sure it is started by using following commands.
# service dovecot startand # chkconfig dovecot on.

• By default messages are sent unencrypted in Dovecot. This means that passwords and other sensitive
information can be captured while in transit. For that reason, we should always use POP3S and IMAPS.

• Steps to create a Base Dovecot Configurat ion


1. As root on the host computer, use following commands to install the Dovecot service.
# yum -y install dovecot

2. Run following command to create some self-signed certificates for Dovecot, and install them in
the right locations.

/usr/libexec/dovecot/mkcert.sh

3. Use service dovecot start to start Dovecot.


4. As root mail rahul
# mail -s “hello” rahul <.

This sends an empty message to user rahul that has only a subject line.

5. Use # su - rahul to become Rahul and start Mutt using # mutt command.
6. From Mutt, hit c to change the mailbox you’re accessing, and enter the
URL
pop://rahul@localhost. This should give us access to our mailbox on the local computer.

Page 21 of 32
YouTube - Abhay More | Telegram - abhay_more
607A, 6th floor, Ecstasy business park, city of joy, JSD road, mulund (W) | 8591065589/022-25600622
TRAINING -> CERTIFICATION -> PLACEMENT BSC IT : SEM - V : LINUX – U4

7. Use c once more, and enter the URL pop3://rahul@localhost. You’ll now have access to themailbox
using the TLS version of POP3.

Q. Explain APACHE web server with its features.

What is Apache and explain different features of Apache.

Explain working and features of Apache web server.

• Apache is “A PAtCHy server.” It was based on some existing code and a series of “patch files.”

Apache features:

1. Speed: Apache is faster than many other Web servers, including commercial servers.
2. Configurability: Apache is also both easy to configure and easy to reconfigure.
Its configuration information is in plain text files and uses simple English-language directives.

Reconfiguring a running server is also simple, just change configuration directive and restart server.

3. Fewer Bugs: Apache has fewer bugs, Apache’s source code is freely available, so hundreds ofdevelopers
check it, find bugs, fix and submit fixes for inclusion in the code base.
4. Apache is easily extensible using Dynamic Shared Objects (DSOs), more commonly known as
modules. Modules extend Apache’s capabilities and add new features without requiring
recompilation because they can be loaded and unloaded at runtime, just as shared libraries are
dynamically loaded and unloaded.
5. Support very large number of users: Apache uses a binary database format for authenticating
users’ requests for password-protected Web pages. This format enables Apache to support very large
numbers of users.
6. Apache supports virtual hosts, also known as multi-homed servers, which enables a single machine to
provide Web services for multiple domains or IP addresses (or hostnames).
7. Apache enables administrators to define multiple directory index files, the default page to display
when a Web client requests a directory URL. So, for example, the server can return index.html,
index.htm, index.php, or execute a script named index.cgi when a client requests a directory URL,
depending on what Apache finds in the requested directory.
8. Apache has rich support for server logging. We can define custom log file formats and control the
level of detail contained in each log entry. Apache can be configured to generate a unique identifier that
distinguishes one hit from every other hit.

What is Content Negotiation?

9. Content Negotiation: Apache automatically adjusts to the capabilities of connected Web clients, a
process called content negotiation.
It refers to the technique web clients and servers use to select how to present a resource, such as a
document, that is unavailable in different format.

Page 22 of 32
YouTube - Abhay More | Telegram - abhay_more
607A, 6th floor, Ecstasy business park, city of joy, JSD road, mulund (W) | 8591065589/022-25600622
TRAINING -> CERTIFICATION -> PLACEMENT BSC IT : SEM - V : LINUX – U4

For example: suppose that a web page is available in different languages. One way to select proper
language is to give the user an index page from which he can choose desired language or sever can
choose preferred language automatically using content negotiation based on information a web browser
sends indicating its preference like browser can indicate that it likes to see web page in French, if
possible. If not French then English.

The web browser indicate preference by transmitting specific data in each HTTP request header.

Eg: accepted-language: fr (for only French)


accepted-language:fr; q=1.0, en; q=0.5 (preferable French else English)

If a Web client is broken in a way that Apache can determine, incompletely or improperly implements
HTTP standards, or does not support a given HTML specification (or, at least, the specification Apache
supports), it sends Web pages modified to give the best representation of the requested information
based on what the client can process.

Explain the working of Apache web server.


• When a Web browser requests a page the Apache Web server responds, following is the complete
working of APACHE web server.

• The Web client (a browser in this case) first performs a DNS lookup on the server name specified in the
URL, obtains the IP address of the server, and then connects to port 80 at that IP address (or another
port if the server is not using the default HTTP port).
• When the connection is established, the client sends an HTTP GET request for the documentin the
URL, which could be, specific HTML document, an image, a script, or a directory listing etc.
• After the server receives the request, it translates the document URL into a filename on thelocal
system. For example, the document URL http://localhost/college/news.html can become
/home/college/news.html.
• If the document requested has access control Apache Server ask for user name and passwordfrom the
client else reject the request depending on type of access control.

Page 23 of 32
YouTube - Abhay More | Telegram - abhay_more
607A, 6th floor, Ecstasy business park, city of joy, JSD road, mulund (W) | 8591065589/022-25600622
TRAINING -> CERTIFICATION -> PLACEMENT BSC IT : SEM - V : LINUX – U4

If the requested URL specifies a directory than a document, Apache looks for the directoryindex
page, index.html by default, and returns that document to the client. If the directory index page does
not exist, Apache send a directory listing in HTML format back to the client or send an error message,
depending on how the server is configured.

The document can also be a specially written script, a CGI (Common Gateway Interface) script.In this
case, Apache executes the script and sends the results back to the client.

 Finally, after Apache has transmitted the requested document and the client receives it, the
client closes the connection and Apache writes an entry in one or more log files.

Q. Give steps to Create a Basic Website

1. Use # yum -y install httpd to install the Apache web server.


2. Use # chkconfig httpd on to put the Apache web server in our server’s runlevels, and start itat every
boot.
3. Open a root shell, and go to the directory /var/www/html. In this directory, create a file with thename
index.html. In this file, put the content “welcome to my website” and then use servicehttpd start to
start the Apache web server.
# cd
/var/www/html#
vi indix.html

Welcome to my website
Esc:wq!

# service httpd start

4 Use elinks http://localhost to access the website we just created. We’ll notice that our webserver is up
and running.

Q. Give steps to Create a Basic Website

 Use # yum -y install httpd to install the Apache web server.


 Use # chkconfig httpd on to put the Apache web server in our server’s runlevels, and start itat every
boot.
 Open a root shell, and go to the directory /var/www/html. In this directory, create a file with thename
index.html. In this file, put the content “welcome to my website” and then use servicehttpd start to
start the Apache web server.
# cd /var/www/html
# vi indix.html

Welcome to my website
Esc:wq!

Page 24 of 32
YouTube - Abhay More | Telegram - abhay_more
607A, 6th floor, Ecstasy business park, city of joy, JSD road, mulund (W) | 8591065589/022-25600622
TRAINING -> CERTIFICATION -> PLACEMENT BSC IT : SEM - V : LINUX – U4

# service httpd start

 Use elinks http://localhost to access the website we just created. We’ll notice that our webserver is up
and running.

Q. Explain Apache Configuration File directives.

Explain configuration of Apache Web Server.

• All configuration directives of Apache server is in the /etc/httpd directory.


• There are two subdirectories: conf and conf.d.
• In /etc/httpd/conf directory we have Apache main configuration file httpd.conf. This httpd.conffile
is designed to contain the entire Apache configuration.

1. Install Apache

• Use # yum -y install httpd to install the Apache web server.

2. Configuration Directives

 Apache is highly configurable as it has large number of directives. The primary Apacheconfiguration
file, /etc/httpd/conf/httpd.conf is organized into three sections.

a. The first section configures Apache’s global characteristics/ Generic Parameters,


b. The second section configures the primary or default server (the Web server that
responds to all requests not handled by virtual hosts), and
c. The third section configures virtual hosts.

A. Global/Generic Parameters:

• The first section configures Apache’s global characteristics/ Generic Parameters:

List and Explain performance parameters for Apache Modes.

• Apache Mode
• Apache can be started in two different modes: the prefork mode and the worker mode.
• The prefork mode is the default mode. In this mode, a master httpd process is started, and this
master process will start different httpd servers.
• As an alternative, the worker mode can be used. In this mode, one httpd process is active, andit uses
different threads to serve client requests.
• There are various performance parameters for both modes.

ServerTokens OS
Page 25 of 32
YouTube - Abhay More | Telegram - abhay_more
607A, 6th floor, Ecstasy business park, city of joy, JSD road, mulund (W) | 8591065589/022-25600622
TRAINING -> CERTIFICATION -> PLACEMENT BSC IT : SEM - V : LINUX – U4

ServerRoot “/etc/httpd”

PidFile /var/run/httpd.pid

Timeout 60 KeepAlive Off


MaxKeepAliveRequests 100
KeepAliveTimeout 15

<IfModule prefork.c>
StartServers 8
MinSpareServers 5
MaxSpareServers 20
ServerLimit 256
MaxClients 256
MaxRequestsPerChild 4000
</IfModule>

<IfModule worker.c>
StartServers 4
MaxClients 300
MinSpareThreads 25
MaxSpareThreads 75
ThreadsPerChild 25
MaxRequestsPerChild 0
</IfModule>
Listen 80
Include conf.d/*.conf

Q. Write the purpose of following global/Generic configuration directives of httpd.conf

Directive Description
ServerTokens OS Defines the contents of the server’s HTTP response header.
ServerRoot /etc/httpd defines the root of the configuration directory
PidFile /var/run/httpd.pid Defines the file containing the PID of the master server process
Timeout 60 Defines the maximum time in seconds Apache waits for packet
send and receive operations to complete.
KeepAlive Off If set to On, maintains an open connection to a remote client in the
absence of direct contact for the time specified by KeepAliveTimeout.
MaxKeepAliveRequests 100 Sets the number of requests permitted per connection
KeepAliveTimeout 15 Sets the number of seconds permitted to elapse between requests from the
same client on the same connection when KeepAlive is On

Page 26 of 32
YouTube - Abhay More | Telegram - abhay_more
607A, 6th floor, Ecstasy business park, city of joy, JSD road, mulund (W) | 8591065589/022-25600622
TRAINING -> CERTIFICATION -> PLACEMENT BSC IT : SEM - V : LINUX – U4

StartServers 8 Defines the number of child servers created when Apache starts
MinSpareServers 5 Defines the minimum number of spare (idle) child servers permitted
MaxSpareServers 20 Defines the maximum number of spare (idle) child servers the master
server spawns
ServerLimit 256 Specifies the upper limit on the number of server processes or threads
running simultaneously.
MaxClients 300 Sets the maximum number of simultaneous connections (child servers)
supported
MaxRequestsPerChild 4000 Sets the maximum number of requests each child server fills before
terminating
Listen [ipaddress:]80 Combination of IP address and port on which Apache listens for
connections; multiple Listen directives may be used. If specific IP Address
not mentioned, it will bind to port 80 on all IP addresses that are available.

B. Configuring primary or default server(not in syllabus)

• The default or primary server refers to the Web server that responds to all HTTP requests not handled
by virtual hosts, also known as virtual servers.

• A virtual server or virtual host is a Web server that runs on the same machine as the default server but
that is distinguished from the main server by a different host name or IP address.

• Table shows directives used to configure the default server. Again, the default values for each
configuration directive, whether assigned by the Apache Group or by Red Hat, are shown in bold face.

Table: Default server configuration directives


Directive Description

Port 80 Defines the port on which the primary server listens for connectionif no
BindAddress or Listen directive specifies a port number with
:port; has no effect otherwise

User [#]apache Specifies the user name or, if prefixed with #, the UID under whichthe
child servers execute

Group [#]apache Specifies the group name or, if prefixed with #, the GID under whicthe
child servers execute

ServerAdmin root@localhost Defines the e-mail address included in error messages displayed tclient
connections

Page 27 of 32
YouTube - Abhay More | Telegram - abhay_more
607A, 6th floor, Ecstasy business park, city of joy, JSD road, mulund (W) | 8591065589/022-25600622
TRAINING -> CERTIFICATION -> PLACEMENT BSC IT : SEM - V : LINUX – U4

ServerName Specifies an alternative name for the server, such as


www.mydomain.com, that is different than the host’s actual name
(webbeast.mydomain.com)

DocumentRoot Sets the base directory from which all requested documents will b
“/var/www/html served; document URLs (file names) are interpreted relative to
” DocumentRoot; see also UserDir

ReadmeName README.html Defines README.html as the file whose contents will be appendeto the
end of a directory listing

Port 80
User apache
Group apache
ServerAdmin root@localhost
DocumentRoot “/var/www/html”

<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>

<Directory “/var/www/html”>
Options Indexes Includes FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
</Directory>
.
.
.
C. Configuring virtual servers

Table shows the Apache configuration directives that control the configuration and behavior ofvirtual
servers.

Table: VIRTUAL SERVER CONFIGURATION DIRECTIVES


Directive Description
ServerName fqdn Sets the name of the virtual server to the FQDN fqdn.

NameVirtualHost ipaddr[:port] Defines the IP address addr (listening on port, if specified) for a
name-based virtual host.

<Virtual Host ipaddr[:port]> Defines a virtual host whose IP address is addr (listening on port
Directives specified); directives are one or more of the directives listed
previously and override the directives listed for the default server
</VirtualHost>
Page 28 of 32
YouTube - Abhay More | Telegram - abhay_more
607A, 6th floor, Ecstasy business park, city of joy, JSD road, mulund (W) | 8591065589/022-25600622
TRAINING -> CERTIFICATION -> PLACEMENT BSC IT : SEM - V : LINUX – U4

ServerAlias altname Enables the virtual server to respond to one or more alternate ho
names altname when used with name-based virtual hosts.

Listing: A typical virtual server definition might resemble the following:

Port 80
ServerName example.domain.com
NameVirtualHost 192.168.0.1

<VirtualHost 192.168.0.1>
DocumentRoot /var/www/thisdomain
ServerName www.domain.com
</VirtualHost>

<VirtualHost 192.168.0.1>
DocumentRoot /var/www/thatdomain
ServerName www.that.domain.com
</VirtualHost>
3. Starting and Stopping Apache

 To start and stop Apache, the preferred method is to use the httpd initialization script and the
 service utility.

# service httpd start

Starting httpd: [OK]

# service httpd stop

Stopping httpd: [OK]

• There are some additional arguments such as restart, reload and configtest.

• The restart argument stops and starts Apache.

• The reload argument signals Apache to reload its configuration files and it is good way to refresh a
running server’s configuration without restarting it and closing all active connections.

• The configtest argument causes Apache to parse its configuration files. If it detects an error, itwill
display an error message indicating what went wrong and where in the configuration file it found
error.

Page 29 of 32
YouTube - Abhay More | Telegram - abhay_more
607A, 6th floor, Ecstasy business park, city of joy, JSD road, mulund (W) | 8591065589/022-25600622
TRAINING -> CERTIFICATION -> PLACEMENT BSC IT : SEM - V : LINUX – U4

Use # chkconfig httpd on to put the Apache web server in our server’s runlevels, and start itat every
boot.

Q. What is Apache Module? How to add modules in Apache web server.

• To extend the functionality of httpd process we can use Dynamic Shared Objects (DSOs),
more commonly known as modules.

• Modules extend Apache’s capabilities and add new features without requiring recompilation
because they can be loaded and unloaded at runtime, just as shared libraries.
• To include Apache modules, they first need to be installed. By default, some of the most
common modules areinstalled to the /etc/httpd/modules directory.

• To tell Apache that it should load a specific module, we need to use the LoadModule
directive.
• If a module is loaded, it can also have a specific configuration. There are three ways toload
additional configurations for modules:
a. Use the IfModule directive in httpd.conf.
b. Put it in an include file.
c. If a module is common, its parameters can be entered in httpd.conf without
furtherspecification.

a. Using IfModule parameter in the httpd.conf file. This approach is more practical formodulesthat
have a limited number of specific directives.

For example:

<IfModule prefork.c>

StartServers 8

MinSpareServers 5

MaxSpareServers 20

ServerLimit 256

MaxClients 256

MaxRequestsPerChild 4000

</IfModule>

Page 30 of 32
YouTube - Abhay More | Telegram - abhay_more
607A, 6th floor, Ecstasy business park, city of joy, JSD road, mulund (W) | 8591065589/022-25600622
TRAINING -> CERTIFICATION -> PLACEMENT BSC IT : SEM - V : LINUX – U4

b. By default, some modules put their configuration in a separate configuration file and store thatfile in
the directory /etc/httpd/conf.d.

The directive include conf.d/*.conf ensures that all configuration files where the name ends in
.conf are included by defaultwhen Apache starts.

c. If a module is very common and almost always used, its parameters can simply be entered inthe
httpd.conf file.

Q. Give steps to Setup or Install MySQL.


• Apache is often used in the LAMP (Linux, Apache, MySQL, and PHP) stack. Hence, it normallyuses
MySQL database.

Installing MySQL and Creat ing User Accounts

1. Use # yum install -y mysql mysql-server to install the MySQL core components.
2. Use # service mysqld start to start MySQL.
3. Add a MySQL root user
# mysqladmin -u root password ‘password’

It is internal MySQL account and has nothing to do with the Linux root user.

4. Authenticate MySQL as root.


# mysql -u root –p

Now, enter the root password.

5. Now, we are in MYSQL PromptNow and can use one of the many available SQL commands tocheck
the MySQL internal users. At the MySQL prompt, enter

6.Now create a MySQL User with the following command


CREATE USER mysqlUser@localhost IDENTIFIED BY ‘mysqlpassword’;
7.Now that mysqlUser is created, we’ll need to give this user some management permissions.
Page 31 of 32
YouTube - Abhay More | Telegram - abhay_more
607A, 6th floor, Ecstasy business park, city of joy, JSD road, mulund (W) | 8591065589/022-25600622
TRAINING -> CERTIFICATION -> PLACEMENT BSC IT : SEM - V : LINUX – U4

GRANT ALL PRIVILEGES


ON *.*
TO ‘mysqlUser’@’localhost’
WITH GRANT OPTION;
8.At this point, we a’re done and ready to leave the MySQL management interface. Type exit.
9.Now test that we can log into MySQL using the user account we just created. From the bash shell
prompt,
use mysql -u mysqlUser -p
to log in, and use exit to log out again.

Page 32 of 32
YouTube - Abhay More | Telegram - abhay_more
607A, 6th floor, Ecstasy business park, city of joy, JSD road, mulund (W) | 8591065589/022-25600622

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy