1.ssh -i test.pem ec2-user@EC2 IP
2. curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash
3. source ~/.bashrc
4. nvm install --lts # 최신 버전이 아닌 버전을 다운받고 싶다면 https://nodejs.org/en/download/package-manager/current 해당 링크에서 자신이 다운받고자 하는 버전을 찾아서 명령어를 실행시키면 된다.
5. node -e "console.log('Running Node.js ' + process.version)"
6. npm i -g pm2
7. npm install express
8. npm ci
9. npm run build --if-present
10. vi app.js
const express = require('express') const app = express() const port = 3000 app.get('/', (req, res) => { res.send('Hello World!') }) app.listen(port, () => { console.log(`Example app listening on port ${port}`) })
11.pm2 start app.js
https://pm2.keymetrics.io/docs/usage/quick-start/
https://expressjs.com/en/starter/installing.html
https://nodejs.org/en/download/package-manager/current
https://docs.aws.amazon.com/ko_kr/sdk-for-javascript/v2/developer-guide/setting-up-node-on-ec2-instance.html
'Linux' 카테고리의 다른 글
Sudo redirection does not work (0) | 2024.06.09 |
---|---|
Vim settings (0) | 2024.06.09 |
AWS EC2 Apache, php, MySQL 설치 가이드 (2) | 2024.06.08 |
SSH 비밀번호로 접속하기 (0) | 2024.06.08 |
[AWS] AL 2023 EBS 추가하기 (0) | 2024.06.08 |