Reader small image

You're reading from  Webmin Administrator's Cookbook

Product typeBook
Published inMar 2014
Reading LevelIntermediate
Publisher
ISBN-139781849515849
Edition1st Edition
Languages
Tools
Right arrow
Author (1)
Michal Karzynski
Michal Karzynski
author image
Michal Karzynski

Michał Karzyński, with a scientific research background in the areas of molecular biology and bioinformatics, has been running Unix-like operating systems since 2002. He works as a web application developer, programming in dynamic languages such as JavaScript, Python, Perl, and PHP. He specializes in designing programming interfaces between servers and client applications based on the HTTP protocol. He has been using Webmin for over five years to assist in setting up and managing servers. He is currently employed as a project manager at the Gdańsk University of Technology in Poland. His blog can be found at http://michal.karzynski.pl.
Read more about Michal Karzynski

Right arrow

Preface

Welcome to Webmin Administrator's Cookbook. This book provides over a hundred practical recipes for solving real-world system administration tasks through a convenient tool called Webmin.

Running an internet-connected private server used to be expensive and available mainly to larger companies who either hired professional sysadmins or outsourced administration. Thanks to the wide adoption of virtualization software, efficient private servers have now become available to anyone with the right skills. Whether you're a developer trying to optimize the performance of your web application or you're a startup looking to implement new software architecture for your systems, chances are you'll need to configure and run your own servers.

Few things are as valuable as having the right tools for a job, and Webmin is a great addition to your toolbox. It allows you to get your server up and running quickly, monitor its state, and be notified by e-mail when the server needs your attention. Webmin simplifies many system administration tasks by abstracting away the complexity of the system command and configuration file syntax, replacing them with a friendly graphical web interface.

Webmin is very lightweight for a GUI application because it doesn't require a desktop environment to be running on your system. You also don't need complex desktop sharing solutions to use it. Since it is a web application, all you need to make full use of Webmin is a browser. Its web nature also makes Webmin resilient to slow or unstable Internet connections. Overall, it's a great tool for administering servers remotely.

The following are just some of the things Webmin can do:

  • Install software on your system

  • Manage users

  • Configure firewalls

  • Execute commands and set commands to execute on a schedule

  • Monitor and analyze system logs and send alerts

  • Manage files, folders, and permissions

  • Configure network disk sharing

  • Perform automated backups

  • Configure virtual web servers with Apache

  • Manage databases with MySQL or PostgreSQL

  • Set up web applications

  • Configure an e-mail server

In this book, we will discuss all of the topics given in the previous list. We'll go through the process of setting up a server from a fresh installation to a full-fledged web application server that runs Apache, a database management system and e-mail software. We'll cover how to set up web applications written in a range of scripting languages. We'll also set up Webmin to monitor your system and alert you about potential problems.

What this book covers

Chapter 1, Setting Up Your System, covers the first steps that will get your Webmin up and running. In this chapter, we will discuss how to set up Webmin itself, how to monitor what it does, and how to undo changes made through Webmin. The chapter also covers the process of installing other software on your system, selecting which software gets started at boot time, and how to inspect what installation packages put on your system.

Chapter 2, User Management, deals with topics related to the users of your system. The chapter discusses adding and editing system users or groups, allowing these users access to Webmin. We'll also demonstrate how Webmin can be used to export a list of all users from one server and import their accounts into another system. We end the chapter by introducing Usermin, the user-facing companion of Webmin.

Chapter 3, Securing Your System, deals with basic system security, including locking down your system with a firewall and connecting to system services over encrypted tunnels. We'll go through a checklist of security precautions that you should take before putting your server on the Internet.

Chapter 4, Controlling Your System, demonstrates how Webmin can be used to execute commands on your system remotely through a web browser. In this chapter, we'll also discuss how to set up cron jobs to execute commands regularly, delaying command execution until a chosen time, and setting up a web panel for easy access to tasks you need to run occasionally.

Chapter 5, Monitoring Your System, discusses how Webmin can be used to watch over your system and even other servers. We'll demonstrate how Webmin can be set up to handle a situation when services on your machine crash—it can send you e-mail alerts or try to restart the services automatically. In this chapter, we'll also discuss how to analyze the state of your system through log files and configure log rotation routines.

Chapter 6, Managing Files on Your System, covers topics related to remote file management through Webmin. In this chapter, we will also cover how to set up your system as a file-sharing server (CIFS, NFS, SFTP, and FTP) and demonstrate how you can use Webmin to connect your system to remote file shares (CIFS and NFS).

Chapter 7, Backing Up Your System, deals with making copies of important files and databases for safekeeping. We'll demonstrate how Webmin can be used to automate this process, run it on a schedule, and even make off-site backups.

Chapter 8, Running an Apache Web Server, goes through topics related to administering your web server. We'll set up and configure Apache; create virtual servers, password-protected sites, HTTPS websites; and inspect incoming traffic and error logs.

Chapter 9, Running a MySQL Database Server, and Chapter 10, Running a PostgreSQL Database Server, cover tasks related to setting up and running your database server. We'll demonstrate how Webmin can be used to create and edit databases, back them up and manage database users. We'll also demonstrate how to connect to your database securely over an encrypted tunnel and how to install web-based database management tools.

Chapter 11, Running Web Applications, demonstrates how all the pieces come together to run web applications. We'll demonstrate how to set up your system to run web apps written in any scripting language, but we'll focus mainly on PHP and Python. We'll provide recipes for installing popular applications such as WordPress, Drupal, and Django.

Chapter 12, Setting Up an E-mail Server, covers topics related to e-mail. We'll demonstrate how to set your system up as an e-mail server for both incoming and outgoing mail. We'll also discuss dealing with spam.

What you need for this book

Throughout this book, we'll be dealing with system administration, which means you'll need a system to administer. You will get the most out of this book if you rent a Virtual Private Server (VPS) from a hosting provider and set it up with a fresh installation of Linux (preferably Debian or CentOS). VPS servers are inexpensive these days, with prices starting at $5/month. If you prefer to experiment locally, you can set up a virtual machine inside the free VirtualBox platform. You should also configure a terminal emulator or SSH client through which you can access your server to execute commands and edit files.

All instructions provided here will work on Linux, so you will get most out of this book if that is the OS you're using. Debian- or RedHat-based distributions are recommended, but other Linux flavors supported by Webmin should work as well. Many of these recipes will also work on other Unixes (such as BSD-based FreeBSD or OS X), but Webmin's support for these platforms may be limited in places. A complete list of operating systems supported by Webmin may be found online at:

http://www.webmin.com/support.html

Tip

Super users with administrative privileges

In order to perform most tasks described in this book, you will need to have administrative privileges on your system.

The main system administrator on Unix-like operating systems such as Linux is often called root. On some systems you can log in as this super user. When this is the case, you can do anything and everything on the system. This makes potential mistakes more dangerous. Other systems (such as Ubuntu) won't allow you to log in as root, so you will need to log in as a regular user with super user (sudo) privileges.

Users and groups with super user privileges are defined in the /etc/sudoers file. Throughout this book, we will mark commands that require administrative privileges by preceding them with the sudo command, for example:

$ sudo apt-get install webmin

Note that you don't need to use this additional command if you're logged in as root, but it's a good practice to stay logged in as a regular user.

If you can't find the /etc/sudoers file on your system, you will have to log in as root and install the sudo package.

Keep in mind that Webmin runs as root on your system, which means that it can break things. The recipes in this book have been tested, but every system is different and we can't guarantee that they will always work as expected. Before you implement these solutions on your production systems, you should test them in a secondary machine. Make sure you know what you're doing before changing the configuration of your production systems.

Who this book is for

This book is for people who decide to administer a Linux system and want to learn how Webmin helps to make administrative tasks easier. It is expected that you have some previous experience with Linux, but you don't necessarily need to be familiar with all of its details. If you're a novice administrator, this book is a good starting off point; if you're a professional, this book will highlight how Webmin can make your job simpler.

When working with Webmin you may find places where it does not behave as expected on your particular version of your operating system. You should report such cases to Webmin's authors via GitHub. Make sure you include the exact version numbers of Webmin, your OS and other software you're running and step-by-step instructions needed to reproduce your problem. Webmin's issues tracker on GitHub can be found at: https://github.com/webmin/webmin/issues

Conventions

In this book, you will find a number of styles of text that distinguish between different kinds of information. Here are some examples of these styles, and an explanation of their meaning.

Code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, and user input are shown as follows: "The above account and privileges will allow the dbuser to connect to and have full control over the testdb database."

A block of code is set as follows:

create:groupname:passwd:gid:member,member,...

When we wish to draw your attention to a particular part of a code block, the relevant lines or items are set in bold:

create:username:passwd:uid:gid:realname:homedir:shell:min:max:warn:inactive:expire
modify:oldusername:newusername:passwd:uid:gid:realname:homedir:shell:min:max:warn:inactive:expire
delete:username

Any command-line input or output is written as follows:

$ perl -le'@chars=(a..z,A..Z,0..9,_);$p.=$chars[rand(@chars)] while($i++<22);print $p'

New terms and important words are shown in bold. Words that you see on the screen, in menus or dialog boxes for example, appear in the text like this: "Click the Create button to create the account".

Note

Warnings or important notes appear in a box like this.

Tip

Tips and tricks appear like this.

Reader feedback

Feedback from our readers is always welcome. Let us know what you think about this book—what you liked or may have disliked. Reader feedback is important for us to develop titles that you really get the most out of.

To send us general feedback, simply send an e-mail to , and mention the book title via the subject of your message.

If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, see our author guide on www.packtpub.com/authors.

Customer support

Now that you are the proud owner of a Packt book, we have a number of things to help you to get the most from your purchase.

Errata

Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you find a mistake in one of our books—maybe a mistake in the text or the code—we would be grateful if you would report this to us. By doing so, you can save other readers from frustration and help us improve subsequent versions of this book. If you find any errata, please report them by visiting http://www.packtpub.com/submit-errata, selecting your book, clicking on the errata submission form link, and entering the details of your errata. Once your errata are verified, your submission will be accepted and the errata will be uploaded on our website, or added to any list of existing errata, under the Errata section of that title. Any existing errata can be viewed by selecting your title from http://www.packtpub.com/support.

Piracy

Piracy of copyright material on the Internet is an ongoing problem across all media. At Packt, we take the protection of our copyright and licenses very seriously. If you come across any illegal copies of our works, in any form, on the Internet, please provide us with the location address or website name immediately so that we can pursue a remedy.

Please contact us at with a link to the suspected pirated material.

We appreciate your help in protecting our authors, and our ability to bring you valuable content.

Questions

You can contact us at if you are having a problem with any aspect of the book, and we will do our best to address it.

lock icon
The rest of the chapter is locked
You have been reading a chapter from
Webmin Administrator's Cookbook
Published in: Mar 2014Publisher: ISBN-13: 9781849515849
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
undefined
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime

Author (1)

author image
Michal Karzynski

Michał Karzyński, with a scientific research background in the areas of molecular biology and bioinformatics, has been running Unix-like operating systems since 2002. He works as a web application developer, programming in dynamic languages such as JavaScript, Python, Perl, and PHP. He specializes in designing programming interfaces between servers and client applications based on the HTTP protocol. He has been using Webmin for over five years to assist in setting up and managing servers. He is currently employed as a project manager at the Gdańsk University of Technology in Poland. His blog can be found at http://michal.karzynski.pl.
Read more about Michal Karzynski