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 버전으로 가는 것을 추천한다.



모두 수고하셨어욥~!!


반응형


Ubuntu 18.04 Server 설치를 하고 부팅을 하는데

신경 거슬리게 하는 메시지가 자꾸 출력이 되었다.



▷ cloud-init

    - 클라우드 인스턴트를 초기화하기 위한 유틸리티들을 제공해주는 패키지


우쒸... 필요도 없는 것이 거슬리게 하네... 지워버려야겠다!!!


$ sudo apt-get purge cloud-init


이제 이상한 메시지가 안나온다.





반응형


proxy server 셋팅을 하고 있는데,

22번 포트에 대해서도 다른 서버로 전달을 해주어야 하는 경우가 생겼다.


어!? 그러면, proxy server에 ssh 접속은 어떻게 하지?!


proxy server의 ssh 포트를 변경해야할 필요가 생긴 것이다!


그래서, 122번 포트로 변경을 해보고자 한다.


1. 접속 안되는 상황 확인


$ ssh chani@192.168.100.105 -p 122

ssh_exchange_identification: Connection closed by remote host



2. /etc/ssh/sshd_config 수정


$ ssh chani@192.168.100.105 -p 22


$ sudo nano /etc/ssh/sshd_config


Port 22

Port 122


3. /etc/services 수정


    - 필수 사항은 아니지만, 이것도 같이 변경해주는 것이 좋다.


$ sudo nano /etc/services


ssh             122/tcp                         # SSH Remote Login Protocol (by whatwant)



4. 설정 반영 및 확인


$ sudo service ssh restart

$ sudo netstat -anlp | grep sshd

tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      1668/sshd

tcp        0      0 0.0.0.0:122             0.0.0.0:*               LISTEN      1668/sshd



5. 접속


$ ssh chani@192.168.100.105 -p 122

Success !!


파이팅!!


반응형


이번에 회사 업무 때문에 간만에 서버 OS 설치가 필요한 상황이 되어서,

집에서 미리 한 번 해보면서 기록을 해보고자 한다.


1. Image Download

http://releases.ubuntu.com/18.04/



(option) 2. for Virtualbox (VirtualBox Extension Pack)


$ sudo apt install virtualbox-guest-dkms linux-headers-virtual

$ sudo mkdir -p /media/cdrom

$ sudo mount /dev/cdrom /media/cdrom

$ cd /media/cdrom

$ sudo ./VBoxLinuxAdditions.run



3. Language Pack


$ sudo apt-get 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



4. Timezone


$ sudo timedatectl

$ sudo timedatectl list-timezones | grep Seoul

$ sudo timedatectl set-timezone Asia/Seoul

$ sudo timedatectl

$ date



(option) 5. nano


$ nano ~/.nanorc


set tabsize 4

set tabstospaces



6. set time


$ sudo apt-get install ntpdate

$ sudo ntpdate time.windows.com



(option) 7. remove cloud-init


    - 설치하고 부팅을 하면 로그인 화면에서 자꾸 걸리적거리는 cloud-init 관련 메시지... 삭제해버리고 싶어서 했다.

    - cloud-init 정체는 아래 링크에서 확인

        . https://access.redhat.com/documentation/ko-kr/red_hat_virtualization/4.1/html/virtual_machine_management_guide/sect-using_cloud-init_to_automate_the_configuration_of_virtual_machines

    - 이하 내용은 다음 링크를 100% 참고했다.

        . https://nucco.org/2018/05/ubuntu-18-04-chronicles-removing-cloud-init.html


$ sudo dpkg-reconfigure cloud-init


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


$ sudo apt-get 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


반응형


오랜만에 ubuntu에서 docker를 설치하려고 했는데...

Ubuntu 14.04 환경에서 설치가 안되었다. 이런... (https://www.whatwant.com/863)

뭐 이젠 14.04를 놓아줄 때도 된 것 같아서 ... 이를 극복하기 보다는 16.04 환경에서 진행해보기로 했다.

추가로 18.04에서도 해봤다.



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

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



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

※ VirtualBox를 이용하여 해당 OS를 설치하고 update까지만 마친 상태에서 진행하였습니다.




1. Ubuntu version

    - Ubuntu 14.04는 이제 지원하지 않는 것으로 보인다.

    - 특히, 64bit 만 지원한다! 32bit 안된다!



2. Binary 확인

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




3-1. Download 받기 (16.04)


$ wget https://download.docker.com/linux/ubuntu/dists/xenial/pool/stable/amd64/containerd.io_1.2.6-3_amd64.deb

$ wget https://download.docker.com/linux/ubuntu/dists/xenial/pool/stable/amd64/docker-ce-cli_18.09.7~3-0~ubuntu-xenial_amd64.deb

$ wget https://download.docker.com/linux/ubuntu/dists/xenial/pool/stable/amd64/docker-ce_18.09.7~3-0~ubuntu-xenial_amd64.deb


3-2. Download 받기 (18.04)


$ wget https://download.docker.com/linux/ubuntu/dists/bionic/pool/stable/amd64/containerd.io_1.2.6-3_amd64.deb

$ wget https://download.docker.com/linux/ubuntu/dists/bionic/pool/stable/amd64/docker-ce-cli_18.09.7~3-0~ubuntu-bionic_amd64.deb

$ wget https://download.docker.com/linux/ubuntu/dists/bionic/pool/stable/amd64/docker-ce_18.09.7~3-0~ubuntu-bionic_amd64.deb



4-1. Docker 설치하기 (16.04)


$ sudo dpkg --install ./containerd.io_1.2.6-3_amd64.deb

$ sudo dpkg --install ./docker-ce-cli_18.09.7~3-0~ubuntu-xenial_amd64.deb

$ sudo dpkg --install ./docker-ce_18.09.7~3-0~ubuntu-xenial_amd64.deb


4-2. Docker 설치하기 (18.04)


$ sudo dpkg --install ./containerd.io_1.2.6-3_amd64.deb

$ sudo dpkg --install ./docker-ce-cli_18.09.7~3-0~ubuntu-bionic_amd64.deb

$ sudo dpkg --install ./docker-ce_18.09.7~3-0~ubuntu-bionic_amd64.deb




5. Hello World


$ sudo docker run hello-world

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

latest: Pulling from library/hello-world

1b930d010525: Pull complete 

Digest: sha256:41a65640635299bab090f783209c1e3a3f11934cf7756b09cb2f1e02147c6ed8

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/



끝~



반응형

배포본 인기 순위를 확인할 수 있는 사이트 중에서
그나마 가장 영향력이 큰 distrowatch에서 2011년부터 부동의 1위를 차지하고 있는 Linux Mint 이다.

- [공식 사이트] https://distrowatch.com/
- [소개 포스팅] http://www.whatwant.com/704

(최근에 Arch 기반의 Manjaro가 인기가 급상승하고 있지만 Ubuntu 기반의 Mint를 이기긴 힘들거다 ^^)


'2018년 2월 3일' 기준으로 다운로드 받을 수 있는 내역은 아래와 같다.



그런데, 위 이미지에서 메뉴를 살펴보면 "LMDE 2"라는 항목이 보일 것이다.

기본적으로 Linux Mint는 Ubuntu를 base로 하지만,
Debian을 base로 하고 있는 배포판으로 "LMDE 2"라는 이름으로 제공해주고 있다.

Mint는 Ubuntu의 패키지를 그대로 사용할 수 있다는 장점이 있는 반면
Ubuntu와 마찬가지로 버전이 바뀔 때 재설치 수준의 대대적인 빅뱅 업그레이드(?)를 수행해야 한다.
(상위 버전으로 올릴 수는 있지만 솔직히 서비스를 하고 있는 서버에서 상당히 부담스러운 작업이다)

반면 LMDE의 경우에는 Debian 패키지를 사용하고, 말 그대로의 Rolling Release를 하게 되므로
지원기간 만료 걱정없이 작은 패키지 업그레이드 수준으로 꾸준히(?) 사용할 수 있다는 장점이 있다.




일단 Ubuntu에 중독되어 있는 필자이기에..... Linux Mint를 선택하도록 해보겠다.
그런데, 그냥 Ubuntu 쓰면 되는데 왜 Mint가 인기일까?





▶ VirtualBox에 Linux Mint 설치 時 이슈

- 증상 : Linux Mint 18.3 다운로드 후 VirtualBox에 설치하고자 하였으나 화면이 정상 출력이 안됨!
- 환경 : Windows7 - VirtualBox Version 5.2.6
- 해결 : 디스플레이 옵션에 3D를 켰더니 해결이 되었다. 이유는 모르겠음!


▶ 한글 지원

- 예전에는 한글 지원이 부족했다고 하는데... 최근에는 지원 잘된다.





▶ VirtualBox Guest Additions 설치

- 제대로 사용하기 위해선 Guest Additions를 설치해야 한다.



▶ Update

- 그냥 Ubuntu 사용하듯이 하면 된다. "sudo apt-get update / upgrade" 모두 잘 된다.



▶ 메뉴

- Windows의 시작메뉴와 비슷한 구성이다.



설치하고 이것 저것 해보는데...


내가 느낀 점은.... 음... 예쁜 우분투다!


그렇다고해서 우분투 짝퉁이 아니라....

우분투를 사용하는 분이라면 Linux Mint로 넘어가는 것을 고려할 가치가 있다는 말이다.



★ "sudo apt-get update"를 실행할 때에 해시 값이 틀리다고 나오면,
     저장소를 kr 쪽으로 변경하고 해보면 해결이 된다.


반응형

+ Recent posts