----- 주의: 삽질 기록이니 따라하지 마세요 ------
필요할때 쓸 수 있는 서버가 있으면 좋겠다 생각을 했다.
그런데 대표적인 AWS의 경우 1년 마다 새로 회원가입을 해야되서 귀찮았다.
그런데
오라클 클라우드 평생 무료 티어가 있다길래 써보려다
하루를 날리고 계정은 로그인도 안되고 뭐 컨택 이메일은 답장도 안오고 비밀번호 변경 메일도 안오고
화가나서 때려치고 다른걸 검색해보니 GCP 도 1년이 아닌 평생 무료 사용이 가능했다.
오늘은 무료 VM에다 Swift 서버 프레임워크인 Vapor 로 Rest 서버를 세팅하려 한다.
GCP 무료 VM 세팅 참고한글
구글 클라우드 프리티어 이후 항상(평생) 무료 사용하는 방법
예전에 구글 클라우드 프리티어를 1년간 사용했었는데요. 그리고 나서 AWS를 프리티어가 끝나는 1년마다 메뚜기처럼 옮겨다니니 불편했습니다. 그래서 오늘 구글 클라우드 플랫폼에서 항상 무료
nhj12311.tistory.com
참고로 나는 Ubuntu 16.04 버전을 선택했고 나머지 옵션은 같다.
VM 인스턴스가 만들어 졌다.
이제 Vapor 로 Rest 서버 만들어 보자 (Ubuntu 18.04 버전)
# 인스턴스에 접속한다.
VM 인스턴스 탭에서 SSH 연결을 클릭하면 자동으로 연결된다.
# git 을 설치해준다.
우분투 16.04 는 기본적으로 설치가 되있다. 그래도 확인해보자
sudo apt-get install git
# apt 를 업데이트 시켜준다
sudo apt-get update
# python2.7의 컴포넌트와 clang 을 설치한다.
Swift 를 위해 필요하다.
sudo apt-get install clang libicu-dev libpython2.7
# Swift 바이너리 파일을 다운받는다.
apt 가 아닌 스위프트 공홈에서 다운받는다.
Swift 최신버전 확인
Vapor 는 Swift 4.1 이상 부터 지원된다 주의!
https://swift.org/download/#releases
Swift.org
Swift is a general-purpose programming language built using a modern approach to safety, performance, and software design patterns.
swift.org
wget https://swift.org/builds/swift-5.1.2-release/ubuntu1804/swift-5.1.2-RELEASE/swift-5.1.2-RELEASE-ubuntu18.04.tar.gz
# gpg 서명 & 손상여부
gpg --keyserver hkp://pool.sks-keyservers.net \
--recv-keys \
'7463 A81A 4B2E EA1B 551F FBCF D441 C977 412B 37AD' \
'1BE1 E29A 084C B305 F397 D62A 9F59 7F4D 21A5 6D5F' \
'A3BA FD35 56A5 9079 C068 94BD 63BC 1CFE 91D3 06C6' \
'5E4D F843 FB06 5D7F 7E24 FBA2 EF54 30F0 71E1 B235' \
'8513 444E 2DA3 6B7C 1659 AF4D 7638 F1FB 2B2B 08C4' \
'A62A E125 BBBF BB96 A6E0 42EC 925C C1CC ED3D 1561' \
'8A74 9566 2C3C D4AE 18D9 5637 FAF6 989E 1BC1 6FEA'
wget https://swift.org/builds/swift-5.1.2-release/ubuntu1804/swift-5.1.2-RELEASE/swift-5.1.2-RELEASE-ubuntu18.04.tar.gz.sig
gpg --verify swift-5.1.2-RELEASE-ubuntu18.04.tar.gz.sig
# Swift 다운로드 파일 압축 해제
tar xzf swift-5.1.2-RELEASE-ubuntu18.04.tar.gz
# Swift 디렉토리 이동
sudo mv swift-5.1.2-RELEASE-ubuntu18.04 /usr/share/swift
# 경로설정
echo "export PATH=/usr/share/swift/usr/bin:$PATH" >> ~/.bashrc
source ~/.bashrc
이제 Swift 설치가 다됬다. 한번 확인해보자
swift
REPL 에서 빠져나가려면 CTRL+D 하면 된다.
이제 반왔다.
Vapor 가 잘 안깔려서 다음 글로 넘긴다.
curl -sL apt.vapor.sh -o apt.vapor.sh
이게 되야되는데 apt.vapor.sh 가 다운로드가 안된다.
하 참 뭐 툴박스로 삽질도 했는데 일단 실패
다음글
GCP - 무료 Vapor 서버 만들기 - Ubuntu+Swift(2)
----- 주의: 삽질 기록이니 따라하지 마세요 ------ Vapor 다시 시도해보겠다. 일단 새마음 새뜻으로 vm 새로 만들어서 Swfit 설치까지 하겠다. 이전에 했던 Swift 까는 방법은 sudo apt-get update wget https:/..
haningya.tistory.com
참고
https://docs.vapor.codes/4.0/hello-world/
Vapor: Getting Started → Hello, world
Hello, world This guide will take you step by step through creating a new Vapor project, building it, and running the server. If you have not yet installed Swift or Vapor Toolbox, check out the install section. New Project The first step is to create a new
docs.vapor.codes
vapor/apt
Manage Vapor's Swift APT repository. Contribute to vapor/apt development by creating an account on GitHub.
github.com
https://docs.vapor.codes/2.0/getting-started/install-on-ubuntu/
Install: Ubuntu - Vapor Docs
Install on Ubuntu Installing Vapor on Ubuntu only takes a couple of minutes. Supported Vapor supports the same versions of Ubuntu that Swift supports. Version Codename 16.10 Yakkety Yak 16.04 Xenial Xerus 14.04 Trusty Tahr APT Repo Add Vapor's APT repo to
docs.vapor.codes
https://www.digitalocean.com/community/tutorials/how-to-install-swift-and-vapor-on-ubuntu-16-04
How To Install Swift and Vapor on Ubuntu 16.04 | DigitalOcean
In this guide, you'll install Swift and Vapor on Ubuntu 16.04. Then you'll test your setup by creating a simple web application using one of Vapor's templates.
www.digitalocean.com
https://www.techiediaries.com/swift-vapor-tutorial/
Swift Vapor Tutorial — Creating a REST API | Techiediaries
Swift Vapor Tutorial — Creating a REST API Swift Vapor Tutorial—Creating a RESTful API Swift is a popular programming language among iOS developers. It's known for its common use for developing iOS mobile apps for the Apple store but it can be also use
www.techiediaries.com
https://docs.vapor.codes/2.0/getting-started/install-on-ubuntu/
Install: Ubuntu - Vapor Docs
Install on Ubuntu Installing Vapor on Ubuntu only takes a couple of minutes. Supported Vapor supports the same versions of Ubuntu that Swift supports. Version Codename 16.10 Yakkety Yak 16.04 Xenial Xerus 14.04 Trusty Tahr APT Repo Add Vapor's APT repo to
docs.vapor.codes
https://medium.com/@addamb/getting-started-with-vapor-and-swift-on-ubuntu-16-04-31a426654115
Getting started with Vapor and Swift On Ubuntu 16.04
I am not an expert I myself am still learning the inner workings of vapor and swift. I wrote this in hopes to help others get setup and…
medium.com
https://gist.github.com/DevSecOpsGuy/281ffc34e4fc2f01e36d1e2bdf9db574
Swift and Vapor on Ubuntu 18.04
Swift and Vapor on Ubuntu 18.04. GitHub Gist: instantly share code, notes, and snippets.
gist.github.com
'Server > Vapor - Server_Side_Swift' 카테고리의 다른 글
Vapor 서버 만들기 - Ubuntu+Swift+Vapor+Github+Supervisor(5) (0) | 2020.08.16 |
---|---|
Vapor 서버 만들기 - Ubuntu+Swift+Vapor+Github(4) (0) | 2020.08.16 |
GCP - 피땀흘린 서버 인스턴스 이미지로 백업하기 (0) | 2020.08.16 |
GCP - 무료 Vapor 서버 만들기 - Ubuntu+Swift+Vapor(3) (0) | 2020.08.15 |
GCP - 무료 Vapor 서버 만들기 - Ubuntu+Swift(2) (0) | 2020.08.15 |
댓글