0% found this document useful (0 votes)
9 views

Linux Installation Overview4

The document discusses setting up a Samba server and Apache web server. It provides instructions on starting the Samba server, setting up user accounts for Samba, and installing and configuring Apache on Linux. It also describes how to set up name-based and IP-based virtual hosts with Apache.

Uploaded by

carljosephansama
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views

Linux Installation Overview4

The document discusses setting up a Samba server and Apache web server. It provides instructions on starting the Samba server, setting up user accounts for Samba, and installing and configuring Apache on Linux. It also describes how to set up name-based and IP-based virtual hosts with Apache.

Uploaded by

carljosephansama
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 5

Analyze:

comment: A brief description of our share


path: The complete path of the directory we are going to share
read-only: This allows the files of the share to be modified by others
browsable: This would allow File Managers to list the share under “Network”

Starting The Samba Server

You can start the samba server with the service command:
$ sudo service smbd restart

Note that if you have a firewall like ufw enabled, we need to configure it to allow our samba traffic as
such :

$ sudo ufw allow samba

Setting Up User Account

Samba doesn’t use our system account password. Hence, we need to set up a Samba password manually
for our account :

$ sudo smbpasswd -a $USER

samba server is ready!


Apache Web Server overview
Apache is a remarkable piece of application software. It is the most widely used Web Server application
in the world with more than 50% share in the commercial web server market. Apache is the most widely
used Web Server application in Unix-like operating systems but can be used on almost all platforms such
as Windows, OS X, OS/2, etc. The word, Apache, has been taken from the name of the Native American
tribe ‘Apache’, famous for its skills in warfare and strategy making.

It is a modular, process-based web server application that creates a new thread with each simultaneous
connection. It supports a number of features; many of them are compiled as separate modules and
extend its core functionality and can provide everything from server-side programming language
support to the authentication mechanism. Virtual hosting is one such feature that allows a single Apache
Web Server to serve a number of different websites.

Installing Apache

ways of installing the package or application

 One of the features of the open-source web application is that anyone can make an installer as
per their own environment. This has allowed various vendors like Debian, Red Hat, FreeBSD,
Suse, etc. to customize the file location and configuration of Apache taking into account other
installed applications and base OS.
 Apart from installing it from a vendor-based installer, there is always the option of building and
installing it from the source code. Installing Apache from the source file is platform-independent
& works for all OS.

The Apache web server is a modular application where the administrator can choose the required
functionality and install different modules as per his/her requirement.

All modules can be compiled as Dynamic Shared Objects (DSO is an object file that could be shared by
multiple apps while they are executing) that exist separately from the main Apache file. The DSO
approach is highly recommended, it makes the task of adding/removing/updating modules from the
server’s configuration very simple.

Install Apache: Linux Platform

You can install Apache via the default Package Manager available on all Red Hat-based distributions like
CentOs, Red Hat, and Fedora.
[root@amsterdam ~]# yum install httpd

The apache source tarball could be converted into an rpm file using the following command.
[root@amsterdam ~]# rpmbuild -tb httpd-2.4.x.tar.bz2

It is mandatory to have -devel package installed on your server for creating .rpm file from source.
Once you convert the source file into an rpm installer, you could use the following command to install
Apache.
[root@amsterdam ~]# rpm –ivh httpd-2.4.4-3.1.x86_64.rpm
After the installation the server does not start automatically, in order to start the service, you have to
use any of the following command on Fedora, CentOs or Red Hat.

[root@amsterdam ~]# /usr/sbin/apachectl start

[root@amsterdam ~]# service httpd start

[root@amsterdam ~]# /etc/init.d/httpd start

Install Apache from Source

Installing apache from the source require the –devel package to be installed on your server. Once you
download the source file move it to the /usr/local/src folder.

[root@amserversterdam ~] cd /usr/local/src

[root@amserversterdam ~] gzip -d httpd-2.2.26.tar.gz

[root@amserversterdam ~] tar xvf httpd-2.2.26.tar

[root@amserversterdam ~] httpd-2.2.26

In order to see all configuration options available for Apache, you can use ./configure –help option. The
most common configuration option is –prefix={install directory name}.

[root@amserversterdam ~]./configure --help

[root@amserversterdam ~]./configure –prefix=/usr/local/apache –enable-so

[root@amserversterdam ~] make

[root@amserversterdam ~] make install

The above example shows the compilation of Apache within the /usr/local/apache directory with the
DSO capability. The –enable-so option, can load required modules to apache at run time via the DSO
mechanism rather than requiring a recompilation.

Once the installation completes, you can browse the web server’s default page with your favorite
browser. If a firewall is enabled on your server, you must have to make an exception for port 80 on your
OS firewall. You can use the following command to open port 80.

iptables -I INPUT -p tcp --dport 80 -j ACCEPT


Virtual Host

An Apache web server can host multiple websites on the SAME server. You do not need a separate
server machine and Apache software for each website. This can achieve using the concept of Virtual
Host or VHost.

Any domain that you want to host on your web server will have a separate entry in apace configuration
file.

 Name-based Virtual host


 Address-based or IP based virtual host and.

Name-based Virtual Host

Name-based virtual hosting is used to host multiple virtual sites on a single IP address.

In order to configure name-based virtual hosting, you have to set the IP address on which you are going
to receive the Apache requests for all the desired websites. You can do this by NameVirutalHost
directive within the apache configuration i.e. httpd.conf/apache2.conf file.

NameVirtualHost *:80

<VirtualHost 192.168.0.108:80>

ServerAdmin [email protected]

DocumentRoot /var/www/html/example1.com

ServerName www.example1.com

</VirtualHost>

<VirtualHost 192.168.0.108:80>

ServerAdmin [email protected]

DocumentRoot /var/www/html/example2.com

ServerName www.example2.com

</VirtualHost>

You can add as many virtual hosts, as per your requirement. You can check your web configuration files
with:

[root@amsterdam ~]#httpd –t
Syntax OK
If the configuration file has some wrong syntax, it will throw an error

[root@115 conf.d]# httpd -t

Syntax error on line 978 of /etc/httpd/conf/httpd.conf:

Invalid command '*', perhaps misspelled or defined by a module not included in the server
configuration

IP-based Virtual host

In order to setup IP based virtual hosting, you need more than one IP address configured on your server.
So, the number of vhost apache will depend on number of IP address configured on your server. If your
server has 10 IP addresses, you can create 10 IP-based virtual hosts.

Listen 192.168.0.100:80

<VirtualHost 192.168.10.108:80>

ServerAdmin [email protected]

DocumentRoot /var/www/html/example1.com

ServerName www.example1.com

</VirtualHost>

<VirtualHost 192.168.10.109:80>

ServerAdmin [email protected]

DocumentRoot /var/www/html/example2.com

ServerName www.example2.com

</VirtualHost>

You might also like