컴퓨터를 새로 조립하면서

NVME 타입으로 C드라이브를 넣어주기로 하면서 512GB 용량으로 정했었다.


데이터 저장은 4TB 짜리 D드라이브를 넣어줄 것이기 때문에

C드라이브는 512GB 정도면 충분할 것이라 믿었는데...


갈수록 줄어드는 C드라이브의 여유 공간...


이제는 20GB도 남지 않았다.


대체 뭐가 나의 C드라이브를 잡아먹고 있는 것일까?!


그래서 찾아본 하드디스크 용량 분석 프로그램 ...




SpaceSniffer


  - 위키피디아에도 등록이 되어있는 아이로 골라봤다.

    . https://en.wikipedia.org/wiki/SpaceSniffer



  - 홈페이지도 있다.

    . http://www.uderzo.it/main_products/space_sniffer/



  - 2016년도 버전이 끝이라서 좀 우려스럽지만, 그래도 다운로드 받아서 실행해보자~!!

    . 다운로드 받아서 압축 풀고 실행하면 바로 실행된다.

    . 실행할 때 "관리자 권한으로 실행"을 해주는 것이 좋다. 파일 읽을 때 권한 관련해서 경고 받기 귀찮으면... ^^



  - 흐음... 뭔가 덩치 큰 아이들이 꽤 있군... 어?! pagefile.sys 이거 싫은데...

    . 컴퓨터 맞출 때 32GB 메모리를 넣었는데, 굳이 이걸... 그래서 가상메모리 사용안하도록 했더니...



  - 앗싸~ 40GB 정도의 여유 공간 확보했다.... 음... 다음에 용량 부족하면 게임 좀 지워야겠네... ㅠㅜ



반응형

'잘난놈되기' 카테고리의 다른 글

한글 지원되는 Ubuntu Docker Image 만들기  (0) 2021.07.27
bpytop 설치 (Ubuntu 18.04)  (2) 2020.12.31
Docker Hub 활용  (0) 2020.11.14
SiteMap  (0) 2020.08.30
Minikube 실습 - Pod 생성 (docker build & kubectl run & service)  (0) 2020.08.22

 

 

Kubernetes 설치를 해보자 한다.

 

 

Master Node & Worker Node 각 1대씩 구성을 하고자 한다.

 

물리적으로 분리된 BareMetal 구성을 하려고 했지만,

자유로운 설정을 통해 학습해보기 위해서 VirtualBox로 우선 진행해 보았다.

 

 

정말 훌륭한 레퍼런스는 아래 링크와 같다 !!!

  - https://medium.com/finda-tech/overview-8d169b2a54ff

 

 

 

 

1. Master & Worker Node H/W

 

  - Prerequisite

 

구분  CPU Memory Storage 
 Master 2 core 3 GB 30 GB
 Worker 2 core 2 GB 30 GB

 

  - VirtualBox

 

구분  CPU Memory Storage 
 Master 2 core 4 GB 50 GB
 Worker 2 core 4 GB 50 GB

 

    . 네트워크는 NAT가 아니라 Bridge로 잡아줬다. (공유기 환경)

 

 

 

 

 

2. Master & Worker Node S/W

 

  - Ubuntu 20.04 LTS Server 설치를 하면서, 기본적인 환경 설치는 아래 링크와 동일하게 구성하였다.

    . https://www.whatwant.com/entry/notebook-ubuntu-server

 

  - Docker 까지는 미리 설치해두었다. 설치 방법은 아래 링크와 같이 진행하였다.

    . https://www.whatwant.com/entry/Docker-Install-Ubuntu-Server-2004

 

    . kubernetes validated versions이 따로 있으니 이것에 맞추는 것을 추천한다.

 

 

 

 

3. Swap off

 

  - kubelet에서 swap을 지원하지 않기 때문에, Master/Worker 모두 swap 기능을 꺼야 한다.

 

$ sudo swapoff -a

 

  - 영구적으로 기능을 끄기 위해서는 추가 작업도 해줘야 한다.

 

$ sudo nano /etc/fstab

 

  - swap 부분을 찾아서 주석 처리 해주면 된다.

 

#/swap.img  none    swap    sw  0   0

 

 

 

 

4. cgroup driver 설정

 

  - 이미 설치된 docker에 대해서 cgroup driver를 변경해줘야 한다.

 

$ docker info

 

 

  - 지금은 "cgroupfs"로 설정되어 있는 것을 볼 수 있다. "systemd"로 변경해보자.

 

$ sudo nano /etc/docker/daemon.json

 

{

    "exec-opts": ["native.cgroupdriver=systemd"],

    "log-driver": "json-file",

    "log-opts": {

        "max-size": "100m"

    },

    "storage-driver": "overlay2"

}

 

$ sudo mkdir -p /etc/systemd/system/docker.service.d

 

$ sudo systemctl daemon-reload

 

$ sudo systemctl restart docker

 

 

  - "cgroup driver"가 잘 변경된 것을 볼 수 있다.

 

 

 

 

5. Kubernetes 기본 패키지 설치

 

  - Master/Worker Node 모두 [ kubeadm, kubelet, kubectl ] 3개의 패키지가 설치되어야 한다.

    . 부수적으로 [ kubernetes-cni, cri-tools ] 2개 패키지도 필요하다.

 

  - 아래에서 최신 버전의 주소(파일명) 확인 (16.04 이후 버전 모두 동일)

    . https://packages.cloud.google.com/apt/dists/kubernetes-xenial/main/binary-amd64/Packages

 

$ wget https://packages.cloud.google.com/apt/pool/cri-tools_1.13.0-01_amd64_4ff4588f5589826775f4a3bebd95aec5b9fb591ba8fb89a62845ffa8efe8cf22.deb

 

$ wget https://packages.cloud.google.com/apt/pool/kubeadm_1.20.1-00_amd64_7cd8d4021bb251862b755ed9c240091a532b89e6c796d58c3fdea7c9a72b878f.deb

 

$ wget https://packages.cloud.google.com/apt/pool/kubectl_1.20.1-00_amd64_b927311062e6a4610d9ac3bc8560457ab23fbd697a3052c394a1d7cc9e46a17d.deb

 

$ wget https://packages.cloud.google.com/apt/pool/kubelet_1.20.1-00_amd64_560a52294b8b339e0ca8ddbc480218e93ebb01daef0446887803815bcd0c41eb.deb

 

$ wget https://packages.cloud.google.com/apt/pool/kubernetes-cni_0.8.7-00_amd64_ca2303ea0eecadf379c65bad855f9ad7c95c16502c0e7b3d50edcb53403c500f.deb

 

  - 설치도 진행하자

 

$ sudo apt-get install socat conntrack ebtables

 

$ sudo dpkg --install ./kubernetes-cni_0.8.7-00_amd64_ca2303ea0eecadf379c65bad855f9ad7c95c16502c0e7b3d50edcb53403c500f.deb

 

$ sudo dpkg --install ./kubelet_1.20.1-00_amd64_560a52294b8b339e0ca8ddbc480218e93ebb01daef0446887803815bcd0c41eb.deb

 

$ sudo dpkg --install ./cri-tools_1.13.0-01_amd64_4ff4588f5589826775f4a3bebd95aec5b9fb591ba8fb89a62845ffa8efe8cf22.deb

 

$ sudo dpkg --install ./kubectl_1.20.1-00_amd64_b927311062e6a4610d9ac3bc8560457ab23fbd697a3052c394a1d7cc9e46a17d.deb

 

$ sudo dpkg --install ./kubeadm_1.20.1-00_amd64_7cd8d4021bb251862b755ed9c240091a532b89e6c796d58c3fdea7c9a72b878f.deb

 

 

 

 

6. Master Node 셋업

 

  - kubeadm을 이용하여 Master Node 셋업을 진행하자.

 

  - Master Node의 IP를 확인하자

 

$ ifconfig

 

  - 이제 셋업 시작~!! (뒤의 IP는 방금 확인한 IP로 교체!!)

 

$ sudo kubeadm init --pod-network-cidr=10.244.0.0/16 --apiserver-advertise-address=192.168.100.119

 

❯ sudo kubeadm init --pod-network-cidr=10.244.0.0/16 --apiserver-advertise-address=192.168.100.119

[init] Using Kubernetes version: v1.20.1

[preflight] Running pre-flight checks

[WARNING SystemVerification]: this Docker version is not on the list of validated versions: 20.10.1. Latest validated version: 19.03

[preflight] Pulling images required for setting up a Kubernetes cluster

[preflight] This might take a minute or two, depending on the speed of your internet connection

[preflight] You can also perform this action in beforehand using 'kubeadm config images pull'

[certs] Using certificateDir folder "/etc/kubernetes/pki"

[certs] Generating "ca" certificate and key

[certs] Generating "apiserver" certificate and key

[certs] apiserver serving cert is signed for DNS names [kubernetes kubernetes.default kubernetes.default.svc kubernetes.default.svc.cluster.local master-stg] and IPs [10.96.0.1 192.168.100.119]

[certs] Generating "apiserver-kubelet-client" certificate and key

[certs] Generating "front-proxy-ca" certificate and key

[certs] Generating "front-proxy-client" certificate and key

[certs] Generating "etcd/ca" certificate and key

[certs] Generating "etcd/server" certificate and key

[certs] etcd/server serving cert is signed for DNS names [localhost master-stg] and IPs [192.168.100.119 127.0.0.1 ::1]

[certs] Generating "etcd/peer" certificate and key

[certs] etcd/peer serving cert is signed for DNS names [localhost master-stg] and IPs [192.168.100.119 127.0.0.1 ::1]

[certs] Generating "etcd/healthcheck-client" certificate and key

[certs] Generating "apiserver-etcd-client" certificate and key

[certs] Generating "sa" key and public key

[kubeconfig] Using kubeconfig folder "/etc/kubernetes"

[kubeconfig] Writing "admin.conf" kubeconfig file

[kubeconfig] Writing "kubelet.conf" kubeconfig file

[kubeconfig] Writing "controller-manager.conf" kubeconfig file

[kubeconfig] Writing "scheduler.conf" kubeconfig file

[kubelet-start] Writing kubelet environment file with flags to file "/var/lib/kubelet/kubeadm-flags.env"

[kubelet-start] Writing kubelet configuration to file "/var/lib/kubelet/config.yaml"

[kubelet-start] Starting the kubelet

[control-plane] Using manifest folder "/etc/kubernetes/manifests"

[control-plane] Creating static Pod manifest for "kube-apiserver"

[control-plane] Creating static Pod manifest for "kube-controller-manager"

[control-plane] Creating static Pod manifest for "kube-scheduler"

[etcd] Creating static Pod manifest for local etcd in "/etc/kubernetes/manifests"

[wait-control-plane] Waiting for the kubelet to boot up the control plane as static Pods from directory "/etc/kubernetes/manifests". This can take up to 4m0s

[apiclient] All control plane components are healthy after 13.002889 seconds

[upload-config] Storing the configuration used in ConfigMap "kubeadm-config" in the "kube-system" Namespace

[kubelet] Creating a ConfigMap "kubelet-config-1.20" in namespace kube-system with the configuration for the kubelets in the cluster

[upload-certs] Skipping phase. Please see --upload-certs

[mark-control-plane] Marking the node master-stg as control-plane by adding the labels "node-role.kubernetes.io/master=''" and "node-role.kubernetes.io/control-plane='' (deprecated)"

[mark-control-plane] Marking the node master-stg as control-plane by adding the taints [node-role.kubernetes.io/master:NoSchedule]

[bootstrap-token] Using token: t4tcwj.22xh9lzstu56qyrb

[bootstrap-token] Configuring bootstrap tokens, cluster-info ConfigMap, RBAC Roles

[bootstrap-token] configured RBAC rules to allow Node Bootstrap tokens to get nodes

[bootstrap-token] configured RBAC rules to allow Node Bootstrap tokens to post CSRs in order for nodes to get long term certificate credentials

[bootstrap-token] configured RBAC rules to allow the csrapprover controller automatically approve CSRs from a Node Bootstrap Token

[bootstrap-token] configured RBAC rules to allow certificate rotation for all node client certificates in the cluster

[bootstrap-token] Creating the "cluster-info" ConfigMap in the "kube-public" namespace

[kubelet-finalize] Updating "/etc/kubernetes/kubelet.conf" to point to a rotatable kubelet client certificate and key

[addons] Applied essential addon: CoreDNS

[addons] Applied essential addon: kube-proxy

 

Your Kubernetes control-plane has initialized successfully!

 

To start using your cluster, you need to run the following as a regular user:

 

  mkdir -p $HOME/.kube

  sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config

  sudo chown $(id -u):$(id -g) $HOME/.kube/config

 

Alternatively, if you are the root user, you can run:

 

  export KUBECONFIG=/etc/kubernetes/admin.conf

 

You should now deploy a pod network to the cluster.

Run "kubectl apply -f [podnetwork].yaml" with one of the options listed at:

  https://kubernetes.io/docs/concepts/cluster-administration/addons/

 

Then you can join any number of worker nodes by running the following on each as root:

 

kubeadm join 192.168.100.119:6443 --token t4tcwj.22xh9lzstu56qyrb \

    --discovery-token-ca-cert-hash sha256:eb3765b58c9140c9a89daf7ea21444ca44a142939ebb93aedad1ebc03202a1d7

 

  - 사용자 계정에서 kubectl 실행을 위해 위의 가이드 내용 그대로 진행을 해보자.

 

$ mkdir -p $HOME/.kube

 

$ sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config

 

$ sudo chown $(id -u):$(id -g) $HOME/.kube/config

 

  - 잘 설치가 된 것을 확인해보자.

 

$ kubectl get pods --all-namespaces

 

$ kubectl get nodes

 

 

 

  - Pod Network 환경을 맞춰야 하는데, k8s 를 위한 layer 3 환경을 구축해주는 flannel을 사용해보겠다.

    . https://github.com/coreos/flannel/

 

$ kubectl apply -f https://raw.githubusercontent.com/coreos/flannel/master/Documentation/kube-flannel.yml

 

 

  - coredns가 pending에서 running으로 바뀌었고, flannel이 추가 되었고, Master Node가 Ready 상태가 된 것을 볼 수 있다.

 

 
 
7. Worker Node 셋업
 
  - 기본 환경 설치를 모두 했다면, 아래 명령어만 실행하면 된다.
  - 아래 명령어는 Master Node 설치할 때 나왔던 가이드 밑에 있는 부분 그대로 하면 된다. (각자의 환경에 따라서 실행할 것!!!)
 
$ sudo kubeadm join 192.168.100.119:6443 --token t4tcwj.22xh9lzstu56qyrb \
    --discovery-token-ca-cert-hash sha256:eb3765b58c9140c9a89daf7ea21444ca44a142939ebb93aedad1ebc03202a1d7
 
❯ sudo kubeadm join 192.168.100.119:6443 --token t4tcwj.22xh9lzstu56qyrb \
    --discovery-token-ca-cert-hash sha256:eb3765b58c9140c9a89daf7ea21444ca44a142939ebb93aedad1ebc03202a1d7
 
[preflight] Running pre-flight checks
[WARNING SystemVerification]: this Docker version is not on the list of validated versions: 20.10.1. Latest validated version: 19.03
[preflight] Reading configuration from the cluster...
[preflight] FYI: You can look at this config file with 'kubectl -n kube-system get cm kubeadm-config -o yaml'
[kubelet-start] Writing kubelet configuration to file "/var/lib/kubelet/config.yaml"
[kubelet-start] Writing kubelet environment file with flags to file "/var/lib/kubelet/kubeadm-flags.env"
[kubelet-start] Starting the kubelet
[kubelet-start] Waiting for the kubelet to perform the TLS Bootstrap...
 
This node has joined the cluster:
* Certificate signing request was sent to apiserver and a response was received.
* The Kubelet was informed of the new secure connection details.
 
Run 'kubectl get nodes' on the control-plane to see this node join the cluster.
 
  - Master Node에서 잘 붙었는지 확인해보자.
 
$ kubectl get nodes
 

 

 
 
 
 
 
8. hello kubernetes
 
  - Master Node에서 다음과 같이 deployment를 실행해보자.
 
$ kubectl create deployment kubernetes-bootcamp --image=gcr.io/google-samples/kubernetes-bootcamp:v1
 
  - 잘 되었는지 확인도 해보자.
 
$ kubectl get deployments
 
$ kubectl get pods -o wide
 

 

  - Worker Node에서 해당 서비스가 잘 되는지 확인해보자.

 

$ curl http://10.244.1.2:8080

 

 

 

 

 

 

여기까지~

 

 

반응형



우리 아이가 어렸을 적에 쓰기 위해서 구매했던 노트북이 있었는데,

이제는 성능이 제대로 나오지 않아 새로운 노트북을 구매하면서 마땅한 사용처가 없어졌다.


그래서, 버리려다가 저전력 서버로 한 번 셋팅해보고자 마음을 먹었다.



무려 2세대 !!! ㅋㅋㅋ


메모리도 2GB 밖에 안되었는데...

마침 맥북프로 메모리 업그레이드 하면서 교체했던 것이 있어서 4GB로 업그레이드~!!





1. Ubuntu Server 다운로드


  - "Ubuntu Server 20.04.1 LTS" 버전으로 다운로드 받아서 설치하기로 했다.


  - https://ubuntu.com/download/server



  - "Option 3번"으로 다운로드 받으면 된다.





2. 설치 USB 만들기


  - 부팅 USB 만들기 위해서 rufus 포터블로 다운로드 받아보자.


  - https://rufus.ie/


  - 다운로드 받은 뒤 실행한 뒤에



  - 위와 같이 설정을 하면 된다. (파티션 방식, 대상 시스템, 파일 시스템, 클러스터 크기 등)



  - "시작"을 누르면 위와 같은 화면이 나오는데, 그냥 "예"를 선택하면 된다.



  - ISO 이미지 모드로 쓰면 된다.





3. 노트북 BIOS 셋팅


  - 일단 BIOS에 들어가면 된다. (삼성 노트북은 부팅할 때 F2를 눌러주면 된다)


  - Boot 순서 항목에서 USB를 앞으로 잡아주면 된다.






4. Ubuntu 설치


  - 설치 언어는 그냥 English로 잡아주자. 한글 등은 나중에 직접 잡아주면 된다.



  - 설치 중에... 유선랜을 연결하지 않았더니, 인터넷 안된다고 뭐라한다. 뭐 일단은 그냥 무시하고 고고~~~!!



  - 그냥 나머지는 쭉~쭉~ 설치하면 된다.


  - 하지만, 재부팅 후에 로그인을 해도... 무선랜이 동작하지 않는다. 이걸 잡아보자.





5. cloud-init 제거



$ sudo dpkg-reconfigure cloud-init


제일 하단의 None 항목 빼고 나머지 전부 선택을 해제


$ sudo apt purge cloud-init


$ sudo rm -rf /etc/cloud/

$ sudo rm -rf /var/lib/cloud/


또는,


$ sudo mv /etc/cloud /srv/remove/cloud-init/etc-cloud

$ sudo mv /var/lib/cloud/ /srv/remove/cloud-init/var-lib-cloud





(VirtualBox 에서 게스트 확장 설치하기)


  - 메뉴 - 장치 - 게스트 확장 CD 이미지 삽입...


$ sudo mkdir /media/cdrom


$ sudo mount -t iso9660 /dev/cdrom /media/cdrom


$ sudo apt install build-essential linux-headers-`uname -r`


$ sudo /media/cdrom/./VBoxLinuxAdditions.run


$ sudo umount -v /media/cdrom


$ sudo reboot






6. 무선랜 설정


  - Reference : https://medium.com/@yping88/how-to-enable-wi-fi-on-ubuntu-server-20-04-without-a-wired-ethernet-connection-42e0b71ca198


  - 무선랜 드라이버 설치를 위해 파일들을 복사해야 한다. 다음의 3개 파일을 다운로드 받자 (다른 PC에서)


    . http://mirrors.kernel.org/ubuntu/pool/main/w/wpa/wpasupplicant_2.9-1ubuntu4_amd64.deb

    . http://mirrors.kernel.org/ubuntu/pool/main/libn/libnl3/libnl-route-3-200_3.4.0-1_amd64.deb

    . http://mirrors.kernel.org/ubuntu/pool/main/p/pcsc-lite/libpcsclite1_1.8.26-3_amd64.deb


  - USB는 앞에서 사용한 것을 재활용하기로 하고, FAT32로 포맷해서 준비하자.


  - 앞에서 다운로드 받은 3개의 파일을 USB에 넣자.


  - USB를 우리의 Ubuntu Server Notebook에 꼽자


  - USB를 바로 사용하지는 못하지만, 꼽힌 것을 인식했는지를 우선 확인해보자.


$ sudo fdisk -l



  - 제일 아래 부분을 보면 USB가 보일 것이다. Device 명칭을 잘 확인하자.


  - USB를 mount 하기 위해서 mount 위치 용도의 디렉토리 하나 만들고 mount를 하자.


$ sudo mkdir /media/usb


$ sudo mount -t vfat /dev/sdb1 /media/usb



  - USB에서 보이는 3개의 파일을 설치하면 된다.


$ cd /media/usb


$ sudo dpkg -i libnl-route-3-200_3.4.0-1_amd64.deb libpcsclite1_1.8.26-3_amd64.deb wpasupplicant_2.9-1ubuntu4_amd64.deb


  - 이제는 무선랜카드가 잘 잡혔는지 확인해보자.


$ ls -al /sys/class/net/



  - 밑에 보면 "wlp2s0b1"과 같이 제대로 인식된 것을 확인해볼 수 있다. (물론 다른 환경에서는 다른 이름일 수도 있다!!!)


  - 다른 명령어로도 확인해볼 수 있다.


$ ip link



  - 무선랜카드가 잘 잡혔으니, 이제 무선랜 설정을 해보자.


  - netplan 으로 설정하면 되는데, 기존 설정 파일을 백업하고 설정 작업하면 된다.


$ sudo cp /etc/netplan/00-installer-config.yaml /etc/netplan/00-installer-config.yaml


$ sudo nano /etc/netplan/00-installer-config.yaml


network:

  ethernetes: {}

  version: 2

  wifis:

    wlp2s0b1:

      dhcp4: true

      optional:true

      access-points:

        "SSID Name":

          password: "**********"

  renderer: networkd


  - 각자 환경에 맞는 "SSID Name"과 "Password" 설정하면 된다.


  - 문법에 맞춰서 잘 설정했는지 확인해보자.


$ sudo netplan --debug generate


  - 문제가 없으면 이제 실제 적용을 해보자.


$ sudo netplan apply


  - 제대로 동작을 하는지 보기 위해서 재부팅을 하면 된다.


$ sudo reboot





7. 기본 패키지 업그레이드


  - 이제 인터넷이 되니 패키지 업그레이드를 하자


$ sudo apt update


$ sudo apt upgrade


  - 네트워크 관련 도구도 설치를 하자


$ sudo apt install net-tools





8. Language Pack 설치


  - 정상적인 한글 사용을 위해 Language Pack 설치를 해보자


$ sudo apt install language-pack-ko


$ sudo locale-gen ko_KR.UTF-8


$ sudo dpkg-reconfigure locales


$ sudo update-locale LANG=ko_KR.UTF-8 LC_MESSAGES=POSIX




9. Timezone 셋팅


  - Timezone도 제대로 되어있는지 셋팅해보자.


$ sudo timedatectl


$ sudo timedatectl list-timezones | grep Seoul


$ sudo timedatectl set-timezone Asia/Seoul


$ sudo timedatectl


$ date





10. nano 설정


  - 주요 데이터로 nano를 사용하기 위한 환경 설정도 해보자.


$ nano ~/.nanorc


set tabsize 4

set tabstospaces


  - root 계정을 위해서도 추가로 셋팅해주자.


$ sudo nano /root/.nanorc





11. 노트북 덮개 설정


  - 노트북 덮개를 닫더라도 절전 모드로 전환되지 않도록 하기 위한 설정을 하자.


$ sudo nano /etc/systemd/logind.conf


  - "HandleLidSwitch=ignore" 라인을 추가하면 된다.


...

#HandleLidSwitch=suspend

HandleLidSwitch=ignore 

...


  - 수정한 내역을 반영해보자.


$ sudo systemctl restart systemd-logind






12. ssh-server


  - 이미 설치되어있던데... 혹시 모르니


$ sudo apt install openssh-server


  - 이제 외부에서 접속해보면 된다.





13. git 설치하기


  - 요즘은 기본이 되어버린 git ... 설치하고 기본 환경 셋팅을 하자


$ sudo apt install git


  - 사용자 환경 설정을 하자


$ git config --global user.name "whatwant"


$ git config --global user.email "whatwant@whatwant.com"






14. zsh


  - zsh 설치해보자


$ sudo apt install zsh


$ sudo apt install fonts-powerline


$ chsh -s $(which zsh)


  - 로그아웃 하고 재로그인을 해야 이후 셋팅을 진행한다.



  - 그냥 2번으로 선택해보자.


  - oh-my-zsh 설치를 진행하자.


$ sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"


  - theme를 변경해보자.


$ nano ~/.zshrc


# ZSH_THEME="robbyrussell"

ZSH_THEME="agnoster"


  - 또, 로그아웃 하고 재로그인 해보자. 원하는 모습으로 잘 나올 것이다.


  - 유용한 플러그인도 몇 가지 설치해보자


$ git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting


$ git clone git://github.com/zsh-users/zsh-autosuggestions $ZSH_CUSTOM/plugins/zsh-autosuggestions


  - 다운로드 받은 플러그인을 등록하자.


$ nano ~/.zshrc


#plugins=(git)

plugins=(git zsh-syntax-highlighting zsh-autosuggestions)


  - 그리고 다시 설정 파일을 로딩하면 된다.


$ source ~/.zshrc


  - 멀티라인으로 출력되도록 하자.


$ nano ~/.oh-my-zsh/themes/agnoster.zsh-theme


  - 아래 파란색으로 된 부분만 추가해주면 된다.


...

## Main prompt

build_prompt() {

  RETVAL=$?

  prompt_status

  prompt_virtualenv

  prompt_aws

  prompt_context

  prompt_dir

  prompt_git

  prompt_bzr

  prompt_hg

  prompt_newline

  prompt_end

}


## multiline

prompt_newline() {

  if [[ -n $CURRENT_BG ]]; then

    echo -n "%{%k%F{$CURRENT_BG}%}$SEGMENT_SEPARATOR

%(?.%F{$CURRENT_BG}.%F{red})❯%f"


  else

    echo -n "%{%k%}"

  fi


  echo -n "%{%f%}"

  CURRENT_BG=''

}


PROMPT='%{%f%b%k%}$(build_prompt) '






15. sudo 패스워드 없애기


  - 툭하면 sudo를 사용해야하는데, 자꾸 패스워드 입력하는 것이 귀찮으니 없애버리자.


$ sudo visudo


  - 원하는 계정에 대해서 아래와 같이 제일 밑에 라인을 추가하자


whatwant ALL=(ALL) NOPASSWD:ALL





16. NTP


  - 시간 자동 동기화 설정 여부를 확인해보자.


$ timedatectl status


                      Local time: 일 2020-12-27 03:10:03 KST

                 Universal time: 토 2020-12-26 18:10:03 UTC

                        RTC time: 토 2020-12-26 18:10:04

                      Time zone: Asia/Seoul (KST, +0900)

 System clock synchronized: no

                    NTP service: inactive

                RTC in local TZ: no


  - 위와 같이 "System clock synchronized: no"로 되어 있으면 이하 과정을 실행해야 한다.


$ sudo systemctl start systemd-timesyncd


$ sudo systemctl enable systemd-timesyncd


  - 다시 확인해보자


$ timedatectl status


                       Local time: 일 2020-12-27 03:17:33 KST

                  Universal time: 토 2020-12-26 18:17:33 UTC

                         RTC time: 토 2020-12-26 18:17:34

                       Time zone: Asia/Seoul (KST, +0900)

System clock synchronized: yes

                     NTP service: active

                  RTC in local TZ: no


  - 혹시라도 방화벽 이슈로 NTP 서버를 변경해야 하면 아래와 같이 하면 된다.


$ sudo nano /etc/systemd/timesyncd.conf


  - NTP 부분의 주석 삭제하고 아래와 같이 서버를 지정해주면 된다.


NTP=time.windows.com



반응형

'OS > Ubuntu' 카테고리의 다른 글

Tidy Viewer (tv) - CSV Viewer  (0) 2021.10.17
SSH Client on Windows (Xshell)  (0) 2021.01.03
LinuxBrew(HomeBrew) 설치하기 (Ubuntu 18.04)  (0) 2020.12.06
password 관리  (0) 2020.01.05
SSH 서버 포트 변경하기 (ssh server port change)  (1) 2019.07.28


오래된 노트북으로 서버 한 대를 셋팅하던 중, Docker를 설치하는 과정을 기록해보려 한다.



공식 홈페이지 가이드를 따라서 진행했다.

- https://docs.docker.com/engine/installation/linux/ubuntu/



※ 이 블로그를 계속 봐오신 분들은 아시겠지만... 아래 내용은 직접 실행해보면서 작성한 것입니다.



1. Ubuntu version

    - Ubuntu Focal 20.04 (LTS)


❯ lsb_release -a

No LSB modules are available.

Distributor ID: Ubuntu

Description: Ubuntu 20.04.1 LTS

Release: 20.04

Codename: focal


❯ uname -a  

Linux whatwant 5.4.0-58-generic #64-Ubuntu SMP Wed Dec 9 08:16:25 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux



2. Binary 확인

    - 웹으로 다운로드 받을 버전을 확인하자.


https://download.docker.com/linux/ubuntu/dists/focal/pool/stable/amd64/



3. Download 받기


$ wget https://download.docker.com/linux/ubuntu/dists/focal/pool/stable/amd64/containerd.io_1.4.3-1_amd64.deb

$ wget https://download.docker.com/linux/ubuntu/dists/focal/pool/stable/amd64/docker-ce-cli_20.10.1~3-0~ubuntu-focal_amd64.deb

$ wget https://download.docker.com/linux/ubuntu/dists/focal/pool/stable/amd64/docker-ce_20.10.1~3-0~ubuntu-focal_amd64.deb



4. Docker 설치하기


$ sudo dpkg --install ./containerd.io_1.4.3-1_amd64.deb

$ sudo dpkg --install ./docker-ce-cli_20.10.1~3-0~ubuntu-focal_amd64.deb

$ sudo dpkg --install ./docker-ce_20.10.1~3-0~ubuntu-focal_amd64.deb



5. sudo 없이 실행하기


$ sudo usermod -aG docker $USER


  - 로그아웃 후 재로그인해야 적용



6. Hello World


$ docker run hello-world

Unable to find image 'hello-world:latest' locally

latest: Pulling from library/hello-world

0e03bdcc26d7: Pull complete 

Digest: sha256:1a523af650137b8accdaed439c17d684df61ee4d74feac151b5b337bd29e7eec

Status: Downloaded newer image for hello-world:latest


Hello from Docker!

This message shows that your installation appears to be working correctly.


To generate this message, Docker took the following steps:

 1. The Docker client contacted the Docker daemon.

 2. The Docker daemon pulled the "hello-world" image from the Docker Hub.

    (amd64)

 3. The Docker daemon created a new container from that image which runs the

    executable that produces the output you are currently reading.

 4. The Docker daemon streamed that output to the Docker client, which sent it

    to your terminal.


To try something more ambitious, you can run an Ubuntu container with:

 $ docker run -it ubuntu bash


Share images, automate workflows, and more with a free Docker ID:

 https://hub.docker.com/


For more examples and ideas, visit:

 https://docs.docker.com/get-started/



끝~



반응형


간만에 자막 없는 영화를 보고 싶어서 선택한

디바


간만에 보이는 신민아 배우도 관심이 생겼고,

다이빙이라는 아이템도 신선해서 땡겼다.





감독은 85년생 조슬예 님이시다.

각본이나 스토리보드와 같은 작업을 많이 하셨고

심지어 단역이나 조연 출연도 하신 이력이 있다.


송강호 주연의 "택시운전사" 각본의 각색을 담당하기도 하였다.

강동원 주연의 "가려진 시간"에서는 각본을 담당하였다.


"디바" 영화는 조슬예 감독의

장편 데뷔작품이다.

각본도 직접 담당하셨다.





"다이빙"이라는 주제와

"신민아"라는 배우만으로

충분히 이 영화가 설명이 되지만...


굳이 "여성"이라는 프레임을

씌울 필요는 없다고 생각되지만

뉴스 기사로도 나왔기에 언급하자면...


제작사 / 감독 / 촬영감독 / 주연

모두 여성분들이시다.


제작사 올


그렇다고 해서 절대 오해를 하면 안된다.


"남성"에 대한 적개심이나

가부장적 문화에 대한 거부감을 표출하는 스토리가 아니다.


오히려

각본을 여성분이 썼기에

가능한 세밀한 감정 표현들

감각적인 카메라 표현 및 연기, 연출들...

개인적으로는 큰 장점으로 다가온 요소라고 생각한다.




이 영화는 신민아 배우가 90%는 먹고 들어갔다.




스토리는

학교 배경의 전교 1, 2등 아이끼리 벌어지는

우정(사랑?), 질투, 시기, 음모

뭐 그런 것들로 이루어진 이야기가

"다이빙"이라는 배경으로 바뀐 것 뿐이다.



그런데, 이게 억지스럽지 않고 너무나 자연스럽고 어울린다.


"다이빙"이라는 소재 자체도 너무나 어울렸고

다이빙장이라는 장소가 주는 느낌도

그리고 이것 저것 소품들도...




미스터리이기는 하지만

극 초반에 전체적인 미스터리가 예상이 된다.



사고가 나고

주인공과 친구가 나오고

둘 사이가 예상이 되고

의심스러운 부분이 뻔히 보이고...


그럼에도 불구하고

소재가 흥미롭고

연출도 자연스러워서

계속 보게 된다.




다만, 아쉬운 점은

영화의 전체적인 분위기인데...


현실적인 미스터리...

즉, 심리적인 감정 표현이나 실제 사건, 의심스러운 사람들로

만들어진 미스터리인지,


비현실적인 미스터리...

귀신과 같은 심령적인 것들로

만들어진 미스터리인지..


그 경계가 살짝 불분명한 부분들이 등장하면서

어떤 느낌으로 스릴러를... 미스터리를...

느껴야하는지 혼란스러웠다.



개인적으로는

좀 더 현실적인 미스터리로 끌고갔으면

몰입도가 훨씬 더 올라가면서

집중하기 좋았을 것 같다.




그리고 두번째로 아쉬운 점은 음악...

나쁜 것은 아니었지만

개인적으로는 음악이 극을 이끌어가지는 못하고

효과음과 같은 정도의 느낌이었다.

그런 상황에서 필요한 사운드... 딱 그 정도...


반면, 장소가 다이빙장(수영장?)이기에

물소리가 배경으로 깔리는 경우가 많은데

의외로 이 수영장만의 독특한 배경사운드가

묘한 느낌을 주어서 좋았다.




스릴러/미스터리 영화의 특징답게

실제 사건의 전말이 밝혀질 때의

반전...

나쁘지 않았다.


엄청 빡! 왕! 짱! 익사이팅!

뭐 그런건 아니었지만

"의외성"

이라는 측면에서는 신선했다.

하지만, 힘은 조금 빠지는 느낌이...


좀... 엔딩이... 찝찝한... 닦지 않은 느낌이...

이펙트가 너무 없다보니... 음...







조연들의 연기들은 모두 좋았다.

하지만, 그 개인들의 캐릭터가 충분히 부각되지는 않아 아쉽기는 하다.


거의 신민아의 신민아를 위한 신민아에 의한 영화다.


하지만, 조연들의 연기가 좋다보니

이게 그냥 깔끔한 느낌이 든다.






마지막 Credit을 보다가 깜짝 놀랐다.


"故 최아연 선수의 명복을 빕니다"


검색을 해보니 2019년 5월 4일에

중학교 2학년인 최아연(14)양이 훈련도중 다이빙대에 머리를 부딪치는 사고가 있었다고 한다.


https://www.sedaily.com/NewsView/1VJ3M9ZAF1


고인의 명복을 빕니다.


영화와 직접적인 관계가 있었는지는 확인이 안되지만

비슷한 시기에 관련된 사고가 있다보니

언급한 것이 아닌가 한다.





스릴러나 미스터리가 보고 싶지만

너무 머리아프거나 무서운 것은 싫은... 그럴 때 추천할 수는 있는 영화



반응형


대부분 이미 설치되어 있겠지만, 그래도 기본 환경을 맞추기 위해 필수 패키지들을 설치해보자.


$ sudo apt-get install build-essential curl file git



그리고, 본격적인 설치를 위해 다음 명령어를 실행하면 된다.


$ sh -c "$(curl -fsSL https://raw.githubusercontent.com/Linuxbrew/install/master/install.sh)"




그리고 PATH 설정을 해줘야 하는데,

참고한 사이트와는 상황이 조금 다르다 보니 직접 찾아서 해봤다.


지금 사용하고 있는 쉘이 bash가 아니고, zsh 이다.

그래서... ^^


$ nano ~/.zshrc


기본은 주석처리 되어있는 "export PATH" 부분이 보이면 그냥 아래에 다음 줄을 추가해주면 되고

이미 PATH 설정을 사용하고 있으면 앞 부분에 brew 경로만 추가해주면 된다.


export PATH="/home/linuxbrew/.linuxbrew/bin:$PATH"

export MANPATH="/home/linuxbrew/.linuxbrew/share/man:$MANPATH"

export INFOPATH="/home/linuxbrew/.linuxbrew/share/info:$INFOPATH"



수정을 모두 했으면, 환경 설정을 다시 읽어들이고...


$ source ~/.zshrc




잘 되는지 확인을 해보려면...


$ brew install hello





반응형


이번 달에 리뷰 도서로 당첨된 책은 "데이터 전처리 대전"이다.



데이터 전처리 대전 - 10점
모토하시 도모미쓰 지음, 윤준 옮김/한빛미디어


AI/ML 관련 분야 中 "데이터"에 대한 내용을 담고 있는 책이다.



아직까지도 AI/ML 공부한다고 하면

대뜸 TensorFlow 또는 PyTorch와 같은 것으로

어떻게 Training을 해서 모델을 만들 것인지에 대해서 파고든다.


경사하강법(gradient descent)이 어찌고

오버핏이 어찌고 등등등...



하지만, 제대로된 결과물이 나오기 위해서는

제대로된 입력물이 있어야 한다!!!



즉, 데이터가 중요하다는 말이다 !!!



그러한 데이터를 미리 예쁘고 똑똑하게 처리하는 것이 바로

"데이터 전처리" 이다.






제목도 직관적이고

표지 디자인도 예쁘고

색상도 주황색으로 트랜디 하다!


즉, 책을 딱 보면 괜찮을 것 같다는 기대감을 준다 !!!







원서의 경우 2018년도에 작성이 되었고

번역본은 2019년 11월에 출간이 되었다.

아직 개정판은 없는 것 같다.


음... 시시각각 새로운 것들이 쏟아지는 AI/ML 바닥에서

지금 (20년 11월) 이 책을 봐도 되는 것인지

우려가 되기도 하지만...


데이터를 다루는 부분에 있어서는

책에서 설명하고 있는 내용들이 안될일은 없을 것 같다.


즉, 지금 구매해서 봐도 괜찮다.






이 책은 크게 4개의 파트로 구성되어 있다.


정말 직관적이다.


전처리가 무엇인지 설명해주고 (1부)

구조를 어떻게 손봐야 하는지 알려주고 (2부)

내용도 손봐야 하는 경우 어떻게 할지 알려준 다음에 (3부)

실전에 적용하기 위해 필요한 사항들을 알려준다 (4부)





화려한 것을 좋아하는 개인적인 취향에서 조금 아쉽게도

흑백 인쇄이지만

깔끔한 편집으로

보기 편하게 잘 되어 있다.







번역도 술술 읽힐 정도는 아니지만

그냥 보기에 크게 어색하지 않게 잘 되어 있다.







책 내용은

표지에 명시되어 있는 것처럼


파이썬

SQL

R


3가지 방법으로 설명을 해주고 있다.



즉, 현재 주로 사용하고 있는 언어(도구?)가

저 3가지에 속한다고 하면 아무 부담없이

이 책을 구매해도 될 것 같다.



각 도구(언어?)에 대한 설명은 별도로 없기 때문에

셋 중 하나는 다룰줄 아는 사람에게만

이 책을 권장한다.






이 책에서 사용하는 데이터는 한빛미디어 홈페이지에서 다운로드 받을 수 있다.


http://hanbit.co.kr/support/supplement_survey.html?pcode=B1543811360




역자가 예제 환경 설정 등에 대해서 포스팅을 해준다고 했는데,

1년이 지난 지금까지도 포스팅 안해줬다.


https://junyun0516.github.io/




그냥 데이터나 예제를 github를 통해서 공유해주지....




결론은 ...

1년이 지난 책이지만, 지금 봐도 괜찮은 데이터 전처리 관련 도서이다.






* 이 책은 한빛출판네트워크의 '나는 리뷰어다' 이벤트를 통해 제공 받은 도서입니다.



반응형


Prologue #1


최근 Docker Hub 이야기가 Hot 했다.


무료로 마음껏 사용했던 Docker Hub였는데,

Rate Limit 제한을 하게 되어 의도치 않은 Fail 메시지들을 보게 되어 다들 부랴 부랴 계정 등록하기도 하고 라이선스 구매를 하기도 하고...


특히 통합 빌드서버를 사용하는 경우

미리 준비하지 않은 경우 빌드서버에서 rate limit가 걸려 빌드가 계속 fail 되는 사태가 발생해버렸기에 난리였다!



Prologue #2


요즘 Kubernetes 공부를 하고 있는데,

Local에서만 하기에는 좀 제한적이어서 Google Cloud Platform(GCP) 환경에서 테스트를 해보고 있다.


그런데, Minikube 환경에서는 Local에서 만든 Container Image를 반영하기가 손쉬웠는데

GCP에 있는 K8s 환경에서는 그냥은 안되는 것 같다.


Docker Hub에 Local에서 만든 Container Image를 업로드 하면 손쉽게 될 것만 같다.





Body


우선 Docker Hub 사이트에 방문을 해보자.


https://hub.docker.com/



첫 페이지부터 Sign Up을 요구한다.

ID 넣고 Email 넣고 Password 넣고 로봇이 아니라고 체크 한 번 해주고 가입 완료하자.

발송된 Email에서 Confirm 한 번 눌러주면 최종적으로 가입 완료된다.



Sign In 화면은 아래와 같다.




로그인 후 첫화면은 아래와 같다.





그러면, 이제 docker login을 해보자.


실습 환경은 "Ubuntu 18.04" 이다.


Docker 설치는 아래 링크를 참조하기 바란다.

- https://whatwant.tistory.com/entry/Docker-Install-Ubuntu-16041804-64bit-using-Download



일단 login을 시도해보자.


$ docker login



뭔가 permission error가 발생한다.




그러면, Permission 이슈를 해결하고, 다시 해보자.


$ sudo chmod 666 /var/run/docker.sock


$ docker login



잘 되었다 !!!



push 과정까지 실제로 따라해보려면 실습 코드들이 필요하기에 이후 내용은 아래 GitHub Repo를 참고해서 진행하자.


- https://github.com/whatwant-school/docker-hub/tree/main/step01



$ docker build -t ${username}/count:v1 .


$ docker push ${username}/count:v1



Docker Hub에 접속해서 제대로 올라왔는지 확인해보자.




여기까지~!!

반응형

+ Recent posts