Solaris
Frequently-Asked Questions
Pour plus d'information au sujet de cette faq, contactez Jean-Louis BICQUELET
FAQ Revised: Monday 03 July 2017 08:32:08
cat /etc/release Oracle Solaris 11.1 SPARC Copyright (c) 1983, 2013, Oracle and/or its affiliates. All rights reserved. Assembled 06 November 2013
uname -i sun4v isainfo -n sparcv9
ou de manière plus complète
uname -a SunOS supifrldpadm2 5.11 11.1 sun4v sparc sun4v
prtconf -D System Configuration: Oracle Corporation sun4v Memory size: 32256 Megabytes System Peripherals (Software Nodes): prtconf: devinfo facility not available
isainfo -kv 64-bit sparcv9 kernel modules
ou pour obtenir uniquement la valeur numérique
isainfo -b 64
sysdef -i * * Hostid * 862a97d4 * * sun4v Configuration * * * System Configuration * swap files swapfile dev swaplo blocks free /dev/swap - 16 33030128 33030128 * * Utsname Tunables * 5.11 release (REL) supifrldpadm2 node name (NODE) SunOS system name (SYS) 11.1 version (VER)
who -r . run-level 3 Sep 3 18:02 3 0 S
Les niveaux sont:
0 | shutdown |
1 | single user |
2 | n/a |
3 | Multi-user |
4 | n/a |
5 | power off |
6 | reboot |
Il faut éditer le fichier /etc/inittab.
locale -a C POSIX de_DE.UTF-8 en_US.UTF-8 es_ES.UTF-8 fr_FR.UTF-8 it_IT.UTF-8 ja_JP.UTF-8 ko_KR.UTF-8 pt_BR.UTF-8 zh_CN.UTF-8 zh_TW.UTF-8
prtconf | grep -i mem prtconf: devinfo facility not available Memory size: 32256 Megabytes
/usr/bin/pagesize 8192
swap -l swapfile dev swaplo blocks free /dev/swap - 16 33030128 33030128 8192
ou
swap -s total: 3249360k bytes allocated + 4025912k reserved = 7275272k used, 16853912k available swap -s -h total: 3.1G allocated + 3.8G reserved = 6.9G used, 16G available
L'option -h fournit un affiche plus lisible. L'option -k fournit la taille en kilo octets.
swap -l -k swapfile dev swaplo blocks free /dev/swap - 8K 16515064K 16515064K [root@supifrldpadm2]:/usr/platform/sun4v # swap -l -k -h swapfile dev swaplo blocks free /dev/swap - 8K 16G 16G
mkfile 128m /var/swapfile_new swap -a /var/swapfile_new update /etc/vfstab
update /etc/vfstab swap -d /var/swapfile_new
psrinfo 0 on-line since 03/25/2014 17:36:36 1 on-line since 03/25/2014 17:36:39 2 on-line since 03/25/2014 17:36:39 3 on-line since 03/25/2014 17:36:39 4 on-line since 03/25/2014 17:36:39 5 on-line since 03/25/2014 17:36:39 6 on-line since 03/25/2014 17:36:39 7 on-line since 03/25/2014 17:36:39 8 on-line since 03/25/2014 17:36:39
psrinfo -p 1
Change le status du cpu à offline ( -f ) ou a online ( -n)
psradm -f 0 psradm -n 0
Pour mettre tous les processeurs online en même temps
psradm -a -n
Pour définir les cpus 0 et 1 comme des spares, on tape
psradm -F -s 0 1
init 0
On peut aussi faire un powerdown:
shutdown -i5 -g0 -y
Pour un reboot immédiat (pour rappel le niveau 6 correspond au reboot).
init 6
shutdown -y -g0 -i6
Pour arrêter le serveur dans 10 minutes, il suffit de préciser apr_s -g le nombre de secondes (600s = 10 minutes, 0=immédiat).
shutdown -y -g600 -i6
boot -s
boot -r
Les options de boot sont:
-s | single user |
-a | interactive |
-x | no device drivers (pour les clusters) |
-r | reconfigure devices |
-m | milestone |
reboot -- -r
On utilise un des commande suivantes suivant le niveau que l'on veut atteindre:
Les répertoires sont :
/etc/init.d
/etc/rc0.d - /etc/rc6.d
eeprom |grep boot-device boot-device=rootdisk rootmir boot-device-index=0 prtconf -pv |grep bootpath bootpath: '/pci@400/pci@1/pci@0/pci@4/scsi@0/disk@w5000cca016428ebd,0:a'
# pkginfo system CSWcommon common - common files and dirs for CSW packages application CSWlibgcc-s1 libgcc_s1 - The GNU Compiler Collection, libgcc_s.so.1 application CSWpkgutil pkgutil - Installs Solaris packages easily monitoring ILMT-TAD4D-agent ILMT-TAD4D-agent application NXISbbc Package Big Brother made in Natixis application NXISzabbix Package Zabbix agent GNOME2 SUNWPython26-extra Supplemental Python libraries and utilities system SUNWTcl Tcl - Tool Command Language system SUNWarc Lint Libraries (usr) ... application gsk8cry64 IBM GSKit Cryptography Runtime application gsk8ssl64 IBM GSKit SSL Runtime With Acme Toolkit
@P/Pour obtenir une liste plus détailler il faut utiliser l'option -l.
pkginfo -l | pg PKGINST: CSWcommon NAME: common - common files and dirs for CSW packages CATEGORY: system ARCH: sparc VERSION: 1.5,REV=2010.12.11 BASEDIR: / VENDOR: http://www.opencsw.org/ packaged for CSW by Philip Brown DESC: Installs some useful standard CSW filesystem symlinks and files PSTAMP: bender20101211174807 INSTDATE: May 16 2014 16:04 HOTLINE: http://www.opencsw.org/bugtrack/ EMAIL: phil@opencsw.org STATUS: completely installed FILES: 140 installed pathnames 130 directories 6 blocks used (approx) PKGINST: CSWlibgcc-s1 NAME: libgcc_s1 - The GNU Compiler Collection, libgcc_s.so.1 CATEGORY: application ARCH: sparc ...
pkgadd -d TIVsmCapi.pkg
On peut aussi installer le paquet:
pkg install ksh88
pkgrm pkg uninstall package
pkgchk -l NXISbbc Pathname: /local/p0/soft/bb Type: symbolic link Source of link: bbagent_1.9i-btf Referenced by the following packages: NXISbbc Current status: installed Pathname: /local/p0/soft/bbagent_1.9i-btf Type: directory Expected mode: 0755 Expected owner: bbuser Expected group: ADMIN Referenced by the following packages: NXISbbc Current status: installed Pathname: /local/p0/soft/bbagent_1.9i-btf/.ssh Type: directory Expected mode: 0700 Expected owner: bbuser cons
pkg history START OPERATION CLIENT OUTCOME 2014-05-07T17:54:31 set-property transfer module Succeeded 2014-05-07T17:54:31 refresh-publishers transfer module Succeeded 2014-05-07T17:54:31 image-create transfer module Succeeded 2014-05-07T17:54:35 rebuild-image-catalogs transfer module Succeeded 2014-05-07T17:54:40 install transfer module Succeeded 2014-05-07T18:14:56 install pkg Succeeded 2014-07-22T11:41:17 refresh-publishers pkg Succeeded 2014-07-22T11:41:17 install pkg Succeeded
DAns le répertoire /var/sadm .
/var/sadm # ls install pkg security system
Comme dans tous les serveurs unix, on utilise ifconfig.
ifconfig -a lo0:1: flags=2001000849mtu 8232 index 1 inet 127.0.0.1 netmask ff000000 ipmp0:1: flags=108001000843 mtu 1500 index 2 inet 100.78.131.112 netmask fffff800 broadcast 0.72.132.112 lo0:1: flags=2002000849 mtu 8252 index 1 inet6 ::1/128
L'autre méthode consiste à utiliser getent et nslookup.
getent hosts darkstar 127.0.0.1 darkstar localhost loghost nslookup darkstar Server: 10.10.2445254 Address: 10.10.245.254#53 Non-authoritative answer: Name: darkstar.universe Address: 10.72.13.112
netstat -i | egrep -v "^Name|^lo0" | awk '{ print $1 }' | cut -d: -f1 | sort ipmp0
La carte ici est une carte IP Multipathing (IPMP).
netstat -rn Routing Table: IPv4 Destination Gateway Flags Ref Use Interface -------------------- -------------------- ----- ----- ---------- --------- default 10.72.128.1 UG 138 2358530354 ipmp0 default 10.72.128.1 UG 112 2130530473 10.72.128.0 10.72.132.112 U 9 2196596 ipmp0 127.0.0.1 127.0.0.1 UH 2 1810778 lo0 Routing Table: IPv6 Destination/Mask Gateway Flags Ref Use If --------------------------- --------------------------- ----- --- ------- -----
Utilisez netstat -i ou netstat -a.
netstat -i Name Mtu Net/Dest Address Ipkts Ierrs Opkts Oerrs Collis Queue lo0 8232 loopback darkstar 49597907 0 49597907 0 0 0 ipmp0 1500 darkstar.cdcsdm darkstar.cdcsdm 1987519434 0 2494952191 0 0 0 Name Mtu Net/Dest Address Ipkts Ierrs Opkts Oerrs Collis lo0 8252 darkstar darkstar 49597907 0 49597907 0 0
ifconfig qfe1 down unplumb
getent hosts loghost 127.0.0.1 darkstar localhost loghost
getent hosts cruser 10.72.13.16 cruser.universe echo $? 0
echo "Total: " `netstat | wc -l` Total: 36
netstat -an |awk '{print $7}' | sort | uniq -c 31 2 ----------- 7 ESTABLISHED 7 IDLE 16 LISTEN 1 Remote 2 Rwind 8 TIME_WAIT
svcs -a STATE STIME FMRI legacy_run Sep_03 lrc:/etc/rc2_d/S01tlm legacy_run Sep_03 lrc:/etc/rc2_d/S89PRESERVE legacy_run Sep_03 lrc:/etc/rc3_d/S80splunk legacy_run Sep_03 lrc:/etc/rc3_d/S99CA-DSM legacy_run Sep_03 lrc:/etc/rc3_d/S99tsm_SUPIFRLDPADM2 legacy_run Sep_03 lrc:/etc/rc3_d/S99zabbix-agent disabled Sep_03 svc:/network/install:default disabled Sep_03 svc:/network/ipsec/ike:default disabled Sep_03 svc:/network/ipsec/manual-key:default disabled Sep_03 svc:/system/name-service-cache:default disabled Sep_03 svc:/network/nis/client:default
svcs -xv
svcadm disable svc:/system/name-service/cache
svcadm enable svc:/system/name-service/cache
dmesg Thursday, April 9, 2015 11:14:04 AM CEST Mar 5 11:30:32 darkstar sudo: [ID 702911 auth.alert] batman : command not allowed ; TTY=pts/5 ; PWD=/users/batman ; USER=root ; COMMAND=/usr/bin/ls /opt/ldap/admin Mar 5 13:14:53 darkstar sudo: [ID 702911 auth.alert] batman : command not allowed ; TTY=pts/5 ; PWD=/users/batman ; USER=root ; COMMAND=/usr/bin/su - Mar 5 13:15:57 darkstar sudo: [ID 702911 auth.alert] batman : command not allowed ; TTY=pts/5 ; PWD=/users/batman ; USER=root ; COMMAND=/usr/bin/su Mar 9 17:03:48 darkstar sudo: [ID 702911 auth.alert] superman : command not allowed ; TTY=pts/4 ; PWD=/users/superman ; USER=root ; COMMAND=/usr/bin/cd /opt/ldap/admin
syslog | /var/log/syslog |
cron | boot /var/adm/messages |
useradd -d home-directory -g nom-du-groupe -G groupes_supplementaires (la virgule sert de séparateur) -m -n -u uid -p passwd
Les options possibles sont:
-c | Commentaire |
-d | répertoire personnel |
-g | groupe principal |
-G | groupes secondaires |
-s | shell |
-u | UID |
-e | date d'expiration |
-f | temps d'inactivité après expiration |
-p | mot de passe |
-m | copie dans le home les fichiers présents dans @i(/etc/skel) |
-n | création d'un groupe portant le nom de l'utilisateur est créé |
userdell user
Pour supprimer aussi son home et ses mails utilisez l'option -r.
userdell -r user
On change l'ID du user pour 1013.
usermod -u 1013 user
On change le groupe du user pour le groupe mysql.
grep mysql /etc/group mysql::70: usermod -g 70 user grep user /etc/passwd user:x:70:70:MySQL user:/:
usermod -l user new_user
usermod -s /bin/bash user su user echo $SHELL /bin/bash
usermod -md /application/mysql user
passwd -x -1 user
On utilise l'option -L pour vérouiller le compte et -U pour le dévérouiller.
usermod -L user su user Password: su: Authentication failure usermod -U user su user Password:
last user wtmp begins Wed May 7 17:57
ps augxww USER PID %CPU %MEM SZ RSS TT S START TIME COMMAND root 8712 0.0 0.39782489168 ? S Sep 03 1075:21 splunkd -p 8089 start root 640 0.0 0.116472 9264 ? S Apr 09 0:00 /usr/lib/ssh/sshd root 641 0.0 0.11938412712 ? S Apr 09 0:01 /usr/lib/ssh/sshd root 642 0.0 0.111392 8536 pts/4 S Apr 09 0:01 -bash zabbix 1107 0.0 0.0 8328 2744 ? S Oct 17 0:00 /opt/zabbix/sbin/zabbix_agentd -c /opt/zabbix/etc/zabbix_agentd.conf zabbix 1109 0.0 0.1 9352 7456 ? S Oct 17 239:54 /opt/zabbix/sbin/zabbix_agentd -c /opt/zabbix/etc/zabbix_agentd.conf zabbix 1110 0.0 0.0 8328 2872 ? S Oct 17 1:14 /opt/zabbix/sbin/zabbix_agentd -c /opt/zabbix/etc/zabbix_agentd.conf root 7119 0.0 0.0 0 0 ? S Sep 03 0:00 zsched
ps augxww |grep zabbix_agentd zabbix 1107 0.0 0.0 8328 2808 ? S Oct 17 0:00 /opt/zabbix/sbin/zabbix_agentd -c /opt/zabbix/etc/zabbix_agentd.conf pargs 1107 1107: /opt/zabbix/sbin/zabbix_agentd -c /opt/zabbix/etc/zabbix_agentd.conf argv[0]: /opt/zabbix/sbin/zabbix_agentd argv[1]: -c argv[2]: /opt/zabbix/etc/zabbix_agentd.conf
prstat PID USERNAME SIZE RSS STATE PRI NICE TIME CPU PROCESS/NLWP 8712 root 96M 87M sleep 59 0 17:49:45 0.0% splunkd/28 20096 root 16M 8880K sleep 59 0 0:00:00 0.0% sshd/1 25972 root 16M 8936K sleep 59 0 0:00:00 0.0% sshd/1 26627 root 16M 9128K sleep 59 0 0:00:00 0.0% sshd/1 8713 root 47M 32M sleep 59 0 0:00:00 0.0% splunkd/1 7912 root 21M 20M sleep 59 0 0:12:20 0.0% svc.configd/15 7939 netcfg 3728K 2936K sleep 59 0 0:00:00 0.0% netcfgd/2 ... 12880 root 11M 8440K sleep 59 0 0:00:00 0.0% bash/1 7908 root 48M 45M sleep 59 0 0:05:24 0.0% svc.startd/12 12878 root 16M 9096K sleep 59 0 0:00:00 0.0% sshd/1 641 root 19M 12M sleep 59 0 0:00:01 0.0% sshd/1 8036 root 12M 3464K sleep 59 0 0:00:02 0.0% net-ipmgmt/1 7980 root 2664K 2304K sleep 59 0 0:00:16 0.0% pfexecd/9 Total: 57 processes, 197 lwps, load averages: 0.46, 0.43, 0.40
mpstat CPU minf mjf xcal intr ithr csw icsw migr smtx srw syscl usr sys wt idl 0 2 0 167 306 51 81 0 6 7 0 120 1 1 0 99 1 20 0 1295 996 846 236 1 17 18 0 446 2 2 0 96 2 3 0 179 52 4 82 1 4 3 0 71 0 0 0 99 3 0 0 7 22 0 37 0 1 1 0 10 0 0 0 100 4 0 0 7 23 0 39 0 1 1 0 10 0 0 0 100
vmstat kthr memory page disk faults cpu r b w swap free re mf pi po fr de sr s4 s5 s6 s7 in sy cs us sy id 0 0 0 21611288 7384936 66 234 0 0 0 0 0 25 25 0 0 4424 6665 3915 0 0 99
iostat tty sd4 sd5 sd6 sd7 cpu tin tout kps tps serv kps tps serv kps tps serv kps tps serv us sy wt id 0 9 1623 25 7 1623 25 7 0 0 0 0 0 0 0 0 0 99
netstat TCP: IPv4 Local Address Remote Address Swind Send-Q Rwind Recv-Q State -------------------- -------------------- ----- ------ ----- ------ ----------- darkstar.cdcsdm.64977 starship.galaxy 128872 0 128872 0 ESTABLISHED darkstar.cdcsdm.ssh cruser.universe.46673 65535 0 64240 0 ESTABLISHED darkstar.cdcsdm.ssh cruser.universe.40613 65535 0 64240 0 ESTABLISHED ... Active UNIX domain sockets Address Type Vnode Conn Local Addr Remote Addr 10010f348fd8 stream-ord 00000000 00000000 100108212038 stream-ord 00000000 00000000 1000bd3ea7c0 stream-ord 00000000 00000000 10009c70e0a0 stream-ord 1000521d8440 00000000 /opt/ilmt//clisock 1000b03b20a8 stream-ord 100065def280 00000000 /system/volatile/inetd.uds 100054b45798 stream-ord 00000000 00000000 10009c70ec40 dgram 00000000 00000000 10003ed03768 dgram 00000000 00000000
ldd /usr/bin/ksh libc.so.1 => /lib/libc.so.1 libm.so.2 => /lib/libm.so.2 /lib/libm/libm_hwcap1.so.2
pwck uucp:x:5:5:uucp Admin:/usr/lib/uucp: Login directory not found nuucp:x:9:9:uucp Admin:/var/spool/uucppublic:/usr/lib/uucp/uucico Login directory not found Optional shell file not found
grpck zbxgrp_14128:x:14128:zabbix Group name too long 1 Bad character(s) in group name
Sur solaris 10 il faut configurer le fichier /etc/default/login. Le reboot n'est pas necessaire.
Sur solaris 11 il faut configurer le fichier /etc/default/login, mais on peut aussi modifier /etc/user_attr.
This list of questions and answers was generated by makefaq.