You are on page 1of 24

LINUX AND OPEN SOURCE SOFTWARE

Chapter 9.
SERVICES CONFIGURATION
IN UBUNTU

1-1
Main contents
➢ Sharing Files and Printers
▪ Using Network File System
▪ Putting Samba to Work
➢ Web services
▪ Common Web Server Stacks
▪ Apache Web Server Management
▪ Nginx Web Server Management
➢ Name Serving with the Domain Name System
▪ Understanding Domain Names
▪ Setting Up a DNS Server with BIND

1-2
Sharing Files and Printers
➢ Using Network File System
➢ Putting Samba to Work
➢ Network and Remote Printing with Ubuntu

1-3
Using Network File System
➢ A protocol developed by Sun Microsystems that enables
computers to use a remote file system as if it were a real
part of the local machine.
➢ A common use of NFS is to allow users’ /home
directories to appear on every local machine they use,
thus eliminating the need to have physical home
directories.
➢ Not installed by default on Ubuntu
▪ nfs-kernel-server (package for installing)
▪ Three main programs in NFS package: portmap, nfsd, mountd
▪ Start manually: sudo systemctl start nfs

1-4
Using Network File System (cont’)
➢ Configure the NFS server: /etc/exports

➢ Configure the NFS client: install nfs-common package


▪ edit the /etc/fstab

▪ You can also use the mount command, as root, to quickly attach a remote directory to
a local file system by using a remote host’s name and exported directory, as in this
example: sudo mount -t nfs 192.168.2.67:/music /music

1-5
Putting Samba to Work
➢ Using the Server Message Block (SMB) protocol to enable
the Windows operating system (or any other operating
system) to access Linux files.
➢ Making your Ubuntu machine look just like a Windows
computer to other Windows computers on your
network—without needing to install Windows on your
PC.

1-6
Putting Samba to Work (cont’)

1-7
Putting Samba to Work on Ubuntu 20
➢ Install sudo apt install samba

➢ Create/Select the share folder sudo mkdir /home/share


➢ Set read/write sudo chmod 777 /home/share
➢ Configure Samba /etc/samba/smb.conf
# Set share configuration at the end
[Docs]
path = /home/share
writable = yes
guest ok = yes
guest only = yes
create mask= 0777
directory mask = 0777

➢ Enable FW sudo ufw allow samba


➢ Restart Samba sudo service samba restart 1-8
Web services
➢ Common Web Server Stacks
➢ Apache Web Server Management
➢ Nginx Web Server Management

1-9
Common Web Server Stacks
➢ LAMP
▪ Composed of Linux, the Apache web server, the MySQL
database, and either PHP, Python, or Perl.
▪ Inexpensive to set up and use, making it much more affordable
than other options for setting up a web server or even selling
web hosting to others.

1-10
Common Web Server Stacks
➢ Install LAMP

1-11
Install LAMP on Ubuntu 20

sudo apt update


sudo apt install apache2
sudo apt install mysql-server
sudo apt install php
sudo apt install php-mysql
sudo apt install phpmyadmin
Tip: to reconfigure PHP and mySQL for root access

sudo dpkg-reconfigure phpmyadmin


sudo dpkg-reconfigure mysql-server
----
sudo mysql -u root
GRANT ALL PRIVILEGES ON * . * TO ‘root'@'localhost' WITH GRANT OPTION;
1-12
FLUSH PRIVILEGES;
Common Web Server Stacks
➢ LEMP
▪ LAMP uses Apache web server, LEMP uses another one, Nginx
➢ MEAN
▪ Run both on the client and server sides in the same language
▪ Mainly used with Javascript
▪ The database used is one of the NoSQL options, MongoDB

1-13
Apache Web Server Management
➢ The most widely used web server on the Internet today
➢ To determine the precise version of Apache
▪ apache2 –v
➢ Installing the Apache Server: install package apache2
➢ Starting and Stopping Apache

1-14
Apache Web Server Management
➢ The most widely used web server on the Internet today
➢ To determine the precise version of Apache
▪ apache2 –v
➢ Installing the Apache Server: install package apache2
➢ Starting and Stopping Apache

➢ Where is apache configuration file?


▪ /etc/apache2 or /usr/local/apache

1-15
Apache Web Server Management
➢ Using .htaccess Configuration Files
▪ sets configurations on a per-directory (usually in a user
directory) basis
▪ useful for sites in which there are multiple content providers,
and you want to control what these people can do with their
space
▪ To limit which server configurations the .htaccess files can
override, use the AllowOverride directive. AllowOverride can
be set globally or per directory.

1-16
Nginx Web Server Management
➢ Nginx is a lightweight and extremely fast web server.
➢ Used by some well-known websites, such as GitHub,
Netflix, and WordPress.com
➢ Stable and fast under high-traffic conditions while using
few resources
➢ THE C10K PROBLEM?

1-17
Nginx Web Server Management
➢ Install Nginx: install nginx package
➢ Configuring Nginx server
▪ Primary configuration file: /etc/nginx/nginx.conf

• Some parts of nginx.conf file

1-18
Nginx Web Server Management
➢ Whenever you make a change to the nginx.conf file, you
must restart Nginx to reload the configuration into Nginx
for the changes to take effect, like this:
▪ sudo systemctl stop nginx
▪ sudo systemctl start nginx

1-19
Name Serving with the Domain Name System
➢ Understanding Domain Names
➢ Setting Up a DNS Server with BIND

1-20
Understanding Domain Names
➢ DNS Servers
▪ A DNS server receives a request or query and responds by resolving that query
and returning the information mapped to it, if it exists.
➢ DNS Records
▪ A: The A record maps a hostname to a 32-bit IPv4 address
▪ AAAA: The AAAA record maps a hostname to a 128-bit IPv6 address, as in this
example:
▪ CNAME: The CNAME record maps one or more aliases to the canonical name of
a machine.
▪ MX: An MX record maps a domain name to a list of mail servers for that domain.
▪ NS: An NS records maps a domain name to a list of DNS servers that are
authoritative for that domain.
▪ SOA: A start of authority, or SOA, record specifies the DNS server that provides
authoritative information about a domain, the email address of the domain
administrator, the domain serial number, and configuration for timers related to
refreshing the zone.
▪ TXT: This record is most commonly used to implement the Sender Policy
Framework (SPF), which is an email validation system designed to help detect and
prevent email spam by detecting email spoofing.

1-21
Understanding Domain Names
➢ Tool
▪ Nslookup
▪ Dig

1-22
Setting Up a DNS Server with BIND
➢ Refer to the Chapter 37 of the text-book

1-23
References
➢ https://ubuntu.com/server/docs

1-24

You might also like