1. webmin与Linux web管理面板
对于Linux服务器而言,除了使用SSH命令行进行远程管理外,有时候需要一些图形化的管理界面方便操作,Linux发行版都附带了一些GUI系统管理工具,但是一般功能比较单一。有一类基于Web方式的管理工具,让你不需要手动编辑 Linux/UNIX 配置文件,远程管理系统的各个方面,包括各类服务的安装配置等。
webmin是Web 方式管理工具,Webmin是老牌开源系统管理工具,基于与硬件架构无关的Perl语言开发,支持绝大多数的Linux/Unix系统,除了各种版本的linux以外还包括:AIX、HPUX、Solaris、Unixware、Irix和FreeBSD等。Webmin特别适合传统的Linux主机(包括国产自主创新产品)管理,管理员通过浏览器访问Webmin的各种管理功能并完成相应的管理动作。
当云计算出现后,虚拟主机成为了一个商业市场,对于虚拟主机的管理,使用Web方式非常合适,并被冠以“管理面板”的名称。对于不熟悉Linux命令行的用户来说,使用管理面板之后,绝大部分的操作都可以用面板完成,除了传统的webmin,还有Plesk, cPanel, DirectAdmin等,当前比较流行的是国内的宝塔面板、国外的cPanel等,《Linux下常见的web一键包运行环境和控制面板汇总》列举了市面上常见的一些面板程序。
webmin最大的优点就是开源免费,而且久经考验,工作可靠,插件式结构使得Webmin具有很强的扩展性和伸缩性。Webmin是为了管理服务器而诞生的,Webmin提供的标准管理模块几乎涵盖了常见的Unix管理,而且第三方的管理模块也被不断地被开发出来,在服务器维护上,比Plesk或者Cpanel功能要强大很多。通过集成Vitrualmin主机管理插件,可以替代Plesk或者Cpanel等收费的管理面板,并且在功能上并不逊色。一个类似的开源产品是CentOS Web Panel,一个专门为CentOS系统打造的VPS控制面板。
2. 龙芯架构下webmin安装
本文测试了两台龙芯的设备,一台是安装了loonginx系统的3A4000终端,一台是安装了中标麒麟服务器V7系统的3B3000服务器。
webmin的下载地址 https://sourceforge.net/projects/webadmin/files/webmin/
用wget下载
#wget http://prdownloads.sourceforge.net/webadmin/webmin-1.960.tar.gz
本文安装参考webmin官网文档《Installing the TAR files》,安装前有几个需要确认的:
(1)webmin版本及包:因为国产自主创新平台的perl版本不一定是最新版本,测试使用的是1.760版本,在webmin下载页面提供了rpm deb和tar.gz等形式的包,rpm安装容易出现问题,体系结构无关情况下建议以tar.gz自行安装。
下载链接:https://sourceforge.net/projects/webadmin/files/webmin/1.760/webmin-1.760.tar.gz/download
(2)perl版本
在国产自主创新平台上都集成了perl环境,使用perl -v 或者 perl -V查看 perl是否安装及其版本
- loonginx系统的perl版本是5.18.4
- 中标麒麟V7的perl版本是5.16.3
- 麒麟V10的perl版本是5.22.1
(3)必须的perl包
下面几个perl包是需要的(yum -y install perl perl-Net-SSLeay openssl perl-IO-Tty perl-Encode-Detect)。
国产信创系统一般都预装了大部分的包,但可能需要手工安装一个perl-Encode-Detect包。怎么寻找包参考本博客文章《龙芯平台下软件安装(怎么寻找龙芯下的package)》。
- 对于loongnix系统,从http://ftp.loongnix.org/os/loongnix/1.0/os/Packages/p/目录下,下载perl-Encode-Detect-1.01-15.fc21.loongson.mips64el.rpm
- 对于中标麒麟V7系统,从http://download.cs2c.com.cn/neokylin/server/releases/7.0/ls_64/Packages/ 目录下,下载perl-Encode-Detect-1.01-13.ns7_4.mips64el.rpm
下载到服务器上,如下命令安装perl-Encode-Detect
rpm -ivh perl-Encode-Detect-1.01-13.ns7_4.mips64el.rpm
准备好几本环境后,安装比较容易
(1)解压
#gunzip webmin-1.760.tar.gz
#tar xf webmin-1.760.tar
(2)执行安装脚本
#cd webmin-1.760
#./setup.sh /usr/local/webmin
剩下的按照提示回答问题,包括配置文件地址、日志地址、端口号设置(默认为10000端口)、操作系统识别、是否使用ssl和密码等,一般选择默认即可。
附录是loonginx系统的安装过程。和中标麒麟系统安装过程中唯一的区别是自动识别OS部分,中标麒麟识别为Redhat Enterprise Linux 7,loonginx需要手动选择,选择Fedora21即可。
(3)安装完成后,可以使用10000端口进行访问(远程访问可能需要开启防火墙规则或者关闭防火墙),如下图。
界面左侧是功能树,包括webmin自身管理配置、系统配置、网络和硬件配置、Apache/DNS/Samba服务配置等。
3. webmin扩展模块安装
Webmin提供的标准管理模块几乎涵盖了常见的Unix管理,而且有很多第三方的管理模块,在webmin官网上可以查询和下载。如果考虑自己写模块,可以先参考《【webmin】添加新模块》。
以安装webmin扩展模块Syncmin为例:
(1)在webmin网站上搜索第三方模块,下载Syncmin 1.0的软件包(.tar文件)到管理计算机,或者复制到webmin服务器上。
(2)在webmin管理首页中,找到webmin->webmin配置,如下图,选择webmin模块。
(3)webmin模块安装如下图,可以从本地(webmin服务器的本地硬盘)、从上载文件(访问webmin的计算机硬盘)、或者URL等方式。这里选择从上载文件,然后点击“从文件安装模块”。
(4)安装成功后提示:
以下模块已经成功安装并加入到您的访问控制列表 :
群集 类别下的 /usr/local/webmin/syncmin (116 kB) 中的 Syncmin Managerwebmin模块安装
(5)然后可以在左边导航中的【群集】中找到新增的管理项【Syncmin Manager】。
附:loonginx系统的安装过程
[root@localhost ~]# cd /opt
[root@localhost ~]# gunzip webmin-1.760.tar.gz
[root@localhost ~]# tar xf webmin-1.760.tar
[root@localhost ~]# cd webmin-1.760
[root@localhost webmin-1.760]# ./setup.sh /usr/local/webmin
***********************************************************************
* Welcome to the Webmin setup script, version 1.760 *
***********************************************************************
Webmin is a web-based interface that allows Unix-like operating
systems and common Unix services to be easily administered.
Installing Webmin from /root/webmin-1.760 to /usr/local/webmin ...
***********************************************************************
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]:
Log file directory [/var/webmin]:
***********************************************************************
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
***********************************************************************
For Webmin to work properly, it needs to know which operating system
type and version you are running. Please select your system type by
entering the number next to it from the list below
---------------------------------------------------------------------------
1) Pardus Linux 2) SmartOS 3) Sun Solaris
4) Lycoris Desktop/LX 5) Caldera OpenLinux eS 6) Caldera OpenLinux
7) Asianux Server 8) Asianux 9) Whitebox Linux
10) Tao Linux 11) CentOS Linux 12) Scientific Linux
13) Gralinux 14) NeoShine Linux 15) Endian Firewall Linu
16) Oracle Enterprise Li 17) Oracle VM 18) XenServer Linux
19) CloudLinux 20) MostlyLinux 21) Redhat Enterprise Li
22) Redhat Linux Desktop 23) AlphaCore Linux 24) X/OS Linux
25) Haansoft Linux 26) cAos Linux 27) Wind River Linux
28) Amazon Linux 29) Redhat Linux 30) Fedora Linux
31) White Dwarf Linux 32) Slamd64 Linux 33) Slackware Linux
34) Xandros Linux 35) APLINUX 36) BigBlock
37) Ubuntu Linux 38) Mepis Linux 39) Linux Mint
40) Debian Linux 41) SuSE OpenExchange Li 42) SuSE SLES Linux
43) SuSE Linux 44) United Linux 45) Corel Linux
46) TurboLinux 47) Cobalt Linux 48) Mandrake Linux Corpo
49) pclinuxos Linux 50) Mageia Linux 51) Mandrake Linux
52) Mandriva Linux 53) Mandriva Linux Enter 54) Conectiva Linux
55) ThizLinux Desktop 56) ThizServer 57) MSC Linux
58) SCI Linux 59) LinuxPPC 60) Trustix SE
61) Trustix 62) Tawie Server Linux 63) TinySofa Linux
64) Cendio LBS Linux 65) Ute Linux 66) Lanthan Linux
67) Yellow Dog Linux 68) Corvus Latinux 69) Immunix Linux
70) Gentoo Linux 71) Secure Linux 72) OpenNA Linux
73) SoL Linux 74) Coherent Technology 75) Playstation Linux
76) StartCom Linux 77) Yoper Linux 78) Caixa Magica
79) openmamba Linux 80) FreeBSD 81) DragonFly BSD
82) OpenBSD 83) NetBSD 84) BSDI
85) HP/UX 86) SGI Irix 87) DEC/Compaq OSF/1
88) IBM AIX 89) SCO UnixWare 90) SCO OpenServer
91) Mac OS X 92) Darwin 93) OpenDarwin
94) Cygwin 95) Sun Java Desktop Sys 96) Generic Linux
97) Windows
---------------------------------------------------------------------------
Operating system: 30
Please enter the version of Fedora Linux you are running
Version: 21
Operating system name: Fedora Linux
Operating system version: 21
***********************************************************************
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):
Login password:
Password again:
Use SSL (y/n): n
Start Webmin at boot time (y/n): y
***********************************************************************
Copying files to /usr/local/webmin ..
..done
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..
..done
Creating uninstall script /etc/webmin/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 /usr/local/webmin
Pre-loaded WebminCore
..done
***********************************************************************
Webmin has been installed and started successfully. Use your web
browser to go to
http://localhost.localdomain:10000/
and login with the name and password you entered previously.