2 분 소요

1. 서론

    오늘은 2주간의 프로젝트를 마치고 오랜만에 수업을 진행했으며, Docker와 Container에 대해서 배워보았다.

2. 본론

1. Docker

1. Web on Docker
//1-1. Install and Run docker
# dnf install -y dnf-utils
# dnf-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
# dnf install -y docker-ce
# wget get.docker.com
# docker -v
# systemctl enable --now docker
# docker info
//1-2. Download OS Image
# docker pull ubuntu:14.04
# docker images //verify
//1-3. Create Container
# docker create -i -t --name myfirst_container ubuntu:14.04
//1-4. Run
# docker start myfirst_container
# docker ps
//1-5. attach
# docker attach myfirst_container
# exit
# docker ps -a
//1-6. Port 할당해서 생성
# docker container prune //delete all
# iptables -t filter -F
# iptables -t filter -X
# docker run -it --name testweb -p 80:80 ubuntu:14.04
//1-7. Apache HTTP Server on Ubuntu
# apt-get update
# apt-get install -y apache2
# service apache2 start
ctrl + shift + p + q
//1-8. Host PC에서 Web 사용 가능한지 체크(Web Browser)
http://10.10.51.37/

2. Cloud server on Docker
//2-1. container 생성
# docker pull ubuntu:20.04
# docker images
# docker create -it --name owncloud -p 80:80 ubuntu:20.04
# docker start owncloud
# docker attach owncloud
//2-2. PPA
# apt -y update && apt -y upgrade
# apt install software-properties-common // PPA를 추가 또는 제거하는 툴
//PPA(Personal Package Archive)는 개인 패키지 저장소로써 개발자가 소스코드를 업로드하면 자동으로 패키지화하여 사용자가 다운로드 받아 설치할 수 있게 해주는 소프트웨어 저장소이다. PPA를 통해 최신 버전들을 다운로드 할 수 있다.
# add-apt-repository ppa:ondrej/php // PHP PPA 추가
# apt install -y libapache2-mod-php7.4 openssl php-imagick php7.4-common php7.4-curl php7.4-gd php7.4-imap php7.4-intl php7.4-json php7.4-ldap php7.4-mbstring php7.4-mysql php7.4-pgsql php-smbclient php-ssh2 php7.4-sqlite3 php7.4-xml php7.4-zip
# php -v
# service start apache2
# service enable apache2
//2-3. mariaDB 설치
# apt install -y mariadb-server
# service mysql start
# mysql -u root -p
//2-4. DB
> CREATE DATABASE owncloud_db;
> GRANT ALL ON owncloud_db.* TO 'owncloud_user'@'localhost' IDENTIFIED BY '1234';
> flush privileges;
> exit
//2-5. owncloud 설치 / 설정
// https://owncloud.com/download-server/
// Download.ZIP > 링크 복사
# apt install -y wget
# wget https://download.owncloud.com/server/stable/owncloud-complete-latest.zip
# ls
# apt install -y unzip
# unzip owncloud-complete-latest.zip -d /var/www
# rm -rf owncloud-complete-latest.zip
# chown -R www-data:www-data /var/www/owncloud/
# vim /etc/apache2/conf-available/owncloud.conf
Alias /owncloud "/var/www/owncloud/“
<Directory /var/www/owncloud/>
Options +FollowSymlinks
AllowOverride All
<IfModule mod_dav.c>
Dav off
</IfModule>
SetEnv HOME /var/www/owncloud
SetEnv HTTP_HOME /var/www/owncloud
</Directory>

# a2enconf owncloud
# a2enmod rewrite
# a2enmod headers
# a2enmod env
# a2enmod dir
# a2enmod mime
# service apache2 restart

//on host pc
10.10.51.37/owncloud
관리자계정 : admin / 1234
사용자 추가 : user1 / keduit.testuer@gmail.com / 1234 / 할당량(100MB)

//동기화
D:\owncloud //생성

ownCloud -> http://10.10.51.37/owncloud -> user1 / 1234
-> 폴더 동기화 연결 추가 -> D:\owncloud

//Optional(CentOS)
# docker search centos
# docker pull centos:8
# docker images
# docker create -i -t --name my_centos8 centos
# docker start my_centos8
# docker ps
# docker attach my_centos8

image

- Owncloud on Amazon Linux
//1. Yum Update
# yum update -y
//2. Install PHP
# amazon-linux-extras install php7.4 -y
# yum install -y php-cli php-common php-gd php-mbstring php-mysqlnd php-pdo php-fpm php-xml curl
# yum install -y php-opcache php-zip php-bcmath libzip-devel php-devel php-pear gcc zlib-devel php-intl
# vim /etc/php-fpm.d/www.conf
user = nginx
group = nginx
# vim /etc/php.ini
date.timezone = Asia/Seoul
# systemctl enable --now php-fpm
//3. Change Permission
# chmod 770 /var/lib/php/session/ -R
# chown nginx.nginx /var/lib/php/session/ -R
//4. Install nginx
# amazon-linux-extras install -y nginx1.12
# systemctl enable --now nginx
# vim /etc/nginx/nginx.conf
root  /usr/share/nginx/html/owncloud;
# systemctl enable --now nginx
//5. Download owncloud
# cd /usr/share/nginx/html/
# wget -q https://download.owncloud.com/server/stable/owncloud-complete-latest.zip
# unzip owncloud-complete-latest.zip -d ./
# chmod 775 owncloud -R
# chown nginx.nginx owncloud -R
//6. Install MariaDB
# vim /etc/yum.repos.d/MariaDB.repo
[mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/10.4/centos7-amd64
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1
# yum install -y MariaDB MariaDB-Server
# systemctl enable --now mariadb
# /usr/bin/mysqladmin -u root password
1234
1234
# mysql -u root -p
1234
> CREATE DATABASE owncloud default CHARACTER SET UTF8;
> exit;

3. 결론

    오랜만에 수업을 진행하니 시간이 참 빠르다.

4. 참고자료

1. Cisco Docs

  1. ARP
  2. CDP / VLAN
  3. Frame Relay
  4. Static Routing
  5. VLAN
  6. VTP
  7. Routed Port
  8. AD
  9. Route Selection
  10. FHRP
  11. HSRP
  12. DHCP
  13. DNS
  14. STP
  15. NAT
  16. EtherChannel
  17. DTP
  18. RIP
  19. NTP
  20. Offset List
  21. Password Encryption
  22. ACL
  23. CAR Attack
  24. Broadcast
  25. Port Assignments
  26. IPv6 Static Routing
  27. HSRP for IPv6
  28. Clock Rate
  29. DHCPv6 Guard
  30. EIGRP
  31. Express Forwarding
  32. Routing and Switching
  33. Load Balancing
  34. Ping, Traceroute
  35. Load Balancing
  36. Fast Switching
  37. CEF
  38. DNS
  39. SSH
  40. Regular Expression
  41. OSPF
  42. EIGRP’s SIA
  43. NSSA
  44. AAA

2. Linux

  1. rhel9’s docs
  2. Linux Directory Structure
  3. File Types in Linux
  4. fstab
  5. Vim Cheat Sheet
  6. Protecting GRUB with a password
  7. SELinux
  8. DNS
  9. Samba as a server
  10. DHCP
  11. NFS
  12. SSH
  13. VNC
  14. heredoc
  15. docker vs podman + buildqh + skopeo
  16. Docker란?
  17. Linux 컨테이너란?
  18. Container vs VM
  19. 컨테이너화란?
  20. container
  21. 컨테이너 오케스트레이션이란?
  22. 쿠버네티스란?
  23. 쿠버네티스 아키텍처 소개
  24. 쿠버네티스 기본 사항 학습
  25. 쿠버네티스 클러스터란?

3. Web

  1. HTML’s Elements
  2. Emmet
  3. JavaScript
  4. Anchor Tag
  5. Post, Get
  6. Block, Inline Elements
  7. Semantic Web
  8. Semantic Elements
  9. CSS
  10. Viewport_meta_tag
  11. Media_queries
  12. JavaScript

4. DB

  1. MySQL

클라우드 엔지니어를 꿈꾸며 공부를 시작한 초보 엔지니어입니다. 틀린점 또는 조언해주실 부분이 있으시면 친절하게 댓글 부탁드립니다. 방문해 주셔서 감사합니다 :)

댓글남기기