리눅스 (Linux)2016. 4. 27. 11:12


/usr/lib/libgconf2-4/gconf-sanity-check-2 exited with status 256 상태에서 종료되었습니다.

그런데 ssh 원격접속은 돼더라구요.
GNOME 환경설정 부분이 잘못 되었나봅니다.
이래저래 구글링을 하며 따라해 봤지만 잘 안돼더라구요.

root 로 접속해서 이것저것 살펴보다가 /tmp 디렉토리가 이상한 것을 발견했네요. +_+!
/tmp 디렉토리 권한이 drwxr-xr-x 이었던가... 지금은 수정을 해버려서 뭐였는지 기억이 잘 안나네요;;
아마 저거였을 겁니다...ㅋ
어쨋든! 이 /tmp 디렉토리 권한이 drwxrwxrwx 가 아니더라구요.

그래서 바꿔주었더니 경고창도 안뜨고 바탕화면도 아주 잘 보이더군요.
혹시나 저와 같은 고통(?)을 겪고 계시는 분들이 있을까 하고 올려봅니다...-_ㅜ

root@ubuntu:/# chmod 777 /tmp/


Posted by 랩퍼우
톰캣 (Tomcat)2016. 4. 21. 19:59

1.           Jdk1.7 설치 및 환경설정

 

1.1         Jdk 설치 및 환경설정

1.1.1  설치

Jdk jdk1.4.2 version 이상 설치한다. 여기서는 jdk1.7 버전을 설치 하였다.

Jdk설치 과정은 생략한다.

 

1.1.2  환경설정

Jdk가 설치된 경로에 맞게 환경변수를 설정 해준다.

-    설치경로 : /usr/jdk1.7.0_79

-    /etc/profile에 아래 path추가

vi /etc/profile

# javapath

export JAVA_HOME="/usr/jdk1.7.0_79"

PATH="$JAVA_HOME/bin:$PATH"

 

Java가 정상적으로 설치 됬는지 확인.

Java -version


설치 한 버전에 맞게 정보가 출력 되는지 확인한다.


 

2.           Tomcat7 설치 및 환경설정

 

2.1         다운로드 

apache-tomcat-7.0.50.tar.gz

 

#cd /usr/local/src

 

#wget http://archive.apache.org/dist/tomcat/tomcat-7/v7.0.50/bin/apache-tomcat-7.0.50.tar.gz

Wget 에러시 # yum install wget (wget 패키지 설치)

 

2.2         압축해제 및 이동

# tar zxvf apache-tomcat-7.0.50.tar.gz

 

# mv /usr/local/src/apache-tomcat-7.0.50 /usr/local/tomcat7

 

2.3         httpd 방화벽 해제

#vi /etc/sysconfig/iptables

 

-A INPUT -m state NEW -m tcp -p tcp --dport 8080 -j ACCEPT

 

#service iptables restart

 

2.4         환경설정 추가

#vi /etc/profile

 

export CATALINA_HOME=/usr/local/tomcat7

export PATH=$PATH:$CATALINA_HOME/bin

 

#source /etc/profile

 

2.5         실행 및 테스트

/usr/local/tomcat7/bin (경로)

#catalina.sh start

OR

# /usr/local/tomcat7/bin/startup.sh (Tomcat 실행)

# /usr/local/tomcat7/bin/shutdown.sh (Tomcat 중지)

 

http://localhost:8080/

웹페이지에서 해당 포트 8080으로 고양이가 보이면 정상적으로 톰캣 서비스 것입니다.


Posted by 랩퍼우
Was2016. 4. 21. 19:48

1.1         목적

Jeus6, oracle 연동 설정 및 확인 방법을 설명한다.

 

OS

Centos 6.7

oracle

Enterprise 11

Webtob

4.1

Jeus

6.0

 

3.            제우스 실행 콘테이너 실행, 웹투비실행

 

# ./wsboot -i
# ./jeus
# ./jeusadmin localhost.localdomain

Ex) jeusadmin gwanak -Uadministrator -Pijinc123

기동: boot

종료: down

 

http://(ip address):8080/examples/index.jsp (홈페이지 확인)

http://(ip address):8088/examples/index.jsp (홈페이지 확인)

 

(jeusadmin으로 로그인후)

콘테이너 시작시 :  # startcon 콘테이너명   (ex)  # startcon gwanak_container1

콘테이너 종료시 :  # downcon 콘테이너명   (ex)  # downcon gwanak_container1

 

4.           오라클 접속 서비스 실행

 

$ su - oracle

$ lsnrctl start
$ sqlplus "/as sysdba"
SQL> startup

 

 

<%@ page contentType="text/html; charset=EUC-KR" pageEncoding="EUC-KR" %>
<%@ page language="java" import="java.util.*, java.sql.*, javax.servlet.http.*" %>

<%! 
 Connection DB_Connection() throws ClassNotFoundException, SQLException, Exception 
 {
  String url = "jdbc:oracle:thin:@127.0.0.1:1521:ORCL";
  String username = "study";
  String userpass = "study";
  Class.forName("oracle.jdbc.driver.OracleDriver");
  Connection conn = DriverManager.getConnection(url, username, userpass);
  return conn;
 }
%>

<%
 Connection conn = DB_Connection();
 Statement stmt = null;
 ResultSet rs = null;

 try
 {

  String sql_n = "select count(*) from tab";

  stmt = conn.createStatement();

  rs = stmt.executeQuery( sql_n );

  out.print(sql_n);

  rs.next();

  out.println("<br>쿼리 test : "+rs.getString(1));

  rs.close();
  conn.close();
 }

 catch(Exception e)
 {
  out.println("<br>oracle error <br>");
  out.println( e.toString() );
 }

 finally
 {
  if(conn != null) try{conn.close();} catch(Exception e){}
 }
%>

<html>
<head>
<title>
제우스 오라클 테스트</title>
</head>
<table cellspacing=1 width=200 border=1>
 <tr>
 <td width=100><p align=center>test</p></td>
 <td width=100><p align=center>
테스트</p></td>
 </tr>
</table>
</html>

 

 

6.1 JEUS 매니저 리소스 - JDBC 선택

 

6.2 JDBC 데이터 소스 생성

6.3 Oracle ConnectionPoolDataSource -Thin

 

6.4 SID name 오라클 설정 했을때 정한 이름, 네트워크는 TCP, PORT 1521, 서버

네임은 localhost 되어 있지만 자기 아이피 주소를 작성

 

6.5 확인 다음

 

6.6 생성 클릭

 

7.            JEUSMain.xml (설정) 확인

경로: /jeus6/config/localhost/JEUSMain.xml

 

 

경로: /jeus6/config/localhost/localhost_sevlet_engine1/WEBMain.xml

[WEBMain.xml]

<web-container xmlns="http://www.tmaxsoft.com/xml/ns/jeus" version="6.0">

    <context-group>

        <group-name>MyGroup</group-name>

        <webserver-connection>

            <http-listener>

                <listener-id>http1</listener-id>

                <port>8088</port>

                <thread-pool>

                    <min>10</min>

                    <max>20</max>

                    <step>1</step>

                </thread-pool>

            </http-listener>

            <webtob-listener>

                <listener-id>webtob1</listener-id>

                <port>9900</port>

                <output-buffer-size>8192</output-buffer-size>

                <thread-pool>

                   <min>1</min>

                   <max>5</max>

                   <step>1</step>

                   <max-idle-time>30000</max-idle-time>

                </thread-pool>

                <disable-pipe>true</disable-pipe> <===== 추가

                <webtob-address>localhost</webtob-address> <!-- WebToB 아이피 -->

              <webtob-home>/root/webtob</webtob-home>  <=== webtob 홈경로 추가

                <registration-id>MyGroup</registration-id>

            </webtob-listener>

        </webserver-connection>

    </context-group>

</web-container>

 

[참고] 다른머신에서 수행할적에 <disable-pipe> true

       같은 머신이면 <disable-pipe> false, 그리고 <webtob-home> 추가해야함

 

한글이 꺠지면 아래 내용 추가

 <encoding>
         <request-url-encoding>
            <default>EUC-KR</default>
            <forced>EUC-KR</forced>
         </request-url-encoding>
         <request-encoding>
            <default>EUC-KR</default>
            <forced>EUC-KR</forced>
         </request-encoding>
         <response-encoding>
            <default>EUC-KR</default>
            <forced>EUC-KR</forced>
         </response-encoding>
      </encoding>

 

9.           Ojdbc.jar 파일 Jeus 라이브러리 데이터 소스폴더에 복사

경로: /app/oracle/product/11.2.0/db_1/jdbc/lib (데이터베이스)

경로: /home/tmax/jeus6/lib/datasource (Jeus)

 

http://(ip address):8080/examples/index.jsp (기본 경로를 찻음)

test.jsp 파일을 추가 http://(ip address):8080/examples/test.jsp (테스트할 경로)

 

Jeus 폴더webhome 이란게 눈에 들어왔고 확인을 해보니 examples 폴더가 있더군요.

 

 

examples_war__ 아래 test.jsp 생성  http://(ip address):8080/examples/test.jsp 접속

 

글씨가 꺠져서 보이면 검정 글씨 부분을 삭제합니다.

<%@ page contentType="text/html; charset=EUC-KR" pageEncoding="EUC-KR" %>

 

10.        브라우저 확인

http://(ip address):8080/examples/test.jsp 접속

'Was' 카테고리의 다른 글

[JEUS] WEBTOB 및 JEUS 실행  (0) 2016.03.03
제우스 쓰레드 덤프, 모니터링 방법  (0) 2016.02.23
[CentOS] JBoss 6.0 설치하기  (0) 2016.02.17
WebtoB vs JEUS 및 서블릿 컴파일  (0) 2016.02.05
jeus webtob 설치 및 연동하기  (0) 2016.02.05
Posted by 랩퍼우
아파치 (Apache )2016. 4. 21. 19:46

1.         JAVA 환경변수 설정

▶ 압축 해제

경로: /usr/java

 

tar zxvf jdk-7u79-linux-x64.gz

 

▶자바 환경 변수 설정

 1.사용자마다 공통된 자바 환경 설정을 적용하려면?

   # vi /etc/profile

   HISTSIZE 항목 밑에

   # Java Enviroment Configuration

   JAVA_HOME="/usr/java/jdk"

   CLASSPATH=".:/usr/java/jdk/lib/tools.jar"

   PATH="$PATH:/usr/java/jdk/bin/"

   export JAVA_HOME CLASSPATH

 

 2.새로운 환경 변수를 적용한다.

   # source /etc/profile

 

 3.아래처럼 메세지 발생하면 정상 설치

   # java -version

java version "1.7.0_79"

Java(TM) SE Runtime Environment (build 1.7.0_79-b15)

Java HotSpot(TM) 64-Bit Server VM (build 24.79-b02, mixed mode)

 

호스트명 확인 및 호스트명 변경

# vi /etc/sysconfig/network (호스트명 변경)

# vi /etc/hosts          (호스트명 변경)

# hostname  호스트명  (호스트명 변경)

 

아래의 명령을 실행하여 의존 패키지를 설치합니다.

yum -y install wget gcc gcc-c++ openssl-devel

 

아래의 명령을 실행하여 Apache HTTPD 설치시 필요한 소스를 다운로드 받습니다.

다운로드

– apache : http://www.apache.org/dyn/closer.cgi
– apr/apr-util : https://apr.apache.org
– pcre :  
http://www.pcre.org

 

 

먼저 파일들을 다운받을 적당한 디렉토리를 선택한다. 여기선 /usr/local/src으로 가정합니다.

# 디렉토리를 이동

$ cd /usr/local/src

 

아래의 명령을 실행하여 다운로드 받은 Apache HTTPD Source 의 압축을 해제합니다.

# 아파치 패키지 파일을 다운 받습니다.

$ wget http://www.atblog.co.kr/file/package/httpd-2.4.10.tar.gz

 

# 그리고 압축을 해제 시켜두자

$ tar xvfz httpd-2.4.10.tar.gz

 

설치경로: /usr/local/apache

 

여기까지 완료되었으면 추가로 Apache설치를 하기 위한 존속성 패키지들을 설치 것이다.

apr 설치 하자.

# 패키지를 다운받고

$ wget http://www.atblog.co.kr/file/package/apr-1.5.1.tar.gz

# 압축을 해지시킨 후

$ tar xvfz apr-1.5.1.tar.gz

# 내부로 진입해 기본적인 세팅과 컴파일 과정을 거친다.

$ cd apr-1.5.1

$ ./configure

$ make

$ make install

$ /usr/local/apr (apr 설치 폴더명 확인)

 

다음 설치 것은 apr-util

# apr설치와 다를건 없다.

# 다시 디렉토리로 돌아와서

$ cd ..

$ wget http://www.atblog.co.kr/file/package/apr-util-1.5.4.tar.gz

$ tar xvfz apr-util-1.5.4.tar.gz

$ cd apr-util-1.5.4

$ ./configure --with-apr=/usr/local/apr

$ make

$ make install

 

끝으로 pcre 설치 합니다.

# 다시 디렉토리로 돌아와서

$ cd ..

$ wget http://www.atblog.co.kr/file/package/pcre-8.36.tar.gz

$ tar xvfz pcre-8.36.tar.gz

$ cd pcre-8.36

$ ./configure --prefix=/usr/local/pcre

$ make

$ make install

 

8.1         소스 컴파일 및 설치

여기까지 설치 하였다면 기본적은 패키지는 전부 설치되어 있다고 있습니다.
이제 아파치를 세팅할 것입니다.

$ cd ..

$ cd httpd-2.4.10

$ ./configure --prefix=/apache --enable-http  --enable-info --enable-cgi --enable-so --with-pcre=/usr/local/pcre --with-apr=/usr/local/apr

$ make

$ make install

 

이제 설치가 완료되었으니 아파치를 구동시켜보자.

$ /usr/local/apache/bin/httpd -k start

 

8.2         설치 확인

정상적으로 설치가 되었는지 확인하기 위하여 아래의 명령을 실행합니다.

localhost:root:/usr/local/apache/bin># httpd -v

Server version: Apache/2.2.15 (Unix)

Server built:   Mar 22 2016 19:03:53

 

8.3         아파치 환경설정

localhost:root:/usr/local/apache/conf># vi httpd.conf

 

Listen@@Port@@ => 80으로 변경

User daemon => nobody으로 변경

Group daemon => nobody으로 변경

 

189 #ServerName (주석해제 후 해당 아이피 작성) => ServerName (호스트네임)

 

8.4         HTTPD 실행

설치 폴더의 bin 디렉토리로 이동합니다.

cd /usr/local/apache/bin

 

아래의 명령을 이용하여 Apache HTTPD를 실행합니다.

./apachectl start

 

정상적으로 프로세스가 실행이 되었는지 확인하기 위하여 아래의 명령을 실행하여 HTTPD 의 프로세스를 확인합니다

ps -ef | grep httpd

root     13729     1  0 18:06 ?        00:00:00 /app/httpd-2.4.9/bin/httpd -k start

daemon   13730 13729  0 18:06 ?        00:00:00 /app/httpd-2.4.9/bin/httpd -k start

daemon   13731 13729  0 18:06 ?        00:00:00 /app/httpd-2.4.9/bin/httpd -k start

daemon   13732 13729  0 18:06 ?        00:00:00 /app/httpd-2.4.9/bin/httpd -k start

root     13815 14640  0 18:06 pts/0    00:00:00 grep httpd

 

정상적으로 실행이 되면 아래와 같이 프로세스 정보가 나타납니다. 만약 아래와 같이 정상적으로 프로세스가 실행되지 않거나 오류 메시지가 나타나면 아래의 오류대응을 참고하시면 됩니다.

 

파일에 위의 것이 없으면 추가해주고 저장하고 나온다.

[root@192 apache]# vi /etc/sysconfig/iptables

-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT

 

[root@192 apache]# /etc/init.d/iptables restart  (방화벽 서비스 다시 시작)

It works!가 나온다면 설치 성공~!

apr_sockaddr_info_get() failed for node01

 

10.1      오류 내용

Apache HTTPD 시작시 아래와 같은 오류 메시지가 출력되며, 실제 기동이 되지 않습니다. node01 이라는 호스트명에 대한 실제 IP 를 찾지 못해서 발생하는 문제입니다.

AH00557: httpd: apr_sockaddr_info_get() failed for node01

 

10.2      오류 해결

아래의 명령을 실행하여 /etc/hosts 파일을 편집합니다.

아래와 같이 해당 호스트명 (node01) 을 등록한 후 저장합니다.

vi /etc/hosts

127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4 node01

::1         localhost localhost.localdomain localhost6 localhost6.localdomain6

 

10.3      오류 내용

httpd: Could not reliably determine the server's fully qualified domain name

 

10.4      오류 해결

httpd.conf 파일 수정

ServerName localhost:80   / ServerName 127.0.0.1


Posted by 랩퍼우
아파치 (Apache )2016. 4. 21. 19:45

Tomcat 홈페이지에서 먼저 Connectors(mod_jk) 다운받는다.

http://tomcat.apache.org/download-connectors.cgi

다운로드가 완료되면 받은 파일을 리눅스 서버에 옮긴다.

 

다운받은 Connectors 파일의 압축을 해제한다.

압축해제가 완료되면 {Connectors 디렉토리}/native 디렉토리로 이동한다.

tar zxvf tomcat-connectors-1.2.37-src.tar.gz

cd tomcat-connectors-1.2.37-src/native

./configure --with-apxs=/usr/sbin/apxs  (yum install 설치했을 때의 위치)

 or

./configure --with-apxs=/usr/local/httpd/jboss-ews-2.1/httpd/sbin/apxs (아파치 설치 서버 경로)

 

make

make install

위의 명령어를 실행하면 httpd/modules 디렉토리 아래에 mod_jk.so 파일이 생성된다.

이때 apxs 위치는 Apache 어떻게 설치했는지에 따라 다르다.

위의 경로는 yum install 설치했을 때의 위치이다.

 

./configure --with-apxs=/usr/sbin/apxs

위와 같은 에러메세지가 나온다면 

#> yum -y install httpd-devel

패키지를 설치한다

 

apache/modules/mod_jk.so     #해당 파일이 존재하는지 확인.

 

httpd/modules 디렉토리에 mod_jk.so 생성 됬다면 Connectors 재대로 설치된 것이다.

설치가 완료되면 httpd.conf 파일에 맨마지막 줄에 아래와 같이 내용을 추가한다

#

# apache - tomcat connector module

#

LoadModule jk_module modules/mod_jk.so

 

<IfModule jk_module>

    JkWorkersFile "conf/workers.properties"

    JkLogFile "logs/mod_jk.log"

    JkLogLevel info

    JkLogStampFormat "[%a %b %d %H:%M:%S %Y] "

    JkRequestLogFormat "%w %V %T"

</IfModule>

# mount file list

JkMount /*.do worker1

JkMount /*.jsp worker1

JkMount /servlet/* worker1

모듈을 설정한 worker 파일을 생성한다.

httpd/conf 디렉토리에 workers.properties 파일을 생성한다.

 

5.           workers 설정 파일 (/usr/local/apache/conf/ 에 생성)

# vi workers.properties

 

worker.list=worker1

 

worker.worker1.type=ajp13

worker.worker1.host=localhost

worker.worker1.port=8009

worker.worker1.lbfactor=1

여기까지 완료되면 mount file list 설정한 .do .jsp 등으로 접속을 시도할 경우 Apache 아닌 Tomcat 설정된 경로의 파일이 실행된다.

예를 들어서 aaa.swcode.net으로 접속할 경우 해당 주소로 연결된 디렉토리의 index.html 파일이 열리지만 aaa.swcode.net/index.jsp 접속할 경우 Tomcat 설정된 경로의 index.jsp 실행된다.

 

 

 

  - apache 서비스 재시작

  - tomcat 서비스 재시작

- 웹페이지 localhost/index.jsp 했을 Apache Tomcat 페이지가 나오면 정상적으로 연동된 것입니다.

-  localhost했을 때는 아파치 시작 페이지가 나옵니다.

 

Posted by 랩퍼우
아파치 (Apache )2016. 4. 21. 19:44


1.2       설치 전 준비 자료

구 분

설 명

jdk

jdk 1.7

X-Window

-

Oracle10g

-

Swap memory

10GB

 

1.3       설치 환경

구 분

설 명

OS

CentOS 6.7

bit

64bit

Kernel

2.6.18-398.e15


 

Jdk1.5, Oracle 환경설정 및 설치.

 

2.1         Jdk 설치 환경설정

2.1.1  설치

Jdk jdk1.4.2 version 이상 설치한다. 여기서는 jdk1.7 버전을 설치 하였다.

Jdk설치 과정은 생략한다.

 

2.1.2  환경설정

Jdk가 설치된 경로에 맞게 환경변수를 설정 해준다.

-    설치경로 : /usr/jdk1.7.0_79

-    /etc/profile에 아래 path추가

vi /etc/profile

# javapath

export JAVA_HOME="/usr/jdk1.7.0_79"

PATH="$JAVA_HOME/bin:$PATH"

 

Java가 정상적으로 설치 됬는지 확인.

Java -version

설치 한 버전에 맞게 정보가 출력 되는지 확인한다.

 

3.1    네임서버 설정

#vi /etc/resolv.conf

nameserver 168.126.63.1

nameserver 168.126.63.2

 

 

 

3.2    Gcc 패키지 설치 (필수 패키지)

yum -y install wget gcc gcc-c++ openssl-devel

 

3.3    기존에 httpd 패키지 확인

httpd 삭제

[root@localhost apr-1.4.8]# rpm -qa |grep httpd (패키지 확인)

[root@localhost apr-1.4.8]# which httpd (설치 되어있는지 확인)

[root@localhost apr-1.4.8]# yum remove httpd (삭제)

 

4.         Apache (아파치) 설치

4.1    설치파일 다운로드

– apache : http://www.apache.org/dyn/closer.cgi
– apr/apr-util : https://apr.apache.org
– pcre :  http://www.pcre.org

 

먼저 파일들을 다운받을 적당한 디렉토리를 선택한다. 여기선 /usr/local/src으로 가정합니다.

# 디렉토리를 이동 하자.

$ cd /usr/local/src

 

4.2    Apache HTTPD 압축 해제

아래의 명령을 실행하여 다운로드 받은 Apache HTTPD Source 압축을 해제합니다.

# 아파치 패키지 파일을 다운 받는다.

$ wget http://www.atblog.co.kr/file/package/httpd-2.4.10.tar.gz

# 그리고 압축을 해제 시켜두자

$ tar xvfz httpd-2.4.10.tar.gz

설치경로: /usr/local/apache

 

4.3    Apr (Apache Portable Runtime)  소스

여기까지 완료되었으면 추가로 Apache설치를 하기 위한 존속성 패키지들을 설치 것이다.

apr 설치 하자.

# 패키지를 다운받고

$ wget http://www.atblog.co.kr/file/package/apr-1.5.1.tar.gz

# 압축을 해지시킨

$ tar xvfz apr-1.5.1.tar.gz

# 내부로 진입해 기본적인 세팅과 컴파일 과정을 거친다.

$ cd apr-1.5.1

$ ./configure

$ make

$ make install

$ mv apr-1.5.1 apr

 

4.4    apr-util 설치

# apr설치와 다를건 없다.

# 다시 디렉토리로 돌아와서

$ cd ..

$ wget http://www.atblog.co.kr/file/package/apr-util-1.5.4.tar.gz

$ tar xvfz apr-util-1.5.4.tar.gz

$ cd apr-util-1.5.4

$ ./configure --with-apr=/usr/local/apr

$ make

$ make install

 

4.5    PCRE 설치

# 다시 디렉토리로 돌아와서

$ cd .

$ wget http://www.atblog.co.kr/file/package/pcre-8.36.tar.gz

$ tar xvfz pcre-8.36.tar.gz

$ cd pcre-8.36

$ ./configure --prefix=/usr/local/pcre

$ make

$ make install

 

4.6     HTTPD 설치

4.6.1        소스 컴파일 및 설치

여기까지 설치 하였다면 기본적은 패키지는 전부 설치되어 있다고 있습니다.
이제 아파치를 세팅할 것입니다.

$ cd ..

$ cd httpd-2.4.10

$ ./configure --prefix=/apache --enable-http  --enable-info --enable-cgi --enable-so --with-pcre=/usr/local/pcre --with-apr=/usr/local/apr

$ make

$ make install

 

이제 설치가 완료되었으니 아파치를 구동시켜보자.

$ /usr/local/apache/bin/httpd -k start

 

4.7    설치 확인

정상적으로 설치가 되었는지 확인하기 위하여 아래의 명령을 실행합니다.

localhost:root:/usr/local/apache/bin># httpd -v

Server version: Apache/2.2.15 (Unix)

Server built:   Mar 22 2016 19:03:53

 

4.8    아파치 환경설정

localhost:root:/usr/local/apache/conf># vi httpd.conf

 

Listen@@Port@@ => 80으로 변경

User daemon => nobody으로 변경

Group daemon => nobody으로 변경

189 #ServerName (주석해제 해당 아이피 작성) => ServerName (호스트네임)

 

4.9     HTTPD 실행

설치 폴더의 bin 디렉토리로 이동합니다.

cd /usr/local/apache/bin

 

아래의 명령을 이용하여 Apache HTTPD 실행합니다.

./apachectl start

 

정상적으로 프로세스가 실행이 되었는지 확인하기 위하여 아래의 명령을 실행하여 HTTPD 프로세스를 확인합니다

ps -ef | grep httpd

root     13729     1  0 18:06 ?        00:00:00 /app/httpd-2.4.9/bin/httpd -k start

daemon   13730 13729  0 18:06 ?        00:00:00 /app/httpd-2.4.9/bin/httpd -k start

daemon   13731 13729  0 18:06 ?        00:00:00 /app/httpd-2.4.9/bin/httpd -k start

daemon   13732 13729  0 18:06 ?        00:00:00 /app/httpd-2.4.9/bin/httpd -k start

root     13815 14640  0 18:06 pts/0    00:00:00 grep httpd

 

정상적으로 실행이 되면 아래와 같이 프로세스 정보가 나타납니다. 만약 아래와 같이 정상적으로 프로세스가 실행되지 않거나 오류 메시지가 나타나면 아래의 오류대응을 참고하시면 됩니다.

 

4.10  방화벽 오픈

파일에 위의 것이 없으면 추가해주고 저장하고 나온다.

[root@192 apache]# vi /etc/sysconfig/iptables

-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT

 

[root@192 apache]# /etc/init.d/iptables restart  (방화벽 서비스 다시 시작)

 

Tomcat 설치하기 위해 먼저 Apache Tomcat 사이트에서 Tomcat 파일을 다운로드 받습니다.

http://tomcat.apache.org/

 

사이트로 이동하면 왼쪽 사이드바 부분에 있는 Download 에서 Tomcat7 클릭하여 다운로드 페이지로 이동후 다운로드 페이지에서 tar.gz  파일을 다운 받습니다..

5.1      압축해제 및 이동

apache-tomcat-7.0.50.tar.gz

 

#cd /usr/local/src

 

5.2      환경설정 추가

#vi /etc/profile

 

export CATALINA_HOME=/usr/local/tomcat7

export PATH=$PATH:$CATALINA_HOME/bin

 

#source /etc/profile

 

5.3      프로세스 확인

ps -ef |grep catalina

 

5.4      홈페이지 확인

http://localhost:8080

 

 

6.1      다운로드

http://tomcat.apache.org/download-connectors.cgi 에서 소스  download

 

6.2      압축 해제 및 설치

tar zxvf tomcat-connectors-1.2.37-src.tar.gz

cd tomcat-connectors-1.2.37-src/native

./configure --with-apxs=/usr/sbin/apx

make

make install

make install /usr/local/httpd/modules/mod_jk.so 복사됨을 확인

 

에러 발생시

./configure --with-apxs=/usr/sbin/apxs

위와 같은 에러메세지가 나온다면 

#> yum -y install httpd-devel

패키지를 설치한다

 

6.3      Apache httpd 설정

cd /apache/httpd-2.4.18/modules

make

make install

 

cd /apache/httpd-2.4.18/docs/conf

vim httpd.conf

 

LoadModule jk_module modules/mod_jk.so

 

 

6.4      mod_jk compile

RHEL6/CentOS 6 기준이며 compile 하려면 사전에 gcc httpd-devel 패키지가 설치되어 있어야 한다. (yum install gcc gcc-c++ httpd-devel)

mod_jk compile 귀찮으면 첨부되어 있는 pre-compiled connector 다운받은 후에/etc/httpd/moduels 복사해 준다.

mod_jk 받아 아파치의 modules 추가됨을 확인해야 정상적으로 완료된 것입니다.

 

6.5      apache/modules/mod_jk.so 해당 파일이 존재하는지 확인.

LoadModule jk_module /apache/httpd-2.4.18/modules/mod_jk.so

JkWorkersFile "conf/workers.properties"

JkLogFile "logs/mod_jk.log"

JkLogLevel info

JkLogStampFormat "[%a %b %d %H:%M:%S %Y]"

JkRequestLogFormat "%w %V %T"

JkMount /*.do worker1

JkMount /*.jsp worker1

JkMount /servlet/* worker1

 

6.6      workers.properties 파일생성

workers.tomcat_home="/tomcat/tomcat8"

workers.java_home=" /usr/java/jdk"

ps=/

worker.list=ajp13

worker.ajp13.port=8009

worker.ajp13.host=localhost

worker.ajp13.type=ajp13

 

6.7      mod_jk.conf 파일생성

[root@localhost conf]# vi mod_jk.conf

 

<IfModule mod_jk.c>

        JkWorkersFile "/apache/httpd-2.4.18/docs/conf/extra/workers.properties"

        JkLogFile "/tomcat/tomcat8/logs/mod_jk.log"

        JkLogLevel info

        JkAutoAlias "/tomcat/tomcat8/webapps"

        JkMount /* ajp13

        JkMount /*.jsp ajp13

        JkMount /servlet/* ajp13

        JkMount /examples/*.jsp ajp13

        JkLogStampFormat "[%a %b %d %H:%M:%S %Y]"

        JkOptions +ForwardKeySize +ForwardURICompat -ForwardDirectories

        JkRequestLogFormat "%w %V %T"

</IfModule>

 

workers.tomcat_home 대입되는 경로는 톰캣디렉토리경로를 작성해주면 되겠습니다.

workers.java_home에는 JDK 디렉토리 설치경로를 작성해주시면 됩니다.

 

6.8      workers_uri.properties 생성

/apache/httpd-2.4.18/docs/conf/extra># vi workers_uri.properties

 

/*.do=ajp13

/*.jsp=ajp13

/*.do=ajp13

/*.jsp=ajp13

/*.js=ajp13

/*.gif=ajp13

/*.jpg=ajp13

/*.css=ajp13

 

  - apache 서비스 재시작

  - tomcat 서비스 재시작

 

-  웹페이지 localhost/index.jsp 했을 Apache Tomcat 페이지가 나오면 정상적으로 연동된 것입니다.

-  localhost했을 때는 아파치 시작 페이지가 나옵니다.

 

Posted by 랩퍼우
아파치 (Apache )2016. 4. 20. 15:23

/usr/local/apache/conf># vi httpd.conf



# tomcat connector

Include conf/extra/httpd-jk.conf



# tomcat connector (주석처리)
# Include conf/extra/httpd-jk.conf




/usr/local/apache/bin># ./apachectl start (아파치 재실행)



/usr/local/apache/bin># ps -ef |grep httpd

root      2370     1  0 15:20 ?        00:00:00 /usr/local/apache/bin/httpd -k start

nobody    2371  2370  0 15:20 ?        00:00:00 /usr/local/apache/bin/httpd -k start

nobody    2372  2370  0 15:20 ?        00:00:00 /usr/local/apache/bin/httpd -k start

nobody    2373  2370  0 15:20 ?        00:00:00 /usr/local/apache/bin/httpd -k start

nobody    2374  2370  0 15:20 ?        00:00:00 /usr/local/apache/bin/httpd -k start

nobody    2375  2370  0 15:20 ?        00:00:00 /usr/local/apache/bin/httpd -k start

root      2377  1631  0 15:20 pts/0    00:00:00 grep httpd



Posted by 랩퍼우
데이터베이스 (DB)2016. 4. 7. 19:02

xwindow와 vnc설정 후 오라클 설치 과정에서 vnc로 접속해 ./runInstaller 입력하면 ui창으로 인스톨 창이 나와야 하는데 콜솔창에서 글씨만 주구장창 나온다.

ui를 나오게 하기 위해서는 다음 처럼 작업을 진행 하면 된다.

su – oracle로 계정을 변경하고

cd database

./runInstaller실행시 아래와 같이 에러가 난다.

 

$./runInstaller

Starting Oracle Universal Installer…

 

Checking Temp space: must be greater than 120 MB.   Actual 44130 MB    Passed

 

Checking swap space: must be greater than 150 MB.   Actual 10047 MB    Passed

 

Checking monitor: must be configured to display at least 256 colors

 

    >>> Could not execute auto check for display colors using command /usr/bin/xdpyinfo. Check if the DISPLAY variable is set.    Failed <<<<

 

Some requirement checks failed. You must fulfill these requirements before

 

continuing with the installation,

 

Continue? (y/n) [n] y

 —————————->>>이렇게 나오면 안된다.

root user로 변경한 후  xhost +를 실행

#xhost +

 access control disabled, clients can connect from any host ->>나와도 상관없음.

#xclock(화면에 UI로 아날로그 시계가 뜬다. 시계를 닫고)

#xterm(다른 화면으로 터미널이 뜬다. user는 root이다.)

#xclock (다시 시계가 뜨는지 확인후 시계를 닫는다.)

#echo $DISPLAY(display를 확인한다.)

:0

 

#su – oracle(오라클 계정으로 변경)

$xclock(시계가 뜨는지 확인한다.- 아마도 에러가 날것이다.)

Error: can’t open display

 

$export DISPLAY=:0(DISPLAY 값을 root계정의 DISPLAY 값과 동일하게 맞춰 준다.)

$xclock (다시 시계가 뜨는지확인)

$./runInstaller

정상적으로 실행이되어 화면이 나온다

Posted by 랩퍼우
리눅스 (Linux)2016. 3. 30. 09:02


1. 설치할 OS 종류 확인

# cat /etc/redhat-release
CentOS release 6.5 (Final)

# getconf LONG_BIT
64

2. Samba란 ?

삼바는 리눅스와 윈도우간에 파일 및 프린터를 공유 할 수 있게 해주는 프로그램이다. 삼바를 통해 리눅스 서버를 타운영체제와 파일을 공유할 수 있는 파일서버로도 사용할 수 있다. 이와같이 삼바가 공유할 수있는 이유는 SMB(Server Message Block)/CIFS(Common Internet File System)라는 프로토콜을 이용함으로써 가능해졌다.


(참고)
SMB 란?
SMB(Server Message Block)는 마이크로소프트사와 인텔이 윈도우 시스템이 다른 시스템의 디스크나 프린터와 같은 자원을 공유할 있도록하기 위해 개발된 프로토콜이다. TCP/IP 기반하의 NetBIOS 프로토콜을 이용하기 때문에 이 프로토콜은 NFS, NIS, lpd 와 같은 유닉스의 분산인증구조와 유사하다. 따라서 윈도우 중심의 네트워크 환경에서는 리눅스를 이용한 공유시스템에서는 SMB가 필수적이다.


CIFS 란?
CIFS(Common Internet File System) 는 네트워크를 위한 SMB 파일 공유 프로토콜의 확장된 버전이며, 윈도우와 유닉스 환경을 동시에 지원하는 인터넷의 표준 파일 규약의 프로토콜이다. CIFS는 이전의 폐쇄적인 SMB 프로토콜과는 달리 CIFS 규약 정의는 여러 유닉스 업체의 참여하여 결정된 내용이기 때문에 삼바도 버전이 올라감에 따라(삼바 버전 2.2 이상) CIFS 규약을 잘 준수하여 안정성이 상당히 향상 되었다. 

(출처: https://www.linux.co.kr/home/lecture/?leccode=10644)


3. 설치

# yum install samba

설치시 의존성에 의해 모두 같이 되는 패키지이지만 꼭 필요한 패키지 목록

 samba 

 SMB 서비스 네트워크 데몬 및 기본 유틸리티 포함 

 samba-client

 공유 네트워크 내에 있는 서버리스트 출력

 samba-common

 설정 파일이나 설정 유틸리티, Man 페이지 포함

설치완료 후 생성되는 파일은 다음과 같다.

# ls /etc/samba
lmhosts  smb.conf  smbusers

 lmhosts 

 공유 네트워크 내에 있는 서버리스트 정보을 담은 파일

 smb.conf

 Samba 서버 설정 파일

 smbusers

 Samba 유저의 별칭을 담은 파일


4. 환경설정

4-1. smb.conf 설정을 위한 기본 내용


[root@seob01 samba]# cat smb.conf

# This is the main Samba configuration file. You should read the
# smb.conf(5) manual page in order to understand the options listed
# here. Samba has a huge number of configurable options (perhaps too
# many!) most of which are not shown in this example
#
# For a step to step guide on installing, configuring and using samba, 
# read the Samba-HOWTO-Collection. This may be obtained from:
#  http://www.samba.org/samba/docs/Samba-HOWTO-Collection.pdf
#
# Many working examples of smb.conf files can be found in the 
# Samba-Guide which is generated daily and can be downloaded from: 
#  http://www.samba.org/samba/docs/Samba-Guide.pdf
#
# Any line which starts with a ; (semi-colon) or a # (hash) 
# is a comment and is ignored. In this example we will use a #
# for commentry and a ; for parts of the config file that you
# may wish to enable
#
# NOTE: Whenever you modify this file you should run the command "testparm"
# to check that you have not made any basic syntactic errors. 
#
#---------------
# SELINUX NOTES:
#
# If you want to use the useradd/groupadd family of binaries please run:
# setsebool -P samba_domain_controller on
#
# If you want to share home directories via samba please run:
# setsebool -P samba_enable_home_dirs on
#
# If you create a new directory you want to share you should mark it as
# "samba_share_t" so that selinux will let you write into it.
# Make sure not to do that on system directories as they may already have
# been marked with othe SELinux labels.
#
# Use ls -ldZ /path to see which context a directory has
#
# Set labels only on directories you created!
# To set a label use the following: chcon -t samba_share_t /path
#
# If you need to share a system created directory you can use one of the
# following (read-only/read-write):
# setsebool -P samba_export_all_ro on
# or
# setsebool -P samba_export_all_rw on
#
# If you want to run scripts (preexec/root prexec/print command/...) please
# put them into the /var/lib/samba/scripts directory so that smbd will be
# allowed to run them.
# Make sure you COPY them and not MOVE them so that the right SELinux context
# is applied, to check all is ok use restorecon -R -v /var/lib/samba/scripts
#
#--------------
#
#======================= Global Settings =====================================

[global] // 전역 설정 부분, 여기 아래에 옵션을 넣게 되면 모든 Samba 정보에 설정된다.

# ----------------------- Network Related Options -------------------------
#
# workgroup = NT-Domain-Name or Workgroup-Name, eg: MIDEARTH
#
# server string is the equivalent of the NT Description field
#
# netbios name can be used to specify a server name not tied to the hostname
#
# Interfaces lets you configure Samba to use multiple interfaces
# If you have multiple network interfaces then you can list the ones
# you want to listen on (never omit localhost)
#
# Hosts Allow/Hosts Deny lets you restrict who can connect, and you can
# specifiy it as a per share option as well
#
workgroup = WORKGROUP// workgroup 부분이야 윈도우의 workgroup과 일치 시키거나 NT 도메인 이름으로 설정한다.

security = user // 서버의 사용자 계정만 사용할 수 있도록 한다. 

server string = Samba Server Version %v 
        // 윈도우의 컴퓨터 설명과 비슷, 나중에 공유를 받게 되면 폴더명 옆에 설명으로 나온다.
        // %h은 호스트이름, %L은 NetBIOS 이름, $v은 Samba Version 표기 

; netbios name = MYSERVER

 

  // 여기서부터 ; 이 앞에 있으면 주석처리
  // NetBIOS 네임을 설정하는 영역, 윈도우의 컴퓨터 이름과 동일.
  // 주석처리 할 경우 호스트 이름을 NetBIOs 네임으로 사용하게 된다. 현재 내가 seob01 라는 호스트 이름이면  NetBIOS 이름은 seob01이 된다.

; interfaces = lo eth0 192.168.12.2/24 192.168.13.2/24 
  // 두개의 네트워크에 Samba Server가 물려있는 경우 Samba가 양쪽 네트워크에 대해 브라우징 및 서비스가 가능하도록 설정. 설정방법은 < IP 주소 > / < 넷마스크 > 이렇게 표기.
; hosts allow = 127. 192.168.12. 192.168.13.
        // Samba Server에 대해 접근을 허락 할 호스트 네임 혹은 IP 주소를 지정.
        // 예를 들어 192.168.1.1~254 단위로 설정하고 다면. -> 192.168.1. 이렇게만 적으면 된다.

# --------------------------- Logging Options -----------------------------
#
# Log File let you specify where to put logs and how to split them up.
#
# Max Log Size let you specify the max size log files should reach

# logs split per machine
log file = /var/log/samba/log.%m
  // 서버에 접속한 호스트마다 개별적인 로그 파일을 생성하도록 설정 
# max 50KB per log file, then rotate
max log size = 50

# ----------------------- Standalone Server Options ------------------------
#
# Scurity can be set to user, share(deprecated) or server(deprecated)
#
# Backend to store user information in. New installations should 
# use either tdbsam or ldapsam. smbpasswd is available for backwards 
# compatibility. tdbsam requires no further configuration.

security = user
   // security 영역은 다음과 같이 설정할 수 있어
   // user = Samba Server에서 계정 및 패스워드를 통한 인증을 거친 사용자에 한하여 공유를 허가
   // share = 모든 공유 영역에 권한 없이 접근이 가능하도록 설정. 윈도우의 워크그룹 기본 모드.
   // server = 공유 영역에 대한 사용 권한은 다른 호스트(NT 패스워드 서버)의 인증 과정을 거친 사용자에 한하여 허가
passdb backend = tdbsam
   // 패스워드에 대한 인증 방식이야
   // tdbsam = samba 내장 TDB SAM 형식
   // ldapsam = LDAP 사용 (LDAP 라이브러리 필요)
   // smbpasswd = smbpasswd 텍스트 파일 인증 형식


# ----------------------- Domain Members Options ------------------------
#
# Security must be set to domain or ads
#
# Use the realm option only with security = ads
# Specifies the Active Directory realm the host is part of
#
# Backend to store user information in. New installations should 
# use either tdbsam or ldapsam. smbpasswd is available for backwards 
# compatibility. tdbsam requires no further configuration.
#
# Use password server option only with security = server or if you can't
# use the DNS to locate Domain Controllers
# The argument list may include:
#   password server = My_PDC_Name [My_BDC_Name] [My_Next_BDC_Name]
# or to auto-locate the domain controller/s
#   password server = *

; security = domain
; passdb backend = tdbsam
; realm = MY_REALM

; password server = <NT-Server-Name>
  // security에서 domain과 server을 할 경우 Samba 이외에 해당 기능을 수행하는 NT 서버가 필요.
  // 즉, 해당 NT 서버를 아래의 password server를 통해 지정.
# ----------------------- Domain Controller Options ------------------------
#
# Security must be set to user for domain controllers
#
# Backend to store user information in. New installations should 
# use either tdbsam or ldapsam. smbpasswd is available for backwards 
# compatibility. tdbsam requires no further configuration.
#
# Domain Master specifies Samba to be the Domain Master Browser. This
# allows Samba to collate browse lists between subnets. Don't use this
# if you already have a Windows NT domain controller doing this job
#
# Domain Logons let Samba be a domain logon server for Windows workstations. 
#
# Logon Scrpit let yuou specify a script to be run at login time on the client
# You need to provide it in a share called NETLOGON
#
# Logon Path let you specify where user profiles are stored (UNC path)
#
# Various scripts can be used on a domain controller or stand-alone
# machine to add or delete corresponding unix accounts
#
; security = user
; passdb backend = tdbsam

; domain master = yes 
; domain logons = yes

# the login script name depends on the machine name
; logon script = %m.bat
# the login script name depends on the unix user used
; logon script = %u.bat
; logon path = \\%L\Profiles\%u
# disables profiles support by specifing an empty path
; logon path =          

; add user script = /usr/sbin/useradd "%u" -n -g users
; add group script = /usr/sbin/groupadd "%g"
; add machine script = /usr/sbin/useradd -n -c "Workstation (%u)" -M -d /nohome -s /bin/false "%u"
; delete user script = /usr/sbin/userdel "%u"
; delete user from group script = /usr/sbin/userdel "%u" "%g"
; delete group script = /usr/sbin/groupdel "%g"


# ----------------------- Browser Control Options ----------------------------
#
# set local master to no if you don't want Samba to become a master
# browser on your network. Otherwise the normal election rules apply
#
# OS Level determines the precedence of this server in master browser
# elections. The default value should be reasonable
#
# Preferred Master causes Samba to force a local browser election on startup
# and gives it a slightly higher chance of winning the election
; local master = no
; os level = 33
; preferred master = yes

#----------------------------- Name Resolution -------------------------------
# Windows Internet Name Serving Support Section:
# Note: Samba can be either a WINS Server, or a WINS Client, but NOT both
#
# - WINS Support: Tells the NMBD component of Samba to enable it's WINS Server
#
# - WINS Server: Tells the NMBD components of Samba to be a WINS Client
#
# - WINS Proxy: Tells Samba to answer name resolution queries on
#   behalf of a non WINS capable client, for this to work there must be
#   at least one WINS Server on the network. The default is NO.
#
# DNS Proxy - tells Samba whether or not to try to resolve NetBIOS names
# via DNS nslookups.

; wins support = yes
; wins server = w.x.y.z
; wins proxy = yes

; dns proxy = yes

# --------------------------- Printing Options -----------------------------
#
# Load Printers let you load automatically the list of printers rather
# than setting them up individually
#
# Cups Options let you pass the cups libs custom options, setting it to raw
# for example will let you use drivers on your Windows clients
#
# Printcap Name let you specify an alternative printcap file
#
# You can choose a non default printing system using the Printing option

load printers = yes
  // Samba에서 별도의 프린터 설정을 하지 않고, printcap name에서 설정한 프린트 설정 파일을 불러와 쓰도록 설정.
  // 아래 printercap name 옵션을 참고.
cups options = raw

; printcap name = /etc/printcap
  // Samba에서 공유해서 사용할 프린트에 대한 설정이 포함되어 있는 파일을 지정하는 영역으로 /etc/printcap 파일을 지정
#obtain list of printers automatically on SystemV
; printcap name = lpstat
; printing = cups
  // 지원하는 프린트 시스템을 지정하는 영역으로 기존의 LPRng을 이용하여 프린트를 사용할 경우 lprng를, CPUS을 이용하여 프린트를 사용할 경우 cpus 지정필요.

# --------------------------- Filesystem Options ---------------------------
#
# The following options can be uncommented if the filesystem supports
# Extended Attributes and they are enabled (usually by the mount option
# user_xattr). Thess options will let the admin store the DOS attributes
# in an EA and make samba not mess with the permission bits.
#
# Note: these options can also be set just per share, setting them in global
# makes them the default for all shares

; map archive = no
; map hidden = no
; map read only = no
; map system = no
; store dos attributes = yes


#============================ Share Definitions ==============================
// 공유 영역 (무엇을 공유할지 쓰는 곳)

[homes] // 사용자 계정을 통해서 자기 홈 경로를 접근 할 수 있다. 접근 경로이다.
comment = Home Directories // 폴더에 대한 설명
browseable = no // 이 폴더가 리스트에 출력하게 할 것인지 여부. yes 할 경우 출력, no 할 경우 보이지 않음. yes로 하면 접속 권한이 없어도 같은 네트웍에 있는 모든 컴퓨터에서 폴더를 볼 수 있다.
#writable = yes // 읽고, 쓰기 권한(yes 허용, no 거부), 기존 버전에서 사용

 read only = no //버전에 따라서 writable or read only 사용

create mask = 0664 // 생성되는 파일 권한

directory mask = 0755 // 생성되는 폴더 권한

 
; valid users = %S // home 계정은 일반적으로 모든 사용자가 접근 가능하다. %S로 설정해 주면 username 사용 \\server\username을 사용할 수 있다. (공유 영역에 접근 가능한 사용자 혹은 그룹을 지정, 그룹일 경우 @(앳)을 꼭 붙여야한다)
         // ex) seob @seobgroup
; valid users = MYDOMAIN\%S

[printers]
comment = All Printers
path = /var/spool/samba
browseable = no
guest ok = no
writable = no
printable = yes

# Un-comment the following and create the netlogon directory for Domain Logons
; [netlogon]
; comment = Network Logon Service
; path = /var/lib/samba/netlogon
; guest ok = yes
; writable = no
; share modes = no


# Un-comment the following to provide a specific roving profile share
# the default is to use the user's home directory
; [Profiles]
; path = /var/lib/samba/profiles
; browseable = no
; guest ok = yes


# A publicly accessible directory, but read only, except for people in
# the "staff" group
; [public]
; comment = Public Stuff
; path = /home/samba
; public = yes
; writable = yes
; printable = no
; write list = +staff

 

# 여러 사용자가 함께 사용할 수 있는 공유 폴더 설정이다.'[]'안에 접속할 경로를 설정해 준다. 아래처럼 '[share]' 를 사용하면 '\\server\share'로 접속하면 된다.

# 이 부분은 설정 파일에 존재하지 않으므로 적당한 위치에 내용 전체를 추가해 주면 된다.

# 사용자간 공유할 필요 없으면 생략해도 된다.

[share]

comment = Shared Files

path = /data/samba/share //실제 파일이 저장될 공간으로, 설정이 끝나고 폴더를 생성 해 주어야 한다.

browseable = yes // no로 해도 무관

read only = no

create mask = 0664

directory mask = 0755

#guest ok = yes //Anonymous로 접속 가능하게 하려면 아래 주석을 풀어준다. 이때는 read only 을 추천한다. 

 

4-2. 옵션 설명

 path  경로 지정 
 browsable  해당 공유 내역을 브라우징 리스트에 나타나게 할 것인지에 대한 옵션
 writable 쓰기 가능 여부 writable=yes은 readonly=no와 동일해 
 printable 프린터 공유에만 사용하는 영역 yes를 할 경우 공유 이름으로 전역 영역에서 정의한 프린터를 공유하게 됨
 public nobody 사용자에 대한 접근 권한 설정. 전역 영역의 guest ok=yes와 연관있음
 hosts allow 공유 영역에 대한 호스트별 접근 허가 설정, IP 혹은 네트워크 주소를 지정
 vlid users 공유 영역에 접근 가능한 사용자 혹은 그룹 지정사용자를 여러 명 지정할 경우 공백으로 구분하여 그룹명
 일 경우 @(골뱅이)를 통해 그룹임을 명시

 ex) seob @seobgroup
 write list 공유 영역에 대한 쓰기 가능한 사용자 혹은 그룹 지정사용자를 여러 명 지정할 경우 공백으로 구분하여 그룹명
 일 경우 @(골뱅이)를 통해 그룹임을 명시

 ex) seob @seobgroup 

(출처: http://leegaworld.blogspot.kr/search?q=samba)


4-3. 설정 추가 


공유 디렉토리 생성





#mkdir /home/share



#chmod 777 /home/share


     74         workgroup = WORKGROUP
     75         server string = LJM21C Samba Server Version %v

    289 [ljm21c]
    290 comment=ljm21c Directories
    291 browseable = yes
    292 writable = yes
    293
    294 path = /home/share


4-4. 방화벽 예외처리

4-4-1. Samba 서버에서 사용중인 포트 확인

# service smb start
SMB서비스를 시작하고 있습니다:                             [  OK  ]

# netstat -anp | grep LISTEN
tcp        0      0 0.0.0.0:139                 0.0.0.0:*                   LISTEN      3725/smbd          
tcp        0      0 0.0.0.0:22                  0.0.0.0:*                   LISTEN      976/sshd           
tcp        0      0 127.0.0.1:25                0.0.0.0:*                   LISTEN      1052/master        
tcp        0      0 0.0.0.0:445                 0.0.0.0:*                   LISTEN      3725/smbd 

=> 139, 445 포트를 사용하고 있다.

(혹은 # vi /etc/services 에서 서버 확인 가능)

(참고) 삼바서버 포트 번호

135/UDP
137/UDP
138/UDP
139/TCP (설정 안해도 작동함)
445/TCP (설정 안해도 작동함)

#vi /etc/sysconfig/iptables
-A INPUT -m state --state NEW -m tcp -p tcp --dport 139 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 445 -j ACCEPT

# service iptables restart
iptables: 체인을 ACCEPT 규칙으로 설정 중:  filter          [  OK  ]
iptables: 방화벽 규칙을 지웁니다:                          [  OK  ]
iptables: 모듈을 언로드하는 중:                            [  OK  ]
iptables: 방화벽 규칙 적용 중:                             [  OK  ]


4-5. 사용자 인증

현재 존자하는 계정에 smb 인증 필요.


4-5-1. samba 계정 등록 절차
    1) 시스템 사용자 등록(useradd) 및 패스워드 등록 (passwd)
    2) 그룹 사용자 등록(gpasswd)
    3) samba 사용자 등록(smbpasswd)


4-5-1-1.  시스템 사용자 등록(useradd) 및 패스워드 등록 (passwd)
# useradd ljm21c
# passwd ljm21c
ljm21c 사용자의 비밀 번호 변경 중
새  암호:
새  암호 재입력:
passwd: 모든 인증 토큰이 성공적으로 업데이트 되었습니다.

# cat /etc/group

wbpriv:x:88:
ljm21c:x:500:


4-5-1-2. 그룹 사용자 등록(gpasswd)

# groupadd WORKGROUP
[root@ljm21c samba]# gpasswd -a ljm21c WORKGROUP
Adding user ljm21c to group WORKGROUPljm21c:x:500:

# cat /etc/group

ljm21c:x:500:
WORKGROUP:x:501:ljm21c


4-5-1-3. samba 사용자 등록(smbpasswd)

# smbpasswd -a ljm21c
New SMB password:
Retype new SMB password:
Added user ljm21c.


5. 윈도우에서 접속

탐색기 혹은 브라우저에서 \\{ip or 호스트} 으로 접속 하면 된다.


6. 문제발생

6-1. 접속은 되지만 공유 디렉토리에 액세스할 수 없음.

[Content]
\\192.168.153.150\ljm21c에 액세스할 권한이 없습니다. 네트워크 관리자에게 액세스 권한을 요청하십시오.

      1) SELinux 서비스 사용 안함으로 설정

(참조: SELinux 는 리눅스 배포판을 설치할 때 리눅스 서버의 보안 강화의 목적으로 설치되고운용되는  , 일종의 보안 툴 같은 개념이다.)

- root 권한으로 아래 명령어 실행

# setenforce 0 

- #vi /etc/sysconfig/selinux 

SELINUX=enforcing OR SELINUX=permissive 을 SELINUX=disabled로 수정

(setenforce 1 은 enforcing 모드를 의미한다)

     2) 해당 공유 디렉토리의 퍼미션 확인

6-2. 접속 자체가 되지 않음.

=> 방화벽 설정 확인한다.

6-3. 접속 시 아이디/패스워드가 일치하지 않음.

=> smbpasswd -a {사용자 계정} 으로 다시 암호 변경

6-4. 인증이 이상하게 될 경우.

=> smb.conf 에서 WORKGROUP = { } 부분을 Windows Group이 동일한지 확인.


7. Windows 에서 Samba 서버 세션 끊기

7-1. 현재 samba 서버와의 세션 연결 확인

C:\> net use [공유이름] /delete

옵션들은 net ? 또는 net use ? 입력으로 확인

C:\> net session /delete


8. 기본 설정 smb.conf 내용

[global]

        workgroup = WORKGROUP

        server string = Samba Server Version %v


        log file = /var/log/samba/log.%m

        max log size = 50


        security = user

        passdb backend = tdbsam



[ljm21c]

comment = ljm21c Shared Directories

browseable = yes

writable = yes

path = /home/share

Posted by 랩퍼우
리눅스 (Linux)2016. 3. 29. 14:04

yum을 사용하려는데 아래와 같은 error가 납니다.



Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=6&arch=x86_64&repo=os error was

14: PYCURL ERROR 6 - "Couldn't resolve host 'mirrorlist.centos.org'"

Error: Cannot find a valid baseurl for repo: base

확인해 보니 OS를 설치하고 resolv.conf 에 nameserver 정보를 작성하지 않아 발생한 error


#] vi /etc/resolv.conf

[추가]

nameserver 168.126.63.1


잘 됩니다~

Posted by 랩퍼우