728x90

도커 명령어 구성


docker sub command 확인

docker 입력 후 tab 키 두 번

 

 

docker [관리 대상(오브젝트)] [동작]

docker 관리 대상 동작
  image, network, container, ... pull, rm, ls, ...

 


도커 이미지 관리


docker image

- 이미지의 태그는 생략하면 무조건 latest로 지정됨

- 특정 태그를 지정하는 것을 권장

- 가급적 latest는 사용하지 않는 것을 권장

 

docker image 서브 커맨드

 

 

1. 이미지 다운로드 (기본적으로 docker hub에서 다운로드됨)

docker image pull

ubuntu 이미지 다운로드

 

2. 다운로드한 도커 이미지 목록 출력

docker image ls

다운로드한 ubuntu 이미지 확인

 

3. 로컬 이미지 삭제

docker image rm

우분투 이미지 삭제

 

4. 로컬 이미지의 상세 정보 확인

docker image inspect

hello-world 이미지 상세 정보 확인

 

728x90
728x90

도커 & 컨테이너


도커란?

- 리눅스 컨테이너를 관리하는 컨테이너 런타임 (엔진) 중의 하나

- 컨테이너 런타임은 컨테이너를 생성/관리 역할

- 리소스들에 대한 격리 (프로세스/파일 시스템)

 

이미지란?

- 어플리케이션 실행에 있어서 필요한 파일들의 집합

 

컨테이너란?

- 이미지를 실행한 상태

- 실행 파일 : 프로세스 = 이미지 : 컨테이너

- 기능: 이미지 생성, 이미지 공유, 컨테이너 실행

- 오브젝트: 이미지, 컨테이너, 네트워크, 볼륨

- 기반 기술

  1) namespace: 각각의 리소스 격리

  2) cgroup: 리소스 관리를 위한 그룹 (컨트롤 그룹)

  3) 가상 브릿지/vNIC: 컨테이너에서 사용할 네트워크 환경을 제공하기 위한 기능

 

 

 

 

 


CentOS에 도커 설치


공식 문서 참고

https://docs.docker.com/engine/install/centos/

 

Install Docker Engine on CentOS

 

docs.docker.com

 

 

저장소 설정

Docker Engine 설치 전에 Docker 저장소 설정 필요

# 유틸리티를 제공하는 패키지 설치: yum-utils
sudo yum install -y yum-utils

# 리포지토리 설정
 sudo yum-config-manager \
    --add-repo \
    https://download.docker.com/linux/centos/docker-ce.repo

 

 

도커 엔진 설치

최신 버전의 Docker Engine, containerd 및 Docker Compose 설치

# 최신 버전 설치 시
sudo yum install docker-ce docker-ce-cli containerd.io docker-compose-plugin

# 또는 특정 버전 설치 시
 sudo yum install docker-ce-<VERSION_STRING> docker-ce-cli-<VERSION_STRING> containerd.io docker-compose-plugin

 

 

 

도커 시작

sudo systemctl start docker

 

설치된 도커 버전 확인

docker --version

 

이미지를 실행하여(이미지가 없다면 다운로드 후 실행됨) Docker 엔진의 설치 확인

sudo docker run hello-world

 

다운로드한 도커 이미지 목록

docker image ls

728x90
728x90

vim 편집기 설정

[vagrant@control-node ~]$ vi ~/.vimrc
syntax on
autocmd FileType yaml setlocal ts=2 sts=2 sw=2 et ai

 


 

플레이북 실행

인벤토리 파일에 호스트 등록 (/etc/ansible/hosts)

[vagrant@control-node ~]$ sudo vi /etc/ansible/hosts

## [webservers]
## alpha.example.org
## beta.example.org
 192.168.56.110
 192.168.56.120
 192.168.56.130
 192.168.56.140

 

플레이북 생성 (.yaml 파일)

[vagrant@control-node ~]$ cat playbook.yaml

---
- name: first playbook
  hosts: all
  tasks:
    - name: use command module
      command: id

...

 

플레이북 실행 (ansible-playbook)

 

728x90
728x90

앤서블 인벤토리


정의

- 앤서블에서 관리할 호스트 목록 정의

- 단일 호스트 및 그룹 단위로 관리

- 정적/동적 인벤토리 지원

 

 

정적 인벤토리에 관리 대상 호스트 지정

- 정적 인벤토리 파일은 텍스트 파일로 INI / YAML 형식 등 사용

- 호스트 그룹 사용 시 []로 그룹 이름 지정

- 기본 그룹으로 all / ungrouped 제공

- :children 접미사를 이용해 중첩 그룹 지정 가능

- 범위 지정 방식으로 간편한 구성 가능

- --list-hosts 옵션으로 확인 가능

 

 

인벤토리 위치 재정의

- 기본 경로: /etc/ansible/hosts

- ansible.cfg 파일에서 재정의 가능

- 명령어 사용 시 --inventory / -i 옵션으로 지정 가능

 

 


앤서블 구성 파일


구성 파일 종류

- /etc/ansible/ansible.cfg (가장 낮은 우선 순위)

- ~/.ansible.cfg

- ./ansible.cfg (일반적으로 권장하는 방식)

- ANSIBLE_CONFIG 환경 변수로 구성 파일의 위치 정의 (유연한 관리)

- ansible --version 명령 혹은 명령어 사용 시 -v 옵션으로 확인

 

앤서블 구성

지시문 설명
inventory 인벤토리 파일의 경로 지정
remote_user 관리 호스트에 로그인할 사용자의 이름
ask_pass SSH 암호를 요청하는 메시지 표시 여부
become 관리 호스트에서 자동으로 사용자를 전환할지 여부
become_method 사용자 전환 방식
become_user 관리 호스트에서 전환할 사용자
become_ask_pass become_method의 암호흫 요청하는 메시지 표시 여부

 

연결 구성

1. 해당 관리 호스트와 통신하는 방법을 확인하기 위해 구성 파일 참조

2. 관리 방법 및 사용자 제어

3. 필요한 정보

  1) 관리 호스트 및 호스트 그룹을 나열하는 인벤토리 위치

  2) 관리 호스트와 통신하는 데 사용할 연결 프로토콜

  3) 관리 호스트에서 사용할 원격 사용자

  4) root로의 권한 에스컬레이션 여부

  5) 에스컬레이션 수행 방법

  6) 로그인하거나 권한을 얻기 위해 SSH 암호 또는 sudo 암호를 요청하는 메시지 표시 여부

728x90
728x90

앤서블 개념


정의

- 오픈 소스 IT 자동화 도구

- 시스템 구성 및 소프트웨어 배포 기능 제공

- 지속적인 배포와 다운 타임 없는 롤링 업데이트 지원

- 주요 목적은 단순성과 사용의 용이성

- YAML 언어 사용

- 분산 구조 설계

- Kerberos / LDAP 등 인증 관리 시스템에 연결이 쉬움

 

장점

- SSH를 통한 구성 (에이전트x)

- YAML 언어를 사용해 접근성이 높음

- 쉽고 단순한 구조, 가독성이 높음

- 변수 기능 사용으로 재사용성 증가

- 다른 도구보다 간소화됨

- 다양한 플랫폼 지원

 

단점

- 다른 도구에 비해 덜 강력함

- DSL을 통한 로직 수행으로 수시로 문서 확인 필요

- 변수 등록으로 인한 복잡성

- 변수 값 확인의 어려움

- 입/출력/구성 파일 간의 형식 일관성이 없음

- 성능 속도 저하

 

구성

- YAML 언어로 구성된 텍스트 파일

- 하나 이상의 작업 내용의 집합

 

동작

- 각 작업은 특정 인수와 함께 작은 코드 조각인 모듈 실행

- 시스템의 특정 측면이 특정 상태에 있는지 확인

- 특정 상태가 아닌 경우 해당 상태를 구성하기 위한 작업 실행

- 작업 실패 시 기본적으로 나머지 동작도 모두 중단

- 별도의 에이전트 없이 ssh 또는 WinRM을 이용한 연결 및 제어

 


앤서블 아키텍처


컨트롤 머신 (제어 노드)

- 설치 및 실행

- 원격으로 관리 노드 제어

- 프로젝트 파일의 사본 보관

- Python v2.6 이상 필요

 

관리 대상 호스트 (관리 노드)

- 컨트롤 머신을 통해 모듈 설치 및 작업 실행

- 인벤토리에 나열된 대상

- 단독 혹은 그룹으로 관리 가능

- Python v2.4 이상 ssh 필요

 

아키텍처

 

 


 

실습 환경


 

아키텍처

- 제어 노드(control-node)

- 관리 호스트(host1, host2, host3, host4)

 

 

 

 

앤서블 구성

 

1. vagrant 설치

https://www.vagrantup.com/

 

Vagrant by HashiCorp

Vagrant enables users to create and configure lightweight, reproducible, and portable development environments.

www.vagrantup.com

 

2. Vagrantfile 다운로드

- 공유 파일

 

3. Vagrantfile 파일 실행

 

  1) 플러그인 설치: vagrant plugin install vagrant-hostmanager

  2) 가상 머신 배포: vagrant up

    - 에러 발생 1: undefined method `old_compare' for nil:NilClass (NoMethodError)

    - 해결

PS C:\HashiCorp\ansible> vagrant.exe plugin uninstall hostmanager
Uninstalling the 'hostmanager' plugin...
Removing hm
Successfully uninstalled hostmanager-1.2.2
Successfully uninstalled rubyhacks-0.1.5

 

- 에러 발생 2: umount: /mnt: not mounted

- 해결

https://www.devopsroles.com/vagrant-no-virtualbox-guest-additions-installation-found-fixed/

PS C:\HashiCorp\ansible> vagrant plugin uninstall vagrant-vbguest
PS C:\HashiCorp\ansible> vagrant plugin install vagrant-vbguest --plugin-version 0.21

 

  3) 실행 중인 가상 머신 확인: vagrant status

 

 

- 에러 발생 3: Vagrantfile에 네트워크 설정을 했음에도 불구하고 static 설정이 되지 않음

- 해결

# 플러그인 버전 확인
# 낮은 버전이라면 업데이트 필요

PS C:\HashiCorp\ansible> vagrant plugin update
Updating installed plugins...
Fetching vagrant-vbguest-0.30.0.gem
Successfully uninstalled vagrant-vbguest-0.21.0
Updated 'vagrant-vbguest' to version '0.30.0'!


PS C:\HashiCorp\ansible> vagrant plugin list
vagrant-hostmanager (1.8.9, global)
  - Version Constraint: > 0
vagrant-vbguest (0.30.0, global)
  - Version Constraint: > 0

 

 

4. 원격 접속

PS C:\HashiCorp\ansible> vagrant ssh control-node
[vagrant@localhost ~]$

 

5. 앤서블 설치

control-node에만 설치하면 됨

[vagrant@control ~]$ sudo yum install -y epel-release
[vagrant@control ~]$ sudo yum install -y ansible

 

6. SSH 설정 (모든 머신에 설정 필요)

기존에는 ssh 키 기반 인증으로 접속하여 패스워드 인증 사용 불가

-> 설정 변경 후에는 패스워드 인증을 사용한 원격 접속 가능

[vagrant@control ~]$ sudo vi /etc/ssh/sshd_config

# no > yes 로 변경
65 PasswordAuthentication yes

[vagrant@control ~]$ sudo systemctl restart sshd

 

7. 호스트 파일 확인

[vagrant@control-node ~]$ sudo cat /etc/hosts
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
127.0.1.1 control-node control-node

## vagrant-hostmanager-start
192.168.56.100  control-node

192.168.56.110  host1

192.168.56.120  host2

192.168.56.130  host3

192.168.56.140  host4

## vagrant-hostmanager-end

 

8. 패스워드 없이 원격 접속 설정

# 모든 가상 머신에서 사용자 생성
# 사용자 생성
[vagrant@control ~]$ sudo useradd ansible

# 패스워드 설정
[vagrant@control ~]$ sudo passwd ansible

# 패스워드 입력 없이 원격 접속하도록 설정
# 1. 컨트롤 노드에서 ssh 생성
# 2. 호스트로 복사 (host1, host2, host3, host4)

[vagrant@control-node ~]$ ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/home/vagrant/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/vagrant/.ssh/id_rsa.
Your public key has been saved in /home/vagrant/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:3lhOyiezamELTdrmy5HRbx7pw02DesuW6EcwACqeJhY vagrant@control-node
The key's randomart image is:
+---[RSA 2048]----+
|    ..           |
|   .  .          |
|.E.    .         |
|..o   ..o        |
|.=   =. Soo.     |
|+   o *= Oo.o    |
|     =ooB=O+ .   |
|     .+.oXB..    |
|     .++o+=o     |
+----[SHA256]-----+


# host[1..4] 설정
[vagrant@control-node ~]$ ssh-copy-id ansible@host1
/usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/home/vagrant/.ssh/id_rsa.pub"
/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
/usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys
ansible@host1's password:

Number of key(s) added: 1

Now try logging into the machine, with:   "ssh 'ansible@host1'"
and check to make sure that only the key(s) you wanted were added.

[vagrant@control-node ~]$ ssh ansible@host1
Last failed login: Tue Jun  7 09:33:07 UTC 2022 from 192.168.56.100 on ssh:notty
There were 25 failed login attempts since the last successful login.
[ansible@host1 ~]$

 

host4에서 에러 발생: ansible 사용자 생성 시 디렉토리가 자동으로 생성되지 않음

[vagrant@control-node ~]$ ssh-copy-id ansible@host4
/usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/home/vagrant/.ssh/id_rsa.pub"
/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
/usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys
ansible@host4's password:
Could not chdir to home directory /home/ansible: No such file or directory
sh: 1: cd: can't cd to /home/ansible
mkdir: cannot create directory ‘.ssh’: Permission denied

vagrant@host4:~$ ls -l /home
total 8
drwxr-xr-x 3 ubuntu  ubuntu  4096 Jun  7 07:36 ubuntu
drwxr-xr-x 4 vagrant vagrant 4096 Jun  7 07:51 vagrant

 

해결: 디렉토리 수동 생성

vagrant@host4:~$ sudo mkdir /home/ansible
vagrant@host4:~$ sudo chown ansible:ansible /home/ansible
vagrant@host4:~$ sudo chmod 755 /home/ansible
vagrant@host4:~$ sudo ls -l /home
total 12
drwxr-xr-x 2 ansible ansible 4096 Jun  7 09:44 ansible
drwxr-xr-x 3 ubuntu  ubuntu  4096 Jun  7 07:36 ubuntu
drwxr-xr-x 4 vagrant vagrant 4096 Jun  7 07:51 vagrant

 

 

8. sudo 설정

패스워드 없이 sudo 명령어 사용 설정

[vagrant@control-node ~]$ sudo ls /etc/sudoers.d
vagrant
[vagrant@control-node ~]$ sudo cat /etc/sudoers.d/vagrant
%vagrant ALL=(ALL) NOPASSWD: ALL
[vagrant@control-node ~]$
[vagrant@control-node ~]$ sudo grep wheel /etc/sudoers
## Allows people in group wheel to run all commands
%wheel  ALL=(ALL)       ALL
# %wheel        ALL=(ALL)       NOPASSWD: ALL


# 모든 가상 머신에서 파일 생성
[vagrant@control-node ~]$ sudo vi /etc/sudoers.d/ansible
ansible ALL=(ALL) NOPASSWD: ALL

 

ansible 파일 생성 전

[vagrant@control-node ~]$ ssh ansible@host1 "sudo id"

We trust you have received the usual lecture from the local System
Administrator. It usually boils down to these three things:

    #1) Respect the privacy of others.
    #2) Think before you type.
    #3) With great power comes great responsibility.

sudo: no tty present and no askpass program specified

 

ansible 파일 생성 후

[vagrant@control-node ~]$ ssh ansible@host1 "sudo id"
uid=0(root) gid=0(root) groups=0(root) context=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023
[vagrant@control-node ~]$ ssh ansible@host2 "sudo id"
uid=0(root) gid=0(root) groups=0(root) context=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023
[vagrant@control-node ~]$ ssh ansible@host3 "sudo id"
uid=0(root) gid=0(root) groups=0(root) context=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023
[vagrant@control-node ~]$ ssh ansible@host4 "sudo id"
uid=0(root) gid=0(root) groups=0(root)
728x90
728x90

IaC 개요


IaC란

- 코드를 통한 인프라 환경 배포 및 관리

- 자동화 언어로 원하는 구성 정의

 

 

기존의 시스템 관리 방식 - 수동 관리

- 명령어 또는 그래픽 도구를 이용한 수동 작업

- 작업 시 오류 발생 가능성이 높음

- 수행 결과에 대한 검증이 제한적

- 여러 시스템의 일관적인 구성이 어려움

- 유지 관리가 어렵고 안정성이 떨어짐

 

 

IaC 특징

 

IaC의 필요성

- 인프라 환경의 규모 확대

- 서비스 방식의 변화

- 반복적인 작업 자동화

- 인프라에 대한 빠른 배포 및 버전 관리 필요

 

IaC 의 장점

- 비용 및 시간 절감

- 버전 관리가 쉬움

- 자동으로 빌드/리빌드 가능

 

 

스크립트와 IaC

 

스크립트의 한계점

- 할 수 있는 일이 제한적

- 구조적 코딩 프로젝트에 비해 스크립트 작성은 느슨하고 약식으로 수행

- 멱등성의 부재

 

IaC의 기능

- 체크인/체크아웃, 리비전, 롤백, 테스트, 배포 등의 기능 제공

- 멱등성을 통한 안정적인 결과 도출

- 인증 정보의 설정도 다룰 수 있음

- 클라우드 환경 및 데브옵스 환경에 적합

- 개발, 테스트, 품질 보증, 스테이징, 릴리스까지 사이클 구성

 

 

IaC 도구 종류

 

[출처] http://www.itdaily.kr/news/articleView.html?idxno=201814

 

 

Infrastructure Templating: 초기 인프라 설정

- 스크립트를 통한 인프라 프로비저닝

 

Manage Infrastructure: 인프라 관리

- 생성된 인프라 수정, 재사용, 인프라 작업 정보 관리

 

Install applications and one time configurations: 인프라 애플리케이션 배포

- 준비된 애플리케이션의 새 버전을 서버에 배포

 

Deploy configuration and changes post install: 배포된 인프라 애플리케이션 관리

 

 

728x90
728x90

NFS란


NFS란

- Network File System

- 서버의 리소스를 클라이언트 상에서 마치 자신의 리소스를 사용하는 것처럼 사용할 수 있도록 제공

- 네트워크가 가능한 곳이면 리눅스, 유닉스 등의 운영 체제에서 NFS를 사용하여 파일 시스템 공유 가능

 


실습 환경


  Server 1 Client 2
IPv4 (enp0s3) 10.0.2.5 10.0.2.4
IPv4 (enp0s8) 192.168.56.101 192.168.56.102
OS CentOS 7 CentOS 7

 

 

실습 개요


NFS 서버의 공유 디렉토리에 클라이언트가 마운트하여 파일 생성 및 삭제가 가능한 것을 확인할 수 있음

 


NFS 서버 구성


 

NFS 패키지 설치 확인

rpm -qa nfs-utils

 

NFS 공유 디렉토리 설정 파일 구성

/etc/exports

vi /etc/exports
/share 10.0.2.*(rw,sync)

 

NFS 공유 디렉토리 생성

mkdir /share
chmod 777 /share
touch /share/file1

 

NFS 설정 적용

systemctl restart nfs-server
systemctl enable nfs-server

exportfs -v
# /share 10.0.2.*(sync,wdelay,hide,no_subtree_check,sec=sys,rw,secure,root_squash,no_all_squash)

 

방화벽 설정

firewall-cmd --permanent --add-service mountd
firewall-cmd --permanent --add-service rpc-bind
firewall-cmd --permanent --add-service nfs
firewall-cmd --reload

 


NFS 클라이언트 연결 1

- 수동 마운트 -


 

NFS 패키지 설치 확인

rpm -qa nfs-utils

 

 

마운트 포인터 생성

mkdir /nfs_share

 

마운트

Server 1의 /share 공유 디렉토리에 마운트

mount -t nfs 10.0.2.15:/share /nfs_share

 

마운트 확인

# Client 2에서 작업
# 마운트 포인트로 이동하여 file2 파일 생성
cd /nfs_share/
touch file2

# Server 1에서 file2 파일 확인
ls /share


AutoFS


 

AutoFS 파일 시스템과 맵(Map)

- 맵: autofs 모듈이 동작하는 데 필요한 정보가 저장된 설정 파일

 

 

Map의 세 가지 종류

1. master map

- AutoFS 파일 시스템에서 가장 기준이 되는 맵

- /etc/auto.master.d/ 에 이름 .autofs 파일에 설정 저장

- direct map이나 indirect map의 이름이나 포인터를 정의하는 역할 담당

 

2. direct map (직접 맵 마운트)

- /etc/auto. 이름으로 파일을 만들어 설정 저장

- 맵 내부의 마운트 포인터로 절대 경로 명 사용

 

3. indirect map (간접 맵 마운트)

- /etc/auto. 이름으로 파일을 만들어 설정 저장

- 맵 내부의 마운트 포인터로 상대 경로명 사용

 


NFS 클라이언트 연결 2

- 자동 마운트 -


직접 맵 마운트


autofs 패키지 설치

# 앞에서 작업했던 마운트 해제
umount /nfs_share

# autofs 패키지 설치
yum install -y autofs

 

direct.autofs 파일 생성

vi /etc/auto.master.d/direct.autofs

# /-: 직접 맵 마운트를 사용하겠다
/-      /etc/auto.direct

 

직접 맵 파일 생성

vi /etc/auto.direct
/nfs_share      -rw,sync        10.0.2.15:/share

 

autofs 설정 적용

systemctl start autofs.service
systemctl enable autofs.service

 

마운트된 것을 확인할 수 있음

 


NFS 클라이언트 연결 3

- 자동 마운트 -


간접 맵 마운트


실습 환경 정리

systemctl stop autofs

# autofs 서비스를 중지하면 자동으로 마운트 해제
umount /nfs_share

# autofs 관련 파일 삭제
rm -rf /etc/auto.direct
rm -rf /etc/auto.master.d/direct.autofs

 

설정 파일 생성

# /indirect 파일 생성
vi /etc/auto.master.d/indirect.autofs
/indirect	/etc/auto.indirect

# /etc/auto.indirect 파일 생성
vi /etc/auto.indirect
share	-rw,sync	10.0.2.15:/share

 

디렉토리 생성

mkdir /indirect
mkdir /indirect/share

 

설정 적용

systemctl start autofs
systemctl enable autofs

 

마운트 성공

 

Clinet 2의 /indirect/share 디렉토리에서 file3 파일 생성

 

Server 1의 /share 디렉토리에서 file3 파일 확인

728x90
728x90

PHP 설치


php7을 설치할 remi 저장소 사전 구축

yum -y install epel-release
wget https://rpms.remirepo.net/enterprise/remi-release-7.rpm --no-check-certificate
rpm -Uvh remi-release-7.rpm

 

php 설치 및 웹 페이지 생성

yum install httpd -y

# yum-config-manager 설치
yum install -y yum-utils

# php7.3 설치가능한 remi repo 활성화
yum-config-manager --enable remi-php73

# php 설치
yum install -y php

# php 웹 페이지 생성
echo "<?php phpinfo(); ?>" > /var/www/html/phpinfo.php

 

서비스 시작 및 방화벽 설정

systemctl restart httpd
systemctl enable httpd

firewall-cmd --permanent --add-service=http
firewall-cmd --permanent --add-service=https
firewall-cmd --reload

 

Win 7에서 php 웹 페이지 확인

192.168.56.101/phpinfo.php

 

 

 

 

MariaDB 구축


DB  설치

yum install mariadb-server mariadb -y

systemctl enable mariadb
systemctl restart mariadb

 

 

DB  보안 설정

mysql_secure_installation

Set root password? [Y/n] y
New password: qwer1234
Re-enter new password: qwer1234

Remove anonymous users? [Y/n] y

Disallow root login remotely? [Y/n] y

Remove test database and access to it? [Y/n] y

Reload privilege tables now? [Y/n] y

 

DB와 php를 연동하는 패키지 설치

yum install php-mysql -y
systemctl restart httpd

 

DB 설정

# 패스워드: qwer1234
mysql -u root -p

MariaDB [(none)]> CREATE DATABASE wordpress;

MariaDB [(none)]> CREATE USER wordpress@localhost IDENTIFIED BY "qwer1234";

MariaDB [(none)]> GRANT ALL ON wordpress.* TO wordpress@localhost;

MariaDB [(none)]> FLUSH PRIVILEGES;

MariaDB [(none)]> exit

 

 

WordPress 구축


워드프레스 설치

cd /tmp && wget http://wordpress.org/latest.tar.gz

tar -xvzf latest.tar.gz -C /var/www/html

chown -R apache /var/www/html/wordpress

 

홈페이지 접속

192.168.56.101/wordpress

 

 

 

 

워드프레스 설정

 

임의의 값 입력 후 워드프레스 설치

 

로그인

 

워드프레스 페이지 확인

192.168.56.101/wordpress/wp-admin

 

 

192.168.56.101/wordpress

 

728x90

+ Recent posts