You are previewing Webmin Administrator's Cookbook.
O'Reilly logo
Webmin Administrator's Cookbook

Book Description

Over 100 recipes to leverage the features of Webmin and master the art of administering your web or database servers

In Detail

Running your own dedicated server has become simpler and less expensive. These days, administering a development server or hosting sites and web applications has become part of the job for many developers. Webmin is an easy-to-use web-based tool which makes getting started with new administrative tasks and performing common jobs more simple and efficient.

Webmin Administrator's Cookbook offers practical, step-by-step recipes covering a range of topics related to setting up and administering a server. The book will show you how Webmin can help you configure an Apache web server, MySQL server, or PostgreSQL database server, as well as how to set up web applications running in PHP or Python.

The book starts by showing you how to set up Webmin on your server and provides you with clear, practical tutorials on configuring various services needed to run a full-fledged web server.

The book provides a handy reference for performing various administrative tasks using Webmin. Whether you want to lock down your server to put it on the Internet or open up more convenient access for use on an internal network, you'll learn how Webmin can help you do it.The book provides recipes for running Apache, MySQL, and PostgreSQL and for getting started with PHP, WordPress, Drupal, Python, and Django.Webmin Administrator's Cookbook will enable you to step more confidently into the world of server administration and prove to be a valuable add-on to your arsenal.

What You Will Learn

  • Learn how to install, configure, and use Webmin
  • Set up file sharing over FTP, SFTP, NFS, and CIFS (Windows Networking)
  • Monitor the state of your server and analyze system logs
  • Get started with popular technologies such as WordPress, Drupal, and Django
  • Learn to manage files and folders on your system
  • Run an Apache web server
  • Set up web applications written in PHP and Python
  • Downloading the example code for this book. You can download the example code files for all Packt books you have purchased from your account at http://www.PacktPub.com. If you purchased this book elsewhere, you can visit http://www.PacktPub.com/support and register to have the files e-mailed directly to you.

    Table of Contents

    1. Webmin Administrator's Cookbook
      1. Table of Contents
      2. Webmin Administrator's Cookbook
      3. Credits
      4. About the Author
      5. About the Reviewers
      6. www.PacktPub.com
        1. Support files, eBooks, discount offers and more
          1. Why Subscribe?
          2. Free Access for Packt account holders
      7. Preface
        1. What this book covers
        2. What you need for this book
        3. Who this book is for
        4. Conventions
        5. Reader feedback
        6. Customer support
          1. Errata
          2. Piracy
          3. Questions
      8. 1. Setting Up Your System
        1. Introduction
        2. Installing Webmin on a Debian-based system
          1. How to do it...
          2. How it works...
          3. There's more...
          4. See also
        3. Installing Webmin on an RPM-based system
          1. How to do it...
          2. How it works...
          3. There's more...
          4. See also
        4. Installing Webmin on another system
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. See also
        5. Connecting to Webmin
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
            1. Changing Webmin's listening port
            2. Specifying the IP address on which Webmin listens
        6. Installing additional Webmin modules
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
            1. Installing a module from a repository
            2. Uninstalling a module
          5. See also
        7. Monitoring what Webmin is doing
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
            1. Rolling back file changes
          5. See also
        8. Controlling which system services are started at boot
          1. How to do it...
          2. How it works...
          3. There's more...
            1. Creating a custom init script
            2. Inspecting active processes
        9. Inspecting the installed software packages
          1. How to do it...
          2. How it works...
          3. There's more...
            1. Viewing the files installed with a package
            2. Identifying which package installed a file
        10. Installing software packages
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
        11. Updating the installed packages to the latest versions
          1. How to do it...
          2. How it works...
          3. There's more...
        12. Enabling Webmin to send an e-mail
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. See also
        13. Getting an e-mail when new versions of packages become available
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
        14. Reading the documentation of the installed software
          1. How to do it...
          2. How it works...
          3. There's more...
      9. 2. User Management
        1. Introduction
        2. Creating a Webmin user
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
            1. Clone a Webmin user
            2. Switch to user
          5. See also
        3. Creating a Webmin group with access to specific modules and options
          1. How to do it...
          2. How it works...
          3. There's more...
            1. Permissions for all modules
          4. See also
        4. Allowing users to log in to Webmin with the system credentials
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
        5. Creating Webmin users based on system accounts
          1. Getting ready
          2. How to do it...
          3. How it works...
        6. Controlling who is currently using Webmin
          1. How to do it...
          2. How it works...
        7. Creating a system user account
          1. Getting ready
          2. How to do it...
          3. How it works...
        8. Modifying a user's UID and other information
          1. How to do it...
          2. How it works...
        9. Temporarily disabling a user account
          1. How to do it...
          2. How it works...
        10. Creating and editing a system group
          1. How to do it...
          2. How it works...
        11. Changing a user's password
          1. Getting ready
          2. How to do it...
          3. How it works...
        12. Exporting users and importing them into another system
          1. How to do it...
          2. How it works...
            1. Webmin's batch file format for operations on users
            2. Webmin's batch file format for operations on groups
          3. There's more...
            1. Export and import system groups
            2. Batch update user accounts
            3. Batch delete user accounts
          4. See also
        13. Installing Usermin
          1. How to do it...
          2. How it works...
          3. See also
      10. 3. Securing Your System
        1. Introduction
          1. Server security checklist
            1. Keeping your system up-to-date
            2. Turning off unnecessary services
            3. Building a firewall around your system
            4. Performing backups
            5. Monitoring your system
            6. Verifying the strength of your passwords
            7. Verifying the system security and setting up intrusion detection and prevention software
        2. Setting up a Linux firewall
          1. Some iptables terminology
          2. Getting ready
          3. How to do it...
          4. How it works...
          5. There's more...
          6. See also
        3. Allowing access to a service through the firewall
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
            1. Creating a service accessible only from the internal network
          5. See also
        4. Verifying your firewall by port scanning
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
            1. Host discovery with Nmap
            2. Scanning all ports
            3. Scanning without administrative privileges
          5. See also
        5. Turning off unnecessary services
          1. How to do it...
          2. How it works...
        6. Verifying the strength of passwords
          1. Getting ready
          2. How to do it...
          3. How it works...
        7. Disabling root login over SSH
          1. How to do it...
          2. How it works...
        8. Restricting Webmin access to a specific IP
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
            1. Allowing access from multiple IP addresses
            2. Allowing access from a dynamically allocated IP
            3. Allowing access from an IP range
            4. Allowing access from the local network
        9. Connecting to Webmin securely over an SSH tunnel
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
            1. Sharing the SSH tunnel with other machines
            2. Creating a tunnel on Windows using Putty
          5. See also
        10. Closing inactive Webmin sessions automatically
          1. How to do it...
          2. How it works...
      11. 4. Controlling Your System
        1. Introduction
        2. Executing a command on the server
          1. How to do it...
          2. How it works...
          3. There's more...
            1. Executing a series of commands
            2. Executing commands conditionally
            3. Executing a command from history
        3. Executing a command as another user
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
            1. Passing input to a command
            2. Running tasks in background
        4. Setting a command to be executed in the future
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        5. Scheduling a command to run regularly with cron
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
            1. Disabling a cron task temporarily
            2. Cloning a cron task
            3. Specifying which users can schedule tasks with cron
        6. Creating a panel for the commands that you execute often
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
            1. Cloning a command
            2. Specifying command arguments
            3. Making the command available in Usermin
          5. See also
        7. Creating a panel with the database commands that you execute often
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. See also
        8. Running a terminal emulator in the browser
          1. How to do it...
          2. How it works...
          3. There's more...
      12. 5. Monitoring Your System
        1. Introduction
        2. Viewing and searching through system logfiles
          1. Getting ready
          2. How to do it...
          3. How it works…
          4. There's more...
            1. Configuring system logs to refresh automatically
          5. See also
        3. Saving Syslog messages to a file
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
        4. Adding other logfiles to Webmin
          1. Getting ready
          2. How to do it…
          3. How it works...
          4. There's more...
        5. Configuring logfile rotation
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
            1. Rotating logfiles on demand
            2. Editing default options
            3. Sending logfiles by email when rotating
        6. Listing recent logins
          1. How to do it...
          2. How it works...
          3. There's more...
        7. Receiving an e-mail when a service stops running
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
            1. Inspecting monitor history
            2. Using predefined monitors
            3. Monitoring system load
            4. Monitoring disk space
          5. See also
        8. Automatically restarting a service that goes down
          1. Getting ready
          2. How to do it...
          3. How it works...
        9. Monitoring a remote server
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
            1. Checking that a remote server is up
            2. Checking that a remote server is running a network service
      13. 6. Managing Files on Your System
        1. Introduction
        2. Downloading files from the server
          1. How to do it...
          2. How it works...
          3. See also
        3. Uploading files to the server
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
            1. Downloading files from the Web directly onto your server
            2. Downloading files from the Web in the background
        4. Managing files and directories on the server
          1. Getting ready
          2. How to do it...
            1. Copying or moving a file or directory
            2. Renaming a file or directory
            3. Deleting a file or directory
            4. Editing a file on the server
            5. Creating a directory on the server
            6. Creating a new file on the server
            7. Creating a symbolic link on the server
            8. Downloading a directory and its content
            9. Extracting files from a compressed archive
          3. How it works...
          4. See also
        5. Changing file ownership and permissions
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
            1. Enabling the setuid bit on an executable file
            2. Setting the sticky bit on a directory
            3. Changing ACLs on a directory
        6. Setting up network-shared folders for Windows
          1. Getting ready
          2. How to do it...
            1. Creating a UNIX pseudo user
            2. Creating a Samba shared network folder
            3. Creating Samba user accounts
            4. Granting Samba users access to the shared folder
          3. How it works...
          4. There's more...
            1. Sharing home directories
            2. Checking who's connected and disconnecting sessions
            3. Debugging Samba
        7. Mounting a Windows-shared folder
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
        8. Setting up an NFS-shared volume
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
            1. Granting access to multiple clients
          5. See also
        9. Mounting a remote NFS volume
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
            1. Mounting NFS v4 exports
          5. See also
        10. Giving users access to your server via SFTP
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. See also
        11. Giving users access to your server via FTP
          1. How to do it...
            1. Opening FTP access in your firewall
          2. How it works...
            1. Passive and active FTP connections
            2. Global configuration and virtual servers
          3. There's more...
            1. Restricting access to users' home directories
            2. Denying FTP access to some users
            3. FTP-only users
          4. See also
      14. 7. Backing Up Your System
        1. Introduction
        2. Backing up configuration files
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        3. Restoring configuration files from backup
          1. How to do it...
          2. How it works...
          3. There's more...
          4. See also
        4. Automatically backing up configuration files
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. See also
        5. Creating a backup of a selected directory
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
            1. Restoring files from a backup archive
          5. See also
        6. Creating a backup of an entire mount point
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
            1. Creating an incremental backup archive
            2. Restoring data from a backup archive
          5. See also
        7. Backing up to a remote host
          1. Getting ready
          2. How to do it...
          3. How it works...
        8. Setting up automatic backups
          1. How to do it...
          2. How it works...
        9. Backing up databases
          1. How to do it...
          2. How it works...
          3. See also
      15. 8. Running an Apache Web Server
        1. Introduction
        2. Installing Apache on your system
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
            1. Setting Apache to start at system boot time
            2. Monitoring that Apache is up and running
          5. See also
        3. Restarting Apache
          1. How to do it...
          2. How it works...
          3. There's more...
            1. Verifying Apache configuration syntax
        4. Enabling Apache modules
          1. How to do it...
          2. How it works...
          3. There's more...
            1. Installing additional modules from software packages
        5. Creating a static HTML site
          1. How to do it...
          2. How it works...
          3. See also
        6. Creating a virtual host
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
            1. Creating an IP-based virtual host
          5. See also
        7. Setting options for directories, files, and locations
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
            1. Setting options on files with names matching a pattern
            2. Setting options for specific URLs
            3. Changing matching path or pattern
            4. Setting options using an .htaccess file
        8. Creating a password-protected website
          1. Getting ready
          2. How to do it...
            1. Creating a user account
          3. How it works...
          4. There's more...
            1. Keeping Apache and system accounts synchronized
          5. See also
        9. Displaying a listing of files in a directory
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        10. Redirecting incoming requests
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
            1. Creating a filesystem alias
        11. Setting up encrypted websites with SSL
          1. Getting ready
            1. Generating a private key
            2. Making a self-signed certificate
            3. Obtaining a commercially signed certificate
            4. Inspecting certificate data
          2. How to do it...
          3. How it works...
          4. There's more...
        12. Logging incoming requests and errors
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. See also
        13. Analyzing logfiles using Webalizer
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
      16. 9. Running a MySQL Database Server
        1. Introduction
        2. Installing the MySQL database server
          1. How to do it...
          2. How it works...
          3. There's more...
            1. Making MySQL ready for production use
          4. See also
        3. Allowing access to MySQL over the network
          1. Getting ready
          2. How to do it...
            1. Instructing MySQL server to listen for network connections
            2. Creating a new user
            3. Granting user access to database
            4. Testing the connection
          3. How it works...
          4. There's more...
            1. Managing databases remotely
          5. See also
        4. Accessing your MySQL server over an SSH tunnel
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
            1. Making an SSH tunnel in MySQL Workbench
          5. See also
        5. Creating a new database
          1. How to do it...
          2. How it works...
          3. See also
        6. Creating users and granting permissions to databases
          1. Getting ready
          2. How to do it...
            1. Creating a user account
            2. Granting privileges
          3. How it works...
          4. There's more...
            1. Granting permissions to a specific database table
            2. Granting permissions to a specific column in a database table
            3. Automatically granting new system users access to MySQL
        7. Creating a backup of your database
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
            1. Backing up all databases automatically
            2. Exporting a database table to CSV
          5. See also
        8. Executing custom SQL commands
          1. How to do it...
          2. How it works...
          3. See also
        9. Restoring database from the backup
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
        10. Editing the structure of your database
          1. Getting ready
          2. How to do it...
            1. Creating a table in a database
            2. Adding a field to a database table
            3. Editing a field
            4. Creating an index
            5. Deleting an index
            6. Deleting a field
            7. Deleting a table from the database
          3. How it works...
          4. See also
        11. Editing records in a database
          1. Getting ready
          2. How to do it...
            1. Adding a row to database table
            2. Editing a row
            3. Deleting a row
          3. How it works...
          4. See also
        12. Checking who is using your database server
          1. How to do it...
          2. How it works...
          3. There's more...
        13. Installing phpMyAdmin
          1. How to do it...
          2. How it works...
          3. There's more...
      17. 10. Running a PostgreSQL Database Server
        1. Introduction
        2. Installing the PostgreSQL database server
          1. How to do it...
          2. How it works...
          3. See also
        3. Locating the PostgreSQL server configuration files
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
            1. Determining location of other configuration files and data files
            2. Checking values of other settings
        4. Allowing access to PostgreSQL over the network
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. See also
        5. Accessing the PostgreSQL server over an SSH tunnel
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. See also
        6. Creating a new database
          1. How to do it...
          2. How it works...
          3. See also
        7. Creating users and granting permissions
          1. How to do it...
          2. How it works...
          3. There's more...
          4. See also
        8. Creating a backup of your database
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
            1. Backing up all databases automatically
            2. Exporting a database table to CSV
          5. See also
        9. Executing custom SQL commands
          1. How to do it...
          2. How it works...
          3. There's more...
            1. Executing a SQL script from a file
          4. See also
        10. Restoring a database from backup
          1. How to do it...
          2. How it works...
          3. There's more...
        11. Editing the structure of your database
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. See also
        12. Editing records in a database
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. See also
        13. Installing phpPgAdmin
          1. How to do it...
          2. How it works...
      18. 11. Running Web Applications
        1. Introduction
        2. Generating dynamic pages using CGI
          1. Getting ready
            1. Checking what user and group Apache is running as
          2. How to do it...
          3. How it works...
          4. There's more...
            1. Displaying incoming request headers
            2. Displaying incoming request body
          5. See also
        3. Installing PHP
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. See also
        4. Changing PHP configuration settings
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
            1. Modifying PHP settings for a directory using .htaccess files
            2. Modifying PHP settings dynamically inside script code
          5. See also
        5. Displaying PHP errors while debugging
          1. How to do it...
          2. How it works...
          3. See also
        6. Logging in PHP
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        7. Installing WordPress on your server
          1. How to do it...
            1. Creating a database
            2. Creating a virtual host and installing WordPress
          2. How it works...
          3. See also
        8. Installing Drupal on your server
          1. Getting ready
          2. How to do it...
            1. Creating a database
            2. Creating a virtual host and installing WordPress
          3. How it works...
          4. See also
        9. Installing a Django-based application using mod_wsgi
          1. How to do it...
          2. How it works...
          3. See also
      19. 12. Setting Up an E-mail Server
        1. Introduction
        2. Setting up your server to send and receive e-mails
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. See also
        3. Setting up secure IMAP access to mailboxes
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        4. Setting up a secure SMTP relay for users
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        5. Controlling the mail queue
          1. Getting ready
          2. How to do it...
          3. How it works...
        6. Reading and writing e-mails on the server
          1. How to do it...
          2. How it works...
        7. Configuring e-mail aliases
          1. How to do it...
          2. How it works...
          3. There's more...
            1. Creating a simple mailing list
            2. Using .forward files
          4. See also
        8. Filtering incoming mail using Procmail and SpamAssassin
          1. How to do it...
          2. How it works...
          3. There's more...
          4. See also
        9. Debugging e-mail-related problems
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
            1. Analyzing mail logs
            2. Testing message sending through Webmin
            3. Sending mail from the command line
            4. Using Telnet to test SMTP authentication
          5. See also
      20. Index