iT邦幫忙

DAY 27
4

Linux Pi的奇幻旅程系列 第 24

Linux Pi的奇幻旅程(27)-webmin管理

公告: 已於20131021T1633修正本文許多安裝程序. 修正內容為:

  1. 修改webmin的目錄結構為:
    /opt/webmin/server
    /opt/webmin/config
    /opt/webmin/log
  2. 安裝的步驟因為目錄結構的改變而不同.

美國最新的朱姆沃爾特級驅逐艦(the USS Zumwalt DDG 1000)將於今年下水, 這艘35億美金的軍艦的設計重點是隱蹤(stealth), 耐操(survivability), 和夠力(firepower), 全鑑配置了尖端科技. 而其核心的運作是一個以市售(off-the-shelf)主機建構的虛擬資料中心, 當然, 這些主機上跑的是Linux和六百萬行的軟體程式. (資料來源:http://www.linux.com/news/enterprise/biz-enterprise/743964-the-navys-newest-warship-is-powered-by-linux)

Webmin (http://www.webmin.com) 提供了Linux管理的Web界面, 用Perl寫成. 並提供模組化介面, 可以安裝不同的模組來管理不同的應用系統.

上一篇: Linux Pi的奇幻旅程(26)-防火牆
http://ithelp.ithome.com.tw/question/10138792
全部: http://ithelp.ithome.com.tw/ironman6/player/bizpro/alll/1
在完成了Joomla!的設定, 並設定iptables來保護Joomla!, 先把這部份的工作備份起來:
$ cd /primillet/knowledge/raspberrypi/images/
$ sudo dd bs=4M if=/dev/sdb of=Raspbian-joomla-iptables-20131019T1025.img
$ tar cfjv Raspbian-joomla-iptables-20131019T1025.img.tar.bz2 Raspbian-joomla-iptables-20131019T1025.img
完成了備份, 換另一張卡, 再取回設定Joomla!, Nginx, PHP-FPM, 和Node.js之前所備份的印象檔:
$ sudo dd bs=4M if=Raspbian-textmode-20131009T2154.img of=/dev/sdb
現在這一切都很自然而順暢了, 指令熟了, 事情就順了.

前文從PHP網站和Node.js網站要先拉到系統面, 也就是防火牆的設定, 本文將從一個剛剛自之前備份的印象檔復原的系統開始, 因此, 先更新系統:
$ sudo apt-get update
$ sudo apt-get upgrade

由於開發Webmin(http://www.webmin.com)的語言是Perl(http://www.perl.org/), 而Webmin所需要的一個Perl模組Net::SSLeay SSLLeay提供https存取Webmin的功能, 對於主機管理是必要的, 只是並未預先安裝在Raspbia系統中, 因此必需在安裝Webmin之前就先安裝這個模組.

安裝Perl模組可以採用CPAN, 原始碼安裝, 或apt安裝. 一開始我用CPAN來安裝, 但失敗了, 由於CPAN是下載原始碼來安裝, 所以我就直接用apt來安裝了:

$ sudo apt-get install libnet-ssleay-perl  libcrypt-ssleay-perl

安裝好SSLeay之後, 開始安裝Wemin:

  1. 到webmin官網, http://www.webmin.com/download.html, 取得原始碼連結:

  2. ssh 到 Raspberry Pi中, 並移到目錄~/workbench:
    pi@raspberrypi ~ $ cd workbench

  3. 下載webmin原始檔的壓縮檔, 我下載的是webmin 1.660版

    pi@raspberrypi ~/workbench $ wget http://prdownloads.sourceforge.net/webadmin/webmin-1.660.tar.gz

  4. 解開壓縮檔, 這要跑一段時間, 您會看到很多webmin的模組不斷地被解壓縮出來

  5. 建立/opt/webmin的目錄結構:

    pi@raspberrypi ~/workbench $ sudo mkdir -p /opt/webmin/{server,config,log}

上面的命令會建立以下的目錄:
/opt/webmin/server
/opt/webmin/config
/opt/webmin/log
這是大括號{}中間以逗點分開的做法, 可以同時建立許多新的目錄, 請注意, 不能有任何空白字元.
指令mkdir可以一次創建多個新目錄, 但是目錄/opt/webmin並不存在, 這就是命令mkdir後的參數-p的用意, -p是parent, 可以讓指令mkdir自動新增不存在的上層目錄.
6. 建立好webmin的目錄結構後, 將目錄~/workbench/webmin-1.660之下的所有內容複製到目錄/opt/webmin/server之下, 這時要用rsync:

pi@raspberrypi ~/workbench $ sudo rsync -avH webmin-1.660/ /opt/webmin/server/
  1. 此時就可以安裝webmin了:

    pi@raspberrypi ~/workbench $ cd /opt/webmin/server/
    pi@raspberrypi /opt/webmin/server $ sudo ./setup.sh


    •        Welcome to the Webmin setup script, version 1.660        *
      

    Webmin is a web-based interface that allows Unix-like operating
    systems and common Unix services to be easily administered.

    Installing Webmin in /opt/webmin/server ...


    Webmin uses separate directories for configuration files and log files.
    Unless you want to run multiple versions of Webmin at the same time
    you can just accept the defaults.

    Config file directory [/etc/webmin]: /opt/webmin/config
    Log file directory [/var/webmin]: /opt/webmin/log


    Webmin is written entirely in Perl. Please enter the full path to the
    Perl 5 interpreter on your system.

    Full path to perl (default /usr/bin/perl):

    Testing Perl ...
    Perl seems to be installed ok


    Operating system name: Debian Linux
    Operating system version: 7.2


    Webmin uses its own password protected web server to provide access
    to the administration programs. The setup script needs to know :

    • What port to run the web server on. There must not be another
      web server already using this port.
    • The login name required to access the web server.
    • The password required to access the web server.
    • If the webserver should use SSL (if your system supports it).
    • Whether to start webmin at boot time.

    Web server port (default 10000):
    Login name (default admin): bizproadmin
    Login password:
    Password again:
    Use SSL (y/n): y
    Start Webmin at boot time (y/n): y


    Creating web server config files..
    ..done

    Creating access control file..
    ..done

    Inserting path to perl into scripts..
    ..done

    Creating start and stop scripts..
    ..done

    Copying config files..
    ..done

    Configuring Webmin to start at boot time..
    Created init script /etc/init.d/webmin
    ..done

    Creating uninstall script /opt/webmin/config/uninstall.sh ..
    ..done

    Changing ownership and permissions ..
    ..done

    Running postinstall scripts ..
    ..done

    Enabling background status collection ..
    ..done

    Attempting to start Webmin mini web server..
    Starting Webmin server in /opt/webmin/server
    Pre-loaded WebminCore
    ..done


    Webmin has been installed and started successfully. Use your web
    browser to go to

    https://raspberrypi:10000/

    and login with the name and password you entered previously.

    Because Webmin uses SSL for encryption only, the certificate
    it uses is not signed by one of the recognized CAs such as
    Verisign. When you first connect to the Webmin server, your
    browser will ask you if you want to accept the certificate
    presented, as it does not recognize the CA. Say yes.

這樣就完成安裝Webmin了. 首先連到RaspberryPi: https://192.168.1.100:10000, 輸入帳號密瑪:

進入系統後, 主畫面是系統資訊, 可以看到經過改造後的Raspbian, 記憶體也就只有使用76MB多.

透過webmin, 可以安裝很多很多的應用系統, 下圖的左側下方所顯示的, 當然, 有許多系統是不適合在小機器上跑的.

這就是Linux Webmin的管理系統.


上一篇
Linux Pi的奇幻旅程(26)-防火牆
下一篇
Linux Pi的奇幻旅程(28)-DNS
系列文
Linux Pi的奇幻旅程27
圖片
  直播研討會
圖片
{{ item.channelVendor }} {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

1 則留言

我要留言

立即登入留言