windy@wl:~$ cat /etc/release
Oracle Solaris 11 11/11 X86
Copyright (c) 1983, 2011, Oracle and/or its affiliates. All rights reserved.
Assembled 18 October 2011
windy@wl:~$ isainfo -kv
64-bit amd64 kernel modules
windy@wl:~$
windy@wl:~$ cat /etc/passwd | grep root
root:x:0:0:Super-User:/root:/usr/bin/bash
windy@wl:~$ cat /etc/user_attr
root::::type=role
windy::::type=normal;lock_after_retries=no;profiles=System Administrator;roles=root
windy@wl:~$ su
Password:root 계정의 패스워드
root@wl:~# cat /etc/sudoers | grep windy
windy ALL=(ALL) ALL
또한 '설치시 생성했던 사용자'는 sudo 를 사용해 자유롭게 root 권한으로 명령을 실행할 수 있다.
windy@wl:~$ sudo su
Password:windy 계정의 패스워드
root@wl:~#
쉽게 말해 [설치시 생성했던 사용자 계정]과 [루트 계정]은 결과적으로 같은 권한을 가진다는 의미다. 롤 계정과 sudo(1m)에 대해서는 윈디하나의 솔라나라: ACL, SUDO, RBAC을 읽어보자.
windy@wl:~$ pwd /home/windy windy@wl:~$ cat /etc/passwd | grep windy windy:x:60004:10:WindyHana:/home/windy:/usr/bin/bash windy@wl:~$하지만 ZFS에서는 /export/home/* 에 생성되어있으며, 이는 automount 에 의해 /home 에 링크되어있다.
windy@wl:~$ zfs get mountpoint rpool/export/home/windy NAME PROPERTY VALUE SOURCE rpool/export/home/windy mountpoint /export/home/windy inherited from rpool/export windy@wl:~$ cat /etc/auto_home | grep /export/home/windy windy localhost:/export/home/windy
automount 에 대해서는 윈디하나의 솔라나라: NFS - /home 디렉토리(홈 디렉토리 공유)를 읽어보자.
사용자를 생성할 때에는 아래와 같이 기존보다 더 간단히 생성할 수 있다. ZFS 작업과 automount 작업은 useradd(1M)에서 알아서 해준다.
root@wl:~# useradd -c "웹관리자" -g staff -m -u 102 webmast
root@wl:~# su - webmast
webmast@wl:~$ df -h
...
rpool/export/home/webmast
147G 31K 140G 1% /export/home/webmast
/export/home/webmast 140G 31K 140G 1% /home/webmast
webmast@wl:~$ exit
root@wl:~# userdel -r webmast
Found user in files repository.
root@wl:~#
root@wl:~# df -h
Filesystem Size Used Available Capacity Mounted on
rpool/ROOT/solaris 147G 3.2G 140G 3% /
/devices 0K 0K 0K 0% /devices
/dev 0K 0K 0K 0% /dev
ctfs 0K 0K 0K 0% /system/contract
proc 0K 0K 0K 0% /proc
mnttab 0K 0K 0K 0% /etc/mnttab
swap 2.8G 1.5M 2.8G 1% /system/volatile
objfs 0K 0K 0K 0% /system/object
sharefs 0K 0K 0K 0% /etc/dfs/sharetab
/usr/lib/libc/libc_hwcap1.so.1
143G 3.2G 140G 3% /lib/libc.so.1
fd 0K 0K 0K 0% /dev/fd
rpool/ROOT/solaris/var
147G 186M 140G 1% /var
swap 2.8G 48K 2.8G 1% /tmp
rpool/export 147G 32K 140G 1% /export
rpool/export/home 147G 32K 140G 1% /export/home
rpool/export/home/windy
147G 1.1M 140G 1% /export/home/windy
rpool 147G 39K 140G 1% /rpool
/export/home/windy 140G 1.1M 140G 1% /home/windy
root@wl:~# zpool list
NAME SIZE ALLOC FREE CAP DEDUP HEALTH ALTROOT
rpool 149G 6.63G 142G 4% 1.00x ONLINE -
root@wl:~# zfs list
NAME USED AVAIL REFER MOUNTPOINT
rpool 6.73G 140G 39K /rpool
rpool/ROOT 3.63G 140G 31K legacy
rpool/ROOT/solaris 3.63G 140G 3.20G /
rpool/ROOT/solaris/var 335M 140G 186M /var
rpool/dump 2.06G 140G 2.00G -
rpool/export 1.18M 140G 32K /export
rpool/export/home 1.14M 140G 32K /export/home
rpool/export/home/windy 1.11M 140G 1.11M /export/home/windy
rpool/swap 1.03G 140G 1.00G -
root@wl:~# zpool status
pool: rpool
state: ONLINE
scan: none requested
config:
NAME STATE READ WRITE CKSUM
rpool ONLINE 0 0 0
c3t0d0s0 ONLINE 0 0 0
errors: No known data errors
root@wl:~# netadm enable -p ncp Automatic 또는 root@wl:~# netadm enable -p ncp DefaultFixed
네트워크를 설정하기 전에, 자동모드를 사용할 것인지, 수동모드를 사용할 것인지를 결정해야 한다. 자동 모드는 가상인터페이스를 자동으로 관리해주는 것이지 DHCP를 의미하는게 아니다. 자동모드를 사용하면 자동으로 /lib/inet/nwamd 이 실행된다. Oracle Solaris 11에서 네트워크가 구성되는 방식을 읽어보자.
현재 네트워크 모드 및 NCP, NCU(Network Configuration Unit) 이름은 아래와 같이 확인해볼 수 있다.
root@wl:~# netadm list TYPE PROFILE STATE ncp Automatic online ncu:phys net0 online ncu:ip net0 online loc Automatic online loc NoNet offline loc User disabled root@wl:~#
root@wl:~# netadm list
TYPE PROFILE STATE
ncp Automatic online
ncu:phys net0 online
ncu:ip net0 online
loc Automatic online
loc NoNet offline
loc User disabled
root@wl:~# ipadm show-addr
ADDROBJ TYPE STATE ADDR
lo0/v4 static ok 127.0.0.1/8
net0/_b dhcp ok 192.168.0.90/24
lo0/v6 static ok ::1/128
net0/_a addrconf ok fe80::207:e9ff:fe00:6ee6/10
root@wl:~# ipadm show-if
IFNAME CLASS STATE ACTIVE OVER
lo0 loopback ok yes --
net0 ip ok yes --
root@wl:~# dladm show-phys
LINK MEDIA STATE SPEED DUPLEX DEVICE
net0 Ethernet up 100 full iprb0
root@wl:~# dladm show-link
LINK CLASS MTU STATE OVER
net0 phys 1500 up --
root@wl:~# ifconfig -a
lo0: flags=2001000849<UP,LOOPBACK,RUNNING,MULTICAST,IPv4,VIRTUAL> mtu 8232 index 1
inet 127.0.0.1 netmask ff000000
net0: flags=1004843<UP,BROADCAST,RUNNING,MULTICAST,DHCP,IPv4> mtu 1500 index 2
inet 192.168.0.90 netmask ffffff00 broadcast 192.168.0.255
ether 0:7:e9:0:6e:e6
lo0: flags=2002000849<UP,LOOPBACK,RUNNING,MULTICAST,IPv6,VIRTUAL> mtu 8252 index 1
inet6 ::1/128
net0: flags=20002004841<UP,RUNNING,MULTICAST,DHCP,IPv6> mtu 1500 index 2
inet6 fe80::207:e9ff:fe00:6ee6/10
ether 0:7:e9:0:6e:e6
시스템은 Automatic 모드를 사용하고 있으며, net0 라는 가상 인터페이스를 사용하고 있고 이 인터페이스는 iprb0 물리인터페이스(인텔의 100Mbps NIC 장치)를 가리키고 있음을 알 수 있다.
root@wl:~# svcs -l network/physical:default
root@wl:~# ipadm create-ip net0 root@wl:~# ipadm create-addr -T static -a local=10.1.2.3/24 net0/addr
root@wl:~# vi /etc/defaultrouter 192.168.0.1 root@wl:~# route add default 192.168.0.1 add net default: gateway 192.168.0.1
root@wl:~# ipadm create-ip net0 root@wl:~# ipadm create-addr -T dhcp net0/addr
root@wl:~# dladm show-physnet0 가상NIC의 할당 상태를 보임
root@wl:~# dladm show-phys -L net0
root@wl:~# svccfg
svc:> select dns/client
svc:/network/dns/client> setprop config/search = astring: \
("solanara.net" "l.solanara.net" )
svc:/network/dns/client> setprop config/nameserver = net_address: \
( 168.126.63.1 168.126.63.2 )
svc:/network/dns/client> select dns/client:default
svc:/network/dns/client:default> refresh
svc:/network/dns/client:default> validate
svc:/network/dns/client:default> select name-service/switch
svc:/system/name-service/switch> setprop config/host = astring: "files dns"
svc:/system/name-service/switch> select system/name-service/switch:default
svc:/system/name-service/switch:default> refresh
svc:/system/name-service/switch:default> validate
svc:/system/name-service/switch:default>
root@wl:~# svcadm enable dns/client
root@wl:~# svcadm refresh name-service/switch
root@wl:~# grep host /etc/nsswitch.conf root@wl:~# cat /etc/resolv.conf
root@wl:~# netcfg "create ncp ncp-name; create ncu phys ncu-name; set property=value"
root@wl:~# netcfg "create ncp ncp-name; create ncu ip ncu-name; set property=value"
root@wl:~# netcfg "select ncp ncp-name; select ncu ip ncu-name; set ipv4-addrsrc=static; set ipv4-addr = 1.1.1.1/24" root@wl:~# netcfg "create ncp ncp-name; create ncu ip ncu-name; set ipv4-addrsrc=dhcp"
root@wl:~# netcfg "select ncp ncp-name; select ncu phys ncu-name; set property=value" root@wl:~# netcfg "select ncp ncp-name; select ncu ip ncu-name; set property=value"
root@wl:~# netcfg "create loc loc-name; set dns-nameservice-configsrc=dhcp" root@wl:~# netcfg "create loc loc-name; set dns-nameservice-configsr=static; set dns-nameservice-servers=1.1.1.1; set dns-nameservice-search=foo.com"
root@wl:~# netcfg "select ncp ncp-name; select ncu ip ncu-name; set ipv4-default-route=1.1.1.1"
root@wl:~# sysconfig unconfigure system
root@wl:~# sysconfig configure system
windy@wl:~$ rm ~/.profile
windy@wl:~$ rm ~/.bashrc
windy@wl:~$ vi ~/.profile
if [ -f /usr/bin/less ]; then
export PAGER="/usr/bin/less -ins"
elif [ -f /usr/bin/more ]; then
export PAGER="/usr/bin/more -s"
fi
tty -s && stty cs8 -istrip defeucw
if [ "$TERM" = "dumb" ] || [ "$TERM" = "dumb-" ]; then
LANG=C; export LANG;
fi
case ${SHELL} in
*bash)
PS1="\u@\h \w \\$ "
if [ "$0" == "-bash" ]; then
if [ -f ~/.bashrc ]; then
. ~/.bashrc
else
export HISTCONTROL=erasedups
alias ll="/usr/bin/ls -alhF"
alias pp="/usr/bin/ps -eo 'user,pid,ppid,time,comm,s,zone,class,pri,rss,pmem'"
fi
fi
;;
esac
export PS1
EDITOR=vi; export EDITOR
CC=cc; export CC
CXX=CC; export CXX
PATH=/usr/local/ssl/bin:/usr/local/bin:/usr/bin:/usr/sbin:/usr/ccs/bin:/usr/openwin/bin; export PATH
LD_LIBRARY_PATH=/usr/local/ssl/lib:/usr/local/lib:/usr/lib:/usr/ucblib:/usr/ccs/lib; export LD_LIBRARY_PATH
MANPATH=/usr/man:/usr/local/share/man:/usr/openwin/man:/usr/X11/man:/opt/sunstudio12.2/man; export MANPATH
windy@wl:~$ vi ~/.bashrc
export HISTCONTROL=erasedups
alias ll="/usr/bin/ls -alhF"
alias pp="/usr/bin/ps -eo 'user,pid,ppid,time,comm,s,zone,class,pri,rss,pmem'"
export PROMPT_COMMAND='RET_VALUE=$?; if [ "$RET_VALUE" != "0" ]; then RET_VALUE="${RET_VALUE} "; else RET_VALUE=""; fi'
export PS1='${RET_VALUE}\u@\h \w \$ '
windy@wl:~$ sudo cp .bashrc /etc/skel/
Password:[windy계정의패스워드]
windy@wl:~$ sudo cp .profile /etc/skel/
/usr/gnu 디렉토리(기존의 /usr/sfw 디렉토리와 유사)의 툴은 필요한 것만 /usr/local/bin 에 링크시켜 사용할 것이다.
root@wl:~# svcadm enable sar
root@wl:~# crontab -e sys 1)
0 * * * 0-6 /usr/lib/sa/sa1
20,40 8-17 * * 1-5 /usr/lib/sa/sa1
5 18 * * 1-5 /usr/lib/sa/sa2 -s 8:00 -e 18:01 -i 1200 -A
1) 주석만 풀어주면 되며 crontab의 기본 에디터는 vi로 되어있다.
root@wl:~# vi /etc/inet/ntp.conf 1)
server ntp1.sjtel.net
server ntp2.sjtel.net
root@wl:~# svcadm enable ntp
1) ntp1.sjtel.net(ntp1.epidc.co.kr) 의 NTP서버를 사용했다. 사용하고 있는 ISP나 IDC에 다른 시간 서버가 있다면 그걸 사용하는게 더 좋다.
root@wl:/opt# tar xvfj SolarisStudio12.3-solaris-x86-bin.tar.bz2 root@wl:/opt# mv SolarisStudio12.3-solaris-x86-bin/solarisstudio12.3/ . root@wl:/opt# rm -rf rm -rf SolarisStudio12.3-solaris-x86-bin root@wl:/opt# vi /etc/profile ... export PATH=/opt/solarisstudio12.3/bin:$PATH
root@wl:~# pkg install system/header
Packages to install: 1
Create boot environment: No
Create backup boot environment: No
DOWNLOAD PKGS FILES XFER (MB)
Completed 1/1 1560/1560 3.1/3.1
PHASE ACTIONS
Install Phase 1681/1681
PHASE ITEMS
Package State Update Phase 1/1
Image State Update Phase 2/2
root@wl:~# pkg install developer/gcc-45
Packages to install: 4
Create boot environment: No
Create backup boot environment: No
Services to change: 1
DOWNLOAD PKGS FILES XFER (MB)
Completed 4/4 1030/1030 123.6/123.6
PHASE ACTIONS
Install Phase 1270/1270
PHASE ITEMS
Package State Update Phase 4/4
Image State Update Phase 2/2
root@wl:~# gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/gcc/4.5/lib/gcc/i386-pc-solaris2.11/4.5.2/lto-wrapper
Target: i386-pc-solaris2.11
Configured with: /builds/hudson/workspace/nightly/build/i386/components/gcc45/gc
c-4.5.2/configure CC=/ws/onnv-tools/SUNWspro/sunstudio12.1/bin/cc CXX=/ws/onnv-t
ools/SUNWspro/sunstudio12.1/bin/CC --prefix=/usr/gcc/4.5 --mandir=/usr/gcc/4.5/s
hare/man --bindir=/usr/gcc/4.5/bin --libdir=/usr/gcc/4.5/lib --sbindir=/usr/gcc/
4.5/sbin --enable-languages=c,c++,fortran,objc --enable-shared --with-gmp-includ
e=/usr/include/gmp --with-mpfr-include=/usr/include/mpfr --prefix=/usr/gcc/4.5 -
-mandir=/usr/gcc/4.5/share/man --infodir=/usr/gcc/4.5/share/info --libexecdir=/u
sr/gcc/4.5/lib CFLAGS='-g -O2 '
Thread model: posix
gcc version 4.5.2 (GCC)
root@wl:~# vi /etc/profile 1)
...
CC=gcc; export CC
CXX=g++; export CXX
...
1) CC, CXX 환경 변수를 수정한다.
|
|
Copyright © 2004-2012 Jo HoSeok. All rights reserved. |