How to install Webmin on Ubuntu 14/16.04

From ESS-WIKI
Revision as of 09:34, 2 April 2018 by Sam35.lin (talk | contribs) (edit)
Jump to: navigation, search

How to install

首先加入 Webmin 官方 repository, 開啟檔案 /etc/apt/sources.list

$ vi /etc/apt/sources.list

加入以下兩行:

deb http://download.webmin.com/download/repository sarge contrib
deb http://webmin.mirror.somersettechsolutions.co.uk/repository sarge contrib

然後取得以上 repository 的 GPG key:

$ wget http://www.webmin.com/jcameron-key.asc
$ apt-key add jcameron-key.asc

更新 apt-get 就可以開始安裝了:

$ apt-get update
$ apt-get install -y webmin

Webmin 預設使用 10000 埠號, 設定 firewall 開通 10000 埠號:

$ ufw allow 10000

預設帳號密碼為 root 之帳號密碼, 可以這樣存取:

http://localhost:10000
或
https://localhost:10000

Using bash script to install webmin

#!/bin/bash

function install_webmin ()
{
  webmin_repo="deb http://download.webmin.com/download/repository sarge contrib"
  system_source_list=/etc/apt/sources.list

  if grep -q "$webmin_repo" "$system_source_list"; then
    echo "webmin repo exist in $system_source_list"
  else
    #  sudo echo "$webmin_repo" >> $system_source_list
    echo "${webmin_repo}" | sudo tee --append $system_source_list > /dev/null || exit 1
  fi

  sudo wget http://www.webmin.com/jcameron-key.asc || exit 1
  sudo apt-key add jcameron-key.asc || exit 1
  sudo apt -y update || exit 1
  echo "install webmin ..."
  sudo apt -y install webmin || exit 1
}

install_webmin

Config file path

Webmin module 的目錄放置此路徑下.

$ cd /usr/share/webmin

module.infos.cache 路徑

$ /var/webmin/module.infos.cache

set module ACL

$ vi /etc/webmin/webmin.acl

Restart webmin

$ /etc/init.d/webmin restart

Webmin main process

$ vi /usr/share/webmin/miniserv.pl

Webmin main process read below config

$ vi /etc/webmin/miniserv.conf