Linux Installation Overview4
Linux Installation Overview4
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 :
Samba doesn’t use our system account password. Hence, we need to set up a Samba password manually
for our account :
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
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.
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.
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 ~] 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 ~] make
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.
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 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
Invalid command '*', perhaps misspelled or defined by a module not included in the server
configuration
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>