Solaris 10 安装及SVC管理

Solaris 10 安装及SVC管理及X及Vmware及其它可能遇到的一些问题
http://www.chinaunix.net 作者:freedemon  发表于:2005-02-15 03:41:26

【发表回复】【查看论坛原帖】【添加到收藏夹】【关闭】 

先说一下安装


准备
Solaris 10我下载的是DVD正式版,包含6个>=420M的zip分包。
安装媒体的DVD iso需要先把6个zip包解包,然后合并成一个单独的ISO文件,然后刻录为DVD
或使用虚拟光驱安装。
C:> unzip *.zip
C:> copy /B sxxxxx-a+sxxxxx-b+......e solaris10.iso
在windows下可以用copy /B a+b+c...e solaris.iso的命令把各部分合并;如果在
Unix下则是cat *[a-e] >>solaris.iso 。
注意这个过程必须在支持>2G文件的文件系统分区上执行,例如大多数的现代Unix,以及使用
NTFS的Windows 2000等。


安装
我是在Vmware GSX 3.1下测试安装的,和以前一样,选定Guest OS: Solaris 10(exp),
设定网络为Bridge模式,12G IDE VirtualDisk。

安装引导过程和以前基本类似,在进入安装程序加载时多了几个选择,除了Interactive之外
还有Text模式的Interactive安装,这避免了以前很可能遇到的一个变态问题--就是假如你的
显卡不在Solaris支持之列的话,将无法或很难完成安装过程,或者只能忍受640x480分辨率的
折磨。

选择Interactive继续,之后系统会自动开始硬件检测;在Solaris 10种不但能够检测单独的
硬件信息,还根据厂商的OEM体系,内置了一系列的硬件profile,这就意味着,假如你的服务
器是某大厂的畅销产品的话,那么一整套硬件都会得到系统完整的支持,这其中也包含Vmware
虚拟的硬件体系。

检测完成后,按照现在默认的Interactive模式将会进入图形界面,之后的安装过程都会在一个
X-Window终端窗口中完成,当然,步骤和以前还是一样的。依次是:
网络设定
主机信息设定
软件发布选择
分区
开始安装。


安装进行时
现在,Solaris 10内置了一大堆乱七八糟的东西,Sun的,Gnu的,Linux的支持环境的,以及
各种老的新的兼容的杂烩软件,所以完全安装已经膨胀到了3.8G左右,加上components组件将
更大;最小化安装也有800M之多;大家自己看着办吧。


一点Tips: Solaris 10是越来越大,包含的东西也越来越多,很多命令都放在了不同的目录中,
为了方便使用,安装完成后可以先进行一下系统命令查找路径的初始化设定,修改/etc/profile
文件,在最后添加上如下两行,例如我的:
PATH=/sbin:/usr/sbin:/usr/bin:/opt/SUNWspro/bin:/usr/ccs/bin:/usr/X11/bin:/
/usr/X11R6/bin:/usr/dt/bin:/usr/openwin/bin:/usr/sfw/bin:/usr/net/bin:/
/usr/proc/bin:/usr/local/sbin:/usr/local/bin
export PATH
也算是包含了大多数常用命令的路径吧。


.

 
 

--------------------------------------------------------------------------------
 freedemon 回复于:2005-02-15 03:44:28
初始化设定
接下来就让我进入了好半天摸不着头脑的部分了。
Solaris 10中系统管理部分引入了最变态的新特性之一 -- SVC管理模式。Solaris 10几乎
完全摒弃了原来传统的SVR4 Runlevel进程服务模式,而使用了新的SVC模式进行管理,有点
类似AIX的Sub-System和Sub-Service。在SMF中,把各项系统服务进程分成一系列组,然后
通过一套全新的svc系列命令进行管理,用起来非常得不爽,老管理员们估计会很痛苦一段时间。

在现在的Solaris 10环境下,刚完成安装你将什么都看不到 -- 没有Telnet,没有ssh...
假如在Vmware下安装,由于一个莫名其妙的bug?你还将没有X-Window。我刚进入系统时,还
以为安装过程出了什么错,导致系统初始化进入single-user mode,然后看了下/etc/rc*.d
东西少得可怜,连sshd都没有...再看看/etc/inittab,竟然只有三四行内容...害得我差点
就马上重装一遍......

后来决定,还是先把X-Window和ssh弄好再说。

 

--------------------------------------------------------------------------------
 freedemon 回复于:2005-02-15 03:45:52
先看看SSH的问题。

先看看ssh的问题。新安装完成进入系统之后,我还以为是到了单用户模式下,who -r一看发现
确实是在init 3。再一看系统中,除了rpc(tcp:111)什么服务都没有开,没有X-Window没有
telnet没有ssh没有inetd,这是Solaris 么?我几乎要怀疑Sun是不是改变了他的系统初装策
略,要培养一下广大SA们的动手能力。没有sshd,传文件多不方便,于是我只好手工把sshd翻
出来启动... 说到这里我又想骂... btbt的Solaris 10,sshd竟然不在标准目录下,而是放
在了/usr/lib/ssh/sshd下,害得我还find /usr -name sshd -print了一下才找到。
然后启动sshd:
========================================================================
# svcadm enable -t svc:/network/ssh
========================================================================
竟然不成功!

我只好更原始一点:
========================================================================
# /lib/svc/method/sshd start
========================================================================

这下倒是启动起来了,可是不久之后我发现,无论如何系统启动时ssh是不会自动运行的!其他
的几乎所有系统服务也一样;问题根源在哪儿呢?我只好回到eeprom启动模式下:
========================================================================
boot -m verbose
========================================================================

开启内核引导过程的冗余模式,这样会显示出启动过程中的更多信息;这时我发现,这些系统
服务并不是没有启动,而是启动过程中失败了。
再运行一次服务诊断命令:
========================================================================
# svcs -x -v
========================================================================

这下问题全都暴露出来了,原来是因为我新装的系统中没有建立系统DNS解析配置文件/etc/resolv.conf
导致系统dns client服务启动失败,而dns client则是许多服务的依赖前置服务,包括inetd、
sshd、sendmail等几乎所有的网络服务,如果它启动失败则整个服务树中后继的一系列服务都将
无法自动运行!然后inetd则影响则gss-api等一系列服务,而gss-api这个服务又影响了十多个
后继服务。最后因为一个小小的疏漏--没有手工建立/etc/resolv.conf文件,就导致整个Solaris 10
系统中的所有网络服务启动失败。(Solaris 2系列历史上遗留下来的毛病,即安装过程中你可以
指定 DNS服务器 和 默认路由,但他不会自动保存。必须在安装完成系统之后手工建立和设定
/etc/resolv.conf 和 /etc/defaultrouter 两个文件)

发现原因,问题就好解决,首先建立缺少的文件,然后依次按照dependent树启用一系列服务。
========================================================================
# echo "202.96.209.6">/etc/resolv.conf
# svcadm enable -t  svc:/network/dns/client
# svcadm enable -t  svc:/network/inetd
# sync && reboot
========================================================================


几条小tips:
1. Solaris 10启动过程中不会在控制台上显示太多信息,可以在eeprom或boot模式下输入
   boot -m verbose来开启冗余信息模式,对于系统错误诊断有很大帮助。

2. 如果你的系统安装时选择的是中文环境的话,那么安装完成后,在终端(非X-Window)环境
   下可能所有的命令提示和输出信息都是乱码,那么可以用如下命令回到英文的环境:
   $ LANG=""
   $ export LANG    
   以上为默认的ksh

   % setenv LANG zh
   以上为csh

   $ LANG=""
   以上为bash

3. Solaris 10中采用了新的SMF体系来控制系统服务和守护进程,比原来的SVR4 RC要复杂
   多了:_< 类似AIX和Windows NT的体系。 很多原来的rc脚本现在都由SMF/SVC来控制。
   SMF的基本体系:
   管理命令 svcadm(服务状态管理,启动、停止等) 
           svcs(服务信息和诊断) 
   svccfg(服务参数配置)
   配置文件 在/etc/svc目录下,似乎使用了sqllite数据库格式,因此只能用svccfg命令
           管理
   启动    在/etc/inittab中,启动smf::sysinit:/lib/svc/bin/svc.startd一行
           然后由svc.startd来替代原来init和rc所作的一系列工作
   一些启动脚本  在/lib/svc/method目录下,替代了部分/etc/rc*.d中的启动脚本作用
           也可以直接手工运行这些脚本来强制启动某个服务(不根据依赖树关系)
   关于SMF,也许过几天再写一篇文章来详细讲一下他的体系吧。

4. 一条有用的命令
   # svcs -x -v
   可以检查当前系统中的服务状况,并自动诊断出服务出错的原因。

5. 一些可以代替以前/etc/rc*.d/S**的命令:
   # svcs 
   查看当前所有的服务状态,可以使用|管道符重定向作更个性化的查找;如
   # svcs |grep online 查看当前运行服务
   # svcs |grep offline 查看当前停止服务
   # svcs |grep inetd 查看inetd服务状态
   
   # svcadmin enable svc:network/finger 
   启用一个服务,本例是finger,在原来的rc体系中相当于配置/etc/inetd.conf开启finger
   
   #svcadm disable svc:network/ssh
   仅用一个服务,本例中是禁用sshd服务,在原来的rc体系中相当于执行了
   mv /etc/rc2.d/S55sshd /etc/rc2.d/x.S55sshd 
   
   如果要立刻停止或启动服务,那么可以使用svcadm的-t参数:
   # svcadm disable -t network/ssh
   停止sshd服务,相当于 /etc/init.d/sshd stop  
   # svcadm enable -t network/ssh
   启动sshd服务,相当于 /etc/init.d/sshd start    
   # svcadm restart network/ssh
   重启(停止并启动)sshd服务,相当于 /etc/init.d/sshd stop; /etc/init.d/sshd start    
   # svcadm refresh network/ssh
   刷新sshd(重新读取配置文件),相当于 kill -HUP `cat /var/run/sshd.pid`   

6. Solaris 10默认安装配置下是不允许root用户远程通过ssh登录的,这样也许不太方便,那么
   可以修改 /etc/ssh/sshd_config 文件中 PermitRootLogin no 一行为yes,然后重新
   启动sshd服务。

7. 最后,现在大家安装完成Solaris 10之后,可千万不要在忘记手工建立:
   /etc/resolv.conf 和 /etc/defaultrouter 
   了,现在的后果可不像以前仅仅不能解析DNS那么简单:_<  该死的SMF。


.

 

--------------------------------------------------------------------------------
 freedemon 回复于:2005-02-15 03:48:39
解决了网络服务和sshd的问题,再来看看X-Window和Dtlogin吧。

开始安装过程中,系统是能够很好的识别Vmware的虚拟硬件,并且支持到1024x760x24bpp的
分辨率的,但是安装完成之后,使用kdmconfig配置Xsun,无论如何都无法正常地运行X-window
dtlogin的窗口总是一闪而过,而手工运行X却正常,直到现在仍然让我困惑的问题。所幸的是,
在Solaris 10当前的正式发布版本中,配置了老的Xsun和OpenSource的X.org两个X服务器,
那么我们可以试试看X.org。 在Vmware里使用Xorg和Xorg -configure也无法正常运行。
查找资料发现Solaris 10中所带的Xorg版本应该是可以支持Vmware的,经过一番测试,
配置过程如下:

0、执行/usr/X11/bin/xorgconfig开始字符界面的Xorg Server配置;
========================================================================
# /usr/X11/bin/xorgconfig
========================================================================
1、如下屏幕,回车确定;
========================================================================
This program will create a basic xorg.conf file, based on menu selections
you make.  This program will ask for a pathname when it is ready to write
the file.

The xorg.conf file usually resides in /etc/X11.  If no xorg.conf file
is present there, Xorg will probe the system to autoconfigure itself.
You can run Xorg -configure to generate a xorg.conf file based on
the results of autoconfiguration, or let this program produce a base
xorg.conf file for your configuration and fine-tune it.

Before continuing with this program, make sure you know what video card
you have, and preferably also the chipset it uses and the amount of video
memory on your video card, as well as the specifications of your monitor.

Press enter to continue, or ctrl-c to abort.
========================================================================
2、选择鼠标,1或5都可以;
========================================================================
First specify a mouse protocol type. Choose one from the following list:

 1.  Auto
 2.  VUID
 3.  SysMouse
 4.  MouseSystems
 5.  PS/2
 6.  Microsoft
 7.  Busmouse
 8.  IMPS/2
 9.  ExplorerPS/2
10.  GlidePointPS/2
11.  MouseManPlusPS/2
12.  NetMousePS/2
13.  NetScrollPS/2
14.  ThinkingMousePS/2

The recommended protocol is Auto. If you have a very old mouse
or don't want OS support or auto detection, and you have a two-button
or three-button serial mouse, it is most likely of type Microsoft.

Enter a protocol number:
========================================================================
2.1、是否模拟三键鼠标,是;
========================================================================
If your mouse has only two buttons, it is recommended that you enable
Emulate3Buttons.

Please answer the following question with either 'y' or 'n'.
========================================================================
2.2、选择鼠标设备,回车使用默认的/dev/mouse(或/dev/kdmouse);
========================================================================
Now give the full device name that the mouse is connected to, for example
/dev/tty00. Just pressing enter will use the default, /dev/mouse.

Mouse device: 
========================================================================
3、选择键盘设备,5678均可,建议选7;
========================================================================
description of your keyboard. If nothing really matches,
choose 1 (Generic 101-key PC)

  1  Sun Type 6 USB                                    
  2  Sun Type 6 USB (European layout)                  
  3  Sun Type 6 USB (Japanese layout)                  
  4  Sun Type 6 USB (Unix layout)                      
  5  Generic 101-key PC                                
  6  Generic 102-key (Intl) PC                         
  7  Generic 104-key PC                                
  8  Generic 105-key (Intl) PC                         
  9  Sun Type 4                                        
 10  Sun Type 4 (Canadian layout)                      
 11  Sun Type 4 (Japanese layout)                      
 12  Sun Type 4 (European layout)                      
 13  Sun Type 5                                        
 14  Sun Type 5 (European layout)                      
 15  Sun Type 5 (Japanese layout)                      
 16  Sun Type 5 (Unix layout)                          

Enter a number to choose the keyboard.

Press enter for the next page
========================================================================
3.1、选择键盘布局,选1;
========================================================================
  1  U.S. English                                      
  2  U.S. English w/ ISO9995-3                         
  3  U.S. English w/ deadkeys                          
  4  Albanian                                          
  5  Arabic                                            
  6  Armenian                                          
  7  Azerbaijani                                       
  8  Belarusian                                        
  9  Belgian                                           
 10  Bengali                                           
 11  Bosnian                                           
 12  Brazilian                                         
 13  Bulgarian                                         
 14  Burmese                                           
 15  Canadian                                          
 16  French Canadian                                   
 17  Croatian                                          
 18  Croatian (US)                                     

Enter a number to choose the country.
Press enter for the next page
========================================================================
3.2、回车确认;
========================================================================
Please enter a variant name for 'us' layout. Or just press enter
for default variant
========================================================================
3.3、是否使用XKB管理键盘输入,建议选是;
========================================================================
Please answer the following question with either 'y' or 'n'.
Do you want to select additional XKB options (group switcher,
group indicator, etc.)?

Enter your choice: 
========================================================================
4、显示器(Monitor)设置,回车继续;
========================================================================
Now we want to set the specifications of the monitor. The two critical
parameters are the vertical refresh rate, which is the rate at which the
the whole screen is refreshed, and most importantly the horizontal sync rate,
which is the rate at which scanlines are displayed.

The valid range for horizontal sync and vertical sync should be documented
in the manual of your monitor. If in doubt, check the monitor database
/usr/X11/share/doc/Monitors to see if your monitor is there.

Press enter to continue, or ctrl-c to abort.
========================================================================
4.1、选择显示器类型,(800x600建议选2,1024x768建议选6-7);
========================================================================
You must indicate the horizontal sync range of your monitor. You can either
select one of the predefined ranges below that correspond to industry-
standard monitor types, or give a specific range.

It is VERY IMPORTANT that you do not specify a monitor type with a horizontal
sync range that is beyond the capabilities of your monitor. If in doubt,
choose a conservative setting.

    hsync in kHz; monitor type with characteristic modes
 1  31.5; Standard VGA, 640x480 @ 60 Hz
 2  31.5 - 35.1; Super VGA, 800x600 @ 56 Hz
 3  31.5, 35.5; 8514 Compatible, 1024x768 @ 87 Hz interlaced (no 800x600)
 4  31.5, 35.15, 35.5; Super VGA, 1024x768 @ 87 Hz interlaced, 800x600 @ 56 Hz
 5  31.5 - 37.9; Extended Super VGA, 800x600 @ 60 Hz, 640x480 @ 72 Hz
 6  31.5 - 48.5; Non-Interlaced SVGA, 1024x768 @ 60 Hz, 800x600 @ 72 Hz
 7  31.5 - 57.0; High Frequency SVGA, 1024x768 @ 70 Hz
 8  31.5 - 64.3; Monitor that can do 1280x1024 @ 60 Hz
 9  31.5 - 79.0; Monitor that can do 1280x1024 @ 74 Hz
10  31.5 - 82.0; Monitor that can do 1280x1024 @ 76 Hz
11  Enter your own horizontal sync range

Enter your choice: 
========================================================================
4.2、选择显示器刷新频率,建议选2;
========================================================================
You must indicate the vertical sync range of your monitor. You can either
select one of the predefined ranges below that correspond to industry-
standard monitor types, or give a specific range. For interlaced modes,
the number that counts is the high one (e.g. 87 Hz rather than 43 Hz).

 1  50-70
 2  50-90
 3  50-100
 4  40-150
 5  Enter your own vertical sync range

Enter your choice: 
========================================================================

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值