Table of Contents
|
OBJECTIVE
Setting up a Server and a Mail Exchange Server using Mail-In-a-Box.
What is a server
A server is a computing program or device that accepts and responds to requests made by other devices and programs (commonly referred to as clients). It can help provide a multitude of services like storing data, hosting websites, connect gamers or send and receive email. Servers would normally be "dedicated", providing only a certain service rather than a multitude of them. However, with the improvements brought about by technological innovations, servers are now able to handle multiple tasks.
Companies generally set up multiple devices to handle their traffic, with some even setting up "server plants" when the number of requests per unit time is consistently higher. However, anything as small as a computer can also be used to set up a server for the same tasks on a small scale level. Since requests can come in at any time for a certain service, a server would need to remain online at all times. Corporations generally assuage server malfunctioning concerns by setting up unique mechanisms to handle server failures by individual server devices (for e.g. by redirecting to a functioning server).
Depending on their tasks, a server can have any one of several classifications, including but not limited to game servers, application servers, database servers, proxy servers, file servers, web servers and print servers.
Setting up a web server
Now we're going to a run-through of setting up a simple web server at home. We'll use it to serve up a static web page. The LAMP architecture is very commonly used for this:
L – Linux offers great stability, security and freedom and provides a lot of features. It is open-source and a copy of a Linux distribution can be obtained for free online. We will use Ubuntu as our Linux OS of choice.
A – Apache is used to power over 46% of all websites and 43% of the top million or so web pages. It is also free of charge and licensing costs. Owing to its popularity, it has a large open source community improving its stability and functionality by the day.
M – MySQL and MariaDB are relational database management systems (RDBMS). MariaDB is a fork of the MySQL RDBMS created by Monty Widenius and expands upon the features of its predecessor. It helps deliver dynamic content to the user by using a database to store data and retrieve whatever is necessary in real time.
P – PHP is a server-side scripting language. It can provide the interface needed between the client and the server. It can be used for dynamic web pages and has gained popularity as a general purpose programming language in addition to its web-development features.
For now, we shall limit ourselves to the 'LA' part of setting up a server.
To set up the operating system of the server, install Ubuntu. You can download it here. Full instructions for installation can be found on their official website.
Now that we have our OS installed, we need to set up Apache and get our site up and running.
Open up the terminal using Ctrl + Alt + T and run the following commands:
sudo apt-get update
sudo apt-get install apache2
Now let's create a new website example.com.
Apache will look for content to serve when it needs to. For this, it will look to the document root. We shall direct it to /var/www where we will create a folder for the website we plan to create. We shall create another folder public_html in this folder. Rather than having to access this directory via file explorer, we can just run the follwing command on the terminal:
sudo mkdir -p /var/www/example.com/public_html
To give modification access to our current user (if we are not the root user), we'll need to run the following command:
sudo chown -R $USER:$USER /var/www/example.com/public_html
However, to ensure that all the web pages are served correctly, we'll have to modify our read permission as well a little bit :
sudo chmod -R 755 /var/www
Now that all the permsiions are in place, we can serve and load pages easily.
The next step is the front facing part. We now have to creat a html web page for example.com. Inside the public_html folder, create a file called index.html that will the contain your HTML code. Here's a sample:
<html> <head> <title>Example</title> </head> <body <h1>Success! The example.com virtual host is working!</h1> <p>Let's play around a little bit more with our web page.</p> <a href = "https://en.wikipedia.org/"><img src = "http://oregonaitc.org/wp-" alt="Potato Picture"></a> <p> This will be the end of our web page for now.</p> </body> </html>
Up until now, we've installed our operating system, Apache set up the HTML page, directories and granted the necessary permissions. Now we need to configure our host files so Apache knows exactly how to respond to the domain request. It comes with a default virtual host file 000-default.conf that can provide us with a template. It is in the /etc/apache2/sites-available/ directory and we will copy that over to our new domain's using the following command:
sudo cp /etc/apache2/sites-available/000-default.conf /etc/apache2/sites-available/example.com.conf
Open the new file using :
sudo nano /etc/apache2/sites-available/example.com.conf
After removing all the comments in the file, it needs to look like this:
<VirtualHost *:80>
ServerAdmin admin@example.com
ServerName example.com
ServerAlias www.example.com
DocumentRoot /var/www/example.com/public_html
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
where admin@example is your email address, example.com is your domain name and DocumentRoot is the directory we want Apache to access when asked for example.com.
We can then enable our new virtual hosts using :
sudo a2ensite example.com.conf
and then restarting apache for the changes to take effect:
sudo service apache2 restart
In case you recieve an AH00558 message, do not worry, it is harmless.
And voila! We now have a website being served on our web server
Setting up a mail server
Things We Are Planning To Set Up For This.
These are as follows:
1) Postfix
It basically handles the incoming and outgoing of mails.It has a complicated architecture with various parts for different usage.It has a part which keeps running in the background and is divided in smaller pieces for security.Then has something for mapping the addresses,followed by storage of files and finally points for mail to enter and leave.It is written in C language
2) Dovecot
Is a very compatible,fast and light-weight IMAP and is also open source
3) SpamAssassin
Spam means any useless email which has no importance to the receiver. To prevent these types of mail overflowing the user SpamAssasin is used, which with its complicated methods selects and blocks out spam mails
4) ClamAV
Well AV stands for Anti Virus, as we are building a system which can send and receive anything thus we need protection against those who can misuse this . So, we have an open source bodyguard which is good for mail server
5) Sieve
Stands for its literal meaning , for filtering out the unwanted or to segregate two or more different types of objects, here ,mail.
6) Roundcube
another open source software but on the client side, most important usage is the way to send and accept things in the background without disturbing the current screen.
7) MySQL
It is an integral part of the LAMP architecture. It is a database management language. It is used to create,access and manage tabular data and is especially useful for dynamic entities.
8) nginx
It is similar to apache(software to host sites) but better in some sense, though it can hold a lot less sites than apache can still it provides with a lot more speed to those limited sites than apache. It has many features other than acting like a web server like being the http cache or being a balancer between computer resources
THE SET-UP :
Setting Up The Host
If host isn't set-up then do so by
ssh manish@you_server_ip
We used the help of mail box to set-up our mx server.
cd ~
curl https://mailinabox.email/bootstrap.sh | sudo bash
Now you'll have to make an email id for yourself.
Anything like testmail@your_domain.com, after entering move furthur and enter a password
here our email id is ni.vedpi.hsinam|tcatnoc#ni.vedpi.hsinam|tcatnoc
Now we have to select the hostname , this should be the one from step 1
here we have box.manish.pdev.in
You woud be now asked to choose a country name.
Use arrow keys for changing them.
The postfix is getting installed
The Dovecot,SpamAssasin,RoundCube and Nginx are getting installed
The final installation is now ended.
Now open your browser and type the ip address_of_your_website/admin in the URL bar.
After entering the URL you will get a security warning because HTTPS and self-signed certificate were used.
So you will have to create a security exception.
Now enter your email id and password which you entered during the installation proces.
Now you can verify whether you are accessing the same website or not by checking the SHA1 finger-print of that website.
You check that by pressing ctrl+shift+i and going to the security tab.
Verify whether the above SHA1 finger-print is the same or not.
This is how your admin page will look like.
You'll a sea of red text because of the SSL certificate and the Glue Records aren't set.
You can contact your website/system administrator for purchasing the SSL certificate and setting up Glue Records.
To access the web mail interface click on Mail>Instructions from the top navigation bar, and access the URL provided on that page. It should be something like this:
https://box.manish.ipdev.in/mail
Now you'll have to enter the site via the email and the password which you set previously.
Now YOUR MAIL SERVER IS READY TO GO :D
Check by composing a mail and sending it.
Check it in the spam of your account , you can also send e-mails to the mail server which is in our case ni.vedpi.hsinam|tcatnoc#ni.vedpi.hsinam|tcatnoc .
Now you are good to.
SIMPLE HTTP SERVER USING PYTHON
python -m SimpleHTTPServer <port-no.>
Conclusion
+++++We have tried our best to set up these above servers, The main one is the mail server which was cumbersome.But we finally with the help of a guy giving us a server and domain(Ashutosh Kumar
2nd year IIIT-D) mangaed to set it.
The main problem was to set up the Glue Records.
Members
2016179 Raghavv Goel
2016259 Raghav Sood
2016185 Sajag Aggarwal
2016144 Deepanshu Badshah
2016054 Manish Mahalwal
2016186 Saksham Gupta
2016262 Sahil Hassan
2016104 Sushmin Saha