-
Notifications
You must be signed in to change notification settings - Fork 5
인스턴스 셋업 방법
MINCHEOL KANG edited this page May 14, 2022
·
3 revisions
- 현재 AWS EC2 인스턴스 기준입니다.
- Database setup
- NGINX setup
- Environment setup
- Java setup
cat << "EOF" >> /etc/yum.repos.d/MariaDB.repo
[mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/10.4/centos7-amd64
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1
EOF
cat /etc/yum.repos.d/MariaDB.repo
sudo yum install MariaDB-server MariaDB-client -y
sudo systemctl start mariadb
sudo systemctl enable mariadb
sudo mysql-secure-installation
-
mysql-secure-installaion
를 실행하고 인스트럭션을 모두 수행한 뒤 난 뒤 아래 명령어를 실행 합니다.
cat << "EOF" >> /etc/my.cnf
[mysqld]
collation-server=utf8mb4_unicode_ci
init-connect='SET NAMES utf8mb4'
character-set-server=utf8mb4
lower_case_table_names=1
innodb_file_format=barracuda
innodb_large_prefix=on
EOF
sudo systemctl restart mariadb
- 서버 설정이 완료되면 아래 명령어로 MariaDB 로그인을 합니다.
mysql -u root -p
## mariadb login
- MariaDB 프롬프트 내에서 실행합니다.
create database helper;
create database helper-dev;
create user 'helper'@'localhost' identified by 'USER_PASSWORD';
grant all on helper.* to 'helper'@'localhost';
grant all on helper-dev.* to 'helper'@'localhost';
flush privileges;
- 아래 명령어를 실행합니다
cat << "EOF" >> /etc/nginx/conf.d/helper.conf
server {
listen 80;
listen [::]:80;
server_name helper.42seoul.io;
root /usr/share/nginx/html;
location / {
sendfile off;
proxy_pass http://127.0.0.1:8080;
proxy_redirect default;
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_cache_bypass $http_upgrade;
proxy_max_temp_file_size 0;
}
error_page 404 /404.html;
location = /404.html {
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
}
}
EOF
sudo systemctl restart nginx
- let's encryption 사용
sudo yum install yum-utils epel-release -y
sudo yum install certbot python2-certbot-nginx -y
- 설치 후 아래 명령어 실행 후 인스트럭션을 따라갑니다.
certbot
- 적용완료.
cat << "EOF" >> ~/.bash_profile
export UID42=[42API_UID]
export SECRET42=[42API_SECRET]
export HELPER42_DB_USERNAME=helper
export HELPER42_DB_PASSWORD=[USER_PASSWORD]
export HELPER42_DB_NAME=helper-dev
export HELPER42_DB_USERNAME_RELEASE=helper
export HELPER42_DB_PASSWORD_RELEASE=[USER_PASSWORD]
export HELPER42_DB_NAME_RELEASE=helper
EOF
source ~/.bash_profile
- 42 helper는 JDK 1.8로 개발되었습니다.
sudo yum install java-1.8.0-openjdk-devel.x86_64