1. https://www.ncloud.com/ 접속 후 로그인
- 신규 가입 대상 10만 크레딧 받기 : https://www.ncloud.com/main/creditEvent
2. 우측 상단 콘솔 클릭
3. 좌측 Products & Servieces 클릭 후 Server 클릭
- ncloud에서는 가상머신을 server라고 함
4. 서버 생성 클릭
5. 서버 이미지 선택
- 조금이라도 비용을 줄이기 위해 1세대 서버 사용
- 현재 CentOS-7.9 버전을 사용하고 있으므로 가장 근접한 7.8 버전 선택
6. 서버 설정
- Zone : ncloud의 데이터 센터 선택
- HDD, 시간 요금제 : 조금이라도 비용을 줄이기 위함
- Script : 서버 부팅 시 자동으로 실행되는 script 선택 (여기서는 선택 없이 진행)
7. 인증키 생성
- 관리자 비밀번호 확인을 위함
- 새로 생성하거나 보유하고 있는 인증키를 이용할 수 있음
- 한 번 발급된 인증키는 재발급되지 않으며, 이미 발급한 것과 동일한 이름의 인증키 생성 불가
8. 네트워크 접근 설정
- HTTP : Web Server 접근용
- PING : 네트워크 연결 테스트용
- SSH : 원격 접속용
9. 최종 확인
10. 서버 생성
11. 공인 IP 신청
- 신청 시 운영 중인 서버가 있다면 즉시 적용 가능
12. 관리자 비밀번호 확인
13. 포트 포워딩
- 서버 생성 시 2개 이상으로 생성해도 서버 접속용 IP는 1개밖에 안 줌
- 따라서, 서버 별로 포트 포워딩을 통해 SSH 포트를 다르게 줘야 함
- 외부 포트 번호는 1024~65534를 사용할 수 있으며, 기억하기 쉽게 60022, 60122 등 사용
14. 원격 접속 (Xshell)
15. Script 선택하여 서버 생성
※ Script 내용
#! /bin/bash
yum install -y wget expat-devel gcc gcc-c++
rm -rf /web /http
mkdir /web /http
cd /web
wget https://downloads.apache.org/httpd/httpd-2.4.53.tar.gz
wget https://downloads.apache.org/apr/apr-1.7.0.tar.gz
wget https://downloads.apache.org/apr/apr-util-1.6.1.tar.gz
wget https://sourceforge.net/projects/pcre/files/pcre/8.45/pcre-8.45.tar.gz --no-check-certificate
tar xvfz httpd-2.4.53.tar.gz
tar xvfz apr-1.7.0.tar.gz
tar xvfz apr-util-1.6.1.tar.gz
tar xvfz pcre-8.45.tar.gz
cd apr-1.7.0
./configure --prefix=/http/apr ; make ; make install
cd ../apr-util-1.6.1
./configure --prefix=/http/aprutil --with-apr=/http/apr ; make ; make install
cd ../pcre-8.45
./configure --prefix=/http/pcre ; make ; make install
cd ../httpd-2.4.53
./configure --prefix=/http/apache --with-apr=/http/apr --with-apr-util=/http/aprutil --with-pcre=/http/pcre/bin/pcre-config ; make ; make install
useradd -r apache
sed -i 's/User daemon/User apache/g' /http/apache/conf/httpd.conf
sed -i 's/Group daemon/Group apache/g' /http/apache/conf/httpd.conf
cat > /http/apache/htdocs/index.html << EOF
<html>
<body>
<h1>JHJ-WEBSERVER</h1>
<h2>hello world!</h2>
</body>
</html>
EOF
/http/apache/bin/apachectl start
※ 추가된 코드
useradd -r apache
sed -i 's/User daemon/User apache/g' /http/apache/conf/httpd.conf
sed -i 's/Group daemon/Group apache/g' /http/apache/conf/httpd.conf
- ncloud server에서는 user가 daemon으로 되어 있기 때문에 위 작업을 해야 에러가 발생하지 않음
- script를 사용하지 않는다면 /http/apache/conf/http.conf 파일에서 직접 수정해야 함
'Cloud' 카테고리의 다른 글
88_Cloud: Untangle (0) | 2022.06.15 |
---|