sanguk.dev
작성완료
우분투 배포 환경 구축

우분투 배포 환경 구축

우분투 배포 환경 구축을 위해 FPT, CURL, NVM, NodeJS, Python, MySQL을 설치하는 방법을 설명합니다. 각 설치 과정은 명령어와 함께 단계별로 안내되며, MySQL의 외부 접속 허용 및 사용자 권한 설정 방법도 포함되어 있습니다.

UbuntuMySQLNVMNodeJSPython

shell
apt update

FPT 설치

shell
apt install vsftpd

CURL 설치

shell
apt install curl

NVM 및 NodeJS 설치

1. NVM 설치

shell
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.36.0/install.sh | bash
shell
source ~/.bashrc

2. NVM으로 NodeJS 설치 (예: 22버전 설치)

shell
nvm install 22
shell
nvm use 22
shell
nvm alias default 22

Python (FastAPI) 설치

shell
apt install python3 python-pip3
shell
pip3 install uvicorn fastapi

MySQL 설치

1. 설치

shell
apt install mysql-server

2. 외부접속 허용

shell
ufw allow mysql

3. MySQL 실행

shell
systemctl start mysql

4. 서버 재시작 시에 MySQL 자동 재시작

shell
systemctl enable mysql

5. MySQL 접속

shell
mysql -u root -p

6. 데이터베이스 생성

sql
CREATE DATABASE <스키마명>;

7. 사용자 생성

sql
CREATE USER 'root'@'%' identified by '비밀번호';

8. 사용자 권한 할당

sql
GRANT ALL PRIVILEGES ON *.* to 'root'@'%';

9. 사용자 권한 적용

sql
flush privileges;

10. 접속 Host 설정

shell
vi /etc/mysql/mysql.conf.d/mysqld.cnf
plain
bind-address = 127.0.0.1  # before
bind-address = 0.0.0.0  # after

11. MySQL 재시작

shell
systemctl restart mysql