The Tiny Internet Project, Part III
Deploy a Mail Server
Mail servers have two key components: a service that transfers mail and a service that serves up mail. Postfix is a common transfer agent (SMTP), and when coupled with Dovecot, it will provide you with all you need to send and receive mail via IMAP (or POP if you're so inclined).
Deploy another clone of your "ubuntu" template, this time naming
it "mail", making sure the Mode is "Full Clone" and your Target
Storage is "local". Once it's generated, start it up, open a
and update the same basic information you did for your mirror server: set
the static IP address for
eth0 as 10.128.1.5, and
Reboot and install Postfix and Dovecot:
$ sudo apt-get update $ sudo apt-get install postfix
During the install, you'll be prompted to select the type of installation you want. Choose "Internet Site". Follow that by setting the "System mail name" as "mail"—the same as the hostname.
When it's done, install
mailutils and Dovecot tools:
$ sudo apt-get install dovecot-imapd dovecot-pop3d
Reply "Yes" to install the self-signed certificate, set the hostname as "mail" and allow the install to complete.
To configure Postfix, run this command:
$ sudo dpkg-reconfigure postfix
You can confirm the entries you made during the Postfix install, and then proceed to set your user name for the "Root and postmaster mail recipient"—in my case, "jtonello". Look over the other destinations from which to accept mail, and add your domain ("tiny.lab"). Don't force synchronous updates on the mail queue, but under the local networks, be sure to add "10.128.1.0/24" to the list. That's the scope you defined for all your machines. If you leave this out, the mail server will reject all incoming mail.
Figure 16. Postfix Configuration
Set the mailbox limits to suit your needs, and set "all" as the internet protocols to use. You'll start with IPv4, but having IPv6 enabled offers future flexibility.
With the basics now in place, check out the main Ubuntu Postfix and Dovecot pages listed in the Resources section for more information.
You'll be able to use any email client with your new mail server, including Thunderbird and Evolution, two common tools that come pre-installed on many Linux distributions. You also might consider installing a web-based mail tool like Roundcube. It provides a great interface and plenty of features that work well with Postfix and Dovecot.
If you want to dig in to the mail configuration, use Webmin. Log in at https://mail.tiny.lab:10000 and look under the Servers tab for the Postfix and Dovecot entries. From there, you can explore and manage the servers easily.
Set Up a Web Server
So far, without possibly being aware, you've installed apache2 on the mirror and mail servers. These allow web connections to those services, but you'll want a more full-featured LAMP stack (Linux, Apache, MySQL and PHP) for building robust websites.
When you first installed Ubuntu from the .iso, you may have noticed a LAMP choice during the applications install step. You definitely can create a VM from scratch and check that box; it'll give you everything you need. However, since you have a nice pre-made VM template, you can use that and add LAMP to it.
Start by cloning your Ubuntu template. Follow the same steps you did with previous clones—change the IP address (10.128.1.7) and hostname (web01). Reboot and open a terminal to install the LAMP components:
$ sudo apt-get install lamp-server^
The caret (^) is important; don't leave it off. As the installers proceed, you'll be asked to create a root password for the MySQL database. Jot it down or put it in your password safe so you don't forget it.
The installation will create the /var/www/html folder and the default index.html. If you point your browser to the machine (either by IP or DNS name if you set it up), you'll see the default Apache2 page. Test the PHP installation by creating a new file in the same directory:
$ sudo vi /var/www/html/phpinfo.php
Add these lines to the file:
<?php phpinfo(); ?>
Point your browser to the page at http://web01.tiny.lab/phpinfo.php. If you see a page with information, your server is successfully serving up PHP.
To make it easier to work with the MySQL database, install phpMyAdmin:
$ sudo apt-get install phpmyadmin
Select "apache2" as the server to reconfigure automatically, and answer "No" to the next question (because the database is already configured). When the installation is complete, you'll have a very robust web-based tool to manage all your databases. Log in at http://web01.tiny.lab/phpmyadmin with the MySQL user name "root" and the password you set.
If you plan to deploy multiple web servers, go ahead and convert this web01 VM to a template. That way, it will be full-featured and ready with only a few small changes. If you want each VM to use WordPress or another content-management tool, install that before you make your template.
You now have a fully operational tiny internet, complete with a Linux repository; mail, DNS and web servers; and a number of useful tools. Use this setup to explore and learn about Linux. If you mess up a VM server, just deploy another one from your template. Most important, share what you've learned and get others involved, and help spur the curiosity of the next generation of Linux enthusiasts.
Download PuTTY: http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html
Setting Up a Mirror: https://www.howtoforge.com/local_debian_ubuntu_mirror_p2
Installing Roundcube: https://github.com/roundcube/roundcubemail/wiki/Installation
Install a LAMP Stack: https://help.ubuntu.com/community/ApacheMySQLPHP
TinyProxy How-To: https://tinyproxy.github.io
John S. Tonello is Director of IT for NYSERNet, Inc., in Syracuse, New York. He's been a Linux user and enthusiast since he installed his first Slackware system from diskette 20 years ago.
- Bash Shell Script: Building a Better March Madness Bracket
- Machine Learning Everywhere
- Smoothwall Express
- Own Your DNS Data
- Simple Server Hardening
- Understanding OpenStack's Success
- From vs. to + for Microsoft and Linux
- The Weather Outside Is Frightful (Or Is It?)
- Understanding Firewalld in Multi-Zone Configurations
- Ensono M.O.