'분류 전체보기'에 해당되는 글 2491건

  1. 2008.12.30 네이버 지도 이용하기 openapi map
  2. 2008.12.29 구글 차트(Google Chart) API
  3. 2008.12.28 [ JSP ] 게시판 페이징 처리 로직 JSP
  4. 2008.12.24 스크롤바 색상
  5. 2008.12.22 oracle archive mod 전환:::
  6. 2008.12.22 google Chart Types
  7. 2008.12.22 -Chaos Graph API Ver 1.2
  8. 2008.12.22 오라클 9i 임포트 가이드 (import)
  9. 2008.12.19 unix os별 종료 명령어
  10. 2008.12.17 엑셀 sumif 조건별 값 더하기
  11. 2008.12.17 solaris10 apache 2.0.59 설치 2222
  12. 2008.12.17 Solaris10 Apache 2.0.59 설치
  13. 2008.12.17 solaris에 subversion 설치 및 사용법
  14. 2008.12.17 솔라리스 10에 톰켓 5.0.28 버전의 catalina.out 로그 로테이트 관리
  15. 2008.12.17 솔라리스에서 Xmanager 사용하기
  16. 2008.12.17 solaris 설치후 기본적인 설정(추천)
  17. 2008.12.17 ssh 관련 1
  18. 2008.12.17 솔라리스 패키지 관련 명령어
  19. 2008.12.17 SPARC/Solaris Installing OpenSSH
  20. 2008.12.17 solaris 설치후 기본적인 설정 및 설치
  21. 2008.12.17 RAID 구성하기
  22. 2008.12.17 solaris 시스템 디스크 교체 후 E3500 부팅 절차
  23. 2008.12.17 solaris 부팅시 잘못되었을때 vi 명령 안될때
  24. 2008.12.17 solaris 에 proftpd 설치 (추천)
  25. 2008.12.17 solaris 에 openssl 설치하기 (추천)
  26. 2008.12.17 solaris 에 tomcat 설치하기 (추천)
  27. 2008.12.17 solaris 에 amp(Apache HTTPD, MySQL, PHP) 설치하기 (추천)
  28. 2008.12.17 solaris 에 oracle 설치하기(추천)
  29. 2008.12.16 유닉스에서 개발 웹 서버 설치, 설정하기7
  30. 2008.12.16 유닉스에서 개발 웹 서버 설치, 설정하기6
98..Etc/openapi2008. 12. 30. 13:10
반응형
국내 Open API 중의 하나인 Naver API .

그 중에서 가장 인기 좋은(?) Map Open API 에 대해서 구현해 보았다.


사용자 삽입 이미지


Map Open API 키 받기

Open API 를 사용하기 위해서는 Naver 에서 키를 받아야 한다.

주소 : http://openapi.naver.com/register.nhn   에서 키를 받자.

참고 링크 : http://openapi.naver.com/page.nhn?PageId=3_02_2


키 부여


<script type="text/JavaScript"           
          src="http://maps.naver.com/js/naverMap.naver?key=부여받은 NaverMap Key"></script>



뿌릴 부분

<div id='mapContainer' style='width:가로크기 ;  height: 세로크기 '></div>
 
<div id='mapContainer' style='width:300px;height:300px'></div>



객체 생성

var 변수명 = new NMap(document.getElementById('mapContainer'),
                 가로크기, 세로크기 );


var mapObj = new NMap(document.getElementById('mapContainer'),300,300);


표시될 위치 및 ZOOM 레벨 정하기


변수명.setCenterAndZoom(new NPoint(맵 포인트 ), Zoom 레벨 );

Tip : 해당 맵 포인트는 http://mmap.tistory.com/  에서 얻을 수 있다.

mapObj.setCenterAndZoom(new NPoint(321198,529730),3);


확대, 축소 컨트롤 생성

var zoom = new NZoomControl();                 // 컨트롤을 생성
zoom.setAlign("right");                               // 컨트롤 위치 정하기
zoom.setValign("bottom");
mapObj.addControl(zoom);                         // 컨트롤 추가하기

Posted by 1010
98..Etc/Etc...2008. 12. 29. 01:28
반응형
구글 차트(Google Chart) API라는 게 있었군요. 뭐 국내에도 관련 포스트는 많이 있었지만, 정작 사용예를 올려놓은 포스트는 없는 듯해서 쓸데없이; 차트를 몇 개 만들어봤습니다. 먼저 메신저에서 자료수집에 협조해주신 아래 두 분께 감사를...

irk가 공부할 것들
irk가 공부할 것들
http://chart.apis.google.com/chart?cht=p&chs=400x200&chd=t:60,25,10,5
&chl=painting%7Caction%20script%7Cenglish%7Cphilosophy&chco=ff99aa
&chtt=STUDY%21 (가독성 때문에 임의로 행을 나눴습니다. 이하 같습니다)





달팽이 좋아하는 밴드들
달팽이 좋아하는 밴드 및 선호도;
http://chart.apis.google.com/chart?cht=bvg&chbh=50,30,50&chs=500x250&chd=t:78,63,50,40,30
&chl=sister%27s%20barbershop%7Cdelispice%7CJulia%20Hart%7CRadiohead%7CMuse&chxt=y
&chco=99ff66&chtt=dalpoin%27s%20favorite%20bands




저의 160기가 하드의 파티션들;;
저의 160기가 하드의 파티션;;
http://chart.apis.google.com/chart?cht=p3&chd=t:18.6,18.6,31.2,37.2,37.2,0.5,5.99
&chl=C:system%7CD:translation%7CE:down%7CF:music%7CG:game%7CY:ramdisk%7CZ:swap
&chs=400x200&chtt=my%20160gb%20hdd&chco=3366ff




이 블로그 최근 방문자 수
이 블로그 최근 방문자 수
http://chart.apis.google.com/chart?cht=lc&chs=400x200
&chd=t:81.5,82.7,34.4,45.2,50.4,38.3,69.5,45,41.2
&chl=5|6|7|8|9|10|11|12|13&chxt=y&chtt=visitors/10%20(march,%202008)&chco=ff00ff


대충 이 정도입니다만... 사용해본 소감은 일단 엄청나게 불편하다였습니다-_- url만으로 차트 이미지를 만들 수 있다는 점은 분명 매력적이지만(이런 아이디어 자체는 php를 하는 사람이 보기에 사실 전혀 새로울 게 없긴 합니다만), 문제는 그 url을 쳐넣기가 힘들다는 사실이죠. 찾아보니 이미 누군가가 편리하게 html 폼을 만들어놓긴 했더군요. 일반 사용자라면 Chart Maker를 이용하는 것이 이렇게 일일이 url 코드를 직접 작성하는 방법보다 훨씬 편리할 듯합니다.

하지만 이보다 더 본질적인 문제는 사용할 수 있는 자료에 한계가 있다는 점이었습니다. 현재로서 구글 차트 API에 입력할 수 있는 숫자의 범위는 고작 0~4095밖에 안 됩니다. 그것도 복잡한 숫자-문자 변환을 거쳐야만 가능하죠. 그냥 숫자로 입력할 때에는 0.0~100.0이 한계입니다. 때문에 위에서 '이 블로그 최근 방문자 수' 차트를 그릴 때에는 10으로 나누어 입력해야만 했죠. 지금으로선 재미로 사용하는 정도랄까요... 사실 엑스차트와 같은 좋은 국산 서비스도 이미 존재하니까요.

Posted by 1010
05.JSP2008. 12. 28. 16:39
반응형
[ JSP ] 게시판 페이징 처리 로직 JSP

2007/03/09 03:05

http://blog.naver.com/wldud_0729/150015317564

매번 페이징을 구현할 때마다, 한 두시간 씩 끙끙대는 것 같다.

생각을 의사코드로 적은 후에 그걸 코드화 하는 습관을 들여야하는데,

성질이 급해서 일단 생각을 코드화 해서 버그를 잡은 다음에.. 그제서야 의사코드로 적고 있다.

다음은 생각의 흐름를 정리해본 것이다.

************************************************************************************************


 총 데이터 수가 37개인 데이터를 페이징 처리 해보자.

 데이터는 DB에서 가져오거나 xml파일을 읽어올 것이다.

  페이지를 3 페이지씩 보여줄 수도 있고 [1] [2] [3] [다음]

 혹은 10페이지씩 보여줄 수도 있다. [1] [2] [3] [4] [5] ...[10] [다음]

 값 셋팅에 따라 달라질 수 있도록 페이지그룹 사이즈(pageGroupSize) 변수를 사용하겠다.

 셋팅할 수 있는 값이 페이지그룹 사이즈 말고 또 무엇이 있을까?

  한 페이지 당 보여주는 리스트 갯수도 변할 가능성이 많다.

 이것은 페이지 사이즈(pageSize) 변수로 놓자.

 그러면, 페이징 로직의 결과를 예측하기 위해서 이 두개의 변수에 값을 넣어보자.


 총 데이터 갯수 (count): 37
 페이지그룹 사이즈 (페이지그룹을 몇개씩 묶을 것인가) : 3
 페이지 사이즈 (한 페이지 당 리스트 갯수): 4

 이렇게 셋팅을 할 경우, 나오는 결과는?

 총 페이지 수(pageCount)는 37 / 4 = 9.25 니까 10 페이지 되겠다.

  pageCount = (count / pageSize ) + ( count % pageSize == 0 ? 0 : 1); 

  => count % pageSize == 0 ? 0 : 1 이 수식을 풀어서 쓰면

            if(count % pageSize == 0)
                return 0;
            else
                return 1;

    이렇게 표현된다.

 =============================================================================
                                                 [1][2][3]   [4][5][6]   [7][8][9]   [10]
 페이지그룹넘버(numPageGroup) :   - 1 -           - 2 -           - 3 -      - 4 -
 =============================================================================
 
 페이지 그룹은 위와같이 총 4개로 나올 것이다. (pageGroupCount : 4)

 이 페이지 그룹을 본 후, 현재페이지가 호출될 경우를 생각해보면

 5페이지가 호출된다면 numPageGroup이 2인 상태로 페이지바가 보여질 것이다.

 그렇다면, 호출된 현재페이지를 가지고 페이지그룹넘버를 구하고,

 페이지그룹넘버값으로 페이지바의 첫번째 페이지를 계산해보자.

 numPageGroup = 올림(currentPage/pageGroupSize)

  => int numPageGroup = (int) Meth.ceil ((double)currentPage/pageGroupSize)                   

 => numPageGroup : 올림(5/3) = 2

 startPage = (numPageGroup - 1)*pageGroupSize + 1;

 => stratPage : (2-1)*3+1 = 4

 이제 시작페이지를 가지고 마지막 페이지도 구해보자

 endPage = startPage + pageGroupSize -1 => 4+3-1 = 6

 이런식으로 시작페이지와 마지막페이지를 구했다면, for문을 돌려서 페이지바를 출력할 수 있을 것이다.

 그런데, 마지막 페이지그룹을 위 공식대로 계산하면 endPage가 12페이지가 나온다.

  총 페이지수가 10개인데 12페이지까지 출력되면 안 될것이다.

 따라서, if문 처리를 추가해주자.

 if( 마지막페이지 > 총페이지 )
  마지막페이지 = 총 페이지    => endPage = 10

************************************************************************************************

로직은 자바 클래스로, 출력부분은 JSTL 코드로 작성했는데.. 페이징 부분 코드는 다음과 같다.
 

[ 자바 클래스 ]

          //한 페이지 당 보여줄 글 갯수
17:         private final static int pageSize = 4;
18:         //페이지그룹안의 페이지 갯수 ex) [이전] 1 2 3 4 5 [다음] 일 경우 페이지 갯수는 5
19:         private final static int pageGroupSize = 3;

             String pageNum = request.getParameter("pageNum");//페이지 번호
25:
26:         if (pageNum == null) {
27:             pageNum = "1";
28:         }
29:        
30:         int currentPage = Integer.parseInt(pageNum);
31:         int startRow = (currentPage - 1) * pageSize + 1;//한 페이지의 시작글 번호
32:         int endRow = currentPage * pageSize;//한 페이지의 마지막 글번호
33:         int count = 0;
34:         int number=0;


35:         ArrayList articleList = new ArrayList();
36:         BoardDAO dbPro = BoardDAO.getInstance();//DB연동
37:         count = dbPro.getTotalCnt();//전체 글의 수
38:        
39:         if (count > 0) {       
40:                 if(endRow>count)
41:                         endRow = count;
42:             articleList = dbPro.select(startRow,endRow);//현재 페이지에 해당하는 글 목록
43:            
44:         } else {
45:             articleList = null;
46:         }
47:                
48:                 number=count-(currentPage-1)*pageSize;//글목록에 표시할 글번호
49:                
50:                 //페이지그룹의 갯수
51:                 //ex) pageGroupSize가 3일 경우 '[1][2][3]'가 pageGroupCount 개 만큼 있다. 
52:                 int pageGroupCount = count/(pageSize*pageGroupSize)+( count % (pageSize*pageGroupSize) == 0 ? 0 : 1);
53:                 //페이지 그룹 번호
54:                 //ex) pageGroupSize가 3일 경우  '[1][2][3]'의 페이지그룹번호는 1 이고  '[2][3][4]'의 페이지그룹번호는 2 이다.
55:                 int numPageGroup = (int) Math.ceil((double)currentPage/pageGroupSize);

          //해당 뷰에서 사용할 속성
57:         request.setAttribute("currentPage", new Integer(currentPage));
58:         request.setAttribute("startRow", new Integer(startRow));
59:         request.setAttribute("endRow", new Integer(endRow));
60:         request.setAttribute("count", new Integer(count));
61:         request.setAttribute("pageSize", new Integer(pageSize));

             request.setAttribute("number", new Integer(number));
63:         request.setAttribute("pageGroupSize", new Integer(pageGroupSize));
64:         request.setAttribute("numPageGroup", new Integer(numPageGroup));
65:         request.setAttribute("pageGroupCount", new Integer(pageGroupCount));
66:         request.setAttribute("articleList", articleList);
67:       
68:         return "./list.jsp";//해당 뷰


[ JSP 부분 ]

<c:if test="${count > 0}">
   <c:set var="pageCount" value="${count / pageSize + ( count % pageSize == 0 ? 0 : 1)}"/>
   <c:set var="startPage" value="${pageGroupSize*(numPageGroup-1)+1}"/>
   <c:set var="endPage" value="${startPage + pageGroupSize-1}"/>
  
   <c:if test="${endPage > pageCount}" >
     <c:set var="endPage" value="${pageCount}" />
   </c:if>
         
   <c:if test="${numPageGroup > 1}">
        <a href="./list.do?pageNum=${(numPageGroup-2)*pageGroupSize+1 }">[이전]</a>
   </c:if>


   <c:forEach var="i" begin="${startPage}" end="${endPage}">
       <a href="list.do?pageNum=${i}">[
        <font color="#000000" />
          <c:if test="${currentPage == i}">
          <font color="#bbbbbb" />
        </c:if>
        ${i}
       </font>]
       </a>
   </c:forEach>


   <c:if test="${numPageGroup < pageGroupCount}">
        <a href="./list.do?pageNum=${numPageGroup*pageGroupSize+1}">[다음]</a>
   </c:if>
</c:if>

출처 : Tong - 민뎅님의 java통

Posted by 1010
반응형
Posted by 1010
02.Oracle/DataBase2008. 12. 22. 22:07
반응형

$ sqlplus "/ as sysdba" -- 접속한다.


- archive log mode 인지 아닌지 상태 확인

SQL> archive log list
Database log mode              No Archive Mode
Automatic archival             Disabled
Archive destination            /u01/app/oracle/product/10.2.0/db_1/dbs/arch
Oldest online log sequence     2
Current log sequence           4


- spfile 로 startup 되는지 pfile(init_SID.ora)로 startup 되는지 확인한다.

SQL> show parameter spfile
NAME                                               TYPE        VALUE
------------------------------------ ----------- ------------------------------
spfile                                                string

- spfile 로 startup 하지 않는 걸로 확인되었으므로, pfile(init_SID.ora)로 startup 되는 것으로 확인 됨.
모든 parameter 수정은 pfile(init_SID.ora)에서 하면 됨.


1. parameter 수정

initSID.ora 에서 아래 부분을 주석(#)을 제거하고 적절한 값으로 설정 후 저장합니다.

log_archive_start = true
log_archive_dest = "/u01/app/oracle/oradata/TSH1/arch/ reopen=60"
log_archive_format = "SID_arch_%t_%s_%r.arc"


!) oracle10g 에서는

# *.log_archive_start = true --  주석처리
*.log_archive_dest_1 = "location=/oracle/oradata/ORCL/archive reopen=60"   (아카이브파일의 경로)
*.log_archive_format = SID_arch_%t_%s_%r.arc --  file 형식을 이와 같이 설정


 문제 : ORA-32004: obsolete and/or deprecated parameter(s) specified
 해결 : Remove the log_archive_start parameter.
 설명 : As of 10g the log_archive_start parameter has been deprecated.
         When placing the database into archive log mode the starting of the ARCH process is implictly set to auto.
         It is no longer possible to have a database in archive log mode but not have automatic archiving enabled.


2. DB shutdown
SQL> shutdown immediate


3. startup mount
SQL> startup mount


4. archive log mode 변경
SQL> alter database archivelog;


5. DB open
SQL> alter database open;


6. DB shutdown
SQL> shutdown immediate
가능하다면 이 시점에서 DB를 Shutdown 한 뒤  cold backup 을 받고 사용하세요.


- DB startup 후 archive file 이 정상적으로 쌓이는지 확인
SQL> ALTER SYSTEM SWITCH LOGFILE;


- 설정한 경로에 아카이브 파일이 생성되었는지 확인한다.
SQL> !

# ls /u01/app/oracle/oradata/TSH1/arch



### 만약, spfile 로 DB start 시...

- DB open 상태에서

SQL> alter system set log_archive_start=true scope=spfile;

SQL> alter system set log_archive_dest='/Backup/oradata/ORA9/ARC' scope=spfile;
SQL> alter system set log_archive_format='ORA9_%s.arc' scope=spfile;


!) oracle 10g 일 때

SQL> alter system set log_archive_dest='/Backup/oradata/ORA10/ARC' scope=spfile; -

SQL> alter system set log_archive_format='ORA10_%t_%s_%r.arc' scope=spfile; -


SQL> shutdown immediate;

SQL> startup mount;

SQL> archive log list

SQL> alter database archivelog;

SQL> archive log list

SQL> alter database open ;

Posted by 1010
01.JAVA/Java2008. 12. 22. 15:18
반응형

Chart Types

This document gives an overview of the types of charts you can create using the Chart API.

Table of Contents

Line charts

Specify a line chart with

cht=<line chart style>

Where <line chart style> is lc, ls, or lxy as described in the following table.

Parameter Description Example

cht=lc

For charts of type lc, data points are spaced evenly along the x-axis. Multiple data sets are drawn as multiple lines.

For information on how to specify multiple data sets see Using multiple data series.

For information on available parameters, see Optional parameters by chart type.

Chart with line in yellow
cht=lc
chd=t:40,60,60,45,47,75,70,72

cht=ls

Line charts of type ls are also known as sparklines. They take the same parameters, and behave in the same way, as charts of type lc. The difference between charts of type lc and charts of type ls, is that by default, no axis lines are drawn for charts of type ls.

For information on how to add axis lines and labels to a line chart, see Axis styles and labels.

Sparkline chart in blue
cht=ls
chd=t:27,25,60,31,25,39,25,
31,26,28,80,28,27,31,27,
29,26,35,70,25

cht=lxy

For charts of type lxy, a pair of data sets is required for each line. The first data set of each pair specifies the x-axis coordinates, and the second data set specifies y-axis coordinates.

If you pass in an odd number of data sets, the last set is ignored. To space the data points evenly along the x-axis, provide a single undefined value as the first data set of the pair. For more information about undefined values, see Data formats.

Line chart with unevenly spaced data points and lines in red, green and dashed blue
cht=lxy
chd=t:10,20,40,80,90,95,99|
20,30,40,50,60,70,80|
-1|
5,25,45,65,85

Back to top

Bar charts

Specify a bar chart with

cht=<bar chart style>

Where <bar chart style> is bhs, bhg, bvs or bvg as described in the following table.

Depending on the bar chart style, multiple data sets are drawn as stacked or grouped bars. For information on how to specify multiple data sets, see Using multiple data series.

For information on available parameters, see Optional parameters by chart type.

Parameter Description Example

cht=bhs

Horizontal bar chart, with stacked bars.

The first example (all bars in dark blue) has a single data set.

The second example (bars in dark and pale blue) has two data sets.

As you can see, multiple data sets are stacked. You must specify a color for each data set. You can also specify a color for each data point, or bar, within a single data set. See Colors for information about specifying colors.

The second example does not use data scaling. Data points that have a combined value greater than 100 are only partially visible. See Text encoding with data scaling for more information about data scaling.

Horizontal bar chart with two data sets: both are colored in blue
cht=bhs
chco=4D89F9

Horizontal bar chart with two data sets: one data set is colored in dark blue the second is stacked in pale blue
cht=bhs
chco=4D89F9,C6D9FD
chd=t:10,50,60,80,40|
50,60,100,40,20

cht=bvs

Vertical bar chart, with stacked bars.

This example has two data sets, and uses data scaling to ensure that the bars are fully visible.

Vertical bar chart with two data sets: one data set is colored in dark blue the second is stacked in pale bluecht=bvs
chco=4D89F9,C6D9FD
chd=t:10,50,60,80,40|
50,60,100,40,20
chds=0,160

cht=bhg

Horizontal bar chart, with grouped bars.

Horizontal bar chart with two data sets: one data set is colored in dark blue the second is adjacent in pale blue
cht=bhg
chco=4D89D9,C6D9FD

cht=bhg
cht=bvg

Vertical bar chart, with grouped bars.

Vertical bar chart with two data sets: one data set is colored in dark blue the second is adjacent in pale blue
cht=bvg
chco=4D89F9,C6D9FD

chbh

The default width for bars is 23 pixels. If you specify too many bars for the available chart size, not all bars appear.

Use chbh=a to fix this problem, by automatically resizing bars so that they fit within the chart size.

For more options, see Bar width and spacing.

Vertical grouped bar chart in blue and black, bars have the default width
cht=bvg

chbh omitted

Vertical grouped bar chart in blue and black, bars and spaces are automatically sized
cht=bvg
chbh=a

Back to top

Pie charts

Specify a pie chart with

cht=<pie chart style>

Where <pie chart style> is p, p3, or pc as described in the following table. For information on available parameters, see Optional parameters by chart type.

Parameter Description Example

cht=p

Two dimensional pie chart.

Supply one data set only; subsequent data sets are ignored.

By default, pie segment colors are interpolated from dark orange to pale yellow. Specify other colors as described in Colors.

Specify labels with chl as described in Pie chart labels.

The Google Chart API calculates the circle's radius from the minimum of width and height specified in the chart size (chs) parameter. If you are including labels, you probably need to specify the size of the width to be twice the size of the height, to ensure that your labels are fully visible.

Two-dimensional pie chart with four segments where segment colors are interpolated from dark to pale orange

cht=p
chs=200x100

cht=p3

Three dimensional pie chart.

Specify data and formatting in the same way as for two dimensional pie charts, above.

If you are including labels in a three dimensional pie chart, you probably need to specify the size of the width to be 2.5 times the size of the height, to ensure that your labels are fully visible.

Three-dimensional pie chart with four segments where segment colors are interpolated from dark to pale orange

cht=p3
chs=250x100

cht=pc

Concentric pie charts.

Supply two or more data sets.

Two concentric pie charts with four segments each, where segment colors are interpolated from dark to pale orange

cht=pc
chd=s:Helo,Wrld

chp

Pie chart orientation.

To change the orientation of a pie chart, use
chp=<angle in radians>

Pie chart with two segments

chd=t:80,20

Pie chart with two segments, rotated by 0.628

chd=t:80,20
chp=0.628

Back to top

Venn diagrams

Specify a venn diagram with

cht=v

Supply one data set where:

  • The first three values specify the relative sizes of three circles: A, B, and C.
  • The fourth value specifies the area of A intersecting B.
  • The fifth value specifies the area of A intersecting C.
  • The sixth value specifies the area of B intersecting C.
  • The seventh value specifies the area of A intersecting B intersecting C.
Parameter Description Example

cht=v

In this example, the value 100 specifies the first circle, the value 80 specifies the second circle, and the value 60 specifies the third circle. The values 30, 25 and 20 specify the areas of overlap between each pair of circles. The value 10 specifies the area of overlap between all three circles.

For information on available parameters for Venn diagrams, see Optional parameters by chart type.

Venn diagram with three overlapping circles
cht=v
chd=t:100,80,60,30,25,20,10

Back to top

Scatter plots

Specify a scatter plot with

cht=s

For information on available parameters, see Optional parameters by chart type.

Parameter Description Example

cht=s

The default shape for data points in a scatter plot is a circle. The default color for data points is blue. To use a different shape or color, specify the shape markers by using the chm parameter. More information can be found in Shape markers.

At least two data sets should be supplied. The first data set specifies x-coordinates, and the second data set specifies y-coordinates.

A third data set can be used to provide points of varying sizes. If you use chm to alter the shape or color of data points, note that points are scaled relative to the size provided in chm.

Scatter plot with default blue circle data points in different sizes as defined by a third data set
cht=s
chd=t:12,87,75,41,23,96,68,71,34,9|
98,60,27,34,56,79,58,74,18,76|
84,23,69,81,47,94,60,93,64,54

Back to top

Radar charts

Specify a radar chart with

cht=r or cht=rs

For information on available parameters, see Optional parameters by chart type.

Parameter Description Example

cht=r

In a radar chart, data points are drawn between the center of the chart and the perimeter. Points of value zero (0, A or AA depending on the type of encoding) are drawn at the center. Points with the maximum value for the encoding used (100, 9 or ..) are drawn at the perimeter. Intermediate values are scaled between the two.

The points representing the first and last values in the data set are drawn between the center of the chart and the top of the chart. The remaining points are evenly spaced clockwise around the chart, and a line is drawn between each pair of points.

For a chart of type r, points are connected with straight lines.

This example shows a simple radar chart, with a single data set.

Radar chart
cht=r
chd=t:10,20,30,40,50,60,70,80,90

You can add further information and clarity to a radar chart by adding colors, line styles, and axis labels.

This example is a more complex radar chart with two data sets. The color of each data set is specified with chco, as described in Chart colors.

Line styles are specified with chls, as described in Line styles.

Axis labels are specified with chxt, chxl, and chxr, as described in Axis styles and labels. For radar charts, the x-axis is drawn in a circle, and the y- and r-axes go from the center of the chart to the top. The t-axis is ignored.

When labels are included in a radar chart, the spacing of the data points around the chart is determined by the number of labels, or the number of data points, whichever is larger.

Radar chart
chco=FF0000,FF9900
chls=2.0,4.0,0.0|2.0,4.0,0.0
chxt=x
chxl=0:|0|45|90|135|180|225|270|315
chxr=0,0.0,360.0

cht=rs

This example uses the same parameters as the previous example, but has a Fill area specified for both data sets.

This example includes an added grid. See Grid lines for more information.

For charts of type rs, points are connected with splines to form a curved line.

Radar chart
chg=25.0,25.0,4.0,4.0
chm=
B,FF000080,0,1.0,5.0|
B,FF990080,1,1.0,5.0

The final example shows the previous example with added Shape markers. The horizontal line shape marker (specified with chm=h) produces a circle on a radar chart. The vertical line shape marker specified with chm=v is drawn as a line from the center of the radar chart to the specified data point. The vertical line shape marker specified with chm=V is drawn as a line from the center of the chart to the perimeter.

The shape markers are specified as follows:

  • the outer blue circle is specified with chm=h,0000FF,...
  • the inner, partially transparent, blue circle is specified with chm=h,3366CC80,...
  • the partially transparent green line (between 1 and 2 o'clock) is specified with chm=V,00FF0080,...
  • the dark green line (at 8 o'clock) is specified with chm=V,008000,...
  • the green line (at 10 o'clock) is specified with chm=v,00A000,...

See Shape markers for more information about available shapes.

You can also specify range markers. See Range markers for more information.

Radar chart
chm=
h,0000FF,0,1.0,4.0|
h,3366CC80,0,0.5,5.0|
V,00FF0080,0,1.0,5.0|
V,008000,0,5.5,5.0|
v,00A000,0,6.5,4

Back to top

Maps

Specify a map with

cht=t, and chtm=<geographical area>

Where <geographical area> is one of the following:

  • africa
  • asia
  • europe
  • middle_east
  • south_america
  • usa
  • world

For example:

Map of the World
chs=440x220
chd=s:_
cht=t
chtm=world

This is the default map for the world. The size used in the example (440 by 220 pixels) is the maximum for all maps. Note that the data set contains just one character, an underscore (_). The underscore specifies a missing value in simple encoding and gives us the simplest map possible. You can make your map more informative and interesting by using color for one or more countries.

Specify the colors on a map, and how they are applied to each country or state, with three parameters in combination:

chco=<default color>,<start of gradient>,<end of gradient>
chld=<country or state codes>
chd=<color levels>

Where:

  • <default color>, <start of gradient>, and <end of gradient> are RRGGBB format hexadecimal numbers. The default color is applied to countries or states that are not listed in the chld parameter. The other colors specify the extremes of a color gradient that is used to color all countries listed in the chld parameter. The color that is applied depends on the country's value in the chd parameter. To control the gradient further, specify more colors.
  • <country or state codes> is a list of either of the following:
  • <color levels> are text encoding, simple encoding, or extended encoding values. Text encoding with data scaling is not available for maps. The first value is used for the first country listed in the chld parameter, the second value is used for the second country listed, and so on. The lowest data value (A, 0, or AA depending on the type of encoding used) is drawn in the color specified by <start of gradient> in chco. The highest value (9, 100, or ..) is drawn in the color specified by <end of gradient>. Intermediate values give intermediate colors.

For example:

Map of Africa
chtm=africa
chco=FFFFFF,FF0000,FFFF00,00FF00
chld=DZEGMGAOBWNGCFKECGCVSNDJTZGHMZZM
chd=t:0,100,50,32,60,40,43,12,14,54,98,17,70,76,18,29
chf=bg,s,EAF7FE

In this example:

  • The first color is FFFFFF, which specifies white. This color is used for any country not listed in the chld parameter.
  • The other colors specify a color gradient from red, through yellow, to green.
  • The first country listed is Algeria (DZ). The first value listed is 0. Therefore, Algeria is drawn with the color at the beginning of the gradient, and appears in red.
  • The second country listed is Madagascar (MG). The second value listed is 100. Therefore, Madagascar is drawn with the color at the end of the gradient, and appears in green.
  • The third country listed is Egypt (EG). The third value listed is 50. Therefore, Egypt is drawn with the color that lies midway across the gradient. The gradient is specified as going from red, through yellow, to green. Egypt appears in yellow.
  • Water masses are considered to be the map's background. They are drawn in pale blue (EAF7FE), as specified in the chf parameter. See Chart area and background fill for more details on background colors.

Back to top

Google-o-meters

Specify a Google-o-meter with

cht=gom

For information on available parameters, see Optional parameters by chart type.

Parameter Description Example

cht=gom

Here's an example of a Google-o-meter using the default colors. See Chart colors for information on specifying other colors.

See Google-o-meter labels for information on specifying the text that appears at the end of the arrow.

Google-o-meter with default red to green coloring
cht=gom
chd=t:70

Back to top

QR codes

QR Codes are a popular type of two-dimensional barcode, which are also known as hardlinks or physical world hyperlinks. QR Codes store text, which can be a URL, contact information, telephone number, even whole verses of poems!

QR codes can be read by any device that has the appropriate software installed. Such devices range from dedicated QR code readers to mobile phones.

Specify a QR code with

cht=qr
chl=<text to encode>
choe=<output encoding>

Where:

  • <text to encode> is the text for the QR code. The text must be url-encoded in UTF8. Note that the space between hello and world is written as %20 in the following example.
  • <output encoding> specifies how the output is encoded. If this parameter is omitted, the default encoding of UTF-8 is used. Available encodings are Shift_JIS, UTF-8, or ISO-8859-1.

For example:
QR code
cht=qr
chl=hello%20world
choe=UTF-8

The example QR code above is the simplest possible type of QR code, and is known as Version 1. It has 21 rows and 21 columns.

  • Version 1 has 21 rows and 21 columns, and can encode up to 25 alphanumeric characters
  • Version 2 has 25 rows and 25 columns, and can encode up to 47 alphanumeric characters
  • Version 3 has 29 rows and 29 columns, and can encode up to 77 alphanumeric characters
  • ...
  • Version 40 has 177 rows and 177 columns, and can encode up to 4,296 alphanumeric characters

The Chart API generates the appropriate QR code version depending on the number of characters you provide. For example, if you provide 55 alphanumeric characters, the Chart API will generate a Version 3 QR code. This may be modified by the error correction (EC) level you choose to use.

Don't confuse the number of rows and columns with size of the QR code image. The number of characters you provide determines the number of rows and columns. The pixel size of the chart is determined with chs as usual (see Chart size).

Error correction and margins

Four levels of error correction (EC) are available. The default level (L) allows the QR code to be read even if up to 7% of the code is misread, missing, or obscured. Other levels provide error correction for codes where up to 30% of the code cannot be read. The number of characters that can be encoded decreases as the EC level increases. See Versions, error correction and maximum characters for details.

The default margin is 4 modules. This means that a blank space equivalent to four rows at the top and bottom and four columns on the left and right is placed around the QR code. This is the minimum required by QR readers.

Optionally, specify an EC level and margin with

chld=<EC level>|<margin>

Where:

  • <EC level> is one of the following:
    • L allows 7% of a QR code to be restored
    • M allows 15% of a QR code to be restored
    • Q allows 25% of a QR code to be restored
    • H allows 30% of a QR code to be restored
  • <margin> defines the margin (or blank space) around the QR code. The default image has a margin equivalent to 4 rows / columns of the chart.

Versions, error correction and maximum characters

Before generating your QR code, consider what kind of device is used to read your code. The best QR code readers are able to read Version 40 codes, mobile devices may read only up to Version 4.

See the following table for information on maximum number of characters for each version and EC level.

Version Rows by columns EC level Maximum characters by EC level and character type
Digits: 0 to 9 Alphanumeric:
0 to 9, A to Z,
space, $ % * + - . / :
Binary Kanji
1 21x21 L 41 25 17 10
M 34 20 14 8
Q 27 16 11 7
H 17 10 7 4
2 25x25 L 77 47 32 20
M 63 38 26 16
Q 48 29 20 12
H 34 20 14 8
3 29x29 L 127 77 53 32
M 101 61 42 26
Q 77 47 32 20
H 58 35 24 15
4 33x33 L 187 114 78 48
M 149 90 62 38
Q 111 67 46 28
H 82 50 34 21
10 57x57 L 652 395 271 167
M 513 311 213 131
Q 364 221 151 93
H 288 174 119 74
40 177x177 L 7,089 4,296 2,953 1,817
M 5,596 3,391 2,331 1,435
Q 3,993 2,420 1,663 1,024
H 3,057 1,852 1,273 784

Further information and standards

QR code is trademarked by Denso Wave, Inc. As you'd expect, the Denso Wave website includes a lot of useful information about QR codes.

QR code was approved as:

  • AIM International (Automatic Identification Manufacturers International) standard (ISS - QR Code) in October 1997.
  • JEIDA (Japanese Electronic Industry Development Association) standard (JEIDA-55) in March 1998.
  • JIS (Japanese Industrial Standards) standard (JIS X 0510) in January 1999.
  • ISO international standard (ISO/IEC18004) in June 2000.

QR code reader software is available from many sources. Google offers a QR Code reader library, Zebra Crossing (ZXing), for free. See http://code.google.com/p/zxing/ for details.

See Barcode Contents for a rough guide to standard encoding of information in barcodes.

Posted by 1010
01.JAVA/Java2008. 12. 22. 15:15
반응형
-Chaos Graph API Ver 1.2

이 컨포넌트는 그래프 차트를 그려주는 API입니다.
구성은 라인그래프, 막대그래프, 영역그래프, 원그래프로 버전 1.0과 같이 4가지 입니다.
버전 1.0과 크게 달라진 부분은 이미지 객체에 관련된 부분인데 이전 버전에서는 
기 생성된 이미지 객체를 인자로 받아서 그 이미지 객체에 그래프를 도시 하였다면 이번 버전에서는
컴포넌트 내부에서 이미지를 생성하고 관리하도록 수정된 부분 입니다. 또한 그래프 이미지를 패널에 
도시해 주는 그래프 패널 클래스와 이미지를 파일로 저장하는 등의 작업을 수행하는 그래프 유틸리티 클래스, 
각종 오류를 처리하는 익셉션 클래스 등이 새로 추가 되었습니다. 
그리고 그래프를 resize(사이즈 재조정)하고 여백을 조정하는 등의 메서드가 추가되었습니다.

이번 버전에서는 예제 프로그램이 두개가 제공됩니다.
하나는 "그래프 뷰어 및 파일저장" 프로그램으로 4가지 종류의 그래프를 패널에 도시하고
도시된 이미지를 파일로 저장시켜주는 프로그램 입니다. (구체적인 내용은 Example1.java을 참조)
다른 하나는 "JVM 메모리 뷰어"로 실시간으로 자바 버추얼 머신의 메모리 정보를 동적인 그래프로
도시하여 주는 프로그램입니다.(구체적인 내용은 Example2.java를 참조)

컨포넌트를 다운로드 받은 후 약간의 설정으로 예제 프로그램(Example1.bat, Example2.bat)을
실행시켜 볼 수 있습니다. 현재는 윈도우용 배치파일만 만들어 놨습니다. 
컴포넌트와 예제는 순수 자바언어로 개발되었기 때문에 자바가 설치된 시스템 이라면 윈도우, 리눅스, 솔라리스 등 어디에서든 실행 가능합니다. 
제가 윈도우에서만 개발하고 테스트 했기 때문에 다른 시스템에서의 테스트는 해보지 못했습니다.
윈도우 외의 시스템에서 실행할 수 있는 환경을 갖추신 분이 있다면 테스트 후에 좀 알려 주셨으면 합니다.

마지막으로 이 컨포넌트를 이용하여 개발하는 것을 누구에게나 자유입니다. 
소스 패키지에 포함되어 있습니다. 공유와 복제는 창조의 어머니 입니다.
하지만 이 컨포넌트 자체를 상업적으로 이용할 수는 없습니다.
원본 수정이나 오류사항 chaos93@hanmail.net으로 연락주십시오.



-설치방법

1. ChaosGraph.zip을 다운로드 받는다.

2. 임의의 디렉토리(C:\ChaosGraph)에 압축을 풉니다.

3. 그러면 C:\ChaosGraph하부에 doc, jar, lib, src 디렉토리가 생깁니다.

4. doc은 API 도큐먼트가 있고, jar에는 이 컨포넌트 패키지인 ChaosGraph.jar가 있습니다. 
   lib에는 jai_codec.jar와 jai_core.jar가(JAI : Java Advanced Imaging Component) 위치하며 
   src에는 소스파일이 위치하게 됩니다.

5. ChaosGraph를 사용하려면 일단 ChasoGraph.jar, jai_codec.jar, jai_core.jar를 classpath에 
   설정하시고 코딩하시면 됩니다.

6. 예제를 실행하려면 Example1.bat, Example2.bat 파일을 열어서 "JAVA_HOME"속성에서
   JDK가 설치된 디렉토리를 설정한 후 배치파일을 실행시키면 됩니다.



-구조

C:\ChaosGraph  ----------  doc  -----  API Documentation (도큐먼트)
                    |
                    -----  jar  -----  ChaosGraph.jar (그래프 컨포넌트)
                    |
                    -----  lib  -----  jai_codec.jar, jai_core.jar (JAI 라이브러리)
                    |
                    -----  src  -----  Source Files (소스)
                    |
                    -----  Example1.bat, Example2.bat(예제 배치파일)
                    |
                    -----  Readme.txt(이 문서)
 




                                                                                                 Developed by 9ins.
첨부파일 :  
ChaosGraph.zip   [2044 KB]   다운로드 횟수 422 회
Posted by 1010
02.Oracle/DataBase2008. 12. 22. 09:38
반응형

오라클 9i 임포트 가이드

2008.7.1 고진우 mr.big


*설명
익스포트한 덤프파일이 있는경우 새로 셋팅된 오라클디비에 임포트로 데이터를 밀어넣는 작업
새로 설치한 오라클디비명은 익스포트한 디비명과 동일하게 설치해야 함

*순서
1.오라클설치
2.리스너가동
3.sys계정으로 오라클 로그인
4.오라클인스턴스시작
5.테이블스페이스 생성
6.유저 생성
7.유저 권한부여
8.임포트

*정의
TESTUSER = 유저명
TESTUSER_TS = 테이블스페이스명
TESTUSER01.dbf = 테이블스페이스 실제 파일명

-------------------------------------------

1.오라클 설치 - 생략

2.리스너 가동
/home/oracle/9i/bin/lsnrctl start

3.sys계정으로 오라클 로그인
4.오라클인스턴스시작
[oracle@localhost ~]$su - oracle
[oracle@localhost ~]$sqlplus '/as sysdba'
SQL*Plus: Release 9.2.0.4.0 - Production on Tue Jul 1 15:53:04 2008
Copyright (c) 1982, 2002, Oracle Corporation.  All rights reserved.
Connected to:
Oracle9i Enterprise Edition Release 9.2.0.4.0 - Production
With the Partitioning, OLAP and Oracle Data Mining options
JServer Release 9.2.0.4.0 - Production
SQL>startup;


5.테이블스페이스 생성
CREATE TABLESPACE TESTUSER_TS
DATAFILE '/home/oracle/oradata/MEDICAL/TESTUSER01.dbf' SIZE 100M
AUTOEXTEND ON NEXT 5M MAXSIZE UNLIMITED;

6.유저 생성
CREATE USER TESTUSER
IDENTIFIED BY "패스워드"
DEFAULT TABLESPACE "TESTUSER_TS"
temporary tablespace temp;

7.유저 권한부여
GRANT CREATE SESSION TO TESTUSER;
GRANT CREATE TABLE TO TESTUSER;
GRANT CREATE ANY INDEX TO TESTUSER;
GRANT CREATE TABLESPACE TO TESTUSER;
GRANT CREATE SEQUENCE TO TESTUSER;
GRANT CREATE VIEW,RESOURCE TO TESTUSER;


*참고 - 재작업시 유저삭제
//DROP USER TESTUSER CASCADE;


8.임포트
대화형 임포트로 작업
[oracle@localhost ~]$ imp
 
Import: Release 9.2.0.4.0 - Production on Tue Jul 1 15:15:22 2008
 
Copyright (c) 1982, 2002, Oracle Corporation.  All rights reserved.
 
Username: TESTUSER
Password: 패스워드
 
Connected to: Oracle9i Enterprise Edition Release 9.2.0.4.0 - Production
With the Partitioning, OLAP and Oracle Data Mining options
JServer Release 9.2.0.4.0 - Production
 
Import file: expdat.dmp > /home/oracle/export파일명.dmp
 
Enter insert buffer size (minimum is 8192) 30720>
 
Export file created by EXPORT:V09.02.00 via conventional path
import done in KO16KSC5601 character set and AL16UTF16 NCHAR character set
import server uses WE8ISO8859P1 character set (possible charset conversion)
List contents of import file only (yes/no): no >
 
Ignore create error due to object existence (yes/no): no > yes
 
Import grants (yes/no): yes >
 
Import table data (yes/no): yes >
 
Import entire export file (yes/no): no >
Username: TESTUSER
 
Enter table(T) or partition(T:P) names. Null list means all tables for user
Enter table(T) or partition(T:P) name or . if done:
 
. importing TESTUSER's objects into TESTUSER
. . importing table                    "CATEGORY"        11 rows imported
. . importing table                      "MAPPING"        83 rows imported
. . importing table                        "BOARD"      1739 rows imported
. . importing table                "SPECIAL_LIST"        278 rows imported
. . importing table                  "TEST_TABLE"          0 rows imported
Import terminated successfully without warnings.

임포트를 완료하였습니다


-------------------

자세한 임포트문서가 없기에 몇번삽질후 문서로 만들어 봤습니다~
삽질하지 마시고 한방에 성공하시길 염원합니다 ^^



출처 : http://phpschool.com/gnuboard4/bbs/board.php?bo_table=tipntech&wr_id=61927&page=1


이건 먹는건가...

Posted by 1010
60.Unix2008. 12. 19. 20:06
반응형
1. AIX
   shutdown -F
   shutdown -Fr 0
 
2. HPUX
   종료 shutdown -hy 0
   리붓 shutdown –r 0
 
3. Solaris
   종료 shutdown -y -i0 -g0
   리붓 shutdown -y -i6 -g0
Posted by 1010
90.개발관련문서2008. 12. 17. 18:25
반응형

총입금액은 SUM함수를 각 입금자의 합은 SUMIF함수를 사용하면 되겠습니다.


입금자 A의 합계는 위의 그림과 같이 입력되어 있을 때

=sumif(입금자데이터를절대주소로, 원하는입금자주소, 더할값의주소) 로 구할 수 있습니다.


원할하게 복사해서 입력할 수 있게하기 위하여 절대주소를 잘 활용하세요,.


파일을 첨부하였으니 참고하세요.

Posted by 1010
60.Unix2008. 12. 17. 17:01
반응형
~ 드디어 아파치를 설치 해보자..
일단 프로그램을 다운받자..(종속프로그램도 모두 다운을 받자..혹시 모르는 경우를 대비해서..)


여기 중요한것은....Tomcat과 연동을 하기위해서는 패키지 설치로 하면 잘 안된다는 것이다..
(왜 안되는지 잘은 모르겠지만...ㅡ.ㅡ;;)
그리고 패키지로 설치하면 $APACHE/conf/httpd.conf 파일이 없다..
이게 왜 없는지는 잘 모르겠다...어디서 만들어줘야 하나??? 아니면 다른 방법으로 ??
제길...

그래서 결국 소스버전으로 설치를 하기로 했다...위 화면에서 패키지 버젼말고 밑으로 조금만 눈을 내리면 소스버젼이 있으니 그것을 받도록 하자~

그리고 설치하자...

1. 받은 파일을 gunzip으로 압축을 풀고 tar도 풀자~


2. 압축이 풀린 폴더로 이동하여
# configure --enable-so --enable-mods-shared=most
명령어를 실행하자.


3. make를 실행하자.
(make는 솔라리스 설치시 설치 되었는데..난 그거 모르고 새로 설치를 해버렸다..ㅡ.ㅡ;)

* 주의
1. /.profile에 PATH가 추가되어 있어야 한다. (/usr/ccs/bin)
2. /.profile에 LD_LIBRARY_PATH가 추가 되어있어야 한다.
(export LD_LIBRARY_PATH=/usr/local/lib:/usr/lib)



4. 에러없이 make가 실행 됬다면 make install을 실행한다.


5. 설치가 끝났다면 /.profile PATH에 아래 경로를 추가해준다.


6. 설치된 /usr/local/apache2/conf/httpd.conf 파일에 아래 부분을 수정해준다.

* 주의
1. 솔라리스에서는 Group #-1 을 그냥 두고 실행하면 안된다..왠지는 모른다..근데 정말 안된다..
2. ServerName을 도메인명 or IP로 설정한다.


7. 아파치를 실행한다. 잘되는지 프로세스도 검사~


8. 자~ 이제 웹으로 확인해보자~!!!!



오늘 아파치 설치할려고 생각한 뻘짓은...정말..한도 끝도 없다...ㅡ.ㅡ;;
제길...뭐 그래도 얻은게 크다~

휴~ ;;;;
Posted by 1010
60.Unix2008. 12. 17. 16:10
반응형
자~ 드디어 아파치를 설치 해보자..
일단 프로그램을 다운받자..(종속프로그램도 모두 다운을 받자..혹시 모르는 경우를 대비해서..)


여기 중요한것은....Tomcat과 연동을 하기위해서는 패키지 설치로 하면 잘 안된다는 것이다..
(왜 안되는지 잘은 모르겠지만...ㅡ.ㅡ;;)
그리고 패키지로 설치하면 $APACHE/conf/httpd.conf 파일이 없다..
이게 왜 없는지는 잘 모르겠다...어디서 만들어줘야 하나??? 아니면 다른 방법으로 ??
제길...

그래서 결국 소스버전으로 설치를 하기로 했다...위 화면에서 패키지 버젼말고 밑으로 조금만 눈을 내리면 소스버젼이 있으니 그것을 받도록 하자~

그리고 설치하자...

1. 받은 파일을 gunzip으로 압축을 풀고 tar도 풀자~


2. 압축이 풀린 폴더로 이동하여
# configure --enable-so --enable-mods-shared=most
명령어를 실행하자.


3. make를 실행하자.
(make는 솔라리스 설치시 설치 되었는데..난 그거 모르고 새로 설치를 해버렸다..ㅡ.ㅡ;)

* 주의
1. /.profile에 PATH가 추가되어 있어야 한다. (/usr/ccs/bin)
2. /.profile에 LD_LIBRARY_PATH가 추가 되어있어야 한다.
(export LD_LIBRARY_PATH=/usr/local/lib:/usr/lib)



4. 에러없이 make가 실행 됬다면 make install을 실행한다.


5. 설치가 끝났다면 /.profile PATH에 아래 경로를 추가해준다.


6. 설치된 /usr/local/apache2/conf/httpd.conf 파일에 아래 부분을 수정해준다.

* 주의
1. 솔라리스에서는 Group #-1 을 그냥 두고 실행하면 안된다..왠지는 모른다..근데 정말 안된다..
2. ServerName을 도메인명 or IP로 설정한다.


7. 아파치를 실행한다. 잘되는지 프로세스도 검사~


8. 자~ 이제 웹으로 확인해보자~!!!!



오늘 아파치 설치할려고 생각한 뻘짓은...정말..한도 끝도 없다...ㅡ.ㅡ;;
제길...뭐 그래도 얻은게 크다~

휴~ ;;;;
Posted by 1010
60.Unix2008. 12. 17. 16:09
반응형

오늘 하루종일 물고 늘어져서 간신히 설치했다..ㅋ;
시스템 설치가 다 그렇듯이.. 간만에 닭질 좀..ㅎㅎ
다음에 똑같은 실수를 하지 말아야겠다는 생각에 정리하는데..
아.. 이미지 뜨기 귀찮군.. 그래서 텍스트로 대충..ㅋㅋㅋ

subversion의 공식 사이트는 아래와 같다.
http://subversion.tigris.org/getting.html


또한 solaris용 subversion 및 관련 프로그램들은 아래에서 다운받을 수 있다.
http://www.sunfreeware.com/programlistsparc10.html

현재 subversion의 버전은 1.4.6이지만 sunfreeware 사이트에서 솔라리스로 패키징된건 1.4.5까지만 나와있다.

subversion 1.4.5를 설치하려면 다음 프로그램이 먼저 설치되어 있어야만 한다.

- apache 2.2.6
- openssl-0.9.8h

둘 다 sunfreeware 사이트에서 구할 수 있으며, sunfreeware 사이트에서 제공하는 프로그램은 모두 솔라리스용으로 컴파일 & 패키징이 되어 있기 때문에 다음과 같이 하기만 하면 쉽게 설치할 수 있다..ㅎㅎ

# gzip -d openssl-0.9.8h-sol10-sparc-local.gz
# pkgadd -d openssl-0.9.8h-sol10-sparc-local

1. openssl 설치
openssl은 위와 같이 pkgadd하면 아주 간단히 설치할 수 있다..ㅋ;

2. apache 2.2.6 설치
(1) apache 설치
apache도 위와 같이 pkgadd하면 디폴트로 /usr/local/apache2에 설치된다.
그 다음에 다음과 같이 httpd.conf를 수정한다.

- User와 Group을 nobody로 설정
- ServerName에 서버 아이피 또는 도메인 설정
- DirectoryIndex 지시자에 index.jsp 추가
- <Directory />에 보면 "Deny from all" 라인이 있다. 이걸 주석 처리한다. (이게 왜 디폴트로 되어 있는지 모르겠군..ㅎㅎ)

# /usr/local/apache2/bin/apachectl start 하면 apache가 뜬다.
# /usr/local/apache2/bin/apachectl stop 하면 종료

이렇게 하면 간단히 되는데.. 나한테는 tomcat하고 연동해야 하는 문제가 있었다..ㅡㅡ

(2) apache와 tomcat 연동
apache와 tomcat을 연동하기 위해서는 apache tomcat connector (http://tomcat.apache.org/connectors-doc/) 가 필요하다.
현재 1.2.26버전이 나와 있는데.. 이걸 컴파일하면 mod_jk.so 라는 모듈이 생성된다.

검색하다보면 mod_jk2.so라는 것도 나오는데 첨에는 2라는 것 때문에 이게 최신일줄 알고 컴파일하는데 잘 안되서 한참 애먹었다.  하지만 나중에 알고보니 이건 옛날 버전이라고..ㅡㅡ;
암튼.. 압축풀고 들어가서 jk 디렉토리 밑에 native 디렉토리로 간다.. (이건 또 왜이리 깊어..)

# ./configure --with-apxs=/usr/local/apache2/bin/apxs
# make
# make install

인스톨까지 끝내면 /usr/local/apache2/modules에 mod_jk.so 파일이 복사된다.
이제 httpd.conf를 열어 LoadModule들이 있는 부분에 다음 줄을 추가한다.

LoadModule jk_module modules/mod_jk.so

그리고 나서 /usr/local/apache2/conf/extra 디렉토리에 httpd-mod_jk.conf 파일 생성한다.
(예제) (아래에서 적당히 자신의 환경에 맞게 수정해야 합니다..ㅎㅎ; 간단하니 다 아실듯)
Alias /test TOMCAT_HOME/webapps/test
LoadModule jk_module modules/mod_jk.so
JkWorkersFile conf/extra/httpd-workers.properties
JkLogFile logs/mod_jk.log
JkLogLevel info
JkLogStampFormat "[%a %b %d %H:%M:%S %Y] "
JkOptions +ForwardKeySize +ForwardURICompat -ForwardDirectories
JkRequestLogFormat "%w %V %T"
JkMount /test/servlet/* ajp13
JkMount /test/*.jsp ajp13

또한 httpd-mod_jk.conf에서 참고하는 httpd-workers.properties 파일도 생성한다
(예제)
workers.tomcat_home=TOMCAT_HOME
workers.java_home=JAVA_HOME
ps=/
worker.list=ajp12, ajp13
worker.ajp12.port=8007
worker.ajp12.host=localhost
worker.ajp12.type=ajp12
worker.ajp12.lbfactor=1

worker.ajp13.port=8009
worker.ajp13.host=localhost
worker.ajp13.type=ajp13
worker.ajp13.lbfactor=1

worker.loadbalancer.type=lb
worker.loadbalancer.balanced_workers=ajp12, ajp13
worker.inprocess.type=jni
worker.inprocess.class_path=$(workers.tomcat_home)$(ps)lib$(ps)tomcat.jar
worker.inprocess.cmd_line=start
worker.inprocess.stdout=$(workers.tomcat_home)$(ps)logs$(ps)inprocess.stdout
worker.inprocess.stderr=$(workers.tomcat_home)$(ps)logs$(ps)inprocess.stder

이제 이 파일을 httpd.conf 에서 로딩한다.
httpd.conf 파일 아무데나.. 마지막 줄도 되고 다음과 같이 추가한다.

Include conf/extra/httpd-mod_jk.conf

다 되었으면 아파치와 톰켓을 재시작하고 아무 jsp를 실행해본다..
사실 처음에는 httpd-mod_jk.conf하고 httpd-workers.properties 파일을 생성 안했었다.
그래도 apache와 tomcat 모두 잘 뜬다..
그런데 jsp를 호출하면 브라우저에 jsp가 실행되는 것이 아니고 jsp 소스 코드가 그냥 텍스트로 떡하니 나온다.. 헐..
이것 때문에 http 소스를 다운받아 컴파일도 하고 멀쩡한 httpd.conf를 몇시간 동안 만지작거리다가 알고보니 이 파일들을 생성 안해서 생긴 문제였다..

3. subversion 설치
(1) subversion 인스톨
subversion-1.4.5-sol10-sparc-local.gz 파일을 다운받아 1,2번의 경우처럼 설치한다.
# gzip -d subversion-1.4.5-sol10-sparc-local.gz
# pkgadd -d subversion-1.4.5-sol10-sparc-local

pkgadd할때 apache2 모듈과 중복된다고 하는데.. 과감히 yes ㅎㅎ
그럼 파일 몇개가 apache2에 덮어 써진다.

(2) httpd.conf 수정
httpd.conf 파일을 열어서 LoadModule들이 있는 줄에 다음줄 추가
LoadModule dav_svn_module modules/mod_dav_svn.so

맨 마지막 줄에는 다음을 추가한다.
이는 svn 저장소가 /data2/svn/repository 이고 접속 주소는 http://서버IP/svn 이며
/data2/svn/password 파일에 있는 아이디와 패스워드로 인증한다는 의미가 된다.
<Location /svn>
    DAV svn
    SVNPath /data2/svn/repository
    AuthType Basic
    AuthName "Subversion repository"
    AuthUserFile /data2/svn/password
    Require valid-user
</Location>

(3) svn 저장소 생성
# cd /data2/svn
# svnadmin create --fs-type fsfs repository
# chmod -R g+w repository
# chown -R nobody repository
# chgrp -R nobody repository
# /usr/local/apache2/bin/htpasswd -c password username
New password:
Re-type new password:
(사용자를 추가할 경우에는 /usr/local/apache2/bin/htpasswd password username)

이제 svn에 접속하면 끝.. 추가로 나는 eclipse에서 접속하기 때문에 eclipse에서 사용법을 간단히..ㅎㅎ

(4) eclipse svn 연동
- Help -> software updates -> find and install 을 선택하면 창이 뜨는데 search for new features to install를 체크하고 next
- new remote site를 클릭하고 다음을 입력한다음에 next
Name : subclipse
URL : http://subclipse.tigris.org/update
- next, ..., next해서 다 설치하고 eclipse를 다시 부팅하면 SVN Repository perspective가 생성됨
- 서버 접속 및 사용..ㅎㅎ; 뭐 이건 svn을 한번쯤 사용해본 사람은 다 알테니 생략..

Posted by 1010
60.Unix2008. 12. 17. 16:06
반응형
  1. 솔라리스 10 spac-64
  2. 톰켓 5.0.28
    • 설치 경로 : /app/tomcat
  3. cronolog 1.6.2
    • 설치 경로 : /usr/local/src 에 http://cronolog.org/서 다운 받아서 압축 해재
    • 압축 해재한 폴더에서
      • ./configure
      • make
      • make install
      • 위 처럼 하면 /usr/local/sbin/에 cronolog 실행 파일이 생성됨
  4. 톰켓 설치 폴더로 이동
    • bin 폴더로 이동
      • cd bin
      • vi catalina.sh 해서 아래 처럼 수정
      • shift
          touch "$CATALINA_BASE"/logs/catalina.out
          if [ "$1" = "-security" ] ; then
            echo "Using Security Manager"
            shift
            "$_RUNJAVA" $JAVA_OPTS $CATALINA_OPTS \
              -Djava.endorsed.dirs="$JAVA_ENDORSED_DIRS" -classpath "$CLASSPATH" \
              -Djava.security.manager \
              -Djava.security.policy=="$CATALINA_BASE"/conf/catalina.policy \
              -Dcatalina.base="$CATALINA_BASE" \
              -Dcatalina.home="$CATALINA_HOME" \
              -Djava.io.tmpdir="$CATALINA_TMPDIR" \

              ==== 추가해야 할 부분 ===
              org.apache.catalina.startup.Bootstrap "$@" \
              start |/usr/local/sbin/cronolog "$CATALINA_BASE"/logs/catalina.out.%y%m%d >> /dev/null 2>&1 &
              =========================
             
              ==== 주석처리 할 부분 ===
        #      org.apache.catalina.startup.Bootstrap "$@" start \
        #      >> "$CATALINA_BASE"/logs/catalina.out 2>&1 &
              =========================

              if [ ! -z "$CATALINA_PID" ]; then
                echo $! > $CATALINA_PID
              fi
          else
            "$_RUNJAVA" $JAVA_OPTS $CATALINA_OPTS \
              -Djava.endorsed.dirs="$JAVA_ENDORSED_DIRS" -classpath "$CLASSPATH" \
              -Dcatalina.base="$CATALINA_BASE" \
              -Dcatalina.home="$CATALINA_HOME" \
              -Djava.io.tmpdir="$CATALINA_TMPDIR" \

              ==== 추가해야 할 부분 ===
              org.apache.catalina.startup.Bootstrap "$@" \
              start |/usr/local/sbin/cronolog "$CATALINA_BASE"/logs/catalina.out.%y%m%d >> /dev/null 2>&1 &
              =========================

              ==== 주석처리 할 부분 ===
        #      org.apache.catalina.startup.Bootstrap "$@" start \
        #      >> "$CATALINA_BASE"/logs/catalina.out 2>&1 &
              =========================

  5. 톰켓 서버 재시작 후 톰켓 설치 폴더의  ./logs 디렉토리를 확인 한다.

    1. catalina.out.080312 이런 형식으로 파일이 생기면 정삭적으로 작동 하는 것이다.

Posted by 1010
60.Unix2008. 12. 17. 14:49
반응형

솔라리스에서 Xmanager 사용하기


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

작성자 : 김재벌 ( ostoneo@naver.com )


본 문서의 내용은 비 상업적 까페에서만 사용이 가능합니다.

특히, 학원광고를 위한 영업까페로의 게시 및 펌질은 불허 하며, 저작권자의 내용을 임의 수정하시는 것도 불법입니다.

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


오랜만에 팁하나 올립니다.


요즘 뭐..이름만 대면 알만한 보안회사의 일을 갑작스레 떠 앉게 되어 8-9월까지는 죽었다고....살아야 하는판인데..

그래도, 테크넷에 안와 볼수도 없고...^^ (중독이라..)


넷사랑에서 나온 Xmanager라는 콘솔 GUI를 제공하는 원격도구가 있죠,


과거 vm 이 활성화 되기 전에는 참으로 공부용으로도 인기가 최고 였지요.


헌데, IP console기반의 장비들을 이용해서 콘솔 접속이 가능하긴 하지만 실제 장비에서 GUI를 이용한 원격관리시에는 여전히 Xmanager는 매우 효과적이고 뛰어난 제품입니다.


게다가 근래에는 개인 사용자들에게는 무료로 배포되고 있으니, 더 좋구요.


헌데, 최신 버전의 솔라리스에 과거 방식으로 접속하면 거부가되는 일들이 발생합니다.


이는 솔라리스의 secure by default는 보안 기능에 의해 차단되는 것으로 이를 오픈해 주면 간단하게 사용하실 수 있습니다.


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

# which netservices
/usr/sbin/netservices
# /usr/sbin/netservices open
restarting syslogd
restarting sendmail
restarting wbem
# svcs -a |grep x
disabled       14:37:01 svc:/system/device/mpxio-upgrade:default
disabled       14:37:12 svc:/network/nis/xfr:default
disabled       14:37:41 svc:/network/rpc/rex:default
disabled       14:37:44 svc:/network/rexec:default
online         14:37:45 svc:/application/x11/xfs:default
online         14:37:49 svc:/application/management/snmpdx:default

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


보다 쉽게 사용할 수 있으실 것입니다.

또, Xshell 세션을 이용한 방식으로도 사용이 가능합니다.


무엇보다 XDMCP 기반의 통신보다는 ssh -x 의 터널링이 보안에 더 안전하다는 것은 잊지 마셔야 합니다.


그럼...^^





Posted by 1010
60.Unix2008. 12. 17. 14:41
반응형

윈디하나의 솔라나라: 솔라리스 10 u6 기본설정

최종 갱신일: 2008-11-03, 이 문서는 윈디하나의 솔라나라, http://www.solanara.net/에서 최근에 갱신된 문서를 찾을 수 있다.

1. 개요

  • 소프트웨어 설치 문서에 생략되어있는 공통 설정 사항에 대해, 솔라리스 10 u6 기준으로 설명하는 문서이다.
  • LD_LIBRARY_PATH와 PATH 환경변수는 반드시 일치해야 한다.
  • 본 문서는 솔라리스 10 u6 x86, 32bit을 기준으로 작성했다. 자신의 솔라리스 버전 및 업데이트 번호는 아래와 같이 확인할 수 있다.
    root@wl ~ # cat /etc/release
                           Solaris 10 10/08 s10x_u6wos_07b X86 1)
               Copyright 2008 Sun Microsystems, Inc.  All Rights Reserved.
                            Use is subject to license terms.
                                Assembled 27 October 2008
    root@wl ~ # isainfo -kv
    32-bit i386 kernel modules 2)
    root@wl ~ # 
    
    1) [솔라리스 10, 2008년 10월에 배포, 업데이트번호는 6, x86버전]이라는 뜻이다.
    2) 32비트 x86 커널을 사용하고 있다는 뜻이다.

2. 솔라리스 설정

  1. 네트워크 설정 확인. 네트워크가 동작하는지 확인해야 한다. 아직 DNS가 설치된것은 아니므로, 도메인으로 외부 서버에 접속할 수 없다.
    # cat /etc/hosts 1)
    127.0.0.1       localhost       
    192.168.0.3  wl     loghost
    # cat /etc/hostname.pcn0 2)
    wl
    # cat /etc/netmasks 3)
    192.168.0.0    255.255.255.0
    # cat /etc/defaultrouter 4)
    192.168.0.1
    # ifconfig -a 5)
    lo0: flags=1000849<UP,LOOPBACK,RUNNING,MULTICAST,IPv4> mtu 8232 index 1
            inet 127.0.0.1 netmask ff000000
    pcn0: flags=1000843<UP,BROADCAST,RUNNING,MULTICAST,IPv4> mtu 1500 index 2
            inet 192.168.0.3 netmask ffffff00 broadcast 192.168.0.255
    
    1) /etc/hosts에 자신의 호스트 이름과 맞는 IP가 입력되어있는지 확인한다. 이 예제에서 호스트 이름은 wl 이다.
    2) NIC와 호스트이름을 확인한다. pcn0는 솔라리스의 pcn 이라는 NIC의 첫번째 드라이버라는 뜻으로 벤더마다 다르다. (솔라리스 스팍용은 ce로 되어있을것이다) pcn0 인터페이스에 wl 호스트의 IP를 넣을 것이다.
    3) netmask를 확인한다. 192.168.0.3의 경우 192.168.0.0/24에 포함된다. 따라서 넷마스크값으로 255.255.255.0 를 정해줄 것이다.
    4) 기본 라우터를 확인한다. 윈도우XP로 따지자면 게이트웨이에 해당된다.
    5) ifconfig -a 를 해보면 pcn0에 IP및 넷마스크가 입력된 것을 확인할 수 있다. 이 정보가 정확하면, 다음으로 단계로 넘어간다. 만약 정확하지 않다면 위 파일들을 고치거나, /usr/sbin/sys-unconfig 명령을 실행해 재시작후, 네트워크 설정을 다시 한다.
  2. 네트워크 테스트
    예제의 네트워크 구성
    ┌─┐
    │A├──┐
    └─┘ ┌┴─┐ ┌───┐ ┏───┓
        │허브├─┤라우터├─┤인터넷├─
    ┌─┐ └┬─┘ └───┘ ┗───┛
    │B├──┘
    └─┘
    
    A: 세팅하고 있는 호스트. 192.168.0.3
    B: 이미 세팅되었으며 정상 작동하고 있는 호스트. 192.168.0.2
    라우터: 192.168.0.1
    
    1. 같은 스위치/허브에 물려있는 호스트로 PING 테스트
      # ping 192.168.0.2
      192.168.0.3 is alive
      #
      
      - 성공시 NIC와 네트워크 케이블, IP세팅, 스위치의 작동은 정상임
      - 실패시 솔라리스 설정, 호스트에 연결되어있는 케이블 및 NIC 드라이버등을 점검
    2. 라우터로 PING 테스트
      # ping 192.168.0.1
      192.168.0.1 is alive
      #
      
      - 성공시 라우터(게이트웨이)까지 가는 장비 스위치/허브들도 정상임. 라우터도 응답 하고 있음.
      - 실패시 라우터 관리자에게 문의 (라우터가 PING응답을 하지 않도록 설정한 경우도 있음)
    3. 외부 호스트로 PING 테스트
      # ping 211.174.186.251
      211.174.186.251 is alive
      #
      
      - 성공시 라우터의 설정이 정상적으로 되어있으며 네트워크는 정상적으로 작동함
      - 실패시 라우터 관리자에게 문의 (외부에 있는 임의의 호스트가 PING응답을 하지 않도록 설정한 경우도 있음)
      여기까지 잘 되면 네트워크 설정은 마무리 된 것이다.
    4. 도메인으로 ping 테스트
      # cp /etc/nsswitch.dns /etc/nsswitch.conf
      # vi /etc/resolv.conf
      domain xxxx.com
      search xxxx.com
      nameserver 168.126.63.1 # 한국통신의 DNS 서버이다.
      nameserver 168.126.63.2
      # ping www.solarisschool.com
      www.solarisschool.com is alive
      #
      
      - 성공시 도메인 서버 세팅 및 도메인 서버가 제대로 작동함
      - 실패시 도메인 서버 세팅 확인 및 다른 도메인 서버 사용
    5. 접속 테스트
      - ICMP패킷이 올바르게 전송되는지만 확인해도 좋지만 확실하게 하기 위해서는 TCP패킷까지 보내보는 것이 좋다. 외부의 호스트에 telnet접속한 후에 다시 자시 서버로 telnet접속해보는 형식. 이건 각자의 환경에 따라 다르기 때문에 구체적인 예는 생략하겠다.
  3. 디스크 확인
    솔라리스 10 u6부터 ROOT 슬라이스도 ZFS를 이용해 설치할 수 있다. 게다가 2개 이상의 디스크가 있고 인스톨시 선택했다면 자동으로 아래와 같이 미러링 해준다. 당연히 이를 이용해야할 것이다. 아래의 예는 40GB인 디스크 2개를 선택해 전체 설치한 예이다.
    # df -h
    파일시스템             크기   사용   가용   용량    설치지점
    rpool/ROOT/rset         37G   3.8G    31G    11%    /
    /devices                 0K     0K     0K     0%    /devices
    ctfs                     0K     0K     0K     0%    /system/contract
    proc                     0K     0K     0K     0%    /proc
    mnttab                   0K     0K     0K     0%    /etc/mnttab
    swap                   1.5G   900K   1.5G     1%    /etc/svc/volatile
    objfs                    0K     0K     0K     0%    /system/object
    sharefs                  0K     0K     0K     0%    /etc/dfs/sharetab
    /usr/lib/libc/libc_hwcap1.so.1
                            35G   3.8G    31G    11%    /lib/libc.so.1
    fd                       0K     0K     0K     0%    /dev/fd
    rpool/ROOT/rset/var     37G    70M    31G     1%    /var
    swap                   1.5G    76K   1.5G     1%    /tmp
    swap                   1.5G    24K   1.5G     1%    /var/run
    rpool/export            37G    19K    31G     1%    /export
    rpool/export/home       37G    18K    31G     1%    /export/home
    rpool                   37G    35K    31G     1%    /rpool
    # zpool status
      풀: rpool
     상태: ONLINE
     스크럽: 요청된 항목이 없습니다.
    구성:
    
            NAME        STATE     READ WRITE CKSUM
            rpool       ONLINE       0     0     0
              mirror    ONLINE       0     0     0
                c0d0s0  ONLINE       0     0     0
                c0d1s0  ONLINE       0     0     0
    
    오류: 알려진 데이터 오류가 없습니다.
    # zfs list
    NAME                  USED  AVAIL  REFER  MOUNTPOINT
    rpool                5.63G  31.0G  35.5K  /rpool
    rpool/ROOT           3.88G  31.0G    18K  legacy
    rpool/ROOT/rset      3.88G  31.0G  3.81G  /
    rpool/ROOT/rset/var  70.1M  31.0G  70.1M  /var
    rpool/dump           1.00G  31.0G  1.00G  -
    rpool/export           37K  31.0G    19K  /export
    rpool/export/home      18K  31.0G    18K  /export/home
    rpool/swap            767M  31.8G    16K  -
    #
    
  4. 솔라리스 패치 - 권장패치를 이용하는 방법
    - 솔라리스 권장 패치는 http://sunsolve.sun.com/pub-cgi/show.pl?target=patches/patch-access 에서 회원가입 후 받을 수 있다. 이곳에서 원하는 버전과 아키텍처를 선택한후 다운로드 하면 된다. 이파일은 솔라리스 전체 패치가 아니라 선에서 권장하는 권장 패치일 뿐이다. README 에는 어떠한 패치가 포함되어있는지 나와있다. 권장패치는 [썬 서비스 플랜]에 가입해야 받을 수 있으며 가입은 유료다. 예전에 찾아봤을때는 일년에 240달러였다.
    - 선은 솔라리스를 6개월에서 1년마다 업데이트해 내놓고 있다. 이것을 이용해 업그레이드 하면 최신 패치를 설치한것과 동일한 효과를 가질 수 있다.
    - 게다가 상당수 개별 패치는 무료다. (권장 패치는 개별 패치들의 모음이다. 역설적으로 말하면 README에 나와있는 패치를 일일이 다 다운받아서 수동으로 설치하면 같은 효과를 낸다는 뜻이다)
    - 여의치 않다고 생각되면 OpenSolaris 를 사용할 수 있다. 솔라나라의 내용은 모두 오픈 솔라리스와 호환된다. [레드햇 엔터프라이즈 리눅스]와 [페도라]의 관계가 [솔라리스]와 [오픈 솔라리스]의 관계와 비슷하다.
    # unzip 10_x86_Recommended.zip
    # cd 10_x86_Recommended
    # ./install_cluster -nosave 1)
    Are you ready to continue with install? [y/n]: y
    Installing xxxxxx-yy...
      Installation of xxxxxx-yy failed. Return code z. 2)
    # sync
    # sync
    # sync
    # init 6
    
    1) 패치 클러스터는 패치 언인스톨을 위해 관련 파일을 압축해 저장해 놓는데 이 파일의 크키가 꽤 크다. 게다가 압축률 안좋은 .Z 확장자로 압축한다. /var/sadm/pkg/*/save/*/*.Z 파일이 그것이다. -nosave옵션을 주면 이를 생성하지 않을 수 있다. 단 패치의 언인스톨은 불가능해진다.
    2) z에 리턴된 코드중 2, 8, 35번은 무시해도 좋다. 코드에 대한 전체 설명은 message.html을 참고한다.
    2 Attempt to apply a patch that's already been applied
    8 Attempting to patch a package that is not installed
    35 Later revision already installed
  5. 솔라리스 패치 - smpatch 를 이용한 방법
    # cp /usr/lib/breg/data/RegistrationProfile.properties /tmp 1)
    # vi /tmp/RegistrationProfile.properties 
    userName=사용자아이디
    password=사용자패스워드
    # /usr/sbin/sconadm register -a -r /tmp/RegistrationProfile.properties
    sconadm이 실행되는 중
    사용자를 인증하는 중 ...
    finish registration!
    # rm /tmp/RegistrationProfile.properties 
    # smpatch get 2)
    patchpro.backout.directory      -       ""
    patchpro.baseline.directory     -       /var/sadm/spool
    patchpro.download.directory     -       /var/sadm/spool
    patchpro.install.types          -       rebootafter:reconfigafter:standard
    patchpro.patch.source           -       https://getupdates1.sun.com/
    patchpro.patchset               -       current
    patchpro.proxy.host             -       ""
    patchpro.proxy.passwd           ****    ****
    patchpro.proxy.port             -       8080
    patchpro.proxy.user             -       ""
    # smpatch analyze 3)
    메시지 생략
    # smpatch download 4)
    (으)로 패치 다운로드 /var/sadm/spool...
    xxxxxx-yy has been validated.
    메시지 생략
    # smpatch update 5)
    에서 패치 설치 /var/sadm/spool...
    xxxxxx-yy 적용되었습니다.
    메시지 생략
    설치 정책이 허용하지 않는 업데이트의 ID가 파일에
    기록되었습니다.6)
            /var/sadm/spool/disallowed_patch_list
    
    설치한 하나 이상의 업데이트를 활성화하려면 시스템을 종료해야 합니다. 시스템 종료를 시작하려면 다음 명령 중 하나를 사용해야 합니다.
    o 펌웨어 프롬프트로 이동 - init 0 또는 shutdown -i 0
    o 시스템 전원 끄기 - init 5 또는 shutdown -i 5
    o 시스템 재시작 - init 6 또는 shutdown -i 6
    # sync
    # init 6
    
    1) 등록을 하지 않았다면 등록한다. 한번만 하면 된다.
    2) 등록이 완료되면 패치프로의 설정 내용을 확인한다. [patchpro.patch.source]가 위와같이 나오는지 확인한다. 프록시를 사용하는 경우 [smpatch set patchpro.proxy.host=xxx.xxx.xxx.xxx]와 같이 지정해 주어야 한다.
    3) 패치를 분석해본다. 설치되어있지 않은 패치번호가 나올 것이다.
    4) 패치를 다운로드 한다. /var/sadm/spool 에 패치를 받는다. 생략 가능하다. 하단에 나오는 [smpatch update] 명령에 필요한 패치를 자동으로 다운로드해준다.
    5) 패치를 적용한다. /var/sadm/spool 에 받은 패치를 실행시킨다. 만약 설치해야할 패치가 다운로드 되지 않았으면 다운로드 한다.
    6) [싱글모드]로 전환([init s]명령을 사용하면 된다)해 [smpatch add -x idlist=/var/sadm/spool/disallowed_patch_list]명령을 주면 [설치 정책이 허용하지 않는 업데이트]를 설치할 수 있다. 허용하지 않는 패치에는 커널 업데이트와 드라이버 업데이트가 포함되기 때문에 반드시 해야한다. 또한 반드시 수동 설치해야 하는 패치도 있는데(SMPATCH LIVE UPGRADE처럼) 이는 [smpatch add -i 121431-25]처럼 명령을 주면 된다
  6. root의 기본 셸과 홈 디렉토리를 변경한다. 아울러 패스워드 암호화 방식도 MD5로 변경한다.
    # mkdir -m 700 /root
    # vi /etc/passwd
    root:x:0:1:Super-User:/root:/bin/bash
    # vi /etc/security/policy.conf
    CRYPT_ALGORITHMS_ALLOW=1,2a,md5,5,6 1)
    CRYPT_DEFAULT=md5 2)
    # passwd root 3)
    새 암호:
    새 암호를 다시 입력하십시오:
    passwd: 암호(root용)가 성공적으로 변경되었습니다.
    # 
    
    1) 사용할 수 있는 알고리즘을 나타낸 것으로 이는 /etc/security/crypt.conf 에 연결되어있는 약어이다.
    1: UNIX crypt 알고리즘
    2a: Blowfish 알고리즘
    md5: MD5 알고리즘
    5: SHA256 알고리즘 (Solaris 10 u6 이상부터 지원)
    6: SHA512 알고리즘 (Solaris 10 u6 이상부터 지원)
    2) __unix__ 를 md5로 변경한다. 이후 패스워드 변경시 /etc/shadow파일을 보면 패스워드 필드가 $md5 로 시작하는 것을 볼 수 있다. 8자 이상의 패스워드도 지원해준다. 참고로 *LK*는 잠금상태, NP는 로그인 불가상태를 의미한다. 참고로 솔라리스 10 u6 이상 사용자들은 더 나은 알고리즘인 6(SHA512)을 사용하는 것도 좋다.
    3) __unix__로 암호화 되어있는 패스워드를 MD5로 암호화 하기 위해 root 패스워드를 한번 더 변경한다.
  7. 환경 설정 파일을 변경한다. 필자는 /etc/profile을 변경한다. 가장 아래줄에 다음과 같이 추가해준다. 필자는 sh와 bash를 사용한다.
    # vi /etc/default/init
    메시지 생략
    LANG=ko_KR.UTF-8
    # vi /etc/profile
    메시지 생략
    alias ll="ls -alF"
    tty -s && stty cs8 -istrip defeucw
    
    case "$0" in
    bash | -bash)
    	PS1="\u@\h \w \\$ "; export PS1
    	;;
    sh | -sh)
    	PS1="`/usr/ucb/whoami`@`hostname'` "
    	case `/usr/xpg4/bin/id -u` in
    		0) PS1="${PS1}# ";;
    		*) PS1="${PS1}$ ";;
    	esac
    	;;
    esac
    EDITOR=vi; export EDITOR
    CC=cc; export CC
    PATH=/usr/local/bin:/opt/SUNWspro/bin:/usr/bin:/usr/sbin:/usr/ccs/bin:/usr/openwin/bin; export PATH
    LD_LIBRARY_PATH=/usr/local/xml/lib:/usr/lib:/usr/local/lib:/usr/ucblib:/usr/ccs/lib; export LD_LIBRARY_PATH
    #
    
    ※ 이 문서에서 가장 중요한 부분이 PATH 환경변수 세팅과 LD_LIBRARY_PATH 환경변수 세팅이다. 꼭 맞춰주자. PATH와 LD_LIBRARY_PATH가 기존에 소개했던 솔라리스 9용 설정과 다르다.
    ※ 솔라리스 콘솔도 컬러를 지원하기 때문에 안시코드를 이용해 컬러를 넣을수도 있다.
    PS1="\u@\h ^[[1;31m\w^[[0m \\$ "; export PS1
    
    처럼 입력할 수 있다. ^[[의 ^[부분은 안시 이스케이프 코드로, vi에디터의 입력 모드에서, Ctrl+V를 누르고 ESC키를 눌러 입력해야 한다.
  8. SAR(System Activity Reporter)를 활성화 하고 크론의 sar 설정을 활성화한다. NTP 데몬을 활성화한다.
    # svcadm enable sar
    # EDITOR=/usr/bin/vi; export EDITOR
    # 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
    # vi /etc/inet/ntp.conf 2)
    # 한국표준과학연구원, time.bora.net
    server 203.248.240.103
    # svcadm enable ntp
    
    1) 주석만 풀어주면 된다.
    2) 여기에서는 NTP 데몬을 이용한 타임서버 동기화 방법을 설명했다. 다른 방법으로 rdate를 cron에 등록시키는 방법도 있다. [rdate time.bora.net]명령을 이용하면된다. [svcadm enable time:stream]와 [svcadm enable time:dgram]가 활성화되어있는 솔라리스 호스트라면 그 호스트에서 시간을 가져올 수 있다.
  9. 사용자를 추가하고 패스워드를 지정한다.
    # useradd -d /export/home/windy -c "윈디하나" -g staff -m -u 101 -s /bin/bash windy 1)
    64 블록
    # passwd windy
    새 암호:
    새 암호를 다시 입력하십시오:
    passwd: 암호(windy용)가 성공적으로 변경되었습니다.
    # 
    
    1) 관리자가 주로 사용할 계정을 생성한다. (당연한 말이지만 꼭 windy가 아니어도 된다. 솔라나라와 똑같이 하라는 말 때문인지, 사용할 계정 이름까지 까지 똑같이 하는 경우를 봤다. 많이 봤다. ㅎㅁ) 8자 이상의 아이디를 가진 계정을 생성하면 [UX: useradd: xxxxxxxxxx name too long.]과 같은 메시지가 발생하지만 생성 되어있다. (그리고 정상적으로 사용 가능하다)
  10. 솔라나라에 필요한 링크를 걸어준다.
    반드시 필요해 링크를 거는 것이 아니라 솔라나라의 문서는 모두 wget을 이용해 받고, (GNU) tar를 이용해 압축을 풀도록 되어있기 때문에 걸어놓는 것이다.
    # mkdir -p /usr/local/bin
    # cd /usr/local/bin
    # ln -s /usr/sfw/bin/wget wget
    # ln -s /usr/sfw/bin/gtar tar
    
  11. 가뿐하게 한번 재시작해준다.
    # sync
    # sync
    # init 6
    

3. 컴파일러/기본 라이브러리 설치

아래에 소개된 프로그램을 설치한다. 솔라나라의 문서를 적용하려면 반드시 설치해야 한다.

Sun Studio 12

※ cc(C 컴파일러)를 설치한다. 솔라나라는 gcc가 아닌 cc를 사용할 것이다. SunStudio12ml-solaris-x86-200709-pkg.tar.bz2 파일은 Sun Studio Downloads에서 Sun Developer Network에 무료로 가입한 후 받을 수 있다.

※ 솔라나라를 2005년 7월에 오픈하면서 이번 리뉴얼에까지 가장 많이 바뀐것이 바로 gcc기준의 문서를 cc로 바꾼것이다. 솔라리스에서 cc가 유료였던 관계로 하는수 없이 gcc를 썼었는데 Sun Studio 11부터 무료로 배포되고 사용할 수 있기 때문에 cc를 사용하는 것이다. (솔라나라에서는 SunStudio 12를 사용한다) gcc와 cc를 혼합해서 쓰는것에는 여러가지 문제가 있으며, 아직까지는 솔라리스를 제대로 지원해주는게 cc라고 생각하기 때문에 cc를 기준으로 설명한다. 솔라나라의 문서는 cc를 기준으로 하지만 gcc를 사용해도 큰 문제 없도록 구성 되어있다. sunfreeware의 gcc나 솔라리스 기본 설치된 gcc(/usr/sfw/bin/gcc)를 사용해도 문제 없다는 의미이다. 실제로 어플리케이션이 컴파일시 gcc만을 요구하는 경우 솔라리스에 이미 설치되어있는 gcc를 이용해 컴파일 할 것이다.
  1. root@wl ~ # mkdir SunStudio
    root@wl ~ # cd SunStudio
    root@wl ~/SunStudio # tar xvfj ../SunStudio12ml-solaris-x86-200709-pkg.tar.bz2
    root@wl ~/SunStudio # ./batch_installer --show-sla 1)
    메시지 생략
    Please contact Sun Microsystems, Inc.  4150 Network Circle,
    Santa Clara, California 95054 if you have questions.
    root@wl ~/SunStudio # ./batch_installer -p all --accept-sla 1)
    Java Accessibility Bridge for GNOME loaded.
    
    
    root@wl ~/SunStudio # cc 2)
    usage: cc [ options] files.  Use 'cc -flags' for details
    root@wl ~/SunStudio # 
    
    1) 라이센스를 확인한다. [./batch_installer -p all --accept-sla]는 라이센스에 동의하였으며, 아무것도 묻지 않고 전체설치할때 사용하는 명령어이다. [Java Accessibility Bridge for GNOME loaded] 메시지가 나온 이후 한참 걸린다.
    2) cc는 [/opt/SUNWspro/bin/cc]에 있다. 경로를 설정해주었으므로 cc만 쳐도 위와같이 나와야 한다. [/usr/ucb/cc: language optional software package not installed] 이렇게 나오면 안된다.
  2. 컴파일러를 설치한 후에는 패치를 해야 한다. Sun Studio 12 Patches에 가보면 버전별로 받아서 설치해야할 패치 목록이 나와있다. 리스트된 패치는 모두 무료로 제공되니 받아서 설치하면 된다. 물론 SDN에 가입해야 받을 수 있다. 솔라나라의 문서는 최소한 아래의 패치를 적용한 것을 기준으로 작성했다.
    root@wl ~/SunStudio/patch # ls -al *.zip
    -rw-r--r--   1 windy    staff    1487960 11월 18일  09:55 119964-11.zip
    -rw-r--r--   1 windy    staff    33330549 11월 18일  09:55 124864-08.zip
    -rw-r--r--   1 windy    staff    2099859 11월 18일  09:55 124868-07.zip
    -rw-r--r--   1 windy    staff    50663857 11월 18일  09:55 124869-02.zip
    -rw-r--r--   1 windy    staff    4446424 11월 18일  09:55 124873-06.zip
    -rw-r--r--   1 windy    staff     324661 11월 18일  09:55 126496-02.zip
    -rw-r--r--   1 windy    staff    6463178 11월 18일  09:55 126498-11.zip [먼저패치해야함]
    -rw-r--r--   1 windy    staff    3136678 11월 18일  09:55 126996-04.zip
    -rw-r--r--   1 windy    staff    10531891 11월 18일  09:55 127002-04.zip
    -rw-r--r--   1 windy    staff     538400 11월 18일  09:55 127144-03.zip [먼저패치해야함]
    root@wl ~/SunStudio/patch # unzip 126498-11
    ...
    root@wl ~/SunStudio/patch # patchadd 126498-11
    ...
    Patch packages installed:
      SPROcpl
      SPROcplx
      SPROmrcpl
      SPROscl
      SPROsclx
      SPROstl4a
      SPROstl4h
      SPROstl4o
      SPROstl4x
      SPROstl4y
      SPROtl7x
      SPROtlbn7
      SPROtll7
      SPROtll7x
    
    root@wl ~/SunStudio/patch # [다른 파일도 위와같이 실행한다]
    
  3. smpatch (위에서 설명) 를 이용하면 cc가 시스템과 같이 패치된다.

OpenSSL

더 자세한 사항은 윈디하나의 솔라나라: OpenSSL을 참고한다. 솔라나라에서 소개하는 상당수의 어플리케이션이 OpenSSL을 지원하고 있으며 SSL과 같이 컴파일할것이다.
root@wl ~/source # wget http://www.openssl.org/source/openssl-0.9.8h.tar.gz
root@wl ~/source # tar xvfz openssl-0.9.8h.tar.gz
root@wl ~/source # cd openssl-0.9.8h
root@wl ~/source/openssl-0.9.8h # ./config
root@wl ~/source/openssl-0.9.8h # make
root@wl ~/source/openssl-0.9.8h # make test
root@wl ~/source/openssl-0.9.8h # make install
Valid XHTML 1.0 Transitional Valid CSS!
Posted by 1010
60.Unix2008. 12. 17. 14:31
반응형
ssh이라는 것이 있다는 이야기를 들었습니다.
 
그래서 telnet을 사용하지 않고 SSH를 사용 하려고 하는데.;;
안되네요..
 
인터넷 검색을 해보니 딱히 설치해야 할 것은 없는거 같고..
 
 
pkginfo -i |grep -i ssh 를 해보면 설치된 패키지가 있습니다.
system      SUNWsshcu                        SSH Common, (Usr)
system      SUNWsshdr                        SSH Server, (Root)
system      SUNWsshdu                        SSH Server, (Usr)
system      SUNWsshr                         SSH Client and utilities, (Root)
system      SUNWsshu                         SSH Client and utilities, (Usr)
 
 
/etc/services 에는 이렇게 되어있습니다.
ssh             22/tcp                          # Secure shell
 
svcs ssh하면
STATE          STIME    FMRI
online         10:44:00 svc:/network/ssh:default
 
그런데 putty나 secureCRT를 이용해서 접근을 하려고 하면
화면에 아무것도 뜨지 않습니다..
 
어떻게 해야하는건지 궁금해서 질문 올려 봅니다.
 
아 /etc/ssh/sshd_config 에서
PermitRootLogin yes
도 해주었습니다..
 
왜 안될까요/..ㅠㅠ
Posted by 1010
60.Unix2008. 12. 17. 14:25
반응형
솔라리스는 거의 모든 오퍼레이팅이 패캐지화 되어 있다구 하여도 과언이 아닙메다.
패캐지 파일은 binaries,configure file,document 파일등으로 구성 되어 있습니다.
우리가 sunfreeware.com 에서 패캐지를 쉽게 얻을수 있듯이 솔라리스 패캐지는 리눅스의
rpm과 마찬가지로 솔라리스에 유용하게 사용 됩니다.

그라믄 가략하게 패캐지 관련 명령어와 사용법을 소개 하것슴다..

1. pkgchk : 말그대로 패캐지를 채크 합니다.

ex)
# pkgchk -l -p /usr/bin/mkdir ----> -l 은 리스트를 말하며 -p는 위치를 의미하는 옵션 입니다.

Pathname: /usr/bin/mkdir
Type: regular file
Expected mode: 0555
Expected owner: bin
Expected group: bin
Expected file size (bytes): 10264
Expected sum(1) of contents: 4598
Expected last modification: 10월 06 16:42:34 1998
Referenced by the following packages:
SUNWcsu
Current status: installed

위와 같은 결과를 보여 줍니다. 그밖에도 많은 옵션이 있는데 manpage를 참조 하세영...

2. pkginfo : 인스톨 되어 있는 패캐지 리스트를 보여 줍니다.

ex)

# pkginfo
system AUBtocsin Auburn Univ. Engineering tocsin network scan detector
system FJSVhea SunOS Header Files for FUJITSU platform specific
system FJSVvplr Fujitsu platform specific symlinks (Root)
system FJSVvplu Fujitsu platform specific symlinks (user)
application FSFgzip gzip
application GLIB glib
application GNUbash bash
tools GNUgzip GNU gzip
tools GNUrcs GNU rcs and diffutils
application GNUwget wget
application GTK+ gtk+
system INTACT INTACT Change Detection System
application IZzip zip
application JSparm parm V5.0b2 - Performance Analysis Report Maker
application LWperl perl
application MHmpg123 mpg123
system MRsnort Marty Roesch's Snort (/usr/local)
utility NRMXkstat NRM Xkstat 0.90 SPARC Solaris 7
application NSCPcom Netscape Communicator
tools PARCdaily DailyCronJob
application PPkde KDE Desktop (PatriotSoft Packages)
application PPqtgif QT (PatriotSoft Packages)
...

3. pkgadd : 패캐지를 Add 합니다.

ex)
# pkgadd -d ntop-1.1-sol7-sparc-local

다음과 같은 패키지를 사용할 수 있습니다.
1 SMCntop ntop
(sparc) 1.1

처리할 패키지(들)를 선택하십시오.(또는 모든 패키지를
처리하려면'all'을 입력하십시오.) (default: all) [?,??,q]:all


4. pkgrm : 패캐지를 지웁니다.

ex)
# pkgrm SMCntop ---> 이렇게 하면 SMCntop만 지워지겠죠.
현재 설치되어 있는 패키지는 다음과 같습니다:
SMCntop ntop
(sparc) 1.1

이 패키지를 제거하겠습니까? y

# pkgrm ----> 패캐지 리스트를 열거하여 주므로 선택하여 지울수 있습니다.


5. pkgproto : prototype file 의 형태를 보여 줍니다.

ex)

# cd /usr/local/apache
# find . -print | pkgproto > prototype ----> 형태를 prototype 파일에 저장 합니다.
d none bin 0755 root other
f none bin/httpd 0755 root other
f none bin/ab 0755 root other
f none bin/apachectl 0755 root other
f none bin/htpasswd 0755 root other
f none bin/htdigest 0755 root other
f none bin/dbmmanage 0755 root other
f none bin/logresolve 0755 root other
f none bin/rotatelogs 0755 root other
f none bin/apxs 0755 root other
d none libexec 0755 root other
d none man 0755 root other
d none man/man1 0755 root other
f none man/man1/htpasswd.1 0644 root other
f none man/man1/htdigest.1 0644 root other
f none man/man1/dbmmanage.1 0644 root other
d none man/man8 0755 root other
f none man/man8/httpd.8 0644 root other
f none man/man8/ab.8 0644 root other
f none man/man8/apachectl.8 0644 root other
f none man/man8/logresolve.8 0644 root other
f none man/man8/rotatelogs.8 0644 root other
f none man/man8/apxs.8 0644 root other
....

여그서 f는 파일을 의미하며 d는 디렉터리를 의미합니다. 위에서 보듯이 퍼미션 코드와 유저 그룹도
알수 있습니다...끝내 줍니다영 ^^;
Posted by 1010
60.Unix2008. 12. 17. 14:21
반응형

Installing OpenSSH Packages for SPARC/Solaris 2.5(.1), 2.6 or 7


Openssh is meant to supply security to your systems. If you don't understand how to properly use it, you may have problems. Such problems are your responsibility. See our disclaimer. Please read the instructions below fully and carefully before you do any installation.

Installation of the openssh software on a Solaris machine is lengthy, but straightforward. To get ssh and sshd running you need to install a number of packages. There are a number of places on the net with details of this procedure. One of the best is on the Sun Blueprints web pages (in pdf format) at

Building and Deploying OpenSSH on Solaris[tm] Operating System (a pdf file)

or the

The OpenSSH Home Page

I do not use the Sun blueprint method exactly because some things have changed since that document was created.

The seven pieces of software that may need to be on your system to use ssh properly are openssl, openssh, zlib, libgcc (if you have gcc-3.3.2 installed, you do not need to install libgcc), and optionally egd, prngd, perl (there is a perl with Solaris 9 and 10 in /usr/bin), and tcp_wrappers. You can either download the sources and do the compiles yourself if you have a C compiler installed and working or you can go to sunfreeware.com and get pre-compiled packages. If you are very concerned about your machine's security and don't want to trust software compiled by someone else, then it is best for you to compile the software yourself. It is also a great learning experience.

The sources for these different programs are on sunfreeware.com or you can go to their home pages at

http://www.zlib.org zlib
http://www.perl.org perl
http://www.aet.tu-cottbus.de/personen/jaenicke/postfix_tls/prngd.html prngd
http://www.openssl.org openssl
http://www.openssh.org openssh
http://www.lothar.com/tech/crypto/ egd
ftp://ftp.porcupine.org/pub/security/index.html tcp_wrappers

You will also need to have the /usr/local/lib/libgcc_s.so.1 library from the libgcc-3.3 or gcc-3.3.2 or higher packages.

I have included support for the optional use of the tcp_wrappers program (using the so-called Advanced Method). This can help to restrict the use of ssh logins to those computers defined in the so-called hosts.allow and hosts.deny files when set up properly. Ssh logins can also be logged using this software.


Installation Steps


Step One: Getting the packages

To install the version of openssh from sunfreeware.com, go to the main page and select the files for SPARC/Solaris 2.6 or SPARC/Solaris 7 at the right.

Or, here are the files you need to download for Solaris 7 (get the similar files for Solaris 2.5(,1) (you will also need the snprintf package), or 2.6):

openssh-5.1p1-sol7-sparc-local.gz (5.1p1 for Solaris 7 now)
openssl-0.9.8h-sol7-sparc-local.gz
tcp_wrappers-7.6-sol7-sparc-local.gz (optional, but recommended
(unless you are using IPV6 - see the tcp_wrappers listing for details on this issue)
zlib-1.2.1-sol7-sparc-local.gz
libgcc-3.3.2-sol7-sparc-local.gz or the gcc-3.3.2-sol7-sparc-local.gz
perl-5.8.3-sol7-sparc-local.gz (optional)
prngd-0.9.25-sol7-sparc-local.gz
egd-0.8-sol7-sparc-local.gz

If you have already installed some of the above files, you can skip their downloads, but most are new.

Step Two: Installing the packages

With the files downloaded, go to the directory where you put them and run

# gunzip openssh-5.1p1-sol7-sparc-local.gz

# gunzip openssl-0.9.8h-sol7-sparc-local.gz

# gunzip zlib-1.2.1-sol7-sparc-local.gz
 
# gunzip libgcc-3.3-sol7-sparc-local.gz  (if you don't have gcc-3.3.2 installed)

# gunzip tcp_wrappers-7.6-sol7-sparc-local.gz (again optional)

# gunzip prngd-0.9.25-sol7-sparc-local.gz

# gunzip egd-0.8-sol7-sparc-local.gz

# gunzip perl-5.8.5-sol7-sparc-local.gz (optional if you already have perl)

# gunzip snprintf-2.2-sol25-sparc-local.gz (for Solaris 2.5(.1) only)

Then run as root:

# pkgadd -d openssh-5.1p1-sol7-sparc-local

# pkgadd -d openssl-0.9.8h-sol7-sparc-local

# pkgadd -d zlib-1.2.1-sol7-sparc-local

# pkgadd -d libgcc-3.3-sol7-sparc-local  (if you don't have gcc-3.3.2 installed)

# pkgadd -d tcp_wrappers-7.6-sol7-sparc-local (optional)

# pkgadd -d prngd-0.9.25-sol7-sparc-local

# pkgadd -d snprintf-2.2-sol25-sparc-local (for Solaris 2.5(.1) only)

# pkgadd -d egd-0.8-sol7-sparc-local

# pkgadd -d perl-5.8.5-sol7-sparc-local (optional)

Once you have installed the packages above, you will have files in various subdirectories of /usr/local. The default location for the ssl files is in /usr/local/ssl. While these files were compiled to avoid the need to put directories like /usr/local/lib and /usr/local/ssl/lib in your LD_LIBRARY_PATH, it is possible that you may need to set this. You should now find ssh in /usr/local/bin and sshd in /usr/local/sbin. Make sure you have /usr/local/bin and /usr/local/sbin in your PATH environment variable. The perl scripts in the optional egd package (with .pl extensions) will look for perl in /usr/local/bin. If you are using the Sun perl, then the Perl programs will need to have /usr/bin at the beginning, while the sunfreeware Perl goes in /usr/local/bin.

Step Three: Getting Entropy

The next step in installation is to start the generation of entropy for use by openssl and openssh. This is done with the prngd program. To set this up, read the README.prngd file. Make sure you have /usr/local/sbin in your PATH first. Now go to your /var/log, /var/adm, or similar directories and look for some log files like messages, syslog, etc. Make sure you are logged in as root user and run

cat ....various log files from your /var/log or /var/adm directories... > /usr/local/etc/prngd/prngd-seed

such as

cat syslog messages > /usr/local/etc/prngd/prngd-seed

Then run

mkdir /var/spool/prngd

/usr/local/sbin/prngd /var/spool/prngd/pool

This should start up the prngd daemon and start generating entropy. You can check this by running

/usr/local/bin/egc.pl /var/spool/prngd/pool get

which, if the egd package (see README.egd) is installed along with perl, will give a message like

32800 bits of entropy in pool

indicating that the prngd is working.

Note: Several users have pointed out that they may get a "PRNG not seeded" message when trying to start sshd. This seems to be a new issue with openssl 0.9.7 versions. They point out that the OpenSSL FAQ says:

Starting with version 0.9.7, OpenSSL will automatically
look for an EGD socket at /var/run/egd-pool, /dev/egd-pool,
/etc/egd-pool and /etc/entropy.
and if they did a link like

ln -s /var/spool/prngd/pool /dev/egd-pool

or similar, the not seeded message above goes away and opnessh programs then work properly.

If you want to automatically start prngd at boot time, you will need to create a startup script appropriate to your setup.

I use the script below placed in /etc/init.d as prngd, which you may wish to modify:

#!/bin/sh

pid=`/usr/bin/ps -e | /usr/bin/grep prngd | /usr/bin/sed -e 's/^  *//' -e 's/ .*//'`
case $1 in
'start')
	/usr/local/sbin/prngd /var/spool/prngd/pool
	;;
'stop')
	if [ "${pid}" != "" ]
	then
		/usr/bin/kill ${pid}
	fi
	;;
*)
	echo "usage: /etc/init.d/prngd {start|stop}"
	;;
esac
placed in /etc/init.d with file name prngd and then as root run

# chown root /etc/init.d/prngd
# chgrp sys /etc/init.d/prngd
# chmod 555 /etc/init.d/prngd
# ln -s /etc/init.d/prngd /etc/rc2.d/S98prngd

# /etc/rc2.d/S98prngd start

will start the process if you want to do it by hand and

# /etc/rc2.d/S98prngd stop

will stop the prngd daemon. You can test that this script actually starts the prngd daemon at boot time by rebooting your system and then doing

ps -e | grep prngd

to see if the process is started.

Step Four: Setting up the sshd user and the /var/empty directory

In openssh 3.5p1, a new security method is setup called privilege separation. The details can be found in the README.privsep file in the openssh source distribution. This method is now the default in openssh. Before doing anything else, you should read the above document and if you agree, implement these steps as root:

# mkdir /var/empty
# chown root:sys /var/empty
# chmod 755 /var/empty
# groupadd sshd
# useradd -g sshd -c 'sshd privsep' -d /var/empty -s /bin/false sshd

/var/empty should not contain any files.

The default sshd_config file /usr/local/etc has the last line

Subsystem sftp /usr/libexec/sftp-server

This may need to be changed to

Subsystem sftp /usr/local/libexec/sftp-server

If you do not do this and attempt to start up sshd, you will get error messages and the daemon will not start.

Step Five: Setting up tcp_wrappers

The next step it to setup tcp_wrappers. First read the README.tcpwrappers so that you know what tcp_wrappers does and how. Basically, tcp_wrappers is used to restrict to some limited group of machines access to your communication ports such as the port 22 that the sshd program uses. If you have tcp_wrappers running already, then you will only need to make sure that the sshd daemon entry is placed in the /etc/hosts.allow and /etc/hosts.deny files in a way that is appropriate to your setup. If you are not currently running tcp_wrappers, you can first create the file /etc/hosts.deny and put the single line

sshd: ALL

in it. Then, create the file /etc/hosts.allow file and put a line, for example, like

sshd: ... a list of the IP numbers of machine you want to be able to communicate with your machine separated by commas ...

in the file. We will test these entries later.

Step Six: Installing ssh and sshd

This is the final step. You should have read the README.openssl and INSTALL.openssl documents and you should also have read the openssh documents README.openssh and INSTALL.openssh.

Each machine that you want to communicate with via the ssh client will need to have an sshd daemon running. But first, you need to run the following three lines to create the key information for the server machine. Again, make sure you have /usr/local/bin and /usr/local/sbin in your PATH. If you have been running sshd before and have keys in /usr/local/etc, running these commands will overwrite them. As root, enter

# ssh-keygen -t rsa1 -f /usr/local/etc/ssh_host_key -N ""
# ssh-keygen -t dsa -f /usr/local/etc/ssh_host_dsa_key -N ""
# ssh-keygen -t rsa -f /usr/local/etc/ssh_host_rsa_key -N ""
and wait until each is done - this may take a few minutes depending on the speed of your machine.

You might also want to study the /usr/local/etc/ssh_config and /usr/local/etc/sshd_config files to see if there is anything you want to configure differently.

Now we can set up scripts to start the sshd daemon. I use the script below which I place in /etc/init.d as sshd, but you are free to devise others to match your needs. There have been some comments on the net recently in the sun-managers mailing list that this script should be replaced. See the post below for details.

#!/bin/sh

pid=`/usr/bin/ps -e | /usr/bin/grep sshd | /usr/bin/sed -e 's/^  *//' -e 's/ .*//'`
case $1 in
'start')
	/usr/local/sbin/sshd
	;;
'stop')
	if [ "${pid}" != "" ]
	then
		/usr/bin/kill ${pid}
	fi
	;;
*)
	echo "usage: /etc/init.d/sshd {start|stop}"
	;;
esac

Alternative script comments

Date: Mon, 13 Jan 2003 14:43:53 -0600 (CST)
From: "Mike's List" 
To: sunmanagers@sunmanagers.org
Subject: SUMMARY: sshd weirdness

Lots of responses on this one, I used the basic script below (from Luc).
Most responded that the script for the sunfreeware.com is badly written
and that the error or non-existence PID is from the grep to kill sshd.
I'm no script expert, only reporting what others replied.

Some recommends search for the /var/run/sshd.pid, this way your ssh
terminal won't get zap while sshd daemon is re-hup or stop/start.

Thanks all.


- Mike


case "$1" in
'start')
        if [ -x /usr/local/sbin/sshd ]; then
                echo "Starting the secure shell daemon"
                /usr/local/sbin/sshd &
        fi
        ;;

'stop')
        echo "Stopping the secure shell daemon "
        pkill -TERM sshd
        ;;
*)
        echo "Usage: /etc/init.d/sshd { start | stop }"
        ;;
esac
exit 0


On Fri, 10 Jan 2003, Mike's List wrote:

> Ok, quite a few asked to see the script (below) --Solaris 8 2/02 running
> sunfreeware.com openssh 3.5p1 --a couple of suggestions below doing
> 
> /bin/sh -x /etc/init.d/sshd stop
> 
> ...to see what's going on, I'm in the server remotely right now so I can't
> stop/start (because stop would just kills all the sshd processes and I
> can't get back in to start).
> 
> 
> - Mike
> 
> 
> #!/bin/sh
> pid=`/usr/bin/ps -e | /usr/bin/grep sshd | /usr/bin/sed -e 's/^  *//' -e 's/ .*//'`
> case $1 in
> 'start')
>         /usr/local/sbin/sshd
> ;;
> 'stop')
>         if [ "${pid}" != "" ]
>         then
>                 /usr/bin/kill ${pid}
>         fi
>         ;;
> *)
>         echo "usage: /etc/init.d/sshd {start|stop}"
>         ;;
> esac

End of alternative script comment

I then do

# chown root /etc/init.d/sshd
# chgrp sys /etc/init.d/sshd
# chmod 555 /etc/init.d/sshd
# ln -s /etc/init.d/sshd /etc/rc2.d/S98sshd

# /etc/rc2.d/S98sshd start

will start the process if you want to do it by hand and

# /etc/rc2.d/S98sshd stop

will stop the sshd daemon. You can check this with

# ps -e | grep sshd

to see if sshd is running. If sshd is running and you have set up tcp_wrappers the way you want, then you can test the system. Of course, you have to have another machine that has the ssh program installed so that you can try to communicate with the machine on which you just started sshd. See the OpenSSH documentation for further details. To test that tcp_wrappers is working, you can put a machine's IP address in hosts.allow and see if you can ssh to the server machine from the client and then take it out and see if access is denied.

To repeat, if you have questions about the detailed use of any of these programs, please read the documentation first or go to their web sites. I do not want to know the security details of any of your systems and it would not be a good idea for you to tell me or anyone else. Security issues are very important and I strongly urge anyone to install as much security software as they can master and to keep a close eye out on the latest CERT and other vulnerability sites for announcements.

I am fully open to constructive suggestions on how make these instructions clearer or better and will include reasonable comments as they arrive.

A sunfreeware.com user, Erick Mechler, has generously submitted a shell script that helps to automate some of the above installation for Solaris 2.6 and 7. The script can be downloaded at

openssh-install.sh

You may need to modify it for your system's structure. Comments should be sent directly to Erick.



© Copyright 2008 Steven M. Christensen and Associates, Inc.
This page was last updated on August 29, 2008.
Posted by 1010
60.Unix2008. 12. 17. 14:17
반응형
Solaris  Basic  Set

 

  **  네트워크  설정  **

 

/etc/hosts

  127.0.0.1              localhost

  192.168.211.20      solaris10  loghost

 

/etc/hostname.pcn0

  solaris10

 

/etc/netmasks

  192.168.211.0          255.255.255.0

 

/etc/defaultrouter

  192.168.211.2

 

        -  부팅시  GW자동인식이  안돼면
            /etc/init.d/inetsvc

            route  add  default  route_IP  1    
   

/etc/resolv.conf
nameserver  219.250.36.130

 

/etc/nsswitch.conf
hosts:        files  dns

 

**  shell  바꾸기**                  

작업의  편의를  위해  root  의  쉘과  홈디렉토리부터  변경해준다.
솔라리스에서는  기본적으로  root  의  홈디렉토리를  /  로  사용하지만  관리의  편의를  위해  /root  라는  디렉토리를  만들어서  root  의  홈디렉토리로  사용한다.

  #  mkdir  /root
 
root의  기본  쉘을  bash로  변경해주고,  홈디렉토리를  /root  로  변경해준다.

  기본  :  root:x:0:1:Super-User:/:/sbin/sh

  변경  :  root:x:0:1:Super-User:/root:/bin/bash

/etc/bashrc와  root의  홈디렉토리에  .bash_profile  을  만들어준다.
  리눅스의  파일을  참조하여  사용한다.

  +++  /etc/bashrc  ++++++++++++++++++++++++++++++++++++++++

#  /etc/bashrc

#  System  wide  functions  and  aliases
#  Environment  stuff  goes  in  /etc/profile

#  by  default,  we  want  this  to  get  set.
#  Even  for  non-interactive,  non-login  shells.
if  [  $UID  -gt  99  ]  &&  [  "`id  -gn`"  =  "`id  -un`"  ];  then
        umask  002
else
        umask  022
fi

#  are  we  an  interactive  shell?
if  [  "$PS1"  ];  then
        case  $TERM  in
        xterm*)
                if  [  -e  /etc/sysconfig/bash-prompt-xterm  ];  then
                        PROMPT_COMMAND=/etc/sysconfig/bash-prompt-xterm
                else
                        PROMPT_COMMAND='echo  -ne  "\033]0;${USER}@${HOSTNAME%%.*}:${PWD/#$HOME/~}\007"'
                fi
                ;;
        screen)
                if  [  -e  /etc/sysconfig/bash-prompt-screen  ];  then
                        PROMPT_COMMAND=/etc/sysconfig/bash-prompt-screen
                else
                PROMPT_COMMAND='echo  -ne  "\033_${USER}@${HOSTNAME%%.*}:${PWD/#$HOME/~}\033\\"'
                fi
                ;;
        *)
                [  -e  /etc/sysconfig/bash-prompt-default  ]  &&  PROMPT_COMMAND=/etc/sysconfig/bash-prompt-default
                ;;
        esac
        #  Turn  on  checkwinsize
        shopt  -s  checkwinsize
        [  "$PS1"  =  "\\s-\\v\\\$  "  ]  &&  PS1="[\u@\h  \W]\\$  "
fi

if  !  shopt  -q  login_shell  ;  then  #  We're  not  a  login  shell
                for  i  in  /etc/profile.d/*.sh;  do
                if  [  -r  "$i"  ];  then
                        .  $i
                fi
        done
        unset  i
fi
#  vim:ts=4:sw=4

  ++++++++++++++++++++++++++++++++++++++++++++++++++++++++

  +++  /etc/bashrc  ++++++++++++++++++++++++++++++++++++++++

#  .bash_profile

#  Get  the  aliases  and  functions
if  [  -f  /etc/bashrc  ];  then
                .  /etc/bashrc
fi

#  User  specific  environment  and  startup  programs

PATH=$PATH:$HOME/bin

export  PATH
unset  USERNAME

  ++++++++++++++++++++++++++++++++++++++++++++++++++++++++

-  다른  사용자의  shell  을  변경하고자  할때도  위와  같은  방법을  참고하여  변경해  준다.


**  솔라리스에서  한글  사용하기**

set  |  grep  LANG  으로  설정  확인
LANG=ko

변경은    /etc/profile  에


LANG=ko
export  LANG

  를  추가해  준다.


**  솔라리스에서  /home  사용하기**

  솔라리스에서는  /home을  automounter가  mount해서  사용하기  때문에  root라  할지라도  디렉토리나  파일을  만들  수  없다.  하지만  리눅스에  익숙한  관리자라면  /home  에서  모든  사용자  홈디렉토리를  관리하기를  원할  것이다.  /home  을  automount  하지  않으려면  /etc/auto_master파일에서  /home부분을  주석처리  하고  시스템을  재부팅하면  된다.

/etc/auto_master

......
+auto_master
/net                        -hosts                    -nosuid,nobrowse
#/home                      auto_home              -nobrowse
/xfn                        -xfn

reboot


**  시스템  시간  맞추기**

직접  맞추기
 
  rdate  명령어를  사용하여  필요할때마다  수정해도  좋지만,  이보다는  시스템  재부팅시에  자동으로  세팅되도록  부팅  스크립트에  포함시켜  준다.  time  서버로는  time.bora.net  또는  time.kriss.re.kr  를  사용한다.
  일단  현재  시간을  맞추기  위하여  프롬프트  상에서  한번  실행해  준다.  이때  리눅스에서는  -s  옵션을  주어  시스템  시간을  동기화  시키지만  솔라리스에서는  -s  옵션을  주지  않는  것을  주의한다.

rdate  time.bora.net

  다음  시스템  부팅시마다  자동으로  맞추기  위하여  부팅  스크립트에  포함시켜  준다.

  /etc/rc3
  …
rdate  time.bora.net

자동으로  맞추기

XNTP  라는  프로그램을  사용하면  시스템에  항상  XNTP  프로그램이  데몬으로  상주하며  자동으로  시스템  시간을  정확히  맞혀  준다  설정방법은

pkginfo  |  grep  ntp

NTP  패키지가  설치되어  있는지  확인하고,  설치되어  있으면

/etc/inet                          /  디렉토리로  이동하여,  ntp.client  파일을  ntp.conf라는  이름으로  복사한다.

ntp.conf  를  열어  맨  밑에

server  time.bora.net
server  time.nuri.net
server  gps.bora.net
server  ntp1.cs.pusan.ac.kr
server  ntp.ewha.net
server  ntp1.gngidc.net
server  ntp2.gngidc.net
server  time.kriss.re.kr

를  추가해  준다.

/etc/init.d/xntpd  start

다음  시스템  재부팅부터는  자동  실행된다

ntpq  -p

로  ntp  서버에  정상  접속하는지  확인한다.


**  DNS  설정  **

솔라리스에서  DNS  설정법은  리눅스와  약간의  차이가  있다.  먼저  리눅스처럼  resolv.conf  파일에  사용할  DNS  를  추가한다.  추가  방법은  동일하지만,  리눅스처럼  resolv.conf  파일이  생성되어  있는  것이  아니고,  시스템  관리자가  직접  생성해  줘야  한다.  위치는  리눅스와  같은  /etc/resolv.conf  가  된다.

resolv.conf

nameserver  211.115.194.2
nameserver  211.115.194.3
nameserver  203.255.112.34
search  localdomain

다음으로  nsswitch.conf  라는  파일을  열어서  hosts:  ….  줄의  맨  끝에  DNS를  추가해  준다.

nsswitch.conf

  …
hosts:            files  dns


**  패키지  다운로드  **

http://www.sunfreeware.com

  패키지  설치  확인은  아래의  명령어를  사용하여  확인한다.

pkginfo  |  grep  {Package  Name}

  패키지  설치법

  보통  솔라리스  패키지는  패키지명-패키지버전-OS버젼-cpu타입-local.gz  으로  제공된다.
  우선  gzip  을  사용하여  gz  압축을  해제후에  pkgadd  를  사용하여  설치한다.

ex)  gzip  -d  autoconf-2.59-sol9-intel-local.gz
    pkgadd  -d  autoconf-2.59-sol9-intel-local


**  컴파일  환경  만들기  **

wget  패키지를  미리  설치하여  다운로드에  사용한다
 
    ftp://ftp.sunfreeware.com/pub/freeware/intel/10/wget-1.10.2-sol10-x86-local.gz  
 
autoconf  패키지  설치

  wget  ftp://ftp.sunfreeware.com/pub/freeware/intel/10/autoconf-2.59-sol10-intel-local.gz

make  패키지  설치

  wget  ftp://ftp.sunfreeware.com/pub/freeware/intel/10/make-3.80-sol10-intel-local.gz


automake  패키지  설치

  wget  ftp://ftp.sunfreeware.com/pub/freeware/intel/10/automake-1.9-sol10-intel-local.gz

gcc  패키지  설치

  wget  ftp://ftp.sunfreeware.com/pub/freeware/intel/10/gcc-3.3.2-sol10-intel-local.gz

 

패키지는  일반적으로  /usr/local  ~  에  설치  되므로  /etc/profile  에  PATH와  LD_LIBRARY_PATH를  수정  또는  추가해  준다.

  /etc/profile

...

PATH=/usr/local/bin:$PATH
LD_LIBRARY_PATH=/usr/lib:/usr/local/lib:/usr/openwin/lib:/usr/openwin/bin:/usr/dt/lib:/usr/ucblib:/opt/lib:/usr/sfw/lib/:.
export  PATH  LD_LIBRARY_PATH

주의사항:
LD_LIBRARY_PATH에서  디렉토리  경로의  순서를  바꾸시면  안됩니다!  역시  PATH에서  /usr/local/bin이  앞에  나와야  합니다.


libgcc  패키지  설치

  wget  ftp://ftp.sunfreeware.com/pub/freeware/intel/10/libgcc-3.3-sol10-intel-local.gz

libiconv  패키지  설치

  wget  ftp://ftp.sunfreeware.com/pub/freeware/intel/10/libiconv-1.9.2-sol10-x86-local.gz


**  개발  환경  만들기**

  --  ls  하이라이팅  세팅

  솔라리스에  기본적으로  제공되는  ls  는  하이라이팅  기능을  지원하지  않으므로  fileutils에  포함되어  있는  ls를  사용하기  위하여  fileutils를  설치한다.
  현재  intel  기반  솔라리스용  fileutils  패키지를  제공하지  않으므로  앞서  세팅한  컴파일  환경을  사용하여  설치한다.

wget  http://ftp.gnu.org/pub/gnu/fileutils/fileutils-4.1.tar.gz
 
gzip  -d  fileutils-4.1.tar.gz
tar  xvf  fileutils-4.1.tar.gz

cd  ./fileutils-4.1

./configure

make
  make  시에  컴파일  에러가  난다면
  ........
  error:  parse  error  before  "ctid_t"  
  ........
 
  -  PATH  에  /usr/ccs/bin  가  추가되어  있는지  확인
  -  cd  /usr/local/lib/gcc-lib/sparc-sun-solaris2.10/3.3.2/install-tools
      ./mkheaders

 

make  install

 

설치가  완료되었다면,  /usr/local/bin  에  ls  가  설치되었는지  확인한다.

/usr/local/bin/ls  --color=auto

하이라이팅이  정상적으로  나타난다면,  쉘  스크립트에  alias  를  주어  사용한다.

/etc/profile
...
alias  ls  =  ‘/usr/local/bin/ls  --color=auto’


  --  vi  환경  설정

솔라리스에  기본적으로  제공되는  vi  는  하이라이팅  기능을  지원하지  않으므로  vim  을  설치하여  하이라이팅과  탐색  옵션  기능,  탭  설정  기능  등을  사용한다.

vim  패키지를  다운로드하여  설치한다.
wget  ftp://ftp.sunfreeware.com/pub/freeware/intel/10/vim-6.3-sol10-intel-local.gz

vim  패키지를  사용하기  위해  ncurses  패키지를  다운로드하여  설치한다.
wget  ftp://ftp.sunfreeware.com/pub/freeware/intel/10/ncurses-5.4-sol10-intel-local.gz
 
정상적으로  설치되었는지  확인하여  본다.
vim

이때  라이브러리  에러가  난다면  /etc/profile의  LD_LIBRARY_PATH  에  /usr/sfw/lib/  가  포함되어  있는지  확인하여  본다.

정상적으로  실행되지만  vim  역시  하이라이팅  기능이  기본  설정이  아니다.  터미널을  ansi  표준으로  세팅하고,  vi  를  vim  으로  aliasing  하고,  vim  설정  파일을  각자의  홈  디렉토리에  생성하여  하이라이팅  on  한다.

/etc/profile
...
alias  vi='vim'
TERM=ansi
export  TERM

을  포함하여  준다.

 

기타  추가  aliasing

/etc/profile

....

alias  cp='cp  -i'
alias  l.='ls  -d  .[a-zA-Z]*  --color=tty'
alias  ll='ls  -l  --color=tty'
alias  ls='ls  --color=tty'
alias  mv='mv  -i'
alias  rm='rm  -i'
alias  vi='vim'
alias  which='alias  |  /usr/bin/which  --tty-only  --read-alias  --show-dot  --show-tilde'

 

그리고  각자의  홈  디렉토리에  .

/root/.vimrc

set  incsearch
set  hlsearch
set  laststatus=2
set  ts=4
set  sw=4
syn  on

[출처]  Solaris  설치  후  기본적인  설정|작성자  바람추적
[2008년  04월  01일  22:27:00  수정되었습니다.]
[본문링크] Solaris 설치 후 기본적인 설정
Posted by 1010
60.Unix2008. 12. 17. 13:32
반응형
RAID
 (1) VERITAS(VxVM)
 (2) SUN(DiskSuite) = SVM(Solaris 불륨 레이블)
    용량과 리던딘시 문제를 해결하기 위해 , 솔라리스는 " redundant  array of
    inexpenisive disks"(RAID) 표준에 대한 지원을 지원한다.
    <-  redundant '여유도' 의미
    그리고 RAID는 중요한 데이터를 가지고 있는 서버에 주로 사용한다.
   
    RAID는 다양한 유형의 'striping'과 'mirroring'을 제공하는 여러 서로 다른
    수준(Level)을 제공한다.
   
    RAID 0 - Concatenation Strinping
            :  이 중에 Striping 은 동일한 사이즈의 두 개 이상의 디스크에
                I/O를 분산 시키는 것
                --성능 높고 가용성은 낮다.
           
               
    RAID 1 - 미러링
            : 두 개 이상의 디스크에 테이터를 미러링(복사) 한다.
            즉 디스크 한계가 장애가 생기더라도 데이터가 손실되지 않는다.
            --중요한 데이터에 치중한다면
           
    RAID 5 - parity
            : 스트라이핑이지만 패러티 정보를 분산시켜서 저장함으로써
            RAID 0 이 제공 못하는 가용성을 제공한다.
            디스크 한 개가 장애가 생기더라도 나머지 디스크를 가지고 장애난 디스크의
            정보를 계산함. 
            --성능 향상(즉, 속도에 치중한다면 )
            foar
           
--metadb 옵션들
 
  -a :
 
  Attach a new database device
  The /kernel/drv/md.conf file is automatically
  updated with th new information
  meta database 정보를 add(추가)
 
  -f :
  The -f option is used the create the initial
  static database.
  :force(강제로 추가)
 
  -c :
  number : Specifies the number of replicas to be placed on each
  device
  :meta database replica(복사본)의 개수 지정
 
  -------------------------------------------------------------------
 
  MetaDB 란
  DiskSuite의 전체의 config 정보와 metadevice의 상태 정보를 가지고 있는 DB
  slice당 20M 정도면 충분하고, 최소 2개의 DB 복사본(Replicas)이 요구된다.
 
  [권장사항]
  Disk 1 -3 Replicas
  Disk 2 -4 각 Disk 당 Replicas (총 4 -8)
  Disk 5 이상 - 각 Disk 당 Replice
  - MetaDB 생성할 공간이 없으면, swap를 조금 줄이고, 공간을 확보한다.
  -OS Mirror시에는 두 Disk에 각각 2개 이상의 MetaDB 를 생성한다.
 
 ===================================================================
 

 -- RAID 0 구성 실습
           
bash-2.05# df -h
파일시스템            크기  사용  가용  용량    설치지점
/dev/dsk/c0t0d0s0      5.8G  2.9G  2.8G    51%    /
/proc                    0K    0K    0K    0%    /proc
mnttab                  0K    0K    0K    0%    /etc/mnttab
fd                      0K    0K    0K    0%    /dev/fd
swap                  838M    40K  838M    1%    /var/run
swap                  838M  328K  838M    1%    /tmp
/dev/dsk/c0t0d0s3      94M  1.0M    84M    2%    /p3
/dev/dsk/c0t0d0s4      94M  1.0M    84M    2%    /p4
/dev/dsk/c0t0d0s5      94M  1.0M    84M    2%    /p5
/dev/dsk/c0t0d0s7      1.8G  1.9M  1.7G    1%    /export/home

--Raid 구성하기 전에 /p /p4 mount file --> umount 시킴

bash-2.05# umount /p3
bash-2.05# umount /p4

bash-2.05# df -h
파일시스템            크기  사용  가용  용량    설치지점
/dev/dsk/c0t0d0s0      5.8G  2.9G  2.8G    51%    /
/proc                    0K    0K    0K    0%    /proc
mnttab                  0K    0K    0K    0%    /etc/mnttab
fd                      0K    0K    0K    0%    /dev/fd
swap                  839M    40K  839M    1%    /var/run
swap                  839M  328K  839M    1%    /tmp
/dev/dsk/c0t0d0s5      94M  1.0M    84M    2%    /p5
/dev/dsk/c0t0d0s7      1.8G  1.9M  1.7G    1%    /export/home
bash-2.05#

bash-2.05# metadb
metadb: solaris3: 기존 데이터베이스 없음

bash-2.05# metadb -a -f  -c 1 /dev/dsk/c0t0d0ns3 /dev/dsk/c0t0d0s4
bash-2.05# metadb
        flags          first blk      블록 개수
    a        u        /dev/dsk/c0t0d0s3
    a        u        /dev/dsk/c0t0d0s4
bash-2.05#
bash-2.05# vi /etc/lvm/md.tab

# Logging with mirrored master device and striped logging device
#
#      d1              -t d14 d13
#      blue/d1        -t blue/d14 blue/d13
#
# RAID of devices
#
#      d15            -r /dev/dsk/c1t0d0s0 /dev/dsk/c1t1d0s0 \
#                          /dev/dsk/c1t2d0s0 /dev/dsk/c1t3d0s0
#      blue/d15        -r /dev/dsk/c2t0d0s0 /dev/dsk/c2t1d0s0 \
#                          /dev/dsk/c2t2d0s0 /dev/dsk/c2t3d0s0
#
# Hot Spare Pool of devices
#
#      hsp001          /dev/dsk/c1t0d0s0
#      blue/hsp001    /dev/dsk/c2t0d0s0
#
# 100MB Soft Partition
#
#      d1              -p /dev/dsk/c1t0d0s1 100M
#      blue/d1        -p /dev/dsk/c2t0d0s1 100M
d5 2 1 /dev/dsk/c0t0d0s3 1 /dev/dsk/c0t0d0s4
--마지막 라인 추가 하기
~
:wq!

bash-2.05# metainit d5
d5: Concat/스트립이 설정됨

bash-2.05# newfs /dev/md/rdsk/d5
newfs: 새 시스템 파일 /dev/md/rdsk/d5을(를) 구성하시겠습니까: (y/n)? y
/dev/md/rdsk/d5:        16 트랙, 63 섹터의 390 실린더에 있는 393120 섹터
        192.0MB (25 실린더 그룹) (16 c/g, 7.88MB/g, 3776 i/g)
수퍼 블록 백업 (fsck -F ufs -o b=#의 경우):
 32, 16224, 32416, 48608, 64800, 80992, 97184, 113376, 129568, 145760,
 242912, 258080, 274272, 290464, 306656, 322848, 339040, 355232, 371424,
 387616,
bash-2.05#

bash-2.05# tail /etc/lvm/md.tab
# Hot Spare Pool of devices
#
#      hsp001          /dev/dsk/c1t0d0s0
#      blue/hsp001    /dev/dsk/c2t0d0s0
#
# 100MB Soft Partition
#
#      d1              -p /dev/dsk/c1t0d0s1 100M
#      blue/d1        -p /dev/dsk/c2t0d0s1 100M
d5 2 1 /dev/dsk/c0t0d0s3 1 /dev/dsk/c0t0d0s4
bash-2.05

bash-2.05# cd /

bash-2.05# mkdir /stripe

bash-2.05# mount /dev/md/dsk/d5 /stripe/

bash-2.05# cd /stripe/

bash-2.05# ls
lost+found
bash-2.05# pwd
/stripe
bash-2.05# mkdir aaa
bash-2.05# touch bb.txt
bash-2.05# ls
aaa        bb.txt      lost+found

bash-2.05# metastat
d5: Concat/Stripe
    크기: 393120 블록(191 MB)
    스트립 0:
        장치      시작 블록    Dbase  Reloc
        c0t0d0s3      9072    예      예
    스트립 1:
        장치      시작 블록    Dbase  Reloc
        c0t0d0s4      9072    예      예

장치 재배치 정보:
장치    재배치 장치 ID
c0t0d0  예    id1,dad@AST39140A=AY425135
bash-2.05#

bash-2.05# df -h
파일시스템            크기  사용  가용  용량    설치지점
/dev/dsk/c0t0d0s0      5.8G  2.9G  2.8G    51%    /
/proc                    0K    0K    0K    0%    /proc
mnttab                  0K    0K    0K    0%    /etc/mnttab
fd                      0K    0K    0K    0%    /dev/fd
swap                  836M    40K  836M    1%    /var/run
swap                  836M  328K  836M    1%    /tmp
/dev/dsk/c0t0d0s5      94M  1.0M    84M    2%    /p5
/dev/dsk/c0t0d0s7      1.8G  1.9M  1.7G    1%    /export/home
/dev/md/dsk/d5        180M  1.0M  161M    1%    /stripe

--Raid 0 으로 구성됨 파일 100M 합 200M 구성됨.
bash-2.05#

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

--미러링 실습

bash-2.05# vi /etc/lvm/md.tab

d50 -m /dev/md/dsk/d52 /dev/md/dsk/d53

d52 1 1 /dev/dsk/c0t0d0s3
d53 1 1 /dev/dsk/c0t0d0s4

:wq!
--마지막 라인에 추가시킴

bash-2.05# metainit d52
d52: Concat/스트립이 설정됨

bash-2.05# metainit d53
d53: Concat/스트립이 설정됨

bash-2.05# metainit d50
metainit: d50: 경고: 이 형식의 metainit는 바람직하지 않음.
submirror가 동일한 데이터를 갖고 있지 않을 수 있음.
추가 정보는 metainit(1M)의 ERRORS를 참조하십시오.
d50: 이중화가 설정됨


bash-2.05# newfs /dev/md/rdsk/d50
newfs: 새 시스템 파일 /dev/md/rdsk/d50을(를) 구성하시겠습니까: (y/n)? y
/dev/md/rdsk/d50:      16 트랙, 63 섹터의 187 실린더에 있는 188496 섹터
        92.0MB (12 실린더 그룹) (16 c/g, 7.88MB/g, 3776 i/g)
수퍼 블록 백업 (fsck -F ufs -o b=#의 경우):
 32, 16224, 32416, 48608, 64800, 80992, 97184, 113376, 129568, 145760,
 161952, 178144,


bash-2.05# tail /etc/lvm/md.tab
#
#      d1              -p /dev/dsk/c1t0d0s1 100M
#      blue/d1        -p /dev/dsk/c2t0d0s1 100M
#d5 2 1 /dev/dsk/c0t0d0s3 1 /dev/dsk/c0t0d0s4

d50 -m /dev/md/dsk/d52 /dev/md/dsk/d53

d52 1 1 /dev/dsk/c0t0d0s3
d53 1 1 /dev/dsk/c0t0d0s4

bash-2.05# df -h
파일시스템            크기  사용  가용  용량    설치지점
/dev/dsk/c0t0d0s0      5.8G  2.9G  2.8G    51%    /
/proc                    0K    0K    0K    0%    /proc
mnttab                  0K    0K    0K    0%    /etc/mnttab
fd                      0K    0K    0K    0%    /dev/fd
swap                  864M    40K  864M    1%    /var/run
swap                  864M  312K  864M    1%    /tmp
/dev/dsk/c0t0d0s5      94M  1.0M    84M    2%    /p5
/dev/dsk/c0t0d0s7      1.8G  1.9M  1.7G    1%    /export/home
bash-2.05# pwd
/
bash-2.05# mkdir /mirror
bash-2.05#

bash-2.05# mount /dev/md/dsk/d50 /mirror
bash-2.05#
bash-2.05# cd mirror/
bash-2.05# mkdir ccc
bash-2.05# touch ddd.txt
bash-2.05#
bash-2.05# df -h
파일시스템            크기  사용  가용  용량    설치지점
/dev/dsk/c0t0d0s0      5.8G  2.9G  2.8G    51%    /
/proc                    0K    0K    0K    0%    /proc
mnttab                  0K    0K    0K    0%    /etc/mnttab
fd                      0K    0K    0K    0%    /dev/fd
swap                  863M    40K  863M    1%    /var/run
swap                  863M  312K  863M    1%    /tmp
/dev/dsk/c0t0d0s5      94M  1.0M    84M    2%    /p5
/dev/dsk/c0t0d0s7      1.8G  1.9M  1.7G    1%    /export/home
/dev/md/dsk/d50        86M  1.0M    77M    2%    /mirror

-- 마지막 라인 확인 미러로 구성시 2개의 용량을 반만 사용됨을 알수 있다.

bash-2.05# metastat
d50: 이중화
    서브미러 0: d52
      상태: 확인       
    서브미러 1: d53
      상태: 확인       
    전달: 1
    읽기 옵션: roundrobin (기본값)
    쓰기 옵션: parallel (기본값)
    크기: 188496 블록(92 MB)

d52: d50의 Submirror
    상태: 확인       
    크기: 188496 블록(92 MB)
    스트립 0:
        장치      시작 블록    Dbase        상태 Reloc 핫 스패어
        c0t0d0s3      17136    예            확인    예


d53: d50의 Submirror
    상태: 확인       
    크기: 188496 블록(92 MB)
    스트립 0:
        장치      시작 블록    Dbase        상태 Reloc 핫 스패어
        c0t0d0s4      17136    예            확인    예


장치 재배치 정보:
장치    재배치 장치 ID
c0t0d0  예    id1,dad@AST39140A=AY425135
bash-2.05#



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

 --기존  Meta 정보 삭제
 -- Raid 삭제
 
#metastat
#df -h
#umount /mirror
--unmount 하기 전에 기존 마운트 해제 시킴
bash-2.05# umount /mirror

bash-2.05# metaclear d52
d5: Concat/스트립이 지워짐
bash-2.05# metaclear d53
d5: Concat/스트립이 지워짐
bash-2.05# metaclear d50
d5: Concat/스트립이 지워짐
bash-2.05#

  --강제 삭제시  metaclear -f 옵션을 주고 강제 삭제 시킴

bash-2.05# metadb -d /dev/dsk/c0t0d0s3
bash-2.05# metadb -d /dev/dsk/c0t0d0s4
metadb: solaris3: 최소 1개의 데이터베이스를 갖고 있어야 함(-f 무시)

bash-2.05# metadb -df /dev/dsk/c0t0d0s4
bash-2.05# metadb
bash-2.05# metastat

d50: 이중화
    서브미러 0: d52
      상태: 확인       
    서브미러 1: d53
      상태: 확인       
    전달: 1
    읽기 옵션: roundrobin (기본값)
    쓰기 옵션: parallel (기본값)
    크기: 196560 블록(95 MB)

d52: d50의 Submirror
    상태: 확인       
    크기: 196560 블록(95 MB)
    스트립 0:
        장치      시작 블록    Dbase        상태 Reloc 핫 스패어
        c0t0d0s3      9072    아니          확인    예


d53: d50의 Submirror
    상태: 확인       
    크기: 196560 블록(95 MB)
    스트립 0:
        장치      시작 블록    Dbase        상태 Reloc 핫 스패어
        c0t0d0s4      9072    아니          확인    예


장치 재배치 정보:
장치    재배치 장치 ID
c0t0d0  예    id1,dad@AST39140A=AY425135
bash-2.05#
Posted by 1010
60.Unix2008. 12. 17. 13:27
반응형
----------------------------------------------------------------------------
                        시스템 디스크 교체 후 E3500 부팅 절차
----------------------------------------------------------------------------
시스템 디스크 교체 후 E3500 부팅

개요: 시스템 디스크 교체 후 E3500 부팅
상세 설명:

E3500의 내부 부트 디스크 교체 지침(광채널 디스크)
이 지침은 A5000으로도 알려진 SENA(Solstice Enterprise Network Array)의 부트 디스크에도 적용됩니다.
그러나 SEVM 또는 SDS에 의해 미러링된 부트 디스크에는 적용되지 않습니다
(Solstice Enterprise Volume Manager 또는 Solstice Disk Suite).
Ultra Enterprise 3500의 내부 부트 디스크에 문제가 발생하여 다른 드라이브로 교체했습니다.
새 드라이브는 newfs가 수행되었으며 원본 디스크의 덤프 테이프로부터 복원되었습니다.
새 디스크의 월드 와이드 번호(WWN)를 반영하기 위해 Open Boot Prom의 부트 디바이스 변수를 변경했습니다.

STOP + A

boot cdrom -sw

일반적인 절차에 따라 새 디스크에 적합한 디스크 파티션과 파일 시스템을 생성하고 백업 덤프를 복원합니다.
그런 다음, 아래와 같은 명령을 수행합니다.
이제, 새 디스크로 시스템을 부팅할 수 있도록 교체 디스크의 WWN이 적절한 경로에 생성됩니다.


기존 생성된 디바이스 정보를 삭제한다.

/a/devices/.... <-- 파일 삭제
/a/dev/....  <-- 파일 삭제

drvconfig -r /a/devices -p /a/etc/path_to_inst
disks -r /a
devlinks -r /a

버그 ID 4161768로 인해 다음과 같은 두 명령이 필요합니다.
cd /devices
find . -print | cpio -pduvm /a/devices

(cdrom의 /device 트리를 마운트된 파일시스템으로 복사)
마지막으로, 부트 디스크를 설치합니다.

installboot /usr/platform/`uname -i`/lib/fs/ufs/bootblk /dev/rdsk/cXtXdXsX

#installboot /usr/platform/sun4u/lib/fs/ufs/bootblk /dev/rdsk/cXtXdXs0
# ls -l /dev/rdsk/cXtXdXsX

lrwxrwxrwx 1 root root 50 Aug 1 10:48 /dev/rdsk/cXtXdXsX -> ../../devices/pci@1f,0/pci@1,1/ide@3/dad@1,0:a,raw

여기서 주의 : 윗라인의 pci@1f,0/pci@1,1/ide@3/dad@1,0:a,raw 부분을 꼭 기억 하세요.

--부팅 디스크 앨리어스 지정하기
STOP + A (prom mode)

OK prompt

ok nvalias mirror /pci@1f,0/pci@1,1/ide@3/dad@1,0:a,raw ; --앨리어스 지정함.

ok boot mirror --새로구성된 디스크로 부팅함.


--A5000으로 구성된 경우
마운트된 파일시스템을 해제합니다.모든 파일시스템에 최종 fsck 검사를 수행합니다.
luxadm 명령을 사용하여 부트 디바이스를 생성합니다.
luxadm -v set_boot_dev -y /dev/dsk/cXtXdXs0
시스템이 정지되고 부팅이 제대로 수행되어야 합니다.


----------------------------------------------------------------------------
              기존 디스크 / 에서 새 디스크 / dd copy
----------------------------------------------------------------------------
boot_disk 만들기

1)root 장치 확인
#df -k /

2)디스크 정보 확인
#format  --파일 크기가 동일해야 한다.
0.c1t0d0  <-- 원본
1.c1t1d0  <-- 백업
--원본디스크 와 백업디스크 확인하기

3)백업 디스크 확인
#fdisk /dev/rdsk/c1t1d0p0

y <-- 선택

#dd if=/dev/rdsk/c1t0d0p0 of=/dev/rdsk/c1t1d0p0 bs=8192k


4)백업 디스크에 boot 환경 설정

어떤 디스크로 booting 하는지 부팅패스 확인
#eeprom | grep bootpath
bootpath=/pci@1,0/pci1014,8f@3/sd@0,0:a

두번째 디스크 물리 장치명 확인
#ls -l /dev/rdsk/c1t1d0s0
--경로명확인


5)모든 파일 시스템 체크함

#fsck -y /dev/rdsk/c1t1d0s0
#fsck -y /dev/rdsk/c1t1d0sX --기존 파일시스템 모두 체크함



6)두번째 디스크를 root를 마운트 한다.

#mount /dev/dsk/c1t1d0s0 /mnt

7)boot path 설정

#vi /mnt/boot/solaris/bootenv.rc
--기존 셋팅
setprop bootpath=/pci@1,0/pci1014,8f@3/sd@0,0:a
--변경 셋팅
setprop bootpath=/pci@1,0/pci1014,8f@3/sd@1,0:a

8)자동 마운트 포이트 수정
#vi /mnt/etc/vfstab
--기존 마운트 포인터 수정함

--------------------------------------------------------------------------
                      슬라이스  dd로 copy test
--------------------------------------------------------------------------
# format
Searching for disks...done


AVAILABLE DISK SELECTIONS:
      0. c1t0d0 <DEFAULT cyl 1302 alt 2 hd 255 sec 63>
          /pci@0,0/pci1000,30@10/sd@0,0
      1. c1t1d0 <DEFAULT cyl 1788 alt 2 hd 128 sec 32>
          /pci@0,0/pci1000,30@10/sd@1,0
      2. c1t2d0 <DEFAULT cyl 1020 alt 2 hd 64 sec 32>
          /pci@0,0/pci1000,30@10/sd@2,0
      3. c1t3d0 <DEFAULT cyl 1020 alt 2 hd 64 sec 32>
          /pci@0,0/pci1000,30@10/sd@3,0
      4. c1t4d0 <DEFAULT cyl 1020 alt 2 hd 64 sec 32>
          /pci@0,0/pci1000,30@10/sd@4,0
      5. c1t5d0 <DEFAULT cyl 1020 alt 2 hd 64 sec 32>
          /pci@0,0/pci1000,30@10/sd@5,0
      6. c2t0d0 <DEFAULT cyl 1020 alt 2 hd 64 sec 32>
          /pci@0,0/pci1000,30@11/sd@0,0
      7. c2t1d0 <DEFAULT cyl 1020 alt 2 hd 64 sec 32>
          /pci@0,0/pci1000,30@11/sd@1,0
Specify disk (enter its number): 2
selecting c1t2d0
[disk formatted]


FORMAT MENU:
        disk      - select a disk
        type      - select (define) a disk type
        partition  - select (define) a partition table
        current    - describe the current disk
        format    - format and analyze the disk
        fdisk      - run the fdisk program
        repair    - repair a defective sector
        label      - write label to the disk
        analyze    - surface analysis
        defect    - defect list management
        backup    - search for backup labels
        verify    - read and display labels
        save      - save new disk/partition definitions
        inquiry    - show vendor, product and revision
        volname    - set 8-character volume name
        !<cmd>    - execute <cmd>, then return
        quit
format> p


PARTITION MENU:
        0      - change `0' partition
        1      - change `1' partition
        2      - change `2' partition
        3      - change `3' partition
        4      - change `4' partition
        5      - change `5' partition
        6      - change `6' partition
        7      - change `7' partition
        select - select a predefined table
        modify - modify a predefined partition table
        name  - name the current table
        print  - display the current table
        label  - write partition map and label to the disk
        !<cmd> - execute <cmd>, then return
        quit
partition> p
Current partition table (original):
Total disk cylinders available: 1020 + 2 (reserved cylinders)

Part      Tag    Flag    Cylinders        Size            Blocks
  0 unassigned    wm      0              0        (0/0/0)          0
  1 unassigned    wm      0              0        (0/0/0)          0
  2    backup    wu      0 - 1019    1020.00MB    (1020/0/0) 2088960
  3 unassigned    wm      0              0        (0/0/0)          0
  4 unassigned    wm      0              0        (0/0/0)          0
  5 unassigned    wm      0              0        (0/0/0)          0
  6 unassigned    wm      0              0        (0/0/0)          0
  7 unassigned    wm      0              0        (0/0/0)          0
  8      boot    wu      0 -    0        1.00MB    (1/0/0)      2048
  9 unassigned    wm      0              0        (0/0/0)          0

partition> 0
Part      Tag    Flag    Cylinders        Size            Blocks
  0 unassigned    wm      0              0        (0/0/0)          0

Enter partition id tag[unassigned]:
Enter partition permission flags[wm]:
Enter new starting cyl[0]:
Enter partition size[0b, 0c, 0e, 0.00mb, 0.00gb]: $
partition>
partition>
partition> p
Current partition table (unnamed):
Total disk cylinders available: 1020 + 2 (reserved cylinders)

Part      Tag    Flag    Cylinders        Size            Blocks
  0 unassigned    wm      0 - 1019    1020.00MB    (1020/0/0) 2088960
  1 unassigned    wm      0              0        (0/0/0)          0
  2    backup    wu      0 - 1019    1020.00MB    (1020/0/0) 2088960
  3 unassigned    wm      0              0        (0/0/0)          0
  4 unassigned    wm      0              0        (0/0/0)          0
  5 unassigned    wm      0              0        (0/0/0)          0
  6 unassigned    wm      0              0        (0/0/0)          0
  7 unassigned    wm      0              0        (0/0/0)          0
  8      boot    wu      0 -    0        1.00MB    (1/0/0)      2048
  9 unassigned    wm      0              0        (0/0/0)          0

partition> q

# prtvtoc /dev/rdsk/c1t2d0s2 | fmthard -s - /dev/rdsk/c1t3d0s2
fmthard:  New volume table of contents now in place.
#
#
#
# newfs /dev/rdsk/c1t2d0s0
newfs: construct a new file system /dev/rdsk/c1t2d0s0: (y/n)? y
/dev/rdsk/c1t2d0s0:    2088960 sectors in 1020 cylinders of 64 tracks, 32 sectors
        1020.0MB in 64 cyl groups (16 c/g, 16.00MB/g, 7680 i/g)
super-block backups (for fsck -F ufs -o b=#) at:
 32, 32832, 65632, 98432, 131232, 164032, 196832, 229632, 262432, 295232,
 1771232, 1804032, 1836832, 1869632, 1902432, 1935232, 1968032, 2000832,
 2033632, 2066432,
#
#
# newfs /dev/rdsk/c1t3d0s0
newfs: construct a new file system /dev/rdsk/c1t3d0s0: (y/n)? y
/dev/rdsk/c1t3d0s0:    2088960 sectors in 1020 cylinders of 64 tracks, 32 sectors
        1020.0MB in 64 cyl groups (16 c/g, 16.00MB/g, 7680 i/g)
super-block backups (for fsck -F ufs -o b=#) at:
 32, 32832, 65632, 98432, 131232, 164032, 196832, 229632, 262432, 295232,
 1771232, 1804032, 1836832, 1869632, 1902432, 1935232, 1968032, 2000832,
 2033632, 2066432,
#
#
#

#
# mkdir backup1
# mkdir backup2
#
#
# mount /dev/dsk/c1t2d0s0 /backup1
# mount /dev/dsk/c1t3d0s0 /backup2
#
#
# df -k 
Filesystem            kbytes    used  avail capacity  Mounted on
/dev/dsk/c1t0d0s0    9524711 1348982 8080482    15%    /
/proc                      0      0      0    0%    /proc
mnttab                    0      0      0    0%    /etc/mnttab
fd                        0      0      0    0%    /dev/fd
swap                  316836      20  316816    1%    /var/run
swap                  317116    300  316816    1%    /tmp
/dev/dsk/c1t0d0s7    483151    1048  433788    1%    /export/home
/dev/dsk/c1t2d0s0    981999    1041  922039    1%    /backup1
/dev/dsk/c1t3d0s0    981999    1041  922039    1%    /backup2
# cd /backup1
# pwd   
/backup1
# mkdir folder
#
# mkfile 100m ddfiletest
#
# dd if=/dev/rdsk/c1t2d0s0 of=/dev/rdsk/c1t3d0s0 bs=8192k
127+1 records in
127+1 records out
#
# fsck -y /dev/rdsk/c1t3d0s0

FILE SYSTEM IS CURRENTLY MOUNTED.  CONTINUE?  yes

** /dev/rdsk/c1t3d0s0
** Currently Mounted on /backup2
** Phase 1 - Check Blocks and Sizes
** Phase 2 - Check Pathnames
** Phase 3 - Check Connectivity
** Phase 4 - Check Reference Counts
** Phase 5 - Check Cyl groups
FREE BLK COUNT(S) WRONG IN SUPERBLK
SALVAGE?  yes

4 files, 102474 used, 980957 free (13 frags, 122618 blocks, 0.0% fragmentation)

***** FILE SYSTEM WAS MODIFIED *****

# cd /backup2
# ls -l
total 204946
-rw------T  1 root    other    104857600 Mar  3 17:32 ddfiletest
drwxr-xr-x  2 root    other        512 Mar  3 17:28 folder
drwx------  2 root    root        8192 Mar  3 16:44 lost+found
# pwd
/backup2
#

--dd copy 됨


----------------------------------------------------------------------------
                        테이프 명령어
----------------------------------------------------------------------------

테이프 명령어
명령:mt - 자기 테이프 용도:테이프 상태 확인, 되감기, 지우기 등 경로:/usr/bin/mt

구문:mt [ -f 테이프 장치 이름 ] 명령 [ 반복 횟수] 여기서 테이프 장치 이름은 보통
   /dev/rmt/0입니다.

   명령은 다음과 같습니다.

   status  -테이프 드라이브의 상태 정보를 표시합니다
   rewind  -테이프를 되감습니다.
   retension  -테이프를 팽팽한 상태로 만듭니다.
   erase  -테이프 전체를 지웁니다.
   fsf   -지정된 반복 횟수만큼 파일을 앞으로 건너뜁니다.
   bsf   -지정된 반복 횟수 만큼 파일을 뒤로 건너뜁니다.
   eom   -기록된 미디어의 끝부분으로 건너 뜁니다.

   반복 횟수는 요청된 작업을 수행하는 횟수를 말합니다.
   기본적으로 mt는 명령을 한 번 수행합니다.
   하나의 명령을 두 번 이상 반복하려면 반복 횟수를 지정하면 됩니다.

   예:mt -f /dev/rmt/0 status ---> 테이프의 상태를 표시합니다.
   mt -f /dev/rmt/0 rewind ---> 테이프를 되감습니다.
   mt -f /dev/rmt/0n fsf 2 ---> 첫 번째 두 개의 파일을 건너뜁니다.
   mt -f /dev/rmt/0n bsf 2 ---> 두 개의 파일만큼 뒤로 건너뜁니다.

명령: tar - 테이프 아카이브
용도: 테이프 아카이브를 만들거나 복원합니다.
    디렉토리 구조를 유지하면서 하나 또는 여러 개의 파일을 백업하는데 사용합니다.
경로: /usr/bin/tar
구문: tar [옵션] [장치 이름] [파일 이름]

   옵션은 다음과 같습니다.
   c    tar 파일을 새로 만듭니다.
   r    기존 tar 파일을 대체합니다.
   t    테이프 아카이브의 목차를 표시합니다.
   u    업데이트합니다.
       업데이트할 파일이 tar 파일에 없거나 마지막으로 tar 파일을 쓴 후
       수정된 경우에는 tar 파일의 끝에 씁니다. 업데이트 수행은 다소
       느릴 수 있습니다. 5.x 시스템에서 만든 tar 파일은 4.x 시스템에서
       업데이트할 수 없습니다.
   x    추출하거나 복원합니다.
      추출하거나 복원할 파일은 tar 파일에서 추출하고 현재 디렉토리에서
      tar 파일에 지정된 디렉토리에 씁니다. 추출할 파일 및 디렉토리에
      대해 상대 경로 이름을 사용하십시오.
   v    자세한 정보를 표시합니다.
      기능 문자 다음에 각 파일의 이름을 출력합니다.

여기서 장치 이름은 대개 /dev/rmt/0입니다. 또는 파일 이름일 수도 있습니다. 파일
이름은 아카이브로 만들 파일 이름입니다.

예:
tar cvf /dev/rmt/0 /export/home/user1 --> /dev/rmt/0 테이프에 /export/home/user1의
테이프 아카이브를 만듭니다.
tar tvf /dev/rmt/0 ---> /dev/rmt/0의 목차를 표시합니다.
tar xvf /dev/rmt/0 ---> /dev/rmt/0에서 데이터를 복원합니다.

참고: 위의 명령에서 /dev/rmt/0 대신 /dev/rmt/0n을 사용할 수 있습니다.
/dev/rmt/0n을 사용하면 백업 수행 후 테이프를 되감지 않습니다.
명령: ufsdump
용도: 파일 시스템, 파일 또는 디렉토리를 백업하는데 사용합니다.
   전체 백업이나 증분 백업을 수행할 수 있습니다.
경로: /usr/sbin/ufsdump
구문: ufsdump [옵션] [장치 이름] [덤프할 파일]

옵션은 다음과 같습니다.

0 ~ 9 덤프 레벨 옵션을 지정합니다.
    레벨 0은 가장 낮은 수준으로 전체 백업을 수행합니다. 레벨 1 ~ 9는 증분
    백업을 수행합니다.
u   현재 백업의 날짜와 덤프 레벨을 /etc/dumpdates 덤프 기록에 업데이트합니다.
f   파일이 쓰여질 장치를 지정합니다.이 옵션은 장치 이름이 필요합니다.
v   테이프에 있는 데이터를 파일 시스템에 있는 데이터와 비교하고 검사합니다.

여기서 장치 이름은 /dev/rmt/0입니다.
덤프할 파일은 초기 파일 시스템 /dev/rdsk/c0t2d0s0이나 블록 파일 시스템
/dev/dsk/c0t2d0s0입니다. 또한 /export/home과 같이 파일 시스템 이름이나
/export/home/user1과 같이 파일 이름 또는 디렉토리 이름을 사용할 수도 있습니다.

예:
ufsdump 0uf /dev/rmt/0 /export/home ---> /export/home 파일 시스템을 /dev/rmt/0
으로 덤프하고 전체 백업을 수행합니다.

ufsdump 1uf /dev/rmt/0 /dev/dsk/c0t2d0s4 --> /dev/dsk/c0t2d0s4 파일 시스템을
/dev/rmt/0로 덤프합니다. 이 명령은 레벨 1의 증분 백업을 수행합니다.

ufsdump 4uf dbserver:/dev/rmt/0 /export/home/user1 --> /export/home/user1에 대한
레벨 4의 증분 백업을 Remote Box dbserver에 마운트된 dev/rmt/0 테이프 장치에 덤프
합니다.   여기서 테이프 장치는 로컬 시스템이 아니라원격 시스템인 dbserver에 있는
장치입니다.

명령: ufsrestore
용도: ufsdump 명령으로 만들어진 백업본에서 파일을 복구하거나 추출하는데 사용합니다.
경로: /usr/sbin/ufsrestore
구문: ufsrestore [옵션] [장치 이름] [복원할 파일]

옵션은 다음과 같습니다.
i    대화형 모드로 파일을 복원합니다.
r    백업 전체를 복원합니다.
t    백업의 목차를 표시합니다.
x    명령행에서 지정한 파일을 복원합니다.
f    /dev/rmt/0과 같이 장치 이름을 지정합니다.
v    파일을 복원하고 있는 경로 이름을 표시합니다(세부 정보 표시 모드).

참고: 이 옵션은 ufsdump 명령에서 사용하는 v(verify) 옵션과 다릅니다.

예:
ufsrestore xvf /dev/rmt/0 ./etc/hosts ---> /etc/hosts 파일을 현재 디렉토리로
                   복원합니다.   
ufsrestore ivf /dev/rmt/0 ---> 복원될 파일을 선택합니다.
ufsrestore rvf /dev/rmt/0 ./opt ---> /opt 파일 시스템을 현재 디렉토리로 복원합니다.
ufsrestore tvf /dev/rmt/0 ---> /dev/rmt/0의 목차를 표시합니다.


----------------------------------------------------------------------------
                        ufsdump & ufsrestore & tape 응용편
----------------------------------------------------------------------------
#sync;sync;sync;
#shutdown -i0 -y -g0

stop + A
ok setenv auto-boot? false

ok boot cdrom -sw

#ufsdump 0uf /dev/rmt/0 /dev//rdsk/c0t0d0s0
--백업 완료후..
#poweroff (파워를 내리고 디스크 교체)

또는 새 디스크 교체후

ok boot probe-scsi  -scsi disk 정보 인식시킴 (prom mode)
ok boot probe-ide  -ide disk 정보인식시킴
format  --디스크 인식여부 확인후 작업
ok reset  (or)
ok reset-all


운영중에 인식시키기
#drvconfig;disks;devlinks;
#devfsadm;


#shutdown -i5 -y -g0
ok setenv auto-boot? true

ok boot cdrom -sw

#format

#newfs /dev/rdsk/c0t0d0s0

--(y/n)?  y

#fsck -y /dev/rdsk/c0t0d0s0
--파일 시스템 이상여부 체크함


#mount /dev/dsk/c0t0d0s0 /a

#cd /a

#ufsrestore rvf /dev/rmt/0

--복원시킴


#rm restoresymtable

#installboot /usr/platform/'uname -m'/lib/fs/ufs/bootblk /dev/rdsk/c0t0d0s0

#cd /

#umount /a

#shutdown -g0 -y -i6

--shutdown command
종료 shutdown -y -i0 -g0
-y (yes or no)
-i (default run level S를 다른 레벨로 지정가능함)
-g (default 60초 -g0 바로 셧다운)
리붓 shutdown -y -i6 -g0


----------------------------------------------------------------------------
                백업 4가지 방법 간단히 마무리 정리
----------------------------------------------------------------------------

1. tar
2. cpio
3. dd
4. ufsdump/ufsrestore

1. tar

tar를 화일 또는 디렉토리 전체를 백업 받는데 사용된다.

1.1 화일 시스템에서 테이프로 백업 받기

# tar cvf /dev/rmt/0 .

1.2 테이프에서 화일 시스템로 백업 받기

# tar xvf /dev/rmt/0

1.3 테이프 내용 보기

# tar tvf /dev/rmt/0


2. cpio

2.1 화일 시스템에서 테이프로 백업 받기

# find . -print | cpio -ocvB -O /dev/rmt/0

2.2 테이프에서 화일 시스템로 백업 받기

# cpio -icvBmd -I /dev/rmt/0

2.3 테이프 내용 보기

# cpio -ict -I /dev/rmt/0


3. dd

3.1 화일을 테이프로 백업 받기

# dd if=file1 of=/dev/rmt/0 bs=4096k

3.2 테이프에서 화일로 백업 받기

# dd if=/dev/rmt/0 of=file1 bs=4096k


4. ufsdump/ufsrestore

4.1 화일시스템에서 테이프로 백업 받기

# ufsdump 0cuf /dev/rmt/0 /

4.2 테이프에서 화일 시스템으로 백업 받기

# ufsrestore rvf /dev/rmt/0

4.3 테이프 내용 보기

# ufsrestore tvf /dev/rmt/0

4.4 Interactive restore

# ufsrestore ivf /dev/rmt/0
[이 게시물은 아쿠아님에 의해 2007-05-05 21:24:07 시스템자료실에서 이동 됨]
Posted by 1010
60.Unix2008. 12. 17. 12:50
반응형

#3 잘못 종료 되었을 때

가끔 하다보면 리부팅 시켰을 때
Type control-d to proceed with normal startup,
(or give root password for system maintenance):
이런 메세지가 뜰 때가 있다
이럴 때 당황하게 되는데 처음 화면 떳을때 처럼 복구 시키자

우선 리눅스와 솔라리스의 차이점
linux                                                        solaris

/bin             기본 관리 네트웍 배제               /bin  /usr/bin의심볼릭링크원시
/sbin                                                        /sbin 복구모드에 필요한 명령어들

/usr/bin/    (네트웍 포함한 클라이언트 서버     /usr/bin 일반적인명령어들..
/usr/sbin/ rpm     소스 형식의 컴파일)           /usr/sbin /bin의 파일들의 바로가기(?)

/usr/local/bin       일반적인 명령어                 x
/usr/local/sbin     일반적인 명령어                 x


Type control-d to proceed with normal startup,
(or give root password for system maintenance):

저 메세지가 떳을 때 패스워드를 치면 #프롬프트 상태에 있게 되는데
그곳에서 cd /sbin을 친다 들어가는 이유는 그곳에 있는 명령어를 쓰기 위해..
그리고 fsck란 명령어를 친다( 그리고 계속 물어보는 게 나오는데 그건 고치겠느냐를
물어보는것으로써 전부 y를 치자(안치면 ㅡ.ㅡ안고처줌,,)
그럼 다시 #가 뜨게 되는데 exit를 누르면 화면으로 복구.

다음은 복구 모드에서 파일을 고치거나 하는 방법을 설명..

우선 솔라리스 부팅하다보면 회색바탕화면에
type  b[fine-name][boot-flags] <enter>
or  i<enter>
or <enter>
화면이 나오는데 거기서 b라고 치면 복구모드로 들어가게 된다
b -b라고 치면 완전 복구 모드라고 해서 read-only상태로 들어가게 되고
b -s라고 치면 write-read상태로 들어가게 된다

우선 b -b상태로 들어가게 되면 아까처럼 패스워드 치는 화면이 나오는데 치고나면
프롬프트가 나오는데 거기서
#cd /sbin을친다  <여기에 마운트 명령과 복구 명령들이 있는데 이걸 가능하게 쓰게
하기 위해서..쿨럭..;
#./mount -o remount / 를 치는데 이게 안될수도 있다..
그럼 ./mount -o remount /dev/dsk/c0d0s0를 처주자 위에 것이 안되는 이유는
확실한 경로를 안집어줬기 때문이 아닐까 싶다 ㅡ,.ㅡ(이것때문에 하루를 날려따 ㅠㅠ)
이말뜻은 sbin을 옵션을 변경시켜read-only 상태에서
write-read 상태로 변화시켜 sbin의 명령어를 쓸수 있게 만드는 그런 장치인거 같다
#./mount /usr<--이건 ls을 사용시키기 위한 마운트
fsck <--파일시스템 체크
이상태에서 내가 vi 파일을 잘못 건들였거나 아니면 환경파일등을 잘못 건들여서
부팅이 정상적으로 안될때 하는 방법이다
지금 처음부터 시도 했다면 전부 이제 마운트가 걸렸기 때문에 이제 이상태에서
vi 처주고 고칠 파일 치면 가능하다 만약에 안된다면
앞의 과정에서 fsck대신 vi 고칠파일명으로 써주면 된다

----------------------------------------------------------------------------------------------

이부분은 대충 이런 식으로 이해했는데 맞는건지좀 알려주세요..;;

제가 이해하는데 왠지 핀치가 어긋난다는 느낌을 지울수가 없네요..

뭐 추가 되거나 아니면 수정될 부분있으면 알려주세요 부탁드립니다~~

Posted by 1010
60.Unix2008. 12. 17. 12:32
반응형

윈디하나의 솔라나라: ProFTPD

최종 갱신일: 2008-04-07, 이 문서는 윈디하나의 솔라나라, http://www.solanara.net/에서 최근에 갱신된 문서를 찾을 수 있다.

들어가기 전에

  • ProFTPD는 보안에 중심을 둔 FTP서버이다. 패치도 자주 되는데, http://www.proftpd.org를 모니터링 해 최신 버전이 나오면 패치해 준다. rc버전이라도 서비스에 문제 없다면 업데이트 해 주는 것이 좋다.
  • ProFTPD Korean User Group에서 한글 자료를 구할 수 있다.

1. 설치 전에

ftpwho, ftptop, ftpshut를 쉽게 사용하기 위해 PATH를 걸어준다.
root@wl # vi /etc/profile
# for ProFTPD located at /usr/local/proftpd
if [ -x /usr/local/proftpd/bin/ftpwho ]
then
  PATH=/usr/local/proftpd/bin:$PATH; export PATH;
fi
root@wl #

2. ProFTPD 설치

  1. TCPWrappers
    ProFTPD 1.2.9버전까지만 해도 솔라리스 9에 기본 설치되어있는 TCPWrappers를 이용해 설치할 수 있었지만, 1.2.10에 와서는 설치가 되지 않는다. 최신 버전의 TCPWrappers를 설치한다. sunfreeware.com의 tcp_wrappers-7.6-sol9-intel-local.gz 를 받아 설치한다.
    root@wl ~ # wget ftp://ftp.sunfreeware.com/pub/freeware/intel/9/tcp_wrappers-7.6-sol9-intel-local.gz
    root@wl ~ # gunzip tcp_wrappers-7.6-sol9-intel-local.gz
    root@wl ~ # pkgadd -d tcp_wrappers-7.6-sol9-intel-local
    
  2. OpenSSL의 설치는 openssl.html을 참고한다.
  3. ProFTPD
    root@wl ~ # gtar xvfz cd proftpd-1.3.1.tar.gz
    root@wl ~ # cd proftpd-1.3.1
    root@wl ~/proftpd-1.3.1 # ./configure \
    --with-includes=/usr/sfw/include:/usr/include:/usr/local/include:/usr/local/ssl/include:/usr/local/mysql/include/mysql:/usr/local/mysql/include/mysql \
    --prefix=/usr/local/proftpd \
    --enable-sendfile \
    --enable-shadow \
    --with-modules=mod_wrap:mod_tls:mod_sql:mod_sql_mysql 1)
    root@wl ~/proftpd-1.3.1 # make
    root@wl ~/proftpd-1.3.1 # make install
    
    1) 모듈설명
    mod_wrap: IP주소를 기준으로 사용자들의 접근 제어가 가능하도록 해주는 모듈. 필요없으면 이 부분을 삭제한다.
    mod_tls: ftps를 사용할 수 있도록 하는 모듈. 필요없으면 이 부분을 삭제한다.
    mod_sql: 데이터베이스를 이용해 인증해주는 모듈. 필요없으면 이 부분을 삭제한다.
    mod_sql_mysql: mod_sql의 데이터베이스로 MySQL을 사용할 수 있도록 하는 모듈. 필요없으면 이 부분을 삭제한다.
    ':'은 각각의 명령을 구분하는 구분자이다.
    오류가 나면 --with-include 라인과, --with-modules 라인을 삭제한다.

3. 설치후 기본 설정

ProFTPD는 inetd를 이용해 띄울수 있지만 여기서는 StandAlone으로 띄우는 방법에 대해 설명한다.
root@wl ~ # vi /etc/inetd.conf
#ftp ~~~
root@wl ~ # ps -ef | grep inetd
  root   150     1  0  10월 22 ?        0:00 /usr/sbin/inetd -s
root@wl ~ # kill -HUP 150
root@wl ~ # vi /usr/local/proftpd/etc/proftpd.conf
DefaultRoot ~ # 언 코멘트
root@wl ~ # /usr/local/proftpd/sbin/proftpd # 실행
root@wl ~ # pkill proftpd # 종료

4. 설정하기

root@wl ~ # vi /usr/local/proftpd/etc/proftpd.conf
# 이 내용을 복사해서 사용할 때 # 뒷 부분은 삭제해야 한다.
AllowstoreRestart on      # Upload Resume 허용. 대부분의 서버는 off로 되어있다. 익숙한 ftp사용자가 아니면 off로 해 놓는것이 좋다.
RequireValidShell off     # 익명연결 허용
ShowSymlinks      on      # 심볼릭 링크 보임
DefaultRoot       ~       # 기본 루트 설정
ServerIdent       on      "FTP server" # 서버 정보 보임
DisplayConnect    /etc/proftp.connect.msg # 로그인 이전 메시지
DisplayLogin      /etc/proftp.login.msg   # 로그인 이후 메시지
MaxClients        100	"Sorry, the maximum number(%m) of allowed users are already connected" # 최대 클라이언트 수
MaxClientsPerHost 5	"Sorry, the maximum number clients (%m) from your host are already connected" # 호스트당 최대 클라이언트 수
HideUser          root    # 사용자 숨김
HideGroup         root    # 그룹 숨김
AuthPAM           On      # PAM 인증
AuthPAMConfig     ftp     # PAM 설정
TCPAccessFiles /etc/hosts.allow /etc/hosts.deny # TCPWrapper
<Directory /export/home/*>
  AllowstoreRestart on # Upload Resume을 가능하게 한다.
</Directory>

<IfModule mod_tls.c>
  TLSEngine on
  TLSLog TLSLog  /var/log/ftps.log
  TLSProtocol TLSv1

  # Are clients required to use FTP over TLS when talking to this server?
  TLSRequired off

  # Server's certificate
  TLSRSACertificateFile /usr/local/ssl/certs/signed-req.pem
  TLSRSACertificateKeyFile /usr/local/ssl/certs/req.key

  # CA the server trusts
  TLSCACertificateFile /usr/local/ssl/certs/ca.crt

  # Authenticate clients that want to use FTP over TLS?
  TLSVerifyClient off
</IfModule>
root@wl ~ # vi /etc/pam.conf
ftp auth required /usr/lib/security/pam_unix.so
ftp account required /usr/lib/security/pam_unix.so
※ 파일 전송을 위한 암호화된 프로토콜에는 FTPS, SFTP가 있다. 이중 쉽게 사용할 수 있는 것은 SFTP로 SSH를 설치하면 자동 설치되며, Solaris 9 x86 9/04에 전체 설치를 선택했다면 이미 설치되어있다. 그러나 이는 FTP의 기능중 몇가지, 예를 들면 이어받기나 이어 보내기를 지원하지 않아 불편하다. 그래서 ProFTPD에 SSL을 이용해 FTPS를 사용하는것이며 proftpd는 mod_tls.c를 통해 구현된다.
※ CuteFTP Pro로 FTP with TLS/SSL (AUTH TLS - Explicit)과 FTP with SSL (AUTH SSL - Explicit) 프로토콜을 테스트했으며 모두 정상적으로 되었다.

5. Anonymous FTP 설정

익명 FTP는 사용자인증 과정 없이 사용할 수 있는 FTP서비스를 말한다. 서비스를 비 정상적으로 사용하는 사용자가 많기 때문에 주기적인 트래픽 모니터링은 필수다.
# 익명 FTP에 사용할 계정을 만든다. Anonymous FTP를 이 사용자의 권한으로 실행될 것이다.
root@wl ~ # /usr/sbin/groupadd -g 103 ftp
root@wl ~ # useradd -d /export/home/ftp -g ftp -u 104 -s /bin/false ftp
root@wl ~ # mkdir /export/home/ftp # Anonymous FTP의 홈 디렉토리. 소유자와 그룹 모두 root, staff로 놔둔다.
root@wl ~ # vi /usr/local/proftpd/etc/proftpd.conf # 설정은 모두 되어있다. 한번 보자.
root@wl ~ # pkill proftpd
root@wl ~ # /usr/local/proftpd/sbin/proftpd # ProFTPD는 재시작하는 것이 없다.
익명 사용자도 업로드 할 수 있도록 incomming 디렉토리 만들어 보자. 장담하지만, 특별한 접근 제한이 없다면 일주일 이내에 WAREZ에 의해 장악된다. TCPWrapper등을 이용해 접근제한을 하지 않는다면, 실제 서비스에서는 하지 않는 것이 좋다.
root@wl ~ # mkdir /export/home/ftp/incomming
root@wl ~ # chmod 777 /export/home/ftp/incomming
root@wl ~ # vi /usr/local/proftpd/etc/proftpd.conf
# 다음을 추가한다.
<Anonymous ~ftp>
  ...
  # <Anonymous ~ftp>와 </Anonymous> 사이에 아래를 추가한다.
  <Directory incoming>
  AllowOverwrite                on
  AllowStoreRestart             on
    <Limit STOR MKD>
      AllowALL
    </Limit>
  </Directory>
</Anonymous>
root@wl ~ # pkill proftpd
root@wl ~ # /usr/local/proftpd/sbin/proftpd # ProFTPD는 재시작하는 것이 없다.
※ Anonymous의 User와 Group을 모두 ftp로 하였고, AnonymousFTP로 접속한 유저는 ftp:ftp권한을 가진다는 것을 생각하면 이해하기 쉬울 것이다.

5. IP기반의 접근 제어

아래 예제는 192.168.0.3,192.168.0.2에서만 접근 가능하도록 설정한 것이다. FTP서버와 TCP/IP Connection이 이루어지나, 인증이 되지 않는다. 아예 Connection이 안되게 하려면 방하벽을 이용한다.
root@wl ~ # vi /usr/local/proftpd/etc/proftpd.conf
# TCPAccessFiles부분을 추가한다.
TCPAccessFiles /etc/hosts.allow /etc/hosts.deny
root@wl ~ # vi /etc/hosts.deny
ALL:ALL
root@wl ~ # vi /etc/hosts.allow
proftpd: 192.168.0.3,192.168.0.2
root@wl ~ # pkill proftpd
root@wl ~ # /usr/local/proftpd/sbin/proftpd

6. SQL 인증

※ 많은 사람들이 사용하는 ftp서비스를 운영함에 있어서 문제될 수 있는 부분은, 일일이 계정을 주어야 한다는 것이다. ftp만을 접속하게 하기 위해 시스템 로컬 계정을 발급하는 것은 보안상의 문제를 포함해, 여러가지 문제를 야기할 수 있다. 따라서 ftp사용자들의 계정 데이터베이스로 시스템을 이용하지 않는 방법이 나오게 되었으며, 그중 proftpd에서 유용하게 사용 할 수 있는 MySQL Database를 이용한 방법에 대해 설명한다.
root@wl ~ # vi /usr/local/proftpd/etc/proftpd.conf
# 아래부분을 추가한다.
<IfModule mod_sql.c>
SQLAuthenticate on
SQLConnectInfo ftpdb@localhost root
SQLAuthTypes Plaintext
SQLLogFile /var/log/proftpdsqllog
# SQLUserInfo users userid passwd uid gid homedir shell 
# SQLGroupInfo groups groupname gid members
</IfModule>
※ 위세팅은 localhost에 있는 MySQL의 ftpdb 데이터베이스를 사용하며, 사용자 이름은 root, 패스워드는 없다. 테이블 이름은 ftpusers, ftpgroups 이다. 만약 데이터베이스 접속에 패스워드가 필요하다면, [SQLConnectInfo ftp@localhost root]에 한칸 띄우고 패스워드를 써 주면 된다. 이제 MySQL을 세팅할 차례다.
※ SQLUserInfo, SQLGroupInfo 부분의 세팅은 테이블 이름이며 테이블의 필드 이름이다. 기본값을 그대로 사용하기에 주석처리 해 놓은 것이다.
root@wl ~ # mysql -u root
mysql> create database ftpdb;
Query OK, 1 row affected (0.00 sec)
mysql> use ftpdb
Database changed
mysql> CREATE TABLE users (
    userid VARCHAR(30) NOT NULL UNIQUE,
    passwd VARCHAR(80) NOT NULL,
    uid INTEGER UNIQUE,
    gid INTEGER,
    homedir VARCHAR(255),
    shell VARCHAR(255)
  );
Query OK, 0 rows affected (0.00 sec)
mysql> CREATE TABLE groups (
    groupname VARCHAR(30) NOT NULL,
    gid INTEGER NOT NULL,
    members VARCHAR(255)
  );
Query OK, 0 rows affected (0.00 sec)
mysql> insert into users (userid, passwd, uid, gid, homedir, shell) values ('dbtest', 'test', 101, 10, '/export/home/windy', '/bin/bash');
Query OK, 1 row affected (0.00 sec)
mysql> insert into groups (groupname, gid, members) values ('staff', 10, 'dbtest');
Query OK, 1 row affected (0.00 sec)
mysql> exit
Bye
root@wl ~ # pkill proftpd
root@wl ~ # /usr/local/proftpd/sbin/proftpd
- 뭔가 이상하다면 /var/log/proftpdsqllog 파일을 확인해본다. 테이블이름의 기본값이 ProFTPD 버전마다 다른듯 하다.

7. xferlog

ProFTPD는 전송 로그를 /var/log/xferlog에 저장한다. 아래는 로그 파일의 형식에 대한 예이다.
root@wl ~ # tail /var/log/xferlog
Fri Nov 11 11:56:28 2005 0 xxx.xxx.xxx.xxx zzzz /sample.txt a _ i r webmaster ftp  1  *  c
-----------------------1 2 --------------3 ---4 ----------5 6 7 8 9 -------10 -11 12 13 14
로그시간 전송시간 원격호스트이름 파일크기 파일이름 전송종류 특별전송플래그 방향 접근모드 유저이름 서비스이름 인증방법 인증된유저ID 완료여부
1 로그시간. 로그가 저장된 로컬 호스트의 현재 시간
2 전송시간. 전송에 소요된 시간. 초
3 원격호스트이름. 없는 경우 IP로 저장됨
4 파일크기. 바이트
5 파일이름.
6 전송종류. a: 아스키 전송, b: 바이너리 전송
7 특별전송플래그. C: 파일 압축됨, U: 파일 압축풀림, _: 해당없음
8 방향. o: 외부(Outgoing), i:내부(Incoming), d:삭제(Deleted)
9 접근모드. a: 익명유저(Anonymous), g: 손님유저(Guest), r: 로컬 인증된 유저(Real)
10 유저이름. 로컬 유저이름. 손님인 경우 주어진 ID.
11 서비스이름. 수행될때의 서비스 이름. 일반적으로 ftp.
12 인증방법. 0: 없음, 1: RFC931
13 인증된유저ID. 인증 메쏘드에 의해 얻은 유저ID. *의 경우 존재하지 않음
14 완료여부. c: 전송이 완료됨, i: 전송이 완료되지 않음
Posted by 1010
60.Unix2008. 12. 17. 12:31
반응형

윈디하나의 솔라나라: OpenSSL

최종 갱신일: 2008-07-04, 이 문서는 윈디하나의 솔라나라, http://www.solanara.net/에서 최근에 갱신된 문서를 찾을 수 있다.

들어가기 전에

  • OpenSSL은 보안 향상을 위해 사용된다. 그러나 OpenSSL에는 아직 버그가 존재하기 때문에, 수시로 OpenSSL의 버전을 확인해 업데이트 해주어야 한다.
  • SSL은 주로 패킷 스나이핑으로 인한 피해를 줄여줄 뿐이다. 그 이상은 안된다. 만능이 아니다! SSL 설치하고 '보안은 끝'이라고 생각하는 것은 오산일 뿐이다. [SSL을 설치했는데 왜 해킹을 당했나요?]라는 질문은 참 바보같은 질문이다. 해킹에는 수십~수백가지 방법이 있으며, SSL은 그중 하나인 패킷 스나이핑을 무력화할 뿐이다. (패킷스나이핑이 되지 않도록 하는게 아니라, 스나이핑 해봤자 내용이 암호화되어있어 무슨 내용인지 알 수 없도록 만드는 것이다)
  • SSL의 단점? 단 한가지있다. 느리다는 것이다. 느려도 너무 느리다. 패킷의 인코딩/디코딩에 많은 CPU자원을 소모한다. 필자는 이런 서버에는 과감히 다음과 같이 말한다. 'SSL 쓰지말아' 패킷 암호화를 하지 않아도 보안을 향상시킬 수 있는 다른 방법도 많다.
  • 소스가 오픈되어있다고 해서 '무료'인것은 아니다. OpenSSL의 많은 알고리즘은 저작권이 있고, 특허가 취득되어 있다. 만약 OpenSSL의 특정 알고리즘을 사용하려면 사용하기 전에 법률가와 상의 하는것이 좋다. [./config no-idea no-mdc2 no-rc5]와 같이 문제가 될만한 것은 아예 사용 안하도록 설정하는것도 하나의 방법이다. 자세한 사항은 파일의 README에 PATENTS섹션을 참고하자.

1. OpenSSL 설치

아래의 세가지 방법중 어떤것을 사용해도 된다. 솔라나라는 첫번째에 있는 소스 설치방법을 따랐다.
  • OpenSSL 소스 설치: http://www.openssl.org
    root@wl ~ # wget http://www.openssl.org/source/openssl-0.9.8i.tar.gz
    root@wl ~ # tar xvfz openssl-0.9.8i.tar.gz
    root@wl ~ # cd openssl-0.9.8i
    root@wl ~/openssl-0.9.8i # ./config shared
    메시지 생략
    Configured for solaris-x86-cc.
    root@wl ~/openssl-0.9.8i # make
    메시지 생략
    making all in tools...
    root@wl ~/openssl-0.9.8i # make test 1)
    메시지 생략
    compiler: cc -KPIC -DOPENSSL_PIC -DOPENSSL_THREADS -D_REENTRANT -DDSO_DLFCN -DHAVE_DLFCN_H -fast -O -Xa
    OPENSSLDIR: "/usr/local/ssl"
    root@wl ~/openssl-0.9.8i # make install
    메시지 생략
    chmod 644 /usr/local/ssl/lib/pkgconfig/openssl.pc
    root@wl ~/openssl-0.9.8i #
    
    # 환경 설정
    root@wl ~ # vi /etc/profile
    # for OpenSSL located at /usr/local/ssl
    if [ -d /usr/local/ssl ]
    then
      PATH=$PATH:/usr/local/ssl/bin
      LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/ssl/lib
    fi
    
    1) OpenSSL은 반드시 테스트를 하자. 흔하지는 않지만 gcc, cc의 버그로 인해 테스트에 실패하는 경우가 있다. 이런경우 패치를 하거나, gcc, cc, openssl 버전을 낮추거나 gcc, cc의 옵티마이징을 꺼야 한다. [compiler: cc ...] 부분은 시스템마다 다를 수 있다.
  • OpenSSL은 솔라리스 10에 0.9.7d 이 설치되어있다. 경로만 걸어준다.
    root@wl ~ # cd /usr/local/bin
    root@wl /usr/local/bin # ln -s /usr/sfw/bin/openssl openssl
    
  • 패키지 설치. sunfreeware.com 에서 받아 설치한다.
    root@wl ~ # wget ftp://ftp.sunfreeware.com/pub/freeware/intel/10/libgcc-3.4.6-sol10-x86-local.gz
    root@wl ~ # gunzip libgcc-3.4.6-sol10-x86-local.gz
    root@wl ~ # pkgadd -d libgcc-3.4.6-sol10-x86-local
    root@wl ~ # wget ftp://ftp.sunfreeware.com/pub/freeware/intel/10/openssl-0.9.8h-sol10-x86-local.gz
    root@wl ~ # gunzip openssl-0.9.8h-sol10-x86-local.gz
    root@wl ~ # pkgadd -d openssl-0.9.8h-sol10-x86-local
    

2. OpenSSL 인증서 만들기

root@wl ~ # cd /usr/local/ssl/certs
root@wl /usr/local/ssl/certs # openssl req -newkey rsa:2048 -nodes -out req.pem -keyout req.key 1)
Generating a 2048 bit RSA private key
.......++++++
.......++++++
writing new private key to '/usr/local/ssl/certs/root.cert'
-----
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [AU]:KR
State or Province Name (full name) [Some-State]:GyungGiDo
Locality Name (eg, city) []:Suwon
Organization Name (eg, company) [Internet Widgits Pty Ltd]:Solanara
Organizational Unit Name (eg, section) []:SolanaraTeam
Common Name (eg, YOUR name) []:*.solanara.net 2)
Email Address []:admin@solanara.net
Please enter the following 'extra' attributes
to be sent with your certificate request
A challenge password []:
An optional company name []:
root@wl /usr/local/ssl/certs # ls -alF 3)
1) OpenSSL 버전이 낮으면 [-newkey rsa:2048]에서 오류가 난다. [-new]로 대체한다.
2) Apache 설정파일인 httpd.conf의 ServerName에 들어갈 값을 적어준다. 아파치는 이부분을 검사한다. www.solanara.net 과 같이 전체를 다 써줘도 되고, 위와 같이 '별표'를 사용할 수 있으며, 192.186.0.1과 같이 IP를 써도 된다. 다른 내용을 쓰면 인증을 다시 받아야 하는 불상사가 생길 수 있다. 유료 루트 인증기관에 보내기 전에 전화를 걸어 반드시 확인하도록 한다.
3) 총 2개의 파일이 생성되었다. req.key는 공개키로, 유출되지 않고 잃어버리지 않도록 보관해야한다. req.pem (certificate signing request)파일은 CA(Certification Authority=인증기관, 예: 베리사인, 타우트)에게 보내 인증 받아야 한다.

3. Root CA가 되기

CA에서 인증 받으려면 비용이 들기 때문에 테스트용으로는 자신이 CA가 될 필요가 있다. 그런데 CA가 되려면 Root CA(최상위 인증 기관)의 인증이 필요하다. 그리고 그 인증을 받기 위해서는 비용이 든다. 따라서 여기서는 Root CA가 되는 방법을 소개한다. Root CA도 CA중 하나이므로 CA가 하는 일을 모두 할 수 있다.
root@wl /usr/local/ssl/certs # openssl genrsa -des3 -out ca.key 2048 1)
Generating RSA private key, 2048 bit long modulus
............................++++++
............++++++
e is 65537 (0x10001)
Enter pass phrase for ca.key:*****
Verifying - Enter pass phrase for ca.key: *****
root@wl /usr/local/ssl/certs # openssl req -new -x509 -days 365 -key ca.key -out ca.crt 2)
Enter pass phrase for ca.key:
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [AU]:KR
State or Province Name (full name) [Some-State]:GyungGiDo
Locality Name (eg, city) []:Suwon
Organization Name (eg, company) [Internet Widgits Pty Ltd]:Solanara
Organizational Unit Name (eg, section) []:SolanaraTeam
Common Name (eg, YOUR name) []:Solanara CA
Email Address []:admin@solanara.net
root@wl /usr/local/ssl/certs # openssl x509 -req -CA ca.crt -CAkey ca.key -days 365 -in req.pem -out signed-req.pem -CAcreateserial 3)
Signature ok
subject=/C=KR/ST=GyungGiDo/L=Suwon/O=Solanara/OU=SolanaraTeam/CN=wl.solanara.net/emailAddress=admin@solanara.net
Getting CA Private Key
Enter pass phrase for ca.key:*****
root@wl /usr/local/ssl/certs # chmod 600 *
root@wl /usr/local/ssl/certs # ls -alF 4)
총 18
drwxr-xr-x   2 root     bin          512 10월 26일  13:44 ./
drwxr-xr-x  10 root     bin          512 10월 26일  13:40 ../
-rw-------   1 root     other       1671  4월  8일  11:27 ca.crt
-rw-------   1 root     other       1751  4월  8일  11:26 ca.key
-rw-------   1 root     other         17  4월  8일  11:49 ca.srl
-rw-------   1 root     other       1679  4월  8일  11:48 req.key
-rw-------   1 root     other       1074  4월  8일  11:48 req.pem
-rw-------   1 root     other       1330  4월  8일  11:49 signed-req.pem
root@wl /usr/local/ssl/certs # 
1) Root CA의 2048bit private key 파일을 만든다. 결과 파일은 ca.key 이다.
2) 인증서를 만든다. 결과파일은 ca.crt파일이다. ca.crt를 Internet Explorer에 등록해주면 '올바르지 않은 CA'라는 에러메시지를 없앨 수 있다.
3) 이제 Root CA가 되는 일은 끝났다. 클라이언트가 요청한 req.pem을 싸인해주자. 결과파일은 signed-req.pem이다. 베리싸인과 같은 인증 기관은 이 명령 한줄만 실행 해주면 된다. (그러면서 도대체 얼마를 받는거야... ㅡ,.ㅡ)
4) ca.key와 req.key는 소중하게 보관해야 한다. 절대 외부에 유출되서는 안된다.
※ 아파치와 같은 여러 유닉스 데몬에서 SSL을 사용할 때 사용되는 파일은 req.key와 signed-req.pem의 내용이며, 몇몇 데몬은 ca.crt의 내용까지 요구하는 경우도 있다. (형태가 파일인 경우가 대부분이지만 DB에 저장된 문자열일 수도 있다. 실제로 req.key 와 signed-req.pem 은 vi 에디터등으로 열어 내용을 볼 수 있는 텍스트 파일이다) ca.key파일은 디스켓에 담아 별도로 보관한다. (이것이 유출되지 않아야 SSL의 보안이 안전해진다. CA는 이 키 파일의 보안에 많은 비용을 들인다)
Valid XHTML 1.0 Transitional Valid CSS!
Posted by 1010
60.Unix2008. 12. 17. 12:18
반응형

페이지 수정중입니다.

윈디하나의 솔라나라: TOMCAT

최종 갱신일: 2008-11-12, 이 문서는 윈디하나의 솔라나라, http://www.solanara.net/에서 최근에 갱신된 문서를 찾을 수 있다.

아파치 톰캣(Apache Tomcat)

※ 아파치 톰캣은 아파치 소프트웨어 재단에서 만든 자카르타 프로젝트에 속해 있던 소프트웨어로, 현재는 톱레벨프로젝트로 승격되었다. 톰캣을 한마디로 정의하자면 자바 서블릿과 자바서버페이지(JSP)를 구현한 자바 서블릿 컨테이너다. 자카르타 프로젝트는 아파치 소프트웨어 재단에서 지원하는 오픈 소스 자바 솔루션 프로젝트의 이름이다. 톰캣은 자바 서블릿(Servlet)과 자바 서비스 페이지(JSP)를 지원하며 표준 스펙을 만족하고 있다. 자세한 사항은 Apache - Tomcat 홈페이지를 참고하기 바란다.

※ 본 문서에서는 아파치 톰캣을 설치하고, 아파치 웹 서버와 연동시키며, 톰캣 네이티브 라이브러리까지 설치하는 것을 다룬다.

톰캣 설치

  1. Java SE Downloads: 톰캣은 자바로 만들어져 있기 때문에 자바를 설치해야 한다. (솔라리스10의 /usr/java 디렉토리에 있는 자바를 사용해도 된다)
    root@wl ~ # cd /usr/local
    root@wl /usr/local # ~/jdk-6u10-solaris-i586.sh
    root@wl /usr/local # ln -s jdk1.6.0_10/ java
    root@wl /usr/local # vi /etc/profile
    # for Tomcat
    if [ -d /usr/local/tomcat ]
    then
      PATH=$PATH:/usr/local/tomcat/bin; export PATH;
    fi
    
    # for JAVA
    if [ -d /usr/local/java ]
    then
      PATH=/usr/local/java/bin:$PATH; export PATH;
      JAVA_HOME=/usr/local/java; export JAVA_HOME;
    fi
    root@wl /usr/local # . /etc/profile
    
  2. Apache - Tomcat
    root@wl ~ # wget http://apache.mirror.cdnetworks.com/tomcat/tomcat-6/v6.0.18/bin/apache-tomcat-6.0.18.tar.gz
    root@wl ~ # cd /usr/local
    root@wl /usr/local # tar xvfz ~/apache-tomcat-6.0.18.tar.gz
    root@wl /usr/local # ln -s apache-tomcat-6.0.18 tomcat
    root@wl /usr/local # /usr/local/tomcat/bin/startup.sh
    
    ※ 톰캣의 압축을 풀기만 하면 톰캣의 설치는 끝난다. http://localhost:8080 에서 톰캣이 실행된 것을 확인할 수 있다. 8080 포트가 아닌 80 포트로 톰캣을 실행시키려면 /usr/local/tomcat/conf/server.xml 에 8080으로 된 문자를 전부 80으로 바꾸면 되며, 파일 이미지와 JSP파일은 /usr/local/tomcat/webapps/ROOT 에 넣으면 된다.

톰캣 - 아파치 웹 서버 연동

※ 톰캣만으로도 웹 서비스를 하는데에는 지장 없지만, 정적 컨텐츠(예를 들어 이미지들)의 효율적인 전송이나 rewrite와 같은 기능, php의 연동을 위해 아파치 웹 서버가 필요할 때가 있다. 웹서비스시, 톰캣은 JSP와 서블릿을 실행하기 위한 용도로만 사용하고, 나머지(이미지 전송, PHP/CGI실행 등등)는 아파치 웹 서버에 맡기는 방법이다. 여기서는 아파치 웹 서버가 /usr/local/apache2 에 설치되었다고 가정한다. 아파치 웹 서버의 설치방법은 윈디하나의 솔라나라: AMP를 참고한다.

※ 80 포트로 오는 요청은 아파치 웹서버가 담당한다. 이 요청중 JSP/서블릿요청은 톰캣에게 주어 톰캣이 처리하도록 해야 한다. 톰캣과 아파치 웹 서버를 연결해주는 프로토콜은 현재 AJP v1.3이 많이 사용되고 있으며 이를 구현한게 mod_jk 이라는 모듈이다.
  1. Apache Tomcat - Tomcat Connectors (mod_jk) Downloads
    root@wl ~ # wget http://apache.tt.co.kr/tomcat/tomcat-connectors/jk/source/jk-1.2.27/tomcat-connectors-1.2.27-src.tar.gz
    root@wl ~ # tar xvfz tomcat-connectors-1.2.27-src.tar.gz
    root@wl ~ # cd tomcat-connectors-1.2.27-src/native
    root@wl ~/tomcat-connectors-1.2.27-src/native # ./configure --with-apxs=/usr/local/apache2/bin/apxs -enable-jni --with-java-platform=2
    root@wl ~/tomcat-connectors-1.2.27-src/native # /usr/sfw/bin/gmake
    root@wl ~/tomcat-connectors-1.2.27-src/native # /usr/sfw/bin/gmake install
    root@wl ~/tomcat-connectors-1.2.27-src/native # cd ../conf
    root@wl ~/tomcat-connectors-1.2.27-src/conf # cp workers.properties /usr/local/tomcat/conf/workers.properties
    
  2. 아파치 웹 서버, 톰캣 설정
    root@wl ~ # vi /usr/local/apache2/conf/httpd.conf 1)
    LoadModule jk_module modules/mod_jk.so
    JkWorkersFile "/usr/local/tomcat/conf/workers.properties"
    JkLogFile "logs/mod_jk.log"
    JkLogLevel warn
    JkMount /*.jsp ajp13
    root@wl ~ # vi /usr/local/tomcat/conf/workers.properties 2)
    workers.tomcat_home=/usr/local/tomcat
    workers.java_home=/usr/local/jdk
    root@wl ~ # vi /usr/local/tomcat/conf/tomcat-users.xml
    <?xml version='1.0' encoding='utf-8'?>
    <tomcat-users>
      <role rolename="standard" />
      <role rolename="manager"/>
      <user username="tomcat" password="s3cret" roles="standard,manager"/>
    </tomcat-users>
    root@wl ~ # vi /usr/local/tomcat/conf/server.xml
    <!-- Connector 태그에 URIEncoding="UTF-8" 속성을 추가한다.  -->
    <Connector port="8009" protocol="AJP/1.3" redirectPort="8443" URIEncoding="UTF-8"/>
    <!-- 아래의 내용을 <Engine>과 </Engine>사이에 넣어야 한다. -->
    <Host name="APACHE_SERVER_NAME" appBase="APACHE_DOCUMENT_HOME"
       unpackWARs="true" autoDeploy="true"
       xmlValidation="false" xmlNamespaceAware="false">
    </Host>
    root@wl ~ # mkdir -p APACHE_DOCUMENT_HOME/ROOT/WEB-INF
    root@wl ~ # /usr/local/tomcat/bin/startup.sh
    root@wl ~ # /usr/local/apache2/bin/apachectl restart
    
    1) 아파치 웹 서버의 설정 파일을 변경한다. 만약 가상 호스트를 사용하고 있다면, [JkMount /*.jsp ajp13]부분은 각각의 가상호스트세팅(<VirtualHost> ~ </VirtualHost>)에 모두 넣어주어야 한다.
    2) JNI를 사용하기 위해서는 반드시 아래 두 태그를 설정해야 한다.
    3) server.xml을 아파치의 설정에 맞게 바꿔야 한다. APACHE_SERVER_NAME, APACHE_DOCUMENT_HOME은 아파치의 설정에 맞게바꿔야 한다. APACHE_SERVER_NAME은 httpd.conf의 ServerName과 동일하게 해야 하며, APACHE_DOCUMENT_HOME은 httpd.conf의 DocumentRoot와 동일하게 값을 넣어야 한다.

    ※ Context를 정해주지 않으면 400: No Host matches server name xxxx 를 보게 될 것이다. 톰캣 5.5부터 context는 WEB-INF에서 설정할 수 있다.
    ※ http://APACHE_SERVER_NAME/manager/html/ 으로 접속후 tomcat / s3cret 를 사용해 접속하면 톰캣 관리자 페이지가 나온다.

테스트

root@wl ~ # vi $APACHE_DOCUMENT_HOME/ROOT/test.jsp
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<html>
<head><title>JSP TEST</title></head>
<body><pre>
ClassPath: <%=System.getProperty("java.class.path",".")%>
LibraryPath: <%=System.getProperty("java.library.path", ".")%>
Parameter: <%=request.getParameter("param")%> (must be correct)
</pre></body>
</html>
root@wl ~ # http://localhost/test.jsp?param=%ED%95%9C%EA%B8%80 를 확인해보면 된다

The Apache Tomcat Native library

톰캣을 실행시킨후 CATALINA_HOME/logs/catalina.out 을 살펴보면 톰캣을 시작할때 아래와 같은 메시지가 나오는 것을 확인할 수 있다.

정보: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: ... (이하생략)

이 메시지는 톰캣 네이티브 라이브러리를 사용하지 않았을때 나오는 안내문구이다. 성능을 위해서는 네이티브 라이브러리를 사용하라는 것이다. 이는 http://tomcat.apache.org/tomcat-6.0-doc/apr.html 의 문서를 보면 더 많은 정보를 얻을 수 있다. 이 네이티브 라이브러리를 컴파일해 설치하기 위해서는 APR 1.2+(아파치2를 설치할때 같이 설치된다), OpenSSL 0.9.7+, JDK 1.4+ 가 필요하다. 단순히 아래와 같이 설치해주면 된다.
root@wl ~ # cd /usr/local/tomcat/bin
root@wl /usr/local/tomcat/bin # tar xvfz tomcat-native.tar.gz
root@wl /usr/local/tomcat/bin # cd tomcat-native-1.1.14-src/jni/native
root@wl /usr/local/tomcat/bin/tomcat-native-1.1.14-src/jni/native # ./configure --prefix=/usr/local --with-apr=/usr/local/apache2 1)
root@wl /usr/local/tomcat/bin/tomcat-native-1.1.14-src/jni/native # make
root@wl /usr/local/tomcat/bin/tomcat-native-1.1.14-src/jni/native # make install 2)
1) 아파치2의 APR 라이브러리를 사용하고, /usr/local에 설치한다.
2) 설치한 후, 톰캣을 재시작하면 네이티브 라이브러리를 로드하면서 기동할 것이다.
Posted by 1010
60.Unix2008. 12. 17. 12:17
반응형

윈디하나의 솔라나라: AMP(Apache HTTPD, MySQL, PHP)

최종 갱신일: 2008-06-12, 이 문서는 윈디하나의 솔라나라, http://www.solanara.net/에서 최근에 갱신된 문서를 찾을 수 있다.

1. 개요

  • 아파치 2.2.x, MySQL 5.0.x, PHP 5.2.x에 대해 솔라리스 10 u6 기본설정대로 설정시 설치하는 방법에 대해 설명하는 문서이다. 만약 사용자의 현재 설정이 이와 다르다면 약간의 수정이 필요할 수 있다.
  • SAMP(Solaris, Apache, MySQL, PHP)는 오픈 솔라리스 10에 이미 설치되어있기도 하지만, 여기서는 소스를 이용해 별도의 디렉토리(/usr/local)에 설치한다. 본 내용대로 하기 위해 솔라리스에 이미 설치되어있는 APM을 삭제해야할 필요는 없다.

2. 라이브러리 설치

  1. OpenSSL: Apache와 MySQL에 SSL라이브러리를 넣어 같이 컴파일 한다. 필요없다면 SSL설치를 생략하고 Apache, MySQL 의 configure 시 ssl 옵션을 뺀다. OpenSSL의 설치는 윈디하나의 솔라나라: OpenSSL을 참고한다.
  2. The GNU Readline Library
    root@wl ~ # wget ftp://ftp.cwru.edu/pub/bash/readline-5.2.tar.gz 1)
    root@wl ~ # tar xvfz readline-5.2.tar.gz
    root@wl ~ # cd readline-5.2
    root@wl ~/readline-5.2 # ./configure --enable-multibyte
    root@wl ~/readline-5.2 # make
    root@wl ~/readline-5.2 # make install
    
    1) 사이트가 너무 느리면 [wget http://user.chol.com/~laday/solaris/downloads/readline-5.2.tar.gz] 을 사용할 수 있다.
  3. Oracle Berkeley DB: 유닉스 프로그램에서 보통 DB라 하면 이 버클리 DB를 말할정도로 대중적인 임베디드 데이터베이스이다. 처음엔 UCB(캘리포티아대 버클리)에서 관리하던 버클리DB를, 좀 더 체계적인 관리를 목적으로 1996년 SleepyCat 이라는 법인이 설립되어 이어져오다가, 2006년 2월 오라클에 합병되었다. db-x.x.x.tar.gz 파일은 Oracle Berkeley DB Downloads에서 오라클에 가입(무료)한후 무료로 다운로드 받을 수 있다.
    root@wl ~ # tar xvfz db-4.7.25.tar.gz
    root@wl ~ # cd db-4.7.25
    root@wl2 ~/db-4.7.25 # cd build_unix
    root@wl2 ~/db-4.7.25/build_unix # ../dist/configure \
     --enable-pthread_api
    메시지 생략
    config.status: creating db.h
    config.status: creating db_config.h
    root@wl2 ~/db-4.7.25/build_unix # make
    root@wl2 ~/db-4.7.25/build_unix # make install
    root@wl2 ~/db-4.7.25/build_unix # vi /etc/profile
    # for Oracle Berkeley DB located at /usr/local/db
    if [ -d /usr/local/db ]
    then
      LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/db/lib; export LD_LIBRARY_PATH
    fi
    
    root@wl2 ~/db-4.7.25/build_unix # cd /usr/local
    root@wl2 /usr/local # ln -s BerkeleyDB.4.7/ db
    
  4. The XML C parser and toolkit of Gnome
    root@wl ~ # wget ftp://xmlsoft.org/libxml2/libxml2-2.6.32.tar.gz
    root@wl ~ # tar xvfz libxml2-2.6.32.tar.gz
    root@wl ~ # cd libxml2-2.6.32
    root@wl ~/libxml2-2.6.32 # ./configure --prefix=/usr/local/xml
    root@wl ~/libxml2-2.6.32 # make
    root@wl ~/libxml2-2.6.32 # make install
    
  5. zlib
    root@wl ~ # wget http://www.zlib.net/zlib-1.2.3.tar.gz
    root@wl ~ # tar xvfz zlib-1.2.3.tar.gz
    root@wl ~ # cd zlib-1.2.3
    root@wl ~/zlib-1.2.3 # ./configure -s
    root@wl ~/zlib-1.2.3 # make 1)
    root@wl ~/zlib-1.2.3 # make test
    메시지 생략
                    *** zlib test OK ***
    root@wl ~/zlib-1.2.3 # make install
    
    1) 경고 메시지는 무시한다
  6. libiconv
    root@wl ~ # wget http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.12.tar.gz
    root@wl ~ # tar xvfz libiconv-1.12.tar.gz
    root@wl ~ # cd libiconv-1.12
    root@wl ~/libiconv-1.12 # ./configure --prefix=/usr/local
    root@wl ~/libiconv-1.12 # vi srclib/stdint.h
    /* Verify that intmax_t and uintmax_t have the same size.  Too much code
       breaks if this is not the case.  If this check fails, the reason is likely
       to be found in the autoconf macros.  */
    //typedef int _verify_intmax_size[2 * (sizeof (intmax_t) == sizeof (uintmax_t)) - 1];
    root@wl ~/libiconv-1.12 # make
    root@wl ~/libiconv-1.12 # make install
    
    1) 주석처리한다. 257번째 라인이다. autoconf 의 버그인듯 하다.
  7. FreeType
    root@wl ~ # wget http://nchc.dl.sourceforge.net/sourceforge/freetype/freetype-2.3.6.tar.bz2
    root@wl ~ # tar xvfj freetype-2.3.6.tar.bz2
    root@wl ~ # cd freetype-2.3.6
    root@wl ~/freetype-2.3.6 # GNUMAKE="/usr/sfw/bin/gmake" ./configure
    root@wl ~/freetype-2.3.6 # /usr/sfw/bin/gmake
    root@wl ~/freetype-2.3.6 # /usr/sfw/bin/gmake install
    
  8. LibGD
    root@wl ~ # wget http://www.libgd.org/releases/gd-2.0.35.tar.bz2
    root@wl ~ # tar xvfj gd-2.0.35.tar.bz2
    root@wl ~ # cd gd-2.0.35
    root@wl ~/gd-2.0.35 # ./configure
    root@wl ~/gd-2.0.35 # make
    root@wl ~/gd-2.0.35 # make install
    

3. APM 설치

  1. MySQL
    root@wl ~ # wget http://dev.mysql.com/get/Downloads/MySQL-5.0/mysql-5.0.67.tar.gz/from/http://mysql.byungsoo.net/
    root@wl ~ # tar xvfz mysql-5.0.67.tar.gz
    root@wl ~ # cd mysql-5.0.67
    root@wl ~/mysql-5.0.67 # ./configure \
     --without-readline \
     --with-openssl=/usr/local/ssl \
     --prefix=/usr/local/mysql \
     --enable-thread-safe-client \
     --with-charset=utf8 \
     --with-extra-charsets=ucs2,euckr \
     CFLAGS="-I/usr/local/include" \
     CXXFLAGS="-I/usr/local/include"
    메시지 생략
    Thank you for choosing MySQL!
    root@wl ~/mysql-5.0.67 # make
    메시지 생략
    CC -DDBUG_OFF -D_POSIX_C_SOURCE=199506L -D__EXTENSIONS__ -I/usr/local/include -D
    BIG_TABLES -DHAVE_RWLOCK_T -o mysqlmanager command.o mysqlmanager.o manager.o lo
    g.o thread_registry.o listener.o protocol.o mysql_connection.o user_map.o messag
    es.o commands.o instance.o instance_map.o instance_options.o buffer.o parse.o gu
    ardian.o parse_output.o  ./.libs/liboptions.a -lpthread -lthread -lpthread -lthr
    ead -lpthread -lthread -lpthread -lthread libnet.a ../../vio/libvio.a ../../mysy
    s/libmysys.a ../../strings/libmystrings.a ../../dbug/libdbug.a -lz -lpthread -lt
    hread -lposix4 -lgen -lsocket -lnsl -lm -lpthread -lthread
    root@wl ~/mysql-5.0.67 # make install
    메시지 생략
    Making install in instance-manager
    test -z "/usr/local/mysql/libexec" || /root/source/mysql-5.0.51b/install-sh -d "
    /usr/local/mysql/libexec"
      /bin/bash ../../libtool --preserve-dup-deps --mode=install ../.././install-sh 
    -c 'mysqlmanager' '/usr/local/mysql/libexec/mysqlmanager'
    ../.././install-sh -c mysqlmanager /usr/local/mysql/libexec/mysqlmanager
    root@wl ~/mysql-5.0.67 # 
    
    ※ MySQL 설치하는데 가장 오래걸린다. P4 2.0에서는 보통 30분 정도 걸릴 것이다.
  2. The Apache HTTP Server
    root@wl ~ # wget http://apache.tt.co.kr/httpd/httpd-2.2.9.tar.bz2
    root@wl ~ # tar xvfj httpd-2.2.9.tar.bz2
    root@wl ~ # cd httpd-2.2.9
    root@wl ~/httpd-2.2.9 # ./configure \
      --prefix=/usr/local/apache2 \
      --enable-so \
      --enable-auth-digest \
      --enable-dav \
      --enable-dav-fs \
      --with-mpm=worker \
      --enable-rewrite \
      --enable-deflate \
      --enable-headers \
      --enable-expires \
      --enable-log-forensic \
      --enable-ssl \
      --with-ssl=/usr/local/ssl \
      --enable-dbd \
      --enable-authn-dbm \
      --enable-authn-dbd \
      --enable-authz-dbm
    root@wl ~/httpd-2.2.9 # make
    root@wl ~/httpd-2.2.9 # make install
    
    ※ PHP를 개발한 The PHP Group이나 APACHE를 개발한 The Apache Software Foundation에서는 mpm으로 worker나 perchild를 권장하지 않는다. 값을 지정하지 않는다면 기본값인 prefork을 사용한다.
  3. PHP Hypertext Preprocessor
    root@wl ~ # wget http://kr2.php.net/get/php-5.2.6.tar.bz2/from/this/mirror
    root@wl ~ # tar xvfj php-5.2.6.tar.bz2
    root@wl ~ # cd php-5.2.6
    root@wl ~/php-5.2.6 # ./configure \
    	--prefix=/usr/local/php \
    	--with-apxs2=/usr/local/apache2/bin/apxs \
    	--with-mysql=/usr/local/mysql \
    	--with-mysqli=/usr/local/mysql/bin/mysql_config \
    	--with-pdo-mysql=/usr/local/mysql \
    	--with-iconv=/usr/local \
    	--with-libxml-dir=/usr/local/xml \
    	--enable-mbstring \
    	--enable-mbregex \
    	--enable-dbase \
    	--with-gd \
    	--enable-sigchild \
    	--enable-gd-native-ttf \
    	--with-jpeg-dir=/usr/local \
    	--with-png-dir=/usr/local \
    	--with-zlib-dir=/usr/local \
    	--with-freetype-dir=/usr/local \
    	--enable-wddx \
    	--enable-sysvmsg \
    	--enable-sysvsem \
    	--enable-sysvshm \
    	--enable-sockets \
    	--enable-soap \
    	--enable-ftp \
    	--enable-safe-mode \
    	--enable-exif \
    	--enable-bcmath
    root@wl ~/php-5.2.5 # make
    root@wl ~/php-5.2.5 # make test
    TEST 1/3990 [...]
    ...
    # test스크립트의 오류로 실패하는 경우가 많으므로 실패한다고 해서 설치못하는건 아니다.
    root@wl ~/php-5.2.6 # make install
    root@wl ~/php-5.2.6 # cp php.ini-dist /usr/local/php/lib/php.ini
    
    # 여기까지 하면 설치는 끝난다. 아래는 Zend Optimizer를 설치하는 과정이다.
    root@wl ~ # gtar xvfz ZendOptimizer-3.3.0a-sunos5.9-i386.tar.gz
    root@wl ~ # cd ZendOptimizer-3.3.0a-sunos5.9-i386
    root@wl ~/ZendOptimizer-3.3.0a-sunos5.9-i386 # ./install 1)
    
    1)
    - php.ini파일은 /usr/local/php/lib 디렉토리에 있다.
    - Apache Control Utility는 /usr/local/apache2/bin/apachectl 에 있다.
    - 설치가 완료되면 /usr/local/php/lib/php.ini가 /usr/local/Zend/etc/php.ini파일로 심볼릭 링크된다.
    - 원래의 php.ini은 /usr/local/php/lib/php.ini-zend_optimizer.bak 에 있다.
    - php.ini만 이전것으로 복구하면 자연스럽게 Zend Optimizer를 언인스톨 할 수 있다.
    - Zend Optimizer는 http://www.zend.com에서 무료 회원 가입후 무료로 받을 수 있다.
    - Zend Optimizer는 필수사항이 아니다. Zend Encoder로 인코딩된 php 소스를 실행할 수 있으며, php를 좀 더 빨리 실행시켜준다고 알려져 있으며, Solaris Sparc이나 리눅스에서는 큰 효과가 있지만, Solaris x86에서는 그리 큰 효과가 없는듯 하다. (성능향상이 되는지도 잘 모르겠다 ^^ 스팍에서 설치할땐 쉽게 느낄 수 있을정도의 성능향상이 있었다)

3. APM 설정(기본적인것만)

  1. PATH 설정
    root@wl ~ # vi /etc/profile
    # for Apache located at /usr/local/apache2
    if [ -d /usr/local/apache2 ]
    then
      LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/apache2/lib; export LD_LIBRARY_PATH
      PATH=$PATH:/usr/local/apache2/bin; export PATH;
    fi
    
    # for MySQL located at /usr/local/mysql
    if [ -d /usr/local/mysql/lib/mysql ]
    then
      LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/mysql/lib/mysql; export LD_LIBRARY_PATH
      PATH=$PATH:/usr/local/mysql/bin; export PATH;
    fi
    
  2. MySQL 설정
    root@wl ~ # useradd -d /export/home/mysql -g staff -m -u 102 -s /bin/false mysql 1)
    root@wl ~ # cp /usr/local/mysql/share/mysql/my-medium.cnf /etc/my.cnf 2)
    root@wl ~ # vi /etc/my.cnf 2)
    skip-networking
    #log-bin
    root@wl ~ # /usr/local/mysql/bin/mysql_install_db 3)
    root@wl ~ # chown -R mysql:staff /usr/local/mysql/var 4)
    root@wl ~ # /usr/local/mysql/share/mysql/mysql.server start 5)
    root@wl ~ # /usr/local/mysql/bin/mysqladmin -u root password 'new-password' 6)
    root@wl ~ # /usr/local/mysql/bin/mysqladmin -u root -h wl password 'new-password' 6)
    
    1) MySQL을 실행할 유닉스 계정을 생성한다.
    2) MySQL 설정 파일을 복사한 후 적당히 수정한다. /usr/local/mysql/share/mysql 에 my-huge.cnf, my-large.cnf, my-medium.cnf, my-small.cnf 의 예제 설정 파일이 있다. 이를 /etc/my.cnf 으로 이름을 바꿔 복사하면 된다. 리플리케이션을 사용하지 않는다면 [log-bin]을 찾아 주석처리하고 외부에서 접속이 없다면 [skip-networking]의 주석을 푼다.
    3) 기본 MySQL DB를 생성한다.
    4) 기본 MySQL DB는 /usr/local/mysql/var 에 생성되는데 이 디렉토리및 파일들의 소유자를 변경한다.
    5) MySQL 서버를 시작한다. 종료는 [/usr/local/mysql/share/mysql/mysql.server stop] 커맨드를 사용한다.
    6) MySQL의 root 패스워드를 변경한다. 기본값은 없기 때문에 반드시 수정해야 한다. [wl]부분은 MySQL이 설치된 호스트의 이름이다.
  3. Apache 설정
    아파치 2.2.x로 오면서 기본 설정 방법이 다소 차이난다. 그리고 기본값도 다소 차이가 있다. 예를 들면 디렉토리 권한이 기본적으로 거부되어있다. 따라서 <Directory>지시자로 사용할 디렉토리에 대해 접근권한을 주어야 한다. (그나마 다행인것은 2.0.x와 설정 파일이 호환되기 때문에 기존것을 그대로 써도 되는것 같다) 기존에 httpd.conf파일 하나로 제공되던 기본 설정파일이 httpd.conf와 extra 디렉토리의 파일로 나누어 제공되며 각각의 파일을 include해서 사용하도록 하고 있다. include자체는 이전 버전부터 제공되어왔었지만, 그런 기능을 기본 제공된 httpd.conf에서 사용하는 것은 이번이 처음이 아닐까 한다.
    root@wl ~ # cd /usr/local/apache2/conf
    root@wl /usr/local/apache2/conf # vi httpd.conf
    User nobody 1)
    Group nobody 1)
    
    # AddDefaultCharset ISO-8859-1 2)
    
    # Dynamic Shared Object (DSO) Support
    AddType application/x-httpd-php	.php 3)
    AddType application/x-httpd-php-source	.phps 3)
    
    ServerName xxx.solanara.com:80 4)
    
    Include conf/extra/httpd-mpm.conf 5)
    Include conf/extra/httpd-multilang-errordoc.conf
    Include conf/extra/httpd-autoindex.conf
    Include conf/extra/httpd-languages.conf
    Include conf/extra/httpd-userdir.conf
    Include conf/extra/httpd-info.conf
    Include conf/extra/httpd-vhosts.conf
    Include conf/extra/httpd-manual.conf
    Include conf/extra/httpd-dav.conf
    Include conf/extra/httpd-default.conf
    Include conf/extra/httpd-ssl.conf
    
    root@wl ~ # /usr/local/apache2/bin/apachectl start
    
    1) 아파치 2.2.x에서는 daemon 계정을 사용하도록 되어있다. 이를 nobody를 사용하도록 변경한다.
    2) [AddDefaultCharset ISO-8859-1] 부분이 있다면 주석처리 한다. (2.2.0에는 없다)
    3) PHP사용을 위해 AddType부분의 두라인을 추가한다. [LoadModule php5_module modules/libphp5.so]도 필요하지만, 이 설정은 php에서 make install 시 이미 추가되어있을 것이다.
    4) ServerName을 정해준다. 정하지 않아도 되지만 아파치 시작시 [httpd: Could not determine the server's fully qualified domain name, using xxx.xxx.xxx.xxx for ServerName]와 같은 메시지가 나올 수 있다. 만약 도메인이 없다면 IP를 입력해준다. 예) [ServerName 192.168.0.1]
    5) 각종 삽입 파일 지시자의 주석을 풀어 사용 하도록 한다. 기본값을 그대로 사용하겠다면 풀지 않아도 된다.
  4. PHP 테스트
    root@wl ~ # vi /usr/local/apache2/htdocs/index.php
    <?
      phpinfo();
    ?>
    root@wl ~ #
    
    이후 http://localhost/index.php 에서 php정보가 제대로 나오는지 확인한다. 아래와 비슷하게 나와야 한다. 확인되었으면 index.php파일을 지운다. (보안때문)
    PHP정보
    root@wl ~ # rm /usr/local/apache2/htdocs/index.php
    

    여기까지 되면 설치는 완료되었다.
Valid XHTML 1.0 Transitional Valid CSS!
Posted by 1010
60.Unix2008. 12. 17. 12:16
반응형

윈디하나의 솔라나라: Oracle

최종 갱신일: 2008-06-23, 이 문서는 윈디하나의 솔라나라, http://www.solanara.net/에서 최근에 갱신된 문서를 찾을 수 있다.

개요

  • Oracle 10g Release 2, Solaris 10 u5 x86 을 기준으로 오라클 설치에 대한 설명이다.

1. 설치 전에

  • Oracle은 모두 /export/home/oracle에 설치할 것이다. 필자는 /export/home/oracle을 4GB 주었다.
  • 오라클사에서 말하는 오라클 인스톨을 위한 필수 패키지는 SUNWarc SUNWlibms SUNWi1of SUNWbtool SUNWsprot SUNWi1cs SUNWhea SUNWsprox SUNWi15cs SUNWlibm SUNWtoo SUNWxwfnt 이다. 전체 설치시 모두 설치되어있다. 또한 최신의 커널 패치를 적용해야 한다. 물론 솔라리스 10 u5에서는 이미 설치되어있다.
  • 오라클에서 권장하는 사양은 512MB이상의 램, 1GB이상의 스왑공간, /tmp이 400MB이상 남아있어야 한다. 임시공간이 문제될 것이라 생각되면 TEMP환경변수와 TMPDIR 환경변수를 수정해준다. 예) export TEMP=/disk2/tmp
  1. 솔라리스 10 미만의 시스템인 경우, 시스템 커널 파라메터 변경해야 한다. (솔라리스 10에서는 할 필요 없다) 주로 System V IPC와 관련된 파라미터를 늘려주어야 한다. 자세한 사항은 솔라리스 매뉴얼의 Tunable Parameter부분을 참고한다. /etc/system 파일은 매우 중요하므로 백업받은 후 수정하자.
    root@wl ~ # cp /etc/system /etc/systemold
    root@wl ~ # vi /etc/system
    set noexec_user_stack=1
    set semsys:seminfo_semmni=100
    set semsys:seminfo_semmns=1024
    set semsys:seminfo_semmsl=256
    set semsys:seminfo_semvmx=32767
    set shmsys:shminfo_shmmax=4294967295
    set shmsys:shminfo_shmmin=1
    set shmsys:shminfo_shmmni=100
    set shmsys:shminfo_shmseg=10
    root@wl ~ # sync; sync; reboot
    
  2. 오라클 계정을 생성한다. 오라클은 root로 설치할 수 없다. 오라클에서는 설치를 위해 oinstall 그룹, dba 그룹, oracle 유저를 생성하는 것을 권하고 있다.
    root@wl ~ # groupadd -g 101 oinstall
    root@wl ~ # groupadd -g 102 dba
    root@wl ~ # useradd -d /export/home/oracle -g oinstall -G dba -m -u 103 -s /bin/bash oracle
    root@wl ~ # passwd oracle
    
  3. 오라클 계정의 환경을 설정한다. ORACLE_HOME과 같은 중요한 환경 변수를 설정한다.
    root@wl ~ # /usr/openwin/bin/xhost + 2)
    access control disabled, clients can connect from any host
    root@wl ~ # su - oracle
    oracle@wl ~ $ mkdir oradata 4)
    oracle@wl ~ $ mkdir flash_recovery_area 4)
    oracle@wl ~ $ vi .profile 5)
    DISPLAY=localhost:0.0; export DISPLAY # 다른 호스트의 X윈도우를 사용하려면 해당 호스트의 IP를 localhost대신 적는다.
    ORACLE_BASE=/export/home/oracle; export ORACLE_BASE
    if [ -x /usr/local/bin/dbhome ] # 오라클 설치시 root.sh를 실행하면 dbhome이 존재하며 실행 가능하게 된다.
    then
    	. /usr/local/bin/oraenv
      ORACLE_HOME=`dbhome orcl`; export ORACLE_HOME
      PATH=$PATH:$ORACLE_HOME/bin; export PATH
      LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$ORACLE_HOME/lib
    fi
    # TNS_ADMIN 환경변수는 설정하지 않는다.
    oracle@wl ~ $ . .profile
    oracle@wl ~ $ cksum 10202_database_solx86.zip
    1350902623      681090961       10202_database_solx86.zip
    oracle@wl ~ $ unzip 10202_database_solx86.zip 1)
    oracle@wl ~ $ cd database
    oracle@wl ~/database $ ./runInstaller
    Oracle Universal Installer 시작 중...
    
    설치 프로그램 요구 사항 확인 중...
    
    운영 체제 버전 확인 중: 필수 버전5.10.    실제 5.10
                                          성공함
    
    임시 공간 확인 중: 250MB 이상이어야 합니다..   실제 1020MB    성공함
    스왑 공간 확인 중: 500MB 이상이어야 합니다..   실제 1339MB    성공함
    모니터 확인 중: 최소 256 색상을 표시하도록 구성되어 있어야 합니다..    실제 16777216    성공함
    
    설치 프로그램 요구 사항을 모두 충족했습니다.
    
    다음에서 Oracle Universal Installer의 시작을 준비하는 중 /tmp/OraInstall2008-06-19_04-40-02PM. 기다리십시오.
    oracle@wl ~/database $ 
    
1) 오라클 다운로드 사이트: 가기
2) [xhost +]는 X윈도우의 디스플레이의 접근 권한 제어를 끄는 명령어이다. 오라클 설치가 끝나면 [xhost -]로 다시 켜 놓는다. 당연한 말이지만 X윈도우에 미리 로그인 되어있어야 한다. [/usr/openwin/bin/xhost: unable to open display ""] 메시지가 나오면 DISPLAY 환경변수를 설정5) 해본다.
3) 오라클 어플리케이션이 설치될 곳. 2.5GB정도 필요
4) 오라클 데이터가 설치될 곳. 1.2GB이상 필요
5) 환경 변수를 설정해준다.

2. 오라클 및 오라클 컴패니언 설치

위와같이 한후 마지막에 runInstaller를 실행했다면 GUI화면이 뜰 것이다. 자바로 되어있어 썩 모양이 좋지는 않지만 그럭저럭 봐줄만 한다. 각각의 화면마다 선택해야할 것은 다음과 같다. 빠른 설치를 위해 설정은 대부분 기본값으로 해 놓았다. (필요한 설정은 이전에 .profile을 수정할 때 모두 했다) 또한 이 내용은 Oracle Quick Installation Guide의 내용이기도 하다.
스크린 제목 내용
Welcome Next를 클릭한다.
Specify Inventory Directory and Credentials 오라클 인벤토리설정 화면이다. 기본값으로 놔둔다. Next를 클릭하면 루트 권한으로 orainstRoot.sh를 실행하라고 나오는데 화면을 참조해 실행해준다.
Specify File Locations 파일이 설치될 디렉토리이다. $ORACLE_BASE/product/10.1.0/db_1에 설치된다. Next를 클릭한다.
Select Installation Type Enterprise Edition을 선택하고 Next를 클릭한다.
Select Database Configuration Next를 클릭한다.
Specify Database Configuration Options Global Database Name이 orcl로 되어있는 것을 확인한다. Database Character Set은 KO16KSC5601(완성형)으로 선택되어있는데, 필요하다면 KO16MSWIN949 (확장완성형)로 수정한다. 예제 스키마를 생성할 것인가를 물어보는데 체크하는 것이 테스트용으로 설치하는 목적에 부합할 것이다. Next를 클릭한다.
Select Database Management Option Next를 클릭한다.
Specify Database File Storage Option 위에서 생성한 디렉토리를 선택해준다. 기본값은 $ORACLE_BASE/oradata 이다.
Specify Backup and Recovery Options Next를 클릭한다.
Specify Database Schema Passwords 각각의 계정에 대해 암호를 입력한 후 Next를 클릭한다.
Summary 이제까지 설정한 것을 보여준다. 확인 후 Next를 클릭한다.
Install 인스톨 화면이다. 기다리면 다음 화면으로 자동으로 넘어간다.
Configuration Assistants 설정 화면이다. 데이터 베이스 생성이 끝나면 안내 메시지가 나오는데, 전역데이터베이스이름, SID식별자, http://localhost:5500/em 과 SYS,SYSTEM암호는 반드시 외워놓는다. OK를 클릭한 후 Next를 클릭하면 다음 화면으로 넘어간다.
Setup Privileges 루트 유저로 $ORACLE_HOME/root.sh 을 실행하라는 메시지가 나온다. 루트로 실행해준다. 나오는 메시지 중에서 필요한 것은 다음과 같다.
ORACLE_OWNER= oracle
ORACLE_HOME=/export/home/oracle/oraapp/product/10.1.0/Db_1
End of Installation 주어진 내용을 읽어본 후 Exit를 클릭해 인스톨러를 마친다. (포트 리스트는 $ORACLE_HOME/install/portlist.ini 에 있다.) 이것으로 인스톨을 모두 끝냈다.
Ultra Search URL: http://localhost:5620/ultrasearch
Ultra Search Administration Tool URL: http://localhost:5620/ultrasearch/admin
iSQL*Plus URL: http://localhost:5560/isqlplus
iSQL*Plus DBA URL: http://localhost:5560/isqlplus/dba
Enteprise Manager 10g Database Control URL: http://localhost:5500/em
여기까지 하면 오라클의 설치가 끝난것이다. 여기까지만 설치하더라도 오라클의 운영에는 문제 없지만, 좀 더 편한 관리를 위해 컴패니언을 설치한다. (필자는 오라클은 컴패니언까지 인스톨해야 한다고 보고 있다)
oracle@wl ~ $ cksum solarisx86_CCD_10_1_0_3_Disk1.cpio.gz
4119132538      438221549       solarisx86_CCD_10_1_0_3_Disk1.cpio.gz
oracle@wl ~ $ rm -rf Disk1 # 기존에 압축 풀었던 오라클 데이터베이스 인스톨 파일을 지운다
oracle@wl ~ $ gunzip solarisx86_CCD_10_1_0_3_Disk1.cpio.gz
oracle@wl ~ $ cpio -idcmv < solarisx86_CCD_10_1_0_3_Disk1.cpio
oracle@wl ~/Disk1 $ ./runInstaller

3. 오라클 패치

오라클 패치는 오라클을 구매했을때 주는 CID를 이용해 메타링크(http://metalink.oracle.com) 에 가입한 후 받을 수 있다. 직접 패치하는것도 좋지만, 오라클 전문가의 도움을 받는것도 좋을 것이다.
다음은 패치# 2617419(OPatch 1.0.0.0.55), 4751926 (CPUJan2006)를 설치하는 예를 보인 것이다.
oracle@saturn4 ~ $ echo $ORACLE_HOME
/export/home/oracle/oraapp/OraHome_1
oracle@saturn4 ~ $ echo $PATH
/usr/local/bin:/usr/sfw/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/ccs/bin:/export/home/oracle/oraapp/OraHome_1/bin
oracle@saturn4 ~ $ echo $LD_LIBRARY_PATH
/usr/local/xml/lib:/usr/lib:/usr/local/lib:/usr/ucblib:/usr/ccs/lib:/usr/sfw/lib:/export/home/oracle/oraapp/OraHome_1/lib
oracle@saturn4 ~ $ unzip p2617419_10102_GENERIC.zip 
... # OPatch 디렉토리 생성됨
oracle@saturn4 ~ $ cp -r OPatch/ ./oraapp/OraHome_1/ 
oracle@saturn4 ~ $ unzip p4751926_10103_SOLARISx86.zip 
... # README.html, 4751926 디렉토리 생성됨. README.html은 읽어볼것.
oracle@saturn4 ~ $ cd 4751926
oracle@saturn4 ~/4751926 $ /export/home/oracle/oraapp/OraHome_1/OPatch/opatch apply

Oracle Interim Patch Installer version 1.0.0.0.55
Copyright (c) 2006 Oracle Corporation. All Rights Reserved..

We recommend you refer to the OPatch documentation under
OPatch/docs for usage reference. We also recommend using
the latest OPatch version. For the latest OPatch version
and other support related issues, please refer to document
293369.1 which is viewable from metalink.oracle.com

Oracle Home = /export/home/oracle/oraapp/OraHome_1
Location of Oracle Universal Installer components = /export/home/oracle/oraapp/OraHome_1/oui
Location of OraInstaller.jar  = "/export/home/oracle/oraapp/OraHome_1/oui/jlib"
Oracle Universal Installer shared library = /export/home/oracle/oraapp/OraHome_1/oui/lib/intelsolaris/liboraInstaller.so
Location of Oracle Inventory Pointer = /var/opt/oracle/oraInst.loc
Location of Oracle Inventory = /export/home/oracle/oraapp/OraHome_1/inventory
Path to Java = /export/home/oracle/oraapp/OraHome_1/jre/1.4.2/bin/java
Log file = /export/home/oracle/oraapp/OraHome_1/.patch_storage//*.log

Creating log file "/export/home/oracle/oraapp/OraHome_1/.patch_storage/4751926/Apply_4751926_03-21-2006_11-49-00.log"

Invoking fuser to check for active processes.

Invoking fuser on "/export/home/oracle/oraapp/OraHome_1/bin/oracle"
Invoking fuser on "/export/home/oracle/oraapp/OraHome_1/bin/lsnrctl"
Invoking fuser on "/export/home/oracle/oraapp/OraHome_1/bin/tnslsnr"
Backing up comps.xml ...

OPatch detected non-cluster Oracle Home from the inventory and will patch the local system only.


Please shut down Oracle instances running out of this ORACLE_HOME
(Oracle Home = /export/home/oracle/oraapp/OraHome_1)
Is this system ready for updating?
Please respond Y|N > 
Y 1)
Executing the Apply pre-patch script (/export/home/oracle/4751926/custom/scripts/pre)...
Applying patch 4751926...

Patching archive files...

Patching jar files...

Patching copy files...

Creating new directory "/export/home/oracle/oraapp/OraHome_1/cpu/CPUJan2006/MODPLSQL/owa_all/90"
Creating new directory "/export/home/oracle/oraapp/OraHome_1/olap/admin"
Creating new directory "/export/home/oracle/oraapp/OraHome_1/cpu/CPUJan2006/MODPLSQL/owa_all/30"
Creating file to hold list of directories that were mkdir'ed: "/export/home/oracle/oraapp/OraHome_1/.patch_storage/4751926/opatch_dirs_created.lst"
Running make for target client_sharedlib.

Running make for target ioracle.

Running make for target iexp.

Running make for target iimp.

Running make for target iexpdp.

Running make for target iimpdp.

Running make for target libnmuc.

Running make for target libnmemso.

Running make for target ilsnrctl.

Running make for target itnslsnr.

Running make for target ictxload.



Inventory is good and does not have any dangling patches.


Updating inventory...

Verifying patch...
  Verifying that patch ID is in Oracle Home inventory.

  Verifying copy files.

  Verifying jar files.

  Verifying archive files.

OPATCH_VERIFY_OK: Patch has been applied.

Backing up comps.xml ...

********************************************************************************
********************************************************************************
**                                ATTENTION                                   **
**                                                                            **
** Please note that the Security Patch Installation (Patch Deinstallation) is **
** not complete until all the Post Installation (Post Deinstallation)         **
** instructions noted in the Readme accompanying this patch, have been        **
** successfully completed.                                                    **
**                                                                            **
********************************************************************************
********************************************************************************
Executing the Apply post-patch script (/export/home/oracle/4751926/custom/scripts/post)...

OPatch succeeded.
oracle@saturn4 ~/4751926 $ cd $ORACLE_HOME/cpu/CPUJan2006
oracle@saturn4 ~/oraapp/OraHome_1/cpu/CPUJan2006 $ sqlplus /nolog
SQL> connect / as sysdba
SQL> STARTUP
SQL> @catcpu.sql 2)
SQL> QUIT
oracle@saturn4 ~/oraapp/OraHome_1/cpu/CPUJan2006 $ cd $ORACLE_HOME/rdbms/admin
oracle@saturn4 ~/oraapp/OraHome_1/rdbms/admin $ sqlplus /nolog
SQL> connect / as sysdba
SQL> STARTUP
SQL> @utlrp.sql 3)
SQL> select OBJECT_NAME from DBA_OBJECTS where status = 'INVALID'; 4)

no rows selected

SQL> QUIT
oracle@saturn4 ~/oraapp/OraHome_1/rdbms/admin $ 
1) 오라클관련 인스턴스가 모두 종료되었는지 물어보는 프롬프트. 준비되었으면 Y를 입력하고 엔터를 친다.
2) 오랫동안 걸리는 패치가 끝났다. 패치 이후 스크립트를 실행시킨다.
3) 만약 있을지도 모르는 INVALID 객체를 제거하기 위해 실행한다.
4) no rows selected 가 나오면 정상이다.

4. 오라클 인스턴트 클라이언트 설치

Oracle Instant Client는 오라클 10g에서 새롭게 선 보이는 배포버전이다. 오라클 OCI 라이브러리와 SDK, SQL*Plus, JDBC드라이버만을 지원해준다.
파일이름                                                 크기(바이트)   CRC32
instantclient-basic-solarisx86-10.1.0.3-20050404.zip     30,141,480     4208528557
instantclient-jdbc-solarisx86-10.1.0.3-20050404.zip       4,572,527      556902813
instantclient-sqlplus-solarisx86-10.1.0.3-20050404.zip      266,435      793421160
instantclient-sdk-solarisx86-10.1.0.3-20050404.zip          293,993     1919831458
root@wl ~ # unzip instantclient-basic-solarisx86-10.1.0.3-20050404.zip
root@wl ~ # unzip instantclient-sqlplus-solarisx86-10.1.0.3-20050404.zip
root@wl ~ # unzip instantclient-sdk-solarisx86-10.1.0.3-20050404.zip
root@wl ~ # unzip instantclient-jdbc-solarisx86-10.1.0.3-20050404.zip
root@wl ~ # mv instantclient10_1 /usr/local/instantclient10_1
root@wl ~ # vi /usr/local/instantclient10_1/tnsnames.ora
ORCL =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.0.100)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = orcl)
    )
  )
root@wl ~ # vi /etc/profile
# for Oracle Instant Client
if [ -d /usr/local/instantclient10_1 ]
then
  LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/instantclient10_1; export LD_LIBRARY_PATH
  PATH=$PATH:/usr/local/instantclient10_1; export PATH;
  NLS_LANG=Korean_Korea.KO16KSC5601; export NLS_LANG;
  TNS_ADMIN=/usr/local/instantclient10_1; export TNS_ADMIN;
  SQLPATH=/usr/local/instantclient10_1; export SQLPATH;
fi
root@wl ~ # sqlplus 사용자아이디/사용자패스워드@//호스트주소:포트/DB이름
* 오라클 인스턴트 클라이언트는 라이브러리 파일 크기가 크기 때문에, 가상 메모리를 많이 소모한다.

5. 오라클 관련 어플리케이션 설정

  1. 모든 오라클 관련 어플리케이션은 ORACLE_HOME 환경변수가 있어야 동작한다. 따라서 톰캣이나 아파치/PHP을 사용할 때에도 웹서버를 띄우기 전에 ORACLE_HOME이 환경변수에 존재하는지 확인해야 한다.
  2. 한글문제 해결의 기본은 NLS_LANG 환경 변수를 지정해주는 것이다. NLS_LANG=Korean_Korea.KO16KSC5601 또는 NLS_LANG=American_America.KO16MSWIN949 의 조합으로도 사용할 수 있다. 오라클 데이터베이스에 접속하기 전에 NLS_LANG 환경 변수가 존재하며, 올바르게 설정되었는지 반드시 확인해야 한다.
  3. 오라클 시작/종료
    # 오라클 데이터베이스 시작.
    oracle@wl ~ $ sqlplus /nolog # 'dbstart' 스크립트를 이용할 수도 있다.
    SQL> connect sys/패스워드 as sysdba
    SQL> startup
    SQL> exit
    oracle@wl ~ $ lsnrctl start # 리스너 시작 (외부에서 접속하기 위해서는 필요하다)
    oracle@wl ~ $ searchctl start # Ultra Search 시작
    oracle@wl ~ $ isqlplusctl start # iSQL*Plus 시작
    oracle@wl ~ $ emctl start dbconsole # OEM(Oracle Enterprise Manager) 시작
    
    # 인스톨 이후. 오라클을 시작한 상태에서 실행한다.
    # PL/SQL 모듈 재 컴파일
    oracle@wl ~ $ sqlplus "/ AS SYSDBA"
    SQL> @?/rdbms/admin/utlrp.sql
    # 스태틱 라이브러리 생성
    oracle@wl ~ $ $ORACLE_HOME/bin/genclntst
    
    # 종료
    oracle@wl ~ $ emctl stop dbconsole
    oracle@wl ~ $ isqlplusctl stop
    oracle@wl ~ $ searchctl stop
    oracle@wl ~ $ lsnrctl stop
    oracle@wl ~ $ sqlplus /nolog # 'dbshut' 스크립트를 이용할 수도 있다.
    SQL> connect sys/패스워드 as sysdba
    SQL> shutdown immediate
    SQL> exit
    oracle@wl ~ $
    
  4. Java와 Oracle연동
    * 자바용 오라클 JDBC드라이버는 크게 두가지가 있다. 하나는 THIN을 지원해주는 드라이버고 다른 하나는 OCI기반의 드라이버이다. THIN드라이버의 경우 오라클 라이브러리를 설치할 필요 없다는 장점이있다. (성능은 비슷한것으로 판단된다) 아래는 THIN드라이버를 기준으로 한다.
    * Java 1.4인 경우 $ORACLE_HOME/jdbc/lib/ojdbc14.jar 과 $ORACLE_HOME/jdbc/lib/orai18n.jar 를 CLASS_PATH 에 환경변수 넣어준다.
    * Java 1.2, Java 1.3인 경우 $ORACLE_HOME/jdbc/lib/classes12.jar 과 $ORACLE_HOME/jdbc/lib/nls_charset12.jar 를 환경변수 CLASS_PATH에 넣어준다.
  5. PHP 와 Orale연동
    * PHP컴파일시 ./configure부분을 다음으로 대체한다. 반드시 설치하기 전에 오라클에 설치되어있어야 하며 컴파일 할때 환경 변수 ORACLE_HOME 이 설정되어있어야 한다.
    root@wl ~/php-5.0.4 # . ~oracle/.profile
    root@wl ~/php-5.0.4 # ./configure \
     --prefix=/usr/local/php \
     --with-apxs2=/usr/local/apache2/bin/apxs \
     --with-mysql=/usr/local/mysql \
     --with-mysqli=/usr/local/mysql/bin/mysql_config \
     --with-oci8 \
     --enable-sigchild \
     --with-iconv \
     --with-libxml-dir=/usr/local/xml \
     --enable-modules=so \
     --enable-mbstring \
     --enable-mbregex \
     --with-gd \
     --enable-gd-native-ttf \
     --with-jpeg-dir=/usr/sfw \
     --with-png-dir=/usr/sfw \
     --with-zlib-dir=/usr/local
    root@wl ~/php-5.0.4 # make
    root@wl ~/php-5.0.4 # make install
    
    * PHP 4.3.11, PHP 5.0.4부터 오라클 인스턴트 클라이언트(Oracle Instant Client)를 공식 지원한다. 아래는 PHP 5.2.x에서의 인스턴트 클라이언트를 이용한 방법이다. 4.3.x, 5.0.x에서는 설정 방법이 약간 다르다.
    root@wl ~/php-5.2.3 # ./configure \
     --prefix=/usr/local/php \
     --with-apxs2=/usr/local/apache2/bin/apxs \
     --with-mysql=/usr/local/mysql \
     --with-mysqli=/usr/local/mysql/bin/mysql_config \
     --with-oci8=instantclient,/usr/local/instantclient10_1 \
     --enable-sigchild \
     --with-iconv \
     --with-libxml-dir=/usr/local/xml \
     --enable-modules=so \
     --enable-mbstring \
     --enable-mbregex \
     --with-gd \
     --enable-gd-native-ttf \
     --with-jpeg-dir=/usr/sfw \
     --with-png-dir=/usr/sfw \
     --with-zlib-dir=/usr/local
    root@wl ~/php-5.2.3 # make
    root@wl ~/php-5.2.3 # make install
    
    * 필자가 확인한 결과 PHP 5.0.x에서는 오라클의 커넥션이 끊어지지 않는 현상이 있다. 꼭 솔라리스에 국한된 문제는 아니며, OCI라이브러리를 사용하던 인스턴트 클라이언트를 사용하던 결과는 같다. 상용 서비스에서 오라클이 필요하다면 PHP 4.4.x를 사용하도록 한다. 설치방법은 PHP 5.0.x와 같다. 꼭 PHP 5를 사용해야 한다면, PHP 4.4.0의 OCI익스텐션 소스를 PHP 5.0.x소스에 덮어써 해결할 수 있다고 한다. PHP버그ID 32361 번 (http://bugs.php.net/bug.php?id=32361)에서 확인할 수 있다. 이는 PHP 5.1.2에서 해결되었다.
Posted by 1010
60.Unix2008. 12. 16. 17:11
반응형

유닉스에서 개발 웹 서버 설치, 설정하기

빠르고 기능이 풍부하고 자유롭게 사용 가능한 웹 서버를 만들면서 여러분의 유닉스 실력을 한 단계 높여보자

developerWorks
Go to the previous page 12 페이지 중 8 페이지 Go to the next page

문서 옵션
수평출력으로 설정

이 페이지 출력


제안 및 의견
피드백

튜토리얼 평가

이 컨텐츠를 개선하기 위한 도움을 주십시오.


예제 애플리케이션 설치

톰캣에는 한 가지 주요 예제 애플리케이션이 들어 있다. 이 애플리케이션이 여러분에게 들어맞는 애플리케이션 요구 사항을 테스트하는 데에 확실히 충분하다고는 말할 수 없겠지만 기본적인 JSP 애플리케이션과 기본 서블릿의 기능 테스트를 제공할 것이다.

WAR 위치 찾기

애플리케이션 배치를 위해 톰캣 애플리케이션 매니저를 사용한다면 배치를 위한 웹 아카이브(Web Archive: WAR)를 선택하고자 어떤 디렉터리를 찾아야 할지 알아야 할 것이다. 이 파일을 찾으려면 Listing 11의 코드를 사용한다.


Listing 11. 배치를 위해 WAR 파일 찾기
                    
bash-3.00# cd $CATALINA_HOME
bash-3.00# find . -name *.war
./webapps/docs/appdev/sample/sample.war
./webapps/sample.war




위로


서버를 배치하기 위해 톰캣 웹 애플리케이션 매니저 콘솔 열기

Manager Application에서 Deploy 섹션을 스크롤하여 아래로 내린다. 그림 5에 보였다.


그림 5. 예제 애플리케이션 배치
예제 애플리케이션 배치

War file to deploy에서 Browse를 클릭한다. 위에 나타난 경로를 보고 예제용 애플리케이션을 선택한다. Open을 클릭하고 나서 Deploy를 클릭한다. 실제로 에제 애플리케이션 배치는 이처럼 간단하다.




위로


예제 애플리케이션 테스트하기

애플리케이션 배치 후 http://localhost:8080/sample/로 가서 제대로 나타나는지 살펴볼 수 있다. 여기서 JSP를 클릭하고 난 후 그림 6처럼 기본 애플리케이션 기능이 제대로 뜨고 잘 동작하는지 확인하고자 Servlet을 클릭해볼 수 있다. 이제 서버가 애플리케이션을 띄울 준비가 되었다.


그림 6. 예제 애플리케이션 테스트 및 검증 페이지
예제 애플리케이션 테스트 및 검증 페이지

이건 그저 여러분의 톰캣 서버가 제대로 설치되어 의도했던 대로 동작한다는 걸 말하려는 것뿐이다. 개인 애플리케이션을 배치하려면 톰켓 서버 디렉터리 하의 "컨텍스트 루트(context roots)"에 패키징하여 설치하는 것을 고려하는 J2EE 지침에 따라야 한다.

Posted by 1010
60.Unix2008. 12. 16. 17:10
반응형

유닉스에서 개발 웹 서버 설치, 설정하기

빠르고 기능이 풍부하고 자유롭게 사용 가능한 웹 서버를 만들면서 여러분의 유닉스 실력을 한 단계 높여보자

developerWorks
Go to the previous page 12 페이지 중 7 페이지 Go to the next page

문서 옵션
수평출력으로 설정

이 페이지 출력


제안 및 의견
피드백

튜토리얼 평가

이 컨텐츠를 개선하기 위한 도움을 주십시오.


톰캣 웹 애플리케이션 매니저 설정

톰캣 웹 애플리케이션 매니저에서는 웹 애플리케이션 관리에 도움을 주는 많은 기능을 제공한다. 여기서는 여러 가지 방식으로 웹 애플리케이션을 배치 그리고 "철수(undeploy)", 애플리케이션 목록 보기, 재탑재, 애플리케이션 중지와 시작 등을 할 수 있도록 해준다.

특정 사용자 접근 허용하기

톰캣 웹 애플리케이션 매니저를 구현하려면 우선 tomcat-users.xml 파일에서 특정 사용자에게 접근을 허용해야 한다. 그렇게 하려면 Listing 9의 코드를 사용한다.


Listing 9. 사용자와 역할을 추가하여 톰캣 웹 애플리케이션 매니저에 접근 허용
                    
vi tomcat-users.xml
아래와 같은 두 <tomcat-users> 태그 사이에 그 사이에 있는 두 줄을 추가 
	<tomcat-users>
	<role rolename="manager"/>
	<user username="tomcat1" password="test1234" roles="manager"/>
	</tomcat-users>

이상하게 여기겠지만 위의 user와 password 부분의 사용자 이름과 암호는 완전히 임의로 넣은 것이다. 유닉스 서버 상의 암호를 가진 사용자를 생성할 필요는 없으며 원하는 대로 생성하면 된다. 다만 이 생성된 정보를 갖고 관리 콘솔에 로그인할 정보로 사용하게 될 것이라는 건 명심해두자.

보안을 위해 tomcat-user.xml 파일을 파일 소유자만 접근할 수 있도록 제한하자. 그렇게 하려면 권한을 700으로 설정해야 한다. 예를 들면 아래와 같이 한다.

# chmod 600 tomcat-users.xml




위로


톰캣 서버 재시작

변경된 내용을 적용하려면 톰캣 서버를 재시작해야 한다. 그러기 위해서는 Listing 10의 코드를 사용한다.


Listing 10. 톰캣 서버 재시작하기
                    
cd $CATALINA_HOME/bin
./shutdown.sh 
./startup.sh ;tail -f ../logs/catalina.out

catalina.out 로그 파일을 tail 명령어로 보면 다음과 비슷할 것이다.

May 15, 2008 4:08:12 PM org.apache.jk.server.JkMain start
INFO: Jk running ID=0 time=0/74  config=null
May 15, 2008 4:08:12 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 6271 ms




위로


톰캣 웹 애플리케이션 매니저 콘솔 열기

톰캣 관리 콘솔로 되돌아가자. 화면 왼쪽 네이게이션 부분에서 Administration에서 Tomcat manager 링크를 클릭한다. 그러고 나면 그림 4와 비슷한 창을 보게 될 것이다.


그림 4. 톰캣 웹 애플리케이션 매니저 시작 페이지
톰캣 웹 애플리케이션 매니저

톰캣은 상태 애플리케이션도 갖고 있다. 이 애플리케이션에서는 JVM의 메모리 사용량과 쓰레드 개수 등 톰캣 서버의 상태를 표시해준다. 톰캣 웹 애플리케이션 매니저의 오른쪽 상단에서 Server Status를 클릭하면 아주 유용한 이 도구에 접근할 수 있다.

Posted by 1010