1. Apache 설치
ubuntu 22 터미널에서
sudo apt update
sudo apt upgrade
sudo apt install apache2 -y
아래 명령어로 정상 실행 확인 (activate 확인)
systemctl status apache2
2. MariaBD respository 설정(https://mariadb.org/download/?t=repo-config&d=22.04+"jammy"&v=10.6&r_m=xtom_jp)
sudo apt-get install apt-transport-https curl sudo mkdir -p /etc/apt/keyrings sudo curl -o /etc/apt/keyrings/mariadb-keyring.pgp 'https://mariadb.org/mariadb_release_signing_key.pgp'
Once the key is imported, copy and paste the following into a file under /etc/apt/sources.list.d (for instance /etc/apt/sources.list.d/mariadb.sources):
# MariaDB 10.6 repository list - created 2023-11-28 07:17 UTC
#https://mariadb.org/download/
X-Repolib-Name: MariaDB
Types: deb
# deb.mariadb.org is a dynamic mirror if your preferred mirror goes offline. Seehttps://mariadb.org/mirrorbits/ for details.
# URIs:https://deb.mariadb.org/10.6/ubuntu
URIs:https://tw1.mirror.blendbyte.net/mariadb/repo/10.6/ubuntu
Suites: jammy
Components: main main/debug
Signed-By: /etc/apt/keyrings/mariadb-keyring.pgp
3. MariaDB 10.6 설치하기 (본인이 원하는 버전으로 설치 가능)
sudo apt-get update sudo apt-get install mariadb-server
Version 확인: mysql -V
$ sudo apt install mariadb-client
$ sudo mysql_secure_installation
sudo apt-get update sudo apt-get install mariadb-server
mysql -V (Version 확인_
sudo apt install mariadb-client
sudo mysql_secure_installation
5. 고정 Ip 할당(랜선 필히 확인)
아이피주소: 220.xxx.xxx.xxx. (ssh 할당 port: 100xx)
6. MariaDB 외부접근 설정
https://ubuntu.com/engage/secure-kubernetes-at-the-edge
계정비밀번호 생성
# mariadb 실행
~# mysql
# 비밀번호 설정
MariaDB [(None)]> set password=password('비밀번호');
1) 계정 권한 부여
MariaDB [(None)]> GRANT ALL PRIVILEGES ON *.* to 'root'@'%' IDENTIFIED BY '비밀번호';
@) 환경설정 파일 수정
~# nano /etc/mysql/my.cnf (본인의 포트 번호로 변경 => port 12)
~# nano /etc/mysql/mariadb.conf.d/50-server.cnf (bind-address = 127.0.1 주석처리)
3) DB 재시작
~# systemctl restart mysql.service
4) 외부허용 접속 테스트
mysql -h "IP주소" -P (포트번호) -u root -p
⇒ 접속가능
5) 방화벽 추가
ufw allow 21000
댓글