IT/linux

RedHat에 Oracle RAC 설치시 SSH 상호 인증 설정 절차

울티마 2015. 4. 2. 09:46

1. Oracle 그룹 생성

# /usr/sbin/groupadd -g 501 oinstall

# /usr/sbin/groupadd -g 502 dba

# /usr/sbin/groupadd -g 503 oper

 

2. Oracle 유저 생성

# /usr/sbin/useradd -u 501 -g oinstall -G dba,oper oracle

# passwd oracle

# id nobody

uid=99(nobody) gid=99(nobody) groups=99(nobody)

 

3. SSH 설정

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

매뉴얼에는 oracle 유저만 설정하도록 되어 있으나 최초 설치시에는 root 유저에 대해서도 설정해야 함

안할 경우 중간에 오라클 바이너리가 slave 노드들로 복사될때 소유권 문제가 발생할 수도 있음

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

- SSH 데몬 실행 확인

# pgrep sshd

1539

24898

- SSH 설정

# su - oracle

$ mkdir ~/.ssh

$ chmod 700 ~/.ssh

- SSH Key 생성 (여기서 패스워드로 'secure' 사용)

$ /usr/bin/ssh-keygen -t rsa

Generating public/private rsa key pair.

Enter file in which to save the key (/home/oracle/.ssh/id_rsa):

Enter passphrase (empty for no passphrase):

Enter same passphrase again:

Your identification has been saved in /home/oracle/.ssh/id_rsa.

Your public key has been saved in /home/oracle/.ssh/id_rsa.pub.

The key fingerprint is:

53:9a:fa:53:40:ee:c0:7e:6c:59:db:7a:13:a5:f2:78 oracle@rac2

- DSA Key 생성 (여기서 패스워드로 'secure' 사용)

[oracle@rac2 ~]$ /usr/bin/ssh-keygen -t dsa

Generating public/private dsa key pair.

Enter file in which to save the key (/home/oracle/.ssh/id_dsa):

Enter passphrase (empty for no passphrase):

Enter same passphrase again:

Your identification has been saved in /home/oracle/.ssh/id_dsa.

Your public key has been saved in /home/oracle/.ssh/id_dsa.pub.

The key fingerprint is:

4a:88:14:e7:5a:cc:47:08:54:e3:51:73:9a:0e:f5:0f oracle@rac2

- authorized_keys 파일 생성 및 노드에 Key 추가

[oracle@rac2 ~]$ touch ~/.ssh/authorized_keys

[oracle@rac2 ~]$ cd ~/.ssh

[oracle@rac2 .ssh]$ ls

authorized_keys id_dsa id_dsa.pub id_rsa id_rsa.pub

$ ssh rac1 cat /home/oracle/.ssh/id_rsa.pub >> authorized_keys

The authenticity of host 'rac2 (52.2.44.52)' can't be established.

RSA key fingerprint is 40:19:47:e7:9d:bd:3a:8b:08:03:a8:80:5b:45:2c:26.

Are you sure you want to continue connecting (yes/no)? yes

Warning: Permanently added 'rac2,52.2.44.52' (RSA) to the list of known hosts.

oracle@rac1's password:

$ ssh rac1 cat /home/oracle/.ssh/id_dsa.pub >> authorized_keys

The authenticity of host 'rac2 (52.2.44.52)' can't be established.

RSA key fingerprint is 40:19:47:e7:9d:bd:3a:8b:08:03:a8:80:5b:45:2c:26.

Are you sure you want to continue connecting (yes/no)? yes

Warning: Permanently added 'rac2,52.2.44.52' (RSA) to the list of known hosts.

oracle@rac1's password:

$ ssh rac2 cat /home/oracle/.ssh/id_rsa.pub >> authorized_keys

The authenticity of host 'rac2 (52.2.44.52)' can't be established.

RSA key fingerprint is 40:19:47:e7:9d:bd:3a:8b:08:03:a8:80:5b:45:2c:26.

Are you sure you want to continue connecting (yes/no)? yes

Warning: Permanently added 'rac2,52.2.44.52' (RSA) to the list of known hosts.

oracle@rac2's password:

$ ssh rac2 cat /home/oracle/.ssh/id_dsa.pub >> authorized_keys

The authenticity of host 'rac2 (52.2.44.52)' can't be established.

RSA key fingerprint is 40:19:47:e7:9d:bd:3a:8b:08:03:a8:80:5b:45:2c:26.

Are you sure you want to continue connecting (yes/no)? yes

Warning: Permanently added 'rac2,52.2.44.52' (RSA) to the list of known hosts.

oracle@rac2's password:

- authorized_keys 파일 배포

$ scp authorized_keys rac2:/home/oracle/.ssh/

$ chmod 600 ~/.ssh/authorized_keys

- SSH Equivalency 설정

$ exec /usr/bin/ssh-agent $SHELL

$ /usr/bin/ssh-add

Enter passphrase for /home/oracle/.ssh/id_rsa:

Identity added: /home/oracle/.ssh/id_rsa (/home/oracle/.ssh/id_rsa)

Identity added: /home/oracle/.ssh/id_dsa (/home/oracle/.ssh/id_dsa)

 

4. OS 환경 설정

$ vi .bash_profile

if [ -t 0 ]; then

stty intr ^C

fi

$ su - root

# mkdir /oracle/tmp

# chmod 775 /oracle/tmp

# exit

$ TEMP=/oracle/tmp

$ TMPDIR=/oracle/tmp

$ export TEMP TMPDIR