Ubuntu20 에 swift5 + vapor4 설치하기
1. Ubuntu20.0.4 LTS 버전 설치
2. 한글 locale 설정
ubuntu-18.04.2-live-server-amd64 설치(4) 한글 설치 설정- 리눅스 보안 실습(Kali Linux)
여기서는 한글 설치를 하겠습니다. live 버전이라 처음 설치에 한글이 없었기 때문에 따로 설치를 해줘야 됩니다. apt-get isntall language-pack-ko 위 명령어를 통해 한글 언어팩을 설치할 수 있습니다. �
epicarts.tistory.com
3. sshd 설치 & 설정
www.lesstif.com/lpt/sshd-server-24445601.html
우분투 데스크탑 sshd server 활성화
www.lesstif.com
4. swift5 설치 ( swift5.2.5)
medium.com/@gigmuster/install-swift-5-0-on-ubuntu-18-04-86f6b96654
Install Swift 5.0 on Ubuntu 18.04
This page is a personal memo about how to install Swift 5.0 on Ubuntu 18.04. This memo is written in APR 2019.
medium.com
swift.org/getting-started/#installing-swift
Swift.org
Swift is a general-purpose programming language built using a modern approach to safety, performance, and software design patterns.
swift.org
18.04 와 동일하나, 필수 패키지 설치시, swift.org 참조하여 설치
5. vapor 설치
docs.vapor.codes/4.0/install/linux/
Vapor: Install → Linux
Install on Linux To use Vapor, you will need Swift 5.2 or greater. This can be installed using the toolchains available on Swift.org Supported Distributions and Versions Vapor supports the same versions of Linux distributions that Swift 5.2 or newer versio
docs.vapor.codes
toolbox 체크아웃 후, sudo 오류가 발생하는데, 설치한 swift 폴더를 sudoers 에 추가 해준다.
아래 사이트 참고.
[Linux] sudo command not found 해결법 (Go 권한문제 해결법)
우분투에서 패키지를 설치하지 않고 압축을 풀어서 사용하면 로그인된 사용자에 맞게 설정할 시, 로그인된 사용자는 세팅한 명령어를 사용할 수 있지만 사용자 권한을 변경하면 해당 패키지를
brownbears.tistory.com
6. vapor 샘플 생성 ( hello )
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 run
외부에서 접속 가능하도록 hostname 설정하여 실행
vapor run serve --hostname 0.0.0.0 --port 8080
실행시 오류 01
LinuxMain.swift 오류가 없다고 하는 오류가 발생하며 실행안됨
./Tests 폴더에 아래와 같은 내용을 갖는 LinuxMain.swift 파일 생성
import XCTest
@testable import AppTests
XCTMain([testCase(AppTests.allTests)])
참고 사이트
github.com/vapor/api-template/issues/57
Missing/Empty LinuxMain.swift · Issue #57 · vapor/api-template
The LinuxMain.swift inside Tests folder is empty . Even for the "testNothing" example, it is useful to have an example on what this file should look like, since it is a little misleading ...
github.com