天天看點

Webmin詳細安裝過程及問題解決

 管理系統是件艱巨的任務,建立使用者賬戶,配置服務,檢查日志,還有系統管理者必須面對的所有其他的職責,都使系統管理工作成為一個不小的負擔。下面介紹一個叫webmin的軟體,webmin軟體安裝後能讓讀者從一個很容易使用的web接口控制伺服器的大部分運作。多數主要的服務都包括在内,包括Apache、BIND、SSH、LDAP、Samba、WU-FTP、Sendmail、MYSQL 還有很多。

前期準備

工作安裝webmin時要求系統必須有Perl支援,如果啟用ssl的話還須有openssl及perl-Net-SSLeay子產品的支援!

環境就要用ssl加密的是以必須安裝ssl庫 沒有ssl加密,在你和webmin質檢來回傳送的所有資訊都将是明文的,包括密碼和其他有價值的資訊;

檢查安裝元件的狀态:

[[email protected] ~]# rpm -qa |grep perl

perl-5.8.8-15.el5_2.1

perl-DBI-1.52-2.el5

perl-DBD-MySQL-3.0007-2.el5

perl-String-CRC32-1.4-2.fc6

[[email protected] ~]# rpm -qa |grep openssl

openssl-0.9.8e-7.el5

openssl-devel-0.9.8e-7.el5

檢視後沒有安裝ssl(perl-Net-SSLeay)則到官方網站下載下傳包安裝即可用rpm -ivh 安裝    具體不詳述(http://dag.wieers.com/rpm/packages/perl-Net-SSLeay/ 這個網站下載下傳到perl-Net-SSLeay);

下面是安裝ssl庫的方法:我用的是yum直接安裝的

[[email protected] ~]# yum -y install perl-Net-SSLeay

Loading "fastestmirror" plugin

Loading mirror speeds from cached hostfile

 * base: mirrors.163.com

 * updates: mirrors.163.com

 * addons: mirrors.163.com

 * extras: mirrors.163.com

Setting up Install Process

Parsing package install arguments

Resolving Dependencies

--> Running transaction check

---> Package perl-Net-SSLeay.i386 0:1.30-4.fc6 set to be updated

--> Finished Dependency Resolution

Dependencies Resolved

=============================================================================

 Package                 Arch       Version          Repository        Size

=============================================================================

Installing:

 perl-Net-SSLeay         i386       1.30-4.fc6       base              195 k

Transaction Summary

=============================================================================

Install      1 Package(s)

Update       0 Package(s)

Remove       0 Package(s)

Total download size: 195 k

Running Transaction

  Installing: perl-Net-SSLeay              ######################### [1/1]

Installed: perl-Net-SSLeay.i386 0:1.30-4.fc6

Complete!

You have new mail in /var/spool/mail/root

[[email protected] ~]#

表示安裝成功

Webmin的安裝

webmin的詳細安裝過程分為兩種方式的

所有軟體都可以到官方網站下載下傳http://www.webmin.com 下載下傳最新版本的安裝即可;

第一種方式:RPM包的安裝

包已經下載下傳好了,用下面的指令安裝

[[email protected] ~]# rpm -ivh webmin-1.490-1.noarch.rpm

warning: webmin-1.490-1.noarch.rpm: Header V3 DSA signature: NOKEY, key ID 11f63c51

Preparing...                ########################################### [100%]

Operating system is CentOS Linux

   1:webmin                 ########################################### [100%]

Webmin install complete. You can now login to https://linuxtest:10000/

as root with your root password.

系統安裝後預設是自動啟動的

用ie通路即可  通路如:https://localhost:10000

注https:這個是由于采用了加密也就是裝了ssl後才出現的 預設不裝ssl的話是明文傳輸的不安全。

第二種方式:tar包安裝

如果使用的不是RPM的分發版本,可以從源代碼安裝,從官方下載下傳對應的tar包即可安裝(系統環境需要gcc支援),像安裝其他軟體一樣直接解壓加壓後進入目錄webmin,并作為根使用者自行下面的指令:./setu.sh /usr/local/webmin  該指令将啟動webmin的安裝過程。腳本将詢問幾個選項的選擇,對于多數問題預設答案即可,但是由于出于安全性有幾個答案是必須修改的,例如這個服務的預設端口10000,是以當腳本詢問是什麼端口的時候選擇自己的端口---隻要確定選擇的是大于1024以上的端口,因為低于1024的端口号一般是為系統服務保留的。改變預設端口有助于防範自動運作的工具搜尋webmin并通過掃描他的預設端口發現你的webmin登陸。 還有要選擇admin之外的一個預設使用者名,一定要指定密碼。如果不指定密碼,密碼将為空,任何人都可以登陸的。要確定選擇使用SSL進行加密的,隻有安裝了perl的ssl庫,安裝腳本才會詢問這個問題,是以開始前一定要安裝ssl庫。 腳本詢問的最後一個問題是webmin是否需要在引導時候啟動,這個主要是根據個人選擇,一般選擇no,當使用的時候可以先ssh然後開啟webmin,這樣可以在不用它時候,可以避免成為搜尋的目标,

[[email protected] ~]# tar -zxvf webmin-1.490.tar.gz

[[email protected] ~]# ls

webmin-1.490  

[[email protected] ~]# cd webmin-1.490    (進入解壓出來的目錄)

[[email protected] webmin-1.490]# ./setup.sh /usr/local/webmin (運作安裝腳本setup.sh,并指定安裝目錄為/usr/local,在安裝過程中系統将提示配置檔案的選擇位置,是否啟用ssl,使用的端口,設定使用者名和密碼等;)

[[email protected] /]# ls /usr/local/ (安裝完成後,檢視/usr/local目錄下出現了webmin目錄)

bin etc games include lib libexec named sbin share src webmin

[[email protected] /]# netstat -ntpl (安裝完成後,系統自動啟動webmin服務,使用預設的端口10000,檢視後截取的端口如下)

Active Internet connections (only servers)

Proto Recv-Q Send-Q Local Address               Foreign Address             State       PID/Program name

tcp        0      0 0.0.0.0:10000               0.0.0.0:*                   LISTEN      2950/perl

[[email protected] /]# /etc/webmin/stop   (停止webmin服務)

Stopping Webmin server in /usr/local/webmin

[[email protected] /]# netstat -ntpl(此時即看不到有10000端口開啟)

Active Internet connections (only servers)

Proto Recv-Q Send-Q Local Address               Foreign Address             State       PID/Program name

tcp        0      0 0.0.0.0:758                 0.0.0.0:*                   LISTEN      1848/rpc.statd

tcp        0      0 127.0.0.1:631               0.0.0.0:*                   LISTEN      2140/cupsd

tcp        0      0 :::80                       :::*                        LISTEN      2318/httpd

tcp        0      0 :::22                       :::*                        LISTEN      2103/sshd

[[email protected] /]# /etc/webmin/start (啟動webmin服務)

Starting Webmin server in /usr/local/webmin

Pre-loaded WebminCore

首次通路的時候可能通路不了,可能原因:防火牆端口問題,開啟對應端口

重新啟動webmin

[[email protected] ~]# /etc/init.d/webmin restart

Stopping Webmin server in /usr/libexec/webmin

Starting Webmin server in /usr/libexec/webmin

Pre-loaded WebminCore

以下是通路方式 http://localhost:10000 通路

Webmin Q&A

Q1: Webmin Web頁面無法通路,本機測試https://localhost:10000/ 顯示Error: ssl_error_rx_record_too_long

  A: 檢查配置檔案/etc/webmin/miniserv.conf,發現預設設定 ssl=1 , 更改設定:ssl=0 , restart webmin, 通路正常了;

Webmin配置檔案

Webmin的配置檔案通常是/etc/webmin/miniserv.conf,它的幾個重要參數如表所示:

參數及預設值 說    明
port=10000 設定HTTP伺服器監聽的端口
root=/usr/sfw/lib/webmin  Web檔案的根目錄
ssl=0  是否支援SSL,如果設定為1,這個HTTP伺服器将提供HTTPS服務
session=1

是否支援Session,如果設定為1,在通路Web服務之前

必須先完成使用者登入和認證,使用者的登入和認證 由session_login.cgi實作

logfile=/var/webmin/miniserv.log  日志檔案
errorlog=/var/webmin/miniserv.error  錯誤日志檔案
userfile=/etc/webmin/miniserv.users 存放HTTP伺服器的使用者名和密碼,changepass.pl可以修改使用者密碼
keyfile=/etc/webmin/minserv.pem 存放HTTP伺服器的私鑰和公鑰證書

繼續閱讀