Step 9: Install a Web Admin panel

Web-based administration panels

At times, it is helpful to have a GUI for some configurations. Web administration panels come with risk because you are opening another way entry point into your VPS. One solution is to install them for convenience, but start it only when I need to use it.

Note

Using a web administration panel is optional. You can configure everything using the command line.

Webmin

A favorite web admin panel of users is Webmin. We will install the Debian package because Ubuntu builds on the Debian architecture. See additional instructions at http://www.webmin.com/deb.html

  1. Download the Webmin deb package using wget

    • wget is a command-line tool that downloads a file using common internet protocols. It is similar to curl, but wget will download the file by default instead of displaying the contents. Also, wget can download directories recursively, which allows you to download an entire website.

    • Debian packages are standard Unix archives that include two tar archives. One archive holds the control information and another contains the installable data.

    wget http://prdownloads.sourceforge.net/webadmin/webmin_1.960_all.deb
    
    Example output
     1user@vps:~$ wget http://prdownloads.sourceforge.net/webadmin/webmin_1.960_all.deb
     2--2020-10-21 15:30:38--  http://prdownloads.sourceforge.net/webadmin/webmin_1.960_all.deb
     3Resolving prdownloads.sourceforge.net (prdownloads.sourceforge.net)... 216.105.38.13
     4Connecting to prdownloads.sourceforge.net (prdownloads.sourceforge.net)|216.105.38.13|:80... connected.
     5HTTP request sent, awaiting response... 301 Moved Permanently
     6Location: http://downloads.sourceforge.net/project/webadmin/webmin/1.960/webmin_1.960_all.deb [following]
     7--2020-10-21 15:30:38--  http://downloads.sourceforge.net/project/webadmin/webmin/1.960/webmin_1.960_all.deb
     8Resolving downloads.sourceforge.net (downloads.sourceforge.net)... 216.105.38.13
     9Reusing existing connection to prdownloads.sourceforge.net:80.
    10HTTP request sent, awaiting response... 302 Found
    11Location: https://netcologne.dl.sourceforge.net/project/webadmin/webmin/1.960/webmin_1.960_all.deb [following]
    12--2020-10-21 15:30:38--  https://netcologne.dl.sourceforge.net/project/webadmin/webmin/1.960/webmin_1.960_all.deb
    13Resolving netcologne.dl.sourceforge.net (netcologne.dl.sourceforge.net)... 78.35.24.46, 2001:4dd0:1234:6::5f
    14Connecting to netcologne.dl.sourceforge.net (netcologne.dl.sourceforge.net)|78.35.24.46|:443... connected.
    15HTTP request sent, awaiting response... 200 OK
    16Length: 17026386 (16M) [application/octet-stream]
    17Saving to: ‘webmin_1.960_all.deb’
    18
    19webmin_1.960_all.deb                100%[================================================================>]  16.24M  42.4MB/s    in 0.4s
    20
    212020-10-21 15:30:39 (42.4 MB/s) - ‘webmin_1.960_all.deb’ saved [17026386/17026386]
    22user@vps:~$
    
  2. Install dependencies required for Webmin

    • webmin_1.960_all.deb might not install if the system is missing a dependency.

    • apt install automatically installs all package dependencies. However, we are not using apt to install Webmin. We are using the native package installer, such as running setup.msi on a Windows computer.

    sudo apt-get install -y perl libnet-ssleay-perl openssl libauthen-pam-perl libpam-runtime libio-pty-perl apt-show-versions python unzip
    
     1user@vps:~$ sudo apt-get install -y perl perl libnet-ssleay-perl openssl libauthen-pam-perl libpam-runtime libio-pty-perl apt-show-versions python unzip
     2Reading package lists... Done
     3Building dependency tree
     4Reading state information... Done
     5libpam-runtime is already the newest version (1.1.8-3.6ubuntu2).
     6python is already the newest version (2.7.15~rc1-1).
     7python set to manually installed.
     8perl is already the newest version (5.26.1-6ubuntu0.3).
     9The following additional packages will be installed:
    10  libapt-pkg-perl perl-openssl-defaults
    11The following NEW packages will be installed:
    12  apt-show-versions libapt-pkg-perl libauthen-pam-perl libio-pty-perl libnet-ssleay-perl perl-openssl-defaults
    13The following packages will be upgraded:
    14  openssl
    151 upgraded, 6 newly installed, 0 to remove and 5 not upgraded.
    16Need to get 1,261 kB of archives.
    17After this operation, 1,981 kB of additional disk space will be used.
    18.
    19.
    20.
    
  3. Install the package using the dpkg

    • dpkg is used to install, remove, and provide information about .deb packages. dpkg (Debian Package) itself is a low-level tool.

    sudo dpkg --install webmin_1.960_all.deb
    
     1 user@vps:~$ sudo dpkg --install webmin_1.960_all.deb
     2 (Reading database ... 188574 files and directories currently installed.)
     3 Preparing to unpack webmin_1.960_all.deb ...
     4 Unpacking webmin (1.960) over (1.960) ...
     5 Setting up webmin (1.960) ...
     6 Webmin install complete. You can now login to https://vps:10000/
     7 as root with your root password, or as any user who can use sudo
     8 to run commands as root.
     9 Processing triggers for systemd (237-3ubuntu10.33) ...
    10 Processing triggers for ureadahead (0.100.0-21) ...
    11 user@vps:~$
    
  4. You can configure Webmin to start automatically if you will use it frequently.

    • Otherwise, run systemctl start webmin when you need it and the systemctl stop webmin when you are finished

    sudo systemctl enable webmin
    
  5. Configure Webmin to run on a non-standard port so others do not automatically know if you running Webmin.

    1. We need to edit the Webmin configuration file (/etc/webmin/miniserv.conf) and then open the firewall

      1. Change the default Webmin port from 10000

      2. Choose a random port (ie. 38873), higher numbers are better. You can safely use most ports in the range of 1024 to 49151.

    sudo nano /etc/webmin/miniserv.conf
    
    /etc/webmin/miniserv.conf
    1#port=10000
    2port=38873
    3root=/usr/share/webmin
    4mimetypes=/usr/share/webmin/mime.types
    5addtype_cgi=internal/cgi
    6.
    7.
    8.
    
  6. Update firewall to allow access to the service

    1  user@vps:~# sudo ufw allow 38873
    2  Rule added
    3  Rule added (v6)
    4  user@vps:~#
    5  user@vps:~# ufw enable
    6  Command may disrupt existing ssh connections. Proceed with operation (y|n)? y
    7  Firewall is active and enabled on system startup
    
  7. Restart Webmin for the changes to take effect

    sudo systemctl restart webmin
    
  8. Browse to the URL and Port use SSL (HTTPS).

  9. That’s it! You are all set.