[AWS 무료 서버구축-8/18] Maria DB 설치

Setup/aws|2021. 7. 25. 15:17

Maria DB 설치

aws freeiter linux 서버에 mariadb 설치를 진행하겠습니다

설치

우선 repository 부터 아래와 같이 설정합니다.

ubuntu@goodsaem:~$ sudo apt-get install software-properties-common
ubuntu@goodsaem:~$ sudo apt-key adv --fetch-keys 'https://mariadb.org/mariadb_release_signing_key.asc'
ubuntu@goodsaem:~$ sudo add-apt-repository 'deb [arch=amd64,arm64,ppc64el] https://mirror.yongbok.net/mariadb/repo/10.5/ubuntu bionic main'

패키지를 업데이트한후 mariadb 설치를 진행합니다.

ubuntu@goodsaem:~$ sudo apt update
ubuntu@goodsaem:~$ sudo apt install mariadb-server -y

마리아 디비 버전을 확인합니다. 설치 시점의 최신 버전 10.5.9-MariaDB 으로 설치 되었습니다.

ubuntu@goodsaem:~$ mariadb -V
mariadb  Ver 15.1 Distrib 10.5.9-MariaDB, for debian-linux-gnu (x86_64) using readline 5.2

 

보안설정

마리아 디비 보안 관련 설정을 진행 합니다.

ubuntu@goodsaem:~$ sudo mysql_secure_installation

상세 설정 내용은 아래와 같습니다.

  • 8 라인 root 유저가 사용할 패스워드를 입력합니다.
  • 16 라인 unix socket 인증방식 사용여부는 n 으로 지정해 주세요(root 쉘인증이 기본 사용됩니다.)
  • 21-23 라인 root passwor를 변경합니다.
  • 35 라인 익명 사용자를 삭제 합니다.
  • 41 라인 root의 원격접속을 막습니다. root 는 항상 로컬에서만 접속 가능합니다.
  • 48 라인 test 데이터 베이스를 삭제 합니다.
  • 57 라인 권한에 대한 리로드를 진행합니다. y를 입력해주세요
NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
      SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!

In order to log into MariaDB to secure it, we'll need the current
password for the root user. If you've just installed MariaDB, and
haven't set the root password yet, you should just press enter here.

Enter current password for root (enter for none):
OK, successfully used password, moving on...

Setting the root password or using the unix_socket ensures that nobody
can log into the MariaDB root user without the proper authorisation.

You already have your root account protected, so you can safely answer 'n'.

Switch to unix_socket authentication [Y/n] n
 ... skipping.

You already have your root account protected, so you can safely answer 'n'.

Change the root password? [Y/n] y
New password:
Re-enter new password:
Password updated successfully!
Reloading privilege tables..
 ... Success!


By default, a MariaDB installation has an anonymous user, allowing anyone
to log into MariaDB without having to have a user account created for
them.  This is intended only for testing, and to make the installation
go a bit smoother.  You should remove them before moving into a
production environment.

Remove anonymous users? [Y/n] y
 ... Success!

Normally, root should only be allowed to connect from 'localhost'.  This
ensures that someone cannot guess at the root password from the network.

Disallow root login remotely? [Y/n] y
 ... Success!

By default, MariaDB comes with a database named 'test' that anyone can
access.  This is also intended only for testing, and should be removed
before moving into a production environment.

Remove test database and access to it? [Y/n] y
 - Dropping test database...
 ... Success!
 - Removing privileges on test database...
 ... Success!

Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.

Reload privilege tables now? [Y/n] y
 ... Success!

Cleaning up...

All done!  If you've completed all of the above steps, your MariaDB
installation should now be secure.

Thanks for using MariaDB!

 

디비연결

아래 명령어를 입력하여 mariadb 에 접속합니다. 성공적으로 접속되었습니다.

ubuntu@goodsaem:~$ sudo mariadb
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 53
Server version: 10.5.9-MariaDB-1:10.5.9+maria~bionic mariadb.org binary distribution

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]>

 

마리아 디비 설정

마리아 db 설정을 진행하겠습니다. 아래 명령어를 입력하여 설정파일을 수정합니다.

ubuntu@goodsaem:~$ sudo vi /etc/mysql/mariadb.conf.d/50-server.cnf

가장 마지막 줄에 아래 설정을 추가합니다. (119-130 라인)

#
# These groups are read by MariaDB server.
# Use it for options that only the server (but not clients) should see

# this is read by the standalone daemon and embedded servers
[server]

# this is only for the mysqld standalone daemon
[mysqld]

#
# * Basic Settings
#

user                    = mysql
pid-file                = /run/mysqld/mysqld.pid
basedir                 = /usr
datadir                 = /var/lib/mysql
tmpdir                  = /tmp
lc-messages-dir         = /usr/share/mysql
lc-messages             = en_US
skip-external-locking

# Broken reverse DNS slows down connections considerably and name resolve is
# safe to skip if there are no "host by domain name" access grants
#skip-name-resolve

# Instead of skip-networking the default is now to listen only on
# localhost which is more compatible and is not less secure.
bind-address            = 127.0.0.1

#
# * Fine Tuning
#

#key_buffer_size        = 128M
#max_allowed_packet     = 1G
#thread_stack           = 192K
#thread_cache_size      = 8
# This replaces the startup script and checks MyISAM tables if needed
# the first time they are touched
#myisam_recover_options = BACKUP
#max_connections        = 100
#table_cache            = 64

#
# * Logging and Replication
#

# Both location gets rotated by the cronjob.
# Be aware that this log type is a performance killer.
# Recommend only changing this at runtime for short testing periods if needed!
#general_log_file       = /var/log/mysql/mysql.log
#general_log            = 1

# When running under systemd, error logging goes via stdout/stderr to journald
# and when running legacy init error logging goes to syslog due to
# /etc/mysql/conf.d/mariadb.conf.d/50-mysqld_safe.cnf
# Enable this if you want to have error logging into a separate file
#log_error = /var/log/mysql/error.log
# Enable the slow query log to see queries with especially long duration
#slow_query_log_file    = /var/log/mysql/mariadb-slow.log
#long_query_time        = 10
#log_slow_verbosity     = query_plan,explain
#log-queries-not-using-indexes
#min_examined_row_limit = 1000

# The following can be used as easy to replay backup logs or for replication.
# note: if you are setting up a replication slave, see README.Debian about
#       other settings you may need to change.
#server-id              = 1
#log_bin                = /var/log/mysql/mysql-bin.log
expire_logs_days        = 10
#max_binlog_size        = 100M

#
# * SSL/TLS
#

# For documentation, please read
# https://mariadb.com/kb/en/securing-connections-for-client-and-server/
#ssl-ca = /etc/mysql/cacert.pem
#ssl-cert = /etc/mysql/server-cert.pem
#ssl-key = /etc/mysql/server-key.pem
#require-secure-transport = on

#
# * Character sets
#

# MySQL/MariaDB default is Latin1, but in Debian we rather default to the full
# utf8 4-byte character set. See also client.cnf
character-set-server  = utf8mb4
collation-server      = utf8mb4_general_ci

#
# * InnoDB
#

# InnoDB is enabled by default with a 10MB datafile in /var/lib/mysql/.
# Read the manual for more InnoDB related options. There are many!
# Most important is to give InnoDB 80 % of the system RAM for buffer use:
# https://mariadb.com/kb/en/innodb-system-variables/#innodb_buffer_pool_size
#innodb_buffer_pool_size = 8G

# this is only for embedded server
[embedded]

# This group is only read by MariaDB servers, not by MySQL.
# If you use the same .cnf file for MySQL and MariaDB,
# you can put MariaDB-only options here
[mariadb]

# This group is only read by MariaDB-10.5 servers.
# If you use the same .cnf file for MariaDB of different versions,
# use this group for options that older servers don't understand
[mariadb-10.5]

server-id=1
log_bin = binlog
expire_logs_days=10
innodb_buffer_pool_size = 384M
innodb_file_per_table=TRUE
character-set-client-handshake=OFF
skip-character-set-client-handshake
max_allowed_packet=500M
init_connect=SET collation_connection = utf8mb4_general_ci
init_connect=SET NAMES utf8mb4
character-set-server = utf8mb4
collation-server = utf8mb4_general_ci

설정된 값이 적용되도록 마리아 디비를 재시작 합니다.

ubuntu@goodsaem:~$ sudo systemctl restart mariadb

댓글()

[AWS 무료 서버구축-6/18] AWS free tier 서버 Linux 설정

Setup/aws|2021. 7. 25. 12:18

AWS free tier 서버 Linux 설정

 

구축한 aws + ubuntu 18.0.4 서버 초기 설정을 진행 하겠습니다. 필요없다고 생각하는 부분은 skip 하셔도 상관 없습니다.

 

버전정보 확인

lsb_release - a 명령어를 입력하여 버전 정보를 확인 합니다. 

ubuntu@ip-172-31-47-167:~$ lsb_release -a
No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 18.04.5 LTS
Release:	18.04
Codename:	bionic

 

nopasswd 설정

nopasswd 설정을 진행하겠습니다.

sudo 해서 root 하는 일을 많이 진행할 예정입니다. 그때 마다 패스워드를 입력하지 않기 위해 /etc/sudoers 파일을 수정합니다

ubuntu@ip-172-31-47-167:~$ sudo vi /etc/sudoers

%sudo ALL=(ALL:ALL) ALL 이라고 된부분을 아래와 같이 %sudo ALL=(ALL:ALL) NOPASSWD:ALL 로 수정 합니다.

#
# This file MUST be edited with the 'visudo' command as root.
#
# Please consider adding local content in /etc/sudoers.d/ instead of
# directly modifying this file.
#
# See the man page for details on how to write a sudoers file.
#
Defaults        env_reset
Defaults        mail_badpass
Defaults        secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin"

# Host alias specification

# User alias specification

# Cmnd alias specification

# User privilege specification
root    ALL=(ALL:ALL) ALL

# Members of the admin group may gain root privileges
%admin ALL=(ALL) ALL

# Allow members of group sudo to execute any command
%sudo   ALL=(ALL:ALL) NOPASSWD:ALL

# See sudoers(5) for more information on "#include" directives:

#includedir /etc/sudoers.d

 

패키지 업데이트

최신 패키지로 변경하기 위해 아래와 같이 update upgrade 를 진행합니다.

ubuntu@ip-172-31-47-167:~$ sudo apt update
ubuntu@ip-172-31-47-167:~$ sudo apt upgrade -y

 

타임존 변경

타임존을 변경합니다.

기본 설치하고 나면 timezone이 utc로 설정 되어 있습니다. timezone을 KST로 변경합니다.

ubuntu@ip-172-31-47-167:~$ sudo timedatectl set-timezone 'Asia/Seoul'

date 명령을 입력하여 정상적으로 변경되었는지 확인 합니다.

ubuntu@ip-172-31-47-167:~$ date
Wed Mar  3 23:52:20 KST 2021

 

호스트명 변경

homename을 변경합니다.

호스트 이름을 바꾸지 않아 아래와 ip-172-31-47-167 나옵니다 아래 명령어를 입력하여 호스트 이름을 goodsaem으로 변경합니다.

ubuntu@ip-172-31-47-167:~$ sudo hostnamectl set-hostname goodsaem

정상적으로 변경되었는지 확인 합니다.

ubuntu@ip-172-31-47-167:~$ cat /etc/hostname
goodsaem

서버를 재시작 하면 호스트 이름이 변경되므로 변경되지 않도록 설정을 수정합니다.

ubuntu@ip-172-31-47-167:~$ sudo vi /etc/cloud/cloud.cfg

아래 내용중 preserve_hostname: false 되어 있는 부분을 true로 변경합니다.

# The top level settings are used as module
# and system configuration.

# A set of users which may be applied and/or used by various modules
# when a 'default' entry is found it will reference the 'default_user'
# from the distro configuration specified below
users:
   - default

# If this is set, 'root' will not be able to ssh in and they
# will get a message to login instead as the default $user
disable_root: true

# This will cause the set+update hostname module to not operate (if true)
preserve_hostname: true

# Example datasource config
# datasource:
#    Ec2:
#      metadata_urls: [ 'blah.com' ]
#      timeout: 5 # (defaults to 50 seconds)
#      max_wait: 10 # (defaults to 120 seconds)



# The modules that run in the 'init' stage
cloud_init_modules:
 - migrator
 - seed_random
 - bootcmd
 - write-files
 - growpart
 - resizefs
 - disk_setup
 - mounts
 - set_hostname
 - update_hostname
 - update_etc_hosts
 - ca-certs
 - rsyslog
 - users-groups
 - ssh

# The modules that run in the 'config' stage
cloud_config_modules:
# Emit the cloud config ready event
# this can be used by upstart jobs for 'start on cloud-config'.
 - emit_upstart
 - snap
 - ssh-import-id
 - locale
 - set-passwords
 - grub-dpkg
 - apt-pipelining
 - apt-configure
 - ubuntu-advantage
 - ntp
 - timezone
 - disable-ec2-metadata
 - runcmd
 - byobu

# The modules that run in the 'final' stage
cloud_final_modules:
 - package-update-upgrade-install
 - fan
 - landscape
 - lxd
 - ubuntu-drivers
 - puppet
 - chef
 - mcollective
 - salt-minion
 - reset_rmc
 - refresh_rmc_and_interface
 - rightscale_userdata
 - scripts-vendor
 - scripts-per-once
 - scripts-per-boot
 - scripts-per-instance
 - scripts-user
 - ssh-authkey-fingerprints
 - keys-to-console
 - phone-home
 - final-message
 - power-state-change

# System and/or distro specific settings
# (not accessible to handlers/transforms)
system_info:
   # This will affect which distro class gets used
   distro: ubuntu
   # Default user name + that default users groups (if added/used)
   default_user:
     name: ubuntu
     lock_passwd: True
     gecos: Ubuntu
     groups: [adm, audio, cdrom, dialout, dip, floppy, lxd, netdev, plugdev, sudo, video]
     sudo: ["ALL=(ALL) NOPASSWD:ALL"]
     shell: /bin/bash
   # Automatically discover the best ntp_client
   ntp_client: auto
   # Other config here will be given to the distro class and/or path classes
   paths:
      cloud_dir: /var/lib/cloud/
      templates_dir: /etc/cloud/templates/
      upstart_dir: /etc/init/
   package_mirrors:
     - arches: [i386, amd64]
       failsafe:
         primary: http://archive.ubuntu.com/ubuntu
         security: http://security.ubuntu.com/ubuntu
       search:
         primary:
           - http://%(ec2_region)s.ec2.archive.ubuntu.com/ubuntu/
           - http://%(availability_zone)s.clouds.archive.ubuntu.com/ubuntu/
           - http://%(region)s.clouds.archive.ubuntu.com/ubuntu/
         security: []
     - arches: [arm64, armel, armhf]
       failsafe:
         primary: http://ports.ubuntu.com/ubuntu-ports
         security: http://ports.ubuntu.com/ubuntu-ports
       search:
         primary:
           - http://%(ec2_region)s.ec2.ports.ubuntu.com/ubuntu-ports/
           - http://%(availability_zone)s.clouds.ports.ubuntu.com/ubuntu-ports/
           - http://%(region)s.clouds.ports.ubuntu.com/ubuntu-ports/
         security: []
     - arches: [default]
       failsafe:
         primary: http://ports.ubuntu.com/ubuntu-ports
         security: http://ports.ubuntu.com/ubuntu-ports
   ssh_svcname: ssh

다시 로그아웃 하고 로그인 했을때 hostname 이 변경되었는지 확인 합니다. goodsaem으로 정상 변경되었습니다.

ubuntu@ip-172-31-47-167:~$ logout
Connection to ec2-13-209-42-88.ap-northeast-2.compute.amazonaws.com closed.
goodsaem@goodsaemui-iMac goodsaem % ssh -i "goodsaem.pem" ubuntu@ec2-13-209-42-88.ap-northeast-2.compute.amazonaws.com
Welcome to Ubuntu 18.04.5 LTS (GNU/Linux 5.4.0-1037-aws x86_64)

 * Documentation:  https://help.ubuntu.com
 * Management:     https://landscape.canonical.com
 * Support:        https://ubuntu.com/advantage

  System information as of Thu Mar  4 00:00:55 KST 2021

  System load:  0.0               Processes:           121
  Usage of /:   8.3% of 29.02GB   Users logged in:     1
  Memory usage: 39%               IP address for eth0: 172.31.47.167
  Swap usage:   0%

 * Introducing self-healing high availability clusters in MicroK8s.
   Simple, hardened, Kubernetes for production, from RaspberryPi to DC.

     https://microk8s.io/high-availability

 * Canonical Livepatch is available for installation.
   - Reduce system reboots and improve kernel security. Activate at:
     https://ubuntu.com/livepatch

18 packages can be updated.
0 of these updates are security updates.
To see these additional updates run: apt list --upgradable

New release '20.04.2 LTS' available.
Run 'do-release-upgrade' to upgrade to it.


*** System restart required ***
Last login: Wed Mar  3 23:13:55 2021 from 1.247.71.18
ubuntu@goodsaem:~$

 

/etc/hosts 아이피 변경

/etc/hosts 에 있는 아이피를 변경합니다.

아이피와 호스트 정보를 입력해 주세요 전 127.0.0.1 과 aws 부여해준 공인 아이피(이아이피는 서버를 재시작 하면 다른 아이피로 변경됩니다.)를 입력했습니다. 전 가급적이면 서버를 재시작 하지 않을 계획이므로 그대로 사용하겠습니다.

 

ubuntu@goodsaem:~$ sudo vi /etc/hosts

 

127.0.0.1 localhost
127.0.0.1 goodsaem
13.124.172.200 goodsaem.ml
13.124.172.200 www.goodsaem.ml

# The following lines are desirable for IPv6 capable hosts
::1 ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
ff02::3 ip6-allhosts

 

무료도메인내 ip 변경

freenom 무료 도메인을 발급 받은곳의 아이피를 aws ec2 서버 아이피로 변경합니다.

로그인후 service > my domains 를 클릭합니다.

 

Manage domain 버튼을 클릭합니다.

 

Manage Freenom DNS 를 클릭합니다.

ec2 서버의 아이피를 입력하고 save change 버튼을 클릭하여 변경사항을 적용 합니다.

 

댓글()

[AWS 무료 서버구축-5/18] AWS free tier 서버 접속(mac, windows)

Setup/aws|2021. 7. 25. 11:29

AWS freetier 서버 접속하기

mac , windows pc에서 생성한 프리티어 서버에 접속하는 방법입니다.

연결정보 확인

연결할 서버 접속 정보를 확인합니다.

  1. 인스턴스 아이디 아래 부분의 인스턴스를 클릭합니다.
  2. 연결 버튼을 클릭합니다.
  3. SSH 클라이언트 탭을 클릭합니다.
  4. SSH 클라이언트 아래의 텍스트를 복사합니다.
    • ssh -i "goodsaem.pem" ubuntu@ec2-13-209-42-88.ap-northeast-2.compute.amazonaws.com

 

프리티어 서버생성할때 키를 생성했었습니다. 키 생성한 곳으로 이동하여 붙여 넣기 하고 엔터를 입력하면 아래와 같이 서버에 접속합니다. 

 

Mac 에서 연결하기

Mac 에서 aws 서버 접속하는 방법입니다.

위에 복사한 문자열을 터미널에서 입력하고 엔터를 입력하면 아래와 같이 프리티어 서버로 접속됩니다.

 

goodsaem@goodsaemui-iMac goodsaem % ssh -i "goodsaem.pem" ubuntu@ec2-13-209-42-88.ap-northeast-2.compute.amazonaws.com
Welcome to Ubuntu 18.04.5 LTS (GNU/Linux 5.4.0-1037-aws x86_64)

 * Documentation:  https://help.ubuntu.com
 * Management:     https://landscape.canonical.com
 * Support:        https://ubuntu.com/advantage

  System information as of Wed Mar  3 22:43:18 KST 2021

  System load:  0.0               Processes:           120
  Usage of /:   8.3% of 29.02GB   Users logged in:     0
  Memory usage: 39%               IP address for eth0: 172.31.47.167
  Swap usage:   0%

 * Introducing self-healing high availability clusters in MicroK8s.
   Simple, hardened, Kubernetes for production, from RaspberryPi to DC.

     https://microk8s.io/high-availability

 * Canonical Livepatch is available for installation.
   - Reduce system reboots and improve kernel security. Activate at:
     https://ubuntu.com/livepatch

18 packages can be updated.
0 of these updates are security updates.
To see these additional updates run: apt list --upgradable


*** System restart required ***
Last login: Mon Mar  1 23:55:26 2021 from 1.247.71.18
ubuntu@ip-172-31-47-167:~$

윈도우에서 연결하기

윈도우에서는 putty 로 접속하며 해당 sw 설치하는 방법 과 ec2 서버에 접속하는 방법에 대해서 알아보겠습니다.

https://www.chiark.greenend.org.uk/~sgtatham/putty/latest.html설치파일을 다운로드 받고 설치를 진행합니다. default 로 다음 다음 하셔서 설치를 완료해 주세요..

 

 

putty gen 을 실행 합니다.

 

load 버튼을 클릭합니다. 모든 파일을 . 선택하고 goodsaem.pem 파일을 불러 옵니다.

Save private key 버튼을 클릭합니다.

goodsaem.ppk 파일로 적당한 위치에 저장합니다.

 

  • putty 를 실행하고 위에서 ubuntu@ 뒤쪽에 있는 문자를 복사해서 호스트에 붙여 넣기 합니다. ec2-13-209-42-88.ap-northeast-2.compute.amazonaws.com
  • ssh 메뉴 아래 Auth를 클릭합니다.

Browse 버튼을 클릭하여 goodsaem.ppk 파일을 불러 옵니다.

 

파일을 불러 왔으면 Open 버튼을 클릭 합니다.

login 부분에 ubuntu 라고 입력하고 엔터를 클릭하면 아래와 같이 서버에 접속이 정상 완료됩니다.

이상 mac 및 윈도우에서 구축한 aws 프리티어 서버에 접속하는 방법에 대해서 알아 보았습니다.

다음 시간에는  실제 서버 설정을 진행하겠습니다.

댓글()

[AWS 무료 서버구축-4/18] AWS 에 EC2 인스턴스 추가

Setup/aws|2021. 7. 25. 11:19

AWS 에 EC2 인스턴스 추가

무료로 사용할수 있는 freetier 서버를 추가하겠습니다.

 

Free Tier 서버를 구축을 위해 가입하신 정보로 로그인한후 aws console 버튼을 클릭하신후 서비스 > 모든 서비스 > 컴퓨팅 > EC2 서버를 선택합니다.

 

 

EC2 좌측메뉴중 인스턴스를 클릭하고 다시 인스턴스 시작 버튼을 클릭합니다.

 

프리티어 사용 가능이라고 된 서버가 무료 서버입니다. Ubuntu Server 18.04 LTS(HVM) SSD Volumn type을 선택 합니다.

 

다음 : 인스턴스 세부정보 구성 버튼을 클릭합니다.

 

변경없이 다음 : 스토리지 추가를 클릭합니다.

 

기본값 8 이라고 입력하고 다음 : 태그 추가 버튼을 클릭합니다.

 

 

무료는 30G 가능
30G 까지 가능하지만 해당 크기만큼 용량을 잡으면 프리티어 사용량에 포함 됩니다.
혹시 비용을 초과할수 있고 30G 만큼 사용하지 않을 계획 이므로 8G 로 설정을 진행합니다.

 

태그 추가 버튼을 클릭하여 키와 값에 식별할수 있는 이름을 입력합니다. 그리고 나서 다음 : 보안 그룹 구성 버튼을 클릭합니다.

 

새 보안 그룹 생성을 선택하고 검토 및 시작 버튼을 클릭합니다.

인스턴스 시작 검토 화면에서 선택한 내용들을 확인합니다. 그리고 나서 시작 하기 버튼을 클릭합니다.

이렇게 시작하고 나면 키페이 생성 화면이 팝업이 되는데 새 키 페어 생성을 선택하고 키페어 이름을 입력하고 키 페이 다운로드 버튼을 클릭하여 로컬 pc에 저장합니다. 그리고 나서 인서턴스 시작 버튼을 클릭합니다. 여기까지 완료하셨으면 프리티어 서버가 정상 생성되었습니다.

 

댓글()

[AWS 무료 서버구축-3/18] AWS 계정생성

Setup/aws|2021. 7. 25. 10:29

AWS 계정 생성

1년간 사용할 Aws 무료 계정을 생성합니다. (freetier로 생성하고 신용카드만 등록하면 1년간 사용할수 있습니다. 1년이 지나면 또 다른 신용 카드를 이용해서 서버를 setup 하시면 거의 무한정 사용할수 있을것 같네요)

 

1.계정생성

https://aws.amazon.com/ko/ 여기에 접속하여 우측상단의 AWS 계정생성 버튼을 클릭합니다.

 

 

이메일 주소 암호 계정 이름을 입력합니다.

연락처 정보는 개인,전체이름 및 전화번호 주소 우편 번호를 입력합니다. 주소는 비용이 발생할경우 청구하는 주소가 되므로 정확히 기재해 주시고 영문으로 작성하셔야 됩니다. 영문주소 변환은 https://www.jusoen.com  여기에서 가능합니다.

 

 

신용카드 정보와 만료날짜 및 신용카드에 적혀있는 카드 소유자 이름을 정확하게 입력하시고 청구지 주소를 선택합니다.

휴대폰 전화를 입력하여 문자로 확인코드를 받습니다. 보안검사 부분의 보안문자를 보안문자 입력하는 칸에 정확히 입력합니다.

 

휴대폰으로 온 문자를 확인하고 코드확인 란에 숫자를 입력하여 다음단계로 진행합니다.

마지막 단계로 기본지원 - 무료를 선택한후 가입을 완료합니다.

댓글()

[AWS 무료 서버구축-2/18] 무료 도메인 발급

Setup/aws|2021. 7. 25. 10:17

무료 도메인 발급

무료 도메인 발급 받는 방법에 대해서 알아 보겠습니다.

요즘 대부분의 웹서버는 https 통신을 합니다. 이제는 선택이 아닌 필수 인것 같네요 제가 서버를 구축하게 된 직접적인 원인도 https 설정을 하기 위함입니다. nginx 에 https 서비스를 구성하기 위해서는 도메인이 필요합니다. 도메인이 준비되면 certbot을 통해서 무료 ssl 인증서 적용 및 http/2 적용이 가능한데요 무료 도메인 가입하는 부분에 대해서 아래오 같이 정리했습니다. 서버셋업전 도메인 발급 받으시기 바랍니다.

 

Freenom

Freenom 에서 무료 도메인 발급 받는 방법입니다.

https://www.freenom.com/en/index.html?lang=en freenom 이란 사이트에서 무료 도메인을 발급 받을수 있습니다. 회원가입을 후 도메인 등록을 진행합니다.

  • 로그인 후 원하는 도메인을 입력하고 엔터키를 클릭한후 사용하고자 하는 도메인에서 Get it now! 버튼을 클릭하여 선택합니다. 그리고 나서 Checkout 버튼을 클릭합니다.

 

Use DNS 버튼을 클릭하고 Use Freenom DNS Service를 선택한후 aws free tier의 퍼블릭 ipv4 주소를 입력하고 Continue 버튼을 클릭합니다.

 

도메인 주문이 완료되었습니다.

 

My Domain 에서 주문한 도메인 확인이 가능합니다.

 

댓글()

[AWS 무료 서버구축-1/18] 무료 서버 구축 개요

Setup/aws|2021. 7. 25. 09:55

아마존 클라우드 환경에 rest api  서버 구축 하는 방법에 대한 글입니다.

 

구축원칙

서버를 구축할때 아래의 조건에 맞게 구축되어야 된다는 원칙을 정하고 방법을 찾았습니다.

  • 비용이 발생하면 안됩니다.
  • 완벽하게 https 를 지원해 주어야 됩니다.
  • springboot 지원가능해야 됩니다.
  • 구축해야 되는 서버는 오로지 https://goodsaem.github.io 사이트에서 요청한 데이터만 응답해야 됩니다.
  • mariadb 도 사용할수 있어야 됩니다.

이런 조건을 맞추기 위해서는 aws 서버 구축이 정답이였습니다. 1년간 프리티어로 무료로 사용할수 있기에 회원가입을 하고 신용카드를 등록하여 프리티어 서버를 구축했습니다.

 

아키텍처

  1. 사용자가 브라우저를 통해서 https://goodsaem.github.io를 접속합니다.
  2. 데이터를 저장하거나 데이터를 db 조회가 필요한경우 https://goodsaem.ml로 rest api를 호출합니다.
  3. nginx 웹서버는 https://goodsaem.github.io 에서 호출한 요청에 대해서만 응답하고 나머지 요청은 전부 거부하도록 설정합니다.
  4. https://goodsaem.ml/spring/으로 오는 요청은 spring boot가 응답하도록 설정합니다.
  5. db는 mariadb를 사용하며 spring에서 데이터 crud가 필요한 경우 동작하도록 설계합니다.

 

Setup 목표

 

서버 셋업이 완료되고 나서 ssl 수준이 얼마나 되는지 체크하는 사이트https://www.ssllabs.com/ssltest/analyze.html 에서 점검한 결과 입니다. A를 받았으니 잘 설정한것 같네요 ^^

 

 

 

댓글()