대! 한! 민! 국! 짜자자 짝!짝!

 

기본으로 제공되는 Ubuntu Docker Image는

우리에게 아름다운 한글을 제대로 지원해주지 않는다.

 

그래서 지금부터는 한글을 제대로 지원해주는 Ubuntu Docker Image를 만들어 보고자 한다.

 

 

0. 작업 환경

  - Ubuntu 18.04 Desktop

 

 

1. Docker 설치하기

  - 아래 링크를 참조하면 좋고~ 아니면 아래 과정을 주르륵 따라가도 좋다.

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

 

$ cd /srv/install
$ mkdir docker
$ cd docker

$ wget https://download.docker.com/linux/ubuntu/dists/focal/pool/stable/amd64/containerd.io_1.4.8-1_amd64.deb
$ wget https://download.docker.com/linux/ubuntu/dists/focal/pool/stable/amd64/docker-ce-cli_20.10.7~3-0~ubuntu-focal_amd64.deb
$ wget https://download.docker.com/linux/ubuntu/dists/focal/pool/stable/amd64/docker-ce_20.10.7~3-0~ubuntu-focal_amd64.deb

$ sudo dpkg --install ./containerd.io_1.4.8-1_amd64.deb
$ sudo dpkg --install ./docker-ce-cli_20.10.7~3-0~ubuntu-focal_amd64.deb
$ sudo dpkg --install ./docker-ce_20.10.7~3-0~ubuntu-focal_amd64.deb

$ sudo usermod -aG docker $USER

로그아웃 후 로그인
(Ubuntu Desktop에서 로그아웃으로 안되어서 재시작해버렸음)

$ docker run hello-world

$ nano ~/.zshrc
plugins=(... docker docker-compose)

 

  - 마지막 부분은 개인적으로 zsh을 사용하고 있기에... 자동 완성 기능을 추가해보았다.

 

 

2. Ubuntu Docker Image - 기본

  - 개인 취향으로 기본 패키지들을 조금 더 추가하는 것으로 Dockerfile을 다음과 같이 만들어 봤다.

 

FROM ubuntu:18.04

RUN apt-get update && apt-get upgrade -y
RUN apt-get install -y \
        nano \
        git \
        curl \
        htop \
        man \
        openssh-client \
        sudo \
        wget \
        procps \
        lsb-release

 

  - 위 내용을 `Dockerfile.default` 파일명으로 저장한 뒤 build 하고 run 해보자.

 

host$ docker build -t ubuntu:default -f Dockerfile.default .

host$ docker run -it ubuntu:default bash

 

  - 텍스트 파일을 하나 만들어서 한글을 입력해보자. (물론 제대로 출력이 안되는 것이 정상이다)

 

default$ cd

default$ nano noname.txt

 

 

3. Ubuntu Docker Image - 한글 지원

  - 이번에는 한글을 지원해줄 수 있는 Dockerfile을 작성해 보자.

 

FROM ubuntu:18.04

RUN apt-get update && apt-get upgrade -y
RUN apt-get install -y \
        nano \
        git \
        curl \
        htop \
        man \
        openssh-client \
        sudo \
        wget \
        procps \
        lsb-release

RUN apt-get install -y apt-utils locales
RUN locale-gen ko_KR.UTF-8
ENV LC_ALL ko_KR.UTF-8

 

  - 아래 부분만 추가해서 `Dockerfile.ko_KR` 파일명으로 저장하고 진행해보자

 

host$ docker build -t ubuntu:ko_KR -f Dockerfile.ko_KR .

host$ docker run -it ubuntu:ko_KR bash

 

  - 똑같이 한글이 써지는지 테스트해보자.

 

ko_KR$ cd

ko_KR$ nano noname.txt

 

  - 이번에는 당연히 한글이 잘 써질 것이다!!!

 

 

Ubuntu 자체가 가벼운 이미지가 아니긴 하지만...

그래도 편한 맛에 사용한다고 하면 한글 지원이 필요할 때 참고하면 좋을 듯 하다.

반응형

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

NFS Server 설치 (Ubuntu 18.04/20.04)  (3) 2021.09.21
kubectl 설치 (in Ubuntu)  (0) 2021.08.30
bpytop 설치 (Ubuntu 18.04)  (2) 2020.12.31
하드디스크 용량 분석 (SpaceSniffer)  (0) 2020.12.28
Docker Hub 활용  (0) 2020.11.14

 

매번 귀찮게 찾는 것이 귀찮아서 정리하고자 포스팅 해본다.

 

 

1. Python3 설치하기

$ sudo apt install python3 python3-pip

 

2. update-alternative 설정하기

$ sudo update-alternatives --install /usr/bin/python python /usr/bin/python2 1
$ sudo update-alternatives --install /usr/bin/python python /usr/bin/python3 2
$ sudo update-alternatives --install /usr/bin/pip pip /usr/bin/pip3 1

 

3. select

$ sudo update-alternatives --config python
$ sudo update-alternatives --config pip

 

아~ 속 시원하다~!!

반응형



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

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


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



무려 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)  (0) 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/



끝~



반응형


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


$ 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





반응형



Minikube를 가지고 놀고 싶은데,

내 PC를 지저분하게 만들기가 싫어서...


최애하는 VirtualBox에 Ubuntu 설치해놓고

그 안에 Minikube를 설치해보고자 한다.



Reference: https://kubernetes.io/ko/docs/tasks/tools/install-minikube/



작업환경

    - Host OS: Windows 10

    - VirtualBox v6.1.12 r139181 (Qt5.6.2)

    - Guest OS: Ubuntu 18.04 Desktop

        . 2 CPU, 8192 Memory




1. 가상화 환경?!


    - "가상화 지원 여부를 확인"하란다. 현재 작업하고 있는 PC가 AMD라서 좀 찝찝한데...

    - VirtualBox의 Guest 환경에서 아래와 같이 "네스티드 VT-x/AMD-V 사용하기(V)"에 체크를 해주었다.




    - 뭔가 나오니까 된 것 같다.


❯ grep -E --color 'vmx|svm' /proc/cpuinfo

flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt rdtscp lm constant_tsc rep_good nopl nonstop_tsc cpuid extd_apicid tsc_known_freq pni pclmulqdq ssse3 cx16 sse4_1 sse4_2 x2apic movbe popcnt aes xsave avx hypervisor lahf_lm cmp_legacy svm cr8_legacy abm sse4a misalignsse 3dnowprefetch ssbd vmmcall fsgsbase avx2 clflushopt arat nrip_save flushbyasid decodeassists

flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt rdtscp lm constant_tsc rep_good nopl nonstop_tsc cpuid extd_apicid tsc_known_freq pni pclmulqdq ssse3 cx16 sse4_1 sse4_2 x2apic movbe popcnt aes xsave avx hypervisor lahf_lm cmp_legacy svm cr8_legacy abm sse4a misalignsse 3dnowprefetch ssbd vmmcall fsgsbase avx2 clflushopt arat nrip_save flushbyasid decodeassists




2. VirtualBox 설치 ?


    - VirtualBox in VirtualBox ??? 뭔가 이상하지만... 훌륭한 우리 VirtualBox는 이게 된다.


❯ sudo apt install -y virtualbox virtualbox-ext-pack




3. kubectl 설치


    - 제일 먼저 할 것은 현재 최신 버전이 뭔지 확인하는 것이다.


https://storage.googleapis.com/kubernetes-release/release/stable.txt


    - 지금 확인해본 결과는 v1.18.8 이었다.

    - 다운로드 받자. (다운로드 받는 경로나 wget을 사용하는 것은 개인적인 


> cd /srv/install/kubectl


> wget https://storage.googleapis.com/kubernetes-release/release/v1.18.1/bin/linux/amd64/kubectl


    - 설치하자


❯ chmod +x ./kubectl 


❯ sudo cp ./kubectl /usr/local/bin/kubectl


    - 잘 설치되었는지 확인해보자.


❯ kubectl version --client


Client Version: version.Info{Major:"1", Minor:"18", GitVersion:"v1.18.1", GitCommit:"7879fc12a63337efff607952a323df90cdc7a335", GitTreeState:"clean", BuildDate:"2020-04-08T17:38:50Z", GoVersion:"go1.13.9", Compiler:"gc", Platform:"linux/amd64"}




4. Minikube 설치


    - 다운로드 받아보자


> cd /srv/install/minikube


> wget https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64 -O minikube


    - 설치하자


❯ chmod +x ./minikube 


❯ sudo install minikube /usr/local/bin





5. Minikube 실행


    - 실행은 엄청 쉽다


❯ minikube start





6. dashboard


    - minikube는 대시보드도 간단히 제공해준다.


❯ minikube dashboard


🔌  대시보드를 활성화하는 중 ...

🤔  Verifying dashboard health ...

🚀  프록시를 시작하는 중 ...

🤔  Verifying proxy health ...

🎉  Opening http://127.0.0.1:40647/api/v1/namespaces/kubernetes-dashboard/services/http:kubernetes-dashboard:/proxy/ in your default browser...

[7090:7090:0822/025314.671219:ERROR:viz_main_impl.cc(150)] Exiting GPU process due to errors during initialization


    - 알아서 Chrome이 뜬다. (아! 개인적인 취향으로 VirtualBox에 Ubuntu 설치하자마자 Chrome을 미리 설치해놨다)





7. docker 설치


    - minikube를 가지고 놀기 위해서는 docker가 필요하다.


❯ sudo apt install -y docker.io


    - 현재 사용자 계정으로 docker를 실행할 수 있도록 하자


❯ sudo usermod -aG docker $USER


❯ newgrp docker


    - 현재 계정을 docker 그룹에 넣어도 바로 적용되지 않는다. 재부팅하기 귀찮아서 newgrp으로 지금 docker 그룹에 속한 것처럼 해버렸다.


    - 잘 설치되었는지 실행해보자. Permission 에러가 안나오면 된다.


❯ docker ps -a


CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES



가지고 노는 것은 다음 기회에~

반응형


Ubuntu에서 Python3 환경 셋업을 한 뒤에 (https://www.whatwant.com/entry/Python3-환경-만들기-버전-변경하기-in-Ubuntu)

pandas를 사용해보고자 했더니, 에러가 발생...


Traceback (most recent call last):

  File "./test.py", line 4, in <module>

    import pandas as pd

ModuleNotFoundError: No module named 'pandas'




0. 현재 환경


    - 아래 작업을 실행한 환경은 다음과 같다


$ lsb_release -a


No LSB modules are available.

Distributor ID: Ubuntu

Description:    Ubuntu 18.04.3 LTS

Release:        18.04

Codename:       bionic



$ python --version


Python 3.6.9


    - Python 3.7 버전으로 했을 경우에는 아래와 같이 진행하면 충돌(?)이 있다. 3.6 버전으로 진행하길...




1. pandas 설치하기


    - 뭔가 무지막지하게 많이 설치된다.


$ sudo apt-get install python3-pandas


Reading package lists... Done

Building dependency tree

Reading state information... Done

The following additional packages will be installed:

  blt fonts-lyx javascript-common libaec0 libblas3 libblosc1 libgfortran4 libhdf5-100 libjbig0 libjpeg-turbo8 libjpeg8 libjs-jquery libjs-jquery-ui liblapack3 liblcms2-2 libsnappy1v5 libsz2 libtcl8.6 libtiff5 libtk8.6 libwebp6 libwebpdemux2

  libwebpmux3 libxft2 libxrender1 libxss1 python-matplotlib-data python-tables-data python3-bs4 python3-cycler python3-dateutil python3-decorator python3-html5lib python3-lxml python3-matplotlib python3-numexpr python3-numpy python3-olefile

  python3-pandas-lib python3-pil python3-pyparsing python3-scipy python3-tables python3-tables-lib python3-tk python3-tz python3-webencodings tk8.6-blt2.5 ttf-bitstream-vera x11-common

Suggested packages:

  blt-demo apache2 | lighttpd | httpd libjs-jquery-ui-docs liblcms2-utils tcl8.6 tk8.6 python-cycler-doc python3-genshi python3-lxml-dbg python-lxml-doc dvipng ffmpeg gir1.2-gtk-3.0 ghostscript inkscape ipython3 librsvg2-common

  python-matplotlib-doc python3-cairocffi python3-gi-cairo python3-gobject python3-nose python3-pyqt4 python3-sip python3-tornado texlive-extra-utils texlive-latex-extra ttf-staypuft gfortran python-numpy-doc python3-dev python3-numpy-dbg

  python-pandas-doc python-pil-doc python3-pil-dbg python-pyparsing-doc python-scipy-doc python-tables-doc python3-netcdf4 vitables tix python3-tk-dbg

The following NEW packages will be installed:

  blt fonts-lyx javascript-common libaec0 libblas3 libblosc1 libgfortran4 libhdf5-100 libjbig0 libjpeg-turbo8 libjpeg8 libjs-jquery libjs-jquery-ui liblapack3 liblcms2-2 libsnappy1v5 libsz2 libtcl8.6 libtiff5 libtk8.6 libwebp6 libwebpdemux2

  libwebpmux3 libxft2 libxrender1 libxss1 python-matplotlib-data python-tables-data python3-bs4 python3-cycler python3-dateutil python3-decorator python3-html5lib python3-lxml python3-matplotlib python3-numexpr python3-numpy python3-olefile

  python3-pandas python3-pandas-lib python3-pil python3-pyparsing python3-scipy python3-tables python3-tables-lib python3-tk python3-tz python3-webencodings tk8.6-blt2.5 ttf-bitstream-vera x11-common

0 upgraded, 51 newly installed, 0 to remove and 0 not upgraded.

Need to get 35.7 MB of archives.

After this operation, 160 MB of additional disk space will be used.

Do you want to continue? [Y/n]




2. 테스트 코드


    - 잘 동작하는지 살펴보자. 샘플은 Kaggle의 내용을 참조했다.


import pandas as pd

import pprint


pp = pprint.PrettyPrinter(indent=4)


if __name__ == "__main__":


    fruits = pd.DataFrame( [[30, 21]], columns=['Apples', 'Bananas'] )

    pp.pprint( fruits )


    exit(0)


파이팅~!!!

반응형


Python version.2 지원이 끝난다고 하니

이제는 Python version.3 환경을 기본으로 사용해야할 것 같다.


Ubuntu를 설치하면 기본적으로 셋팅되어 있는 Python은 version.2 이다.


이를 변경하여 Python version.3 환경으로 꾸며 보고자 한다.




0. 기본 환경


    - Ubuntu 설치가 된 깨끗한(?) 환경이다.


$ lsb_release -a


No LSB modules are available.

Distributor ID: Ubuntu

Description:    Ubuntu 18.04.3 LTS

Release:        18.04

Codename:       bionic



$ python --version


Python 2.7.17




1. python3 상태 확인


    - 어?! 그런데, 살펴보면 python3도 이미 설치되어 있다.


$ python3 --version


Python 3.6.9


    - 뭐뭐가 있는지 한 번 보자


$ ls /usr/bin/ | grep python


dh_python2

python

python-config

python2

python2-config

python2.7

python2.7-config

python3

python3.6

python3.6m

python3m

x86_64-linux-gnu-python-config

x86_64-linux-gnu-python2.7-config




2. python 3.7 설치하기


    - 추가로 Python 3.7 버전을 설치해보자


$ sudo apt-get install python3.7


Reading package lists... Done

Building dependency tree

Reading state information... Done

The following additional packages will be installed:

  libpython3.7-minimal libpython3.7-stdlib python3.7-minimal

Suggested packages:

  python3.7-venv python3.7-doc binfmt-support

The following NEW packages will be installed:

  libpython3.7-minimal libpython3.7-stdlib python3.7 python3.7-minimal

0 upgraded, 4 newly installed, 0 to remove and 0 not upgraded.

Need to get 4,282 kB of archives.

After this operation, 22.5 MB of additional disk space will be used.

Do you want to continue? [Y/n]


    - 잘 설치되어 있는지 확인 !


$ python3.7 --version


Python 3.7.5



$ ls /usr/bin/ | grep python


dh_python2

python

python-config

python2

python2-config

python2.7

python2.7-config

python3

python3.6

python3.6m

python3.7

python3.7m

python3m

x86_64-linux-gnu-python-config

x86_64-linux-gnu-python2.7-config




3. Python 버전 등록


    - 기본적인 설정이 등록되어 있는지 확인하여 보자


$ sudo update-alternatives --config python


update-alternatives: error: no alternatives for python


    - 기본 정보를 차례대로 등록해보자


$ sudo update-alternatives --install /usr/bin/python python /usr/bin/python2.7 1


update-alternatives: using /usr/bin/python2.7 to provide /usr/bin/python (python) in auto mode



$ sudo update-alternatives --install /usr/bin/python python /usr/bin/python3.6 2


update-alternatives: using /usr/bin/python3.6 to provide /usr/bin/python (python) in auto mode



$ sudo update-alternatives --install /usr/bin/python python /usr/bin/python3.7 3


update-alternatives: using /usr/bin/python3.7 to provide /usr/bin/python (python) in auto mode




4. Python 버전 설정


    - 위에서 기본적으로 등록을 했으니... 실제 확인


$ sudo update-alternatives --config python


There are 3 choices for the alternative python (providing /usr/bin/python).


  Selection    Path                Priority   Status

------------------------------------------------------------

* 0            /usr/bin/python3.7   3         auto mode

  1            /usr/bin/python2.7   1         manual mode

  2            /usr/bin/python3.6   2         manual mode

  3            /usr/bin/python3.7   3         manual mode


Press <enter> to keep the current choice[*], or type selection number: 0



$ python --version


Python 3.7.5


    - 이제, "python" 이라는 이름으로 버전 확인을 하면 '3.7.5'가 나온다 !!!



그런데, 3.7 버전으로 했을 경우에.... 뭔가 신경써야할 것들이 많은 것 같다 !! (라이브러리 관리가 쉽지 않다는...)

Ubuntu에서는 현재 3.6 버전을 기본으로 제공하고 있으니 이를 따라서 3.6 버전으로 가는 것을 추천한다.



모두 수고하셨어욥~!!


반응형

+ Recent posts