• Cockpit은 웹 기반의 리눅스 서버 GUI 도구 플랫폼입니다. 보통 ssh로 접속하여, 이것저것 터미널 명령어를 이용해서 설정 및 사용도 가능하지만, Cockpit을 사용하면 웹 기반의 GUI 환경에서 작업이 가능합니다.

    https://cockpit-project.org/

    설치도 매우 간단합니다. Ubuntu에서도 쉽게 apt를 이용해서 설치가 가능합니다.

    $ sudo apt install cockpit

    실행은 따로 할 필요없이, 자동으로 서비스로 등록되어 부팅 후에 자동 실행됩니다. 기본포트는 9090으로 설치후 https://localhost:9090으로 접속하면 다음과 같은 화면을 보실 수 있습니다.

    크롬 등 브라우져에서 비보안접속 경고가 떠도 일단은 그냥 접속진행하셔도 무방합니다. 로그인은 현재 PC의 사용자 계정으로 접속하면 됩니다.

    이제 좌측 메뉴에서 기본적으로 제공되는 정보를 이용해 PC 모니터링이 가능합니다. 터미널 실행도 가능합니다.

    좌측의 도구는 사용자가 직접 개발하여 추가도 가능합니다.

    사실 Cockpit에 관심을 가지게 된 이유가, 로봇의 파라미터 설정, 모니터링 및 유지보수가 목적이었는데, 사용자 도구를 이용하여, ROS의 rviz 등을 표시해서 간단한 제어 및 모니터링 기능을 추가해보는 것도 괜찮을듯 합니다.

  • 카카오톡을 좋아하진 않지만, 몇몇개의 오픈 채팅방과 타기관과의 협업에 소통 창구로 카카오톡이 쓰이는 관계로 메세지를 확인하는 편입니다. 아이폰만으로 대응하기엔 살짝 피곤한 부분이 있어, Ubuntu에서 설치할 방법을 찾아보다가, Wine을 사용하면 된다고 하여, 설치를 해봅니다.

    먼저 Wine을 설치합니다. 현재 최신 버전은 8.0이며, 다음과 같은 과정으로 설치가 가능합니다.

    [v] Wine Repository 키 등록 및 Repository를 apt 소스 리스트에 추가

    $ sudo wget -O - https://dl.winehq.org/wine-builds/winehq.key | gpg --dearmor | sudo tee /etc/apt/keyrings/winehq-archive.key
    $ sudo wget -NP /etc/apt/sources.list.d/ https://dl.winehq.org/wine-builds/ubuntu/dists/$(lsb_release -sc)/winehq-$(lsb_release -sc).sources

    [v] 설치

    $ sudo apt update
    $ sudo apt install winehq-stable

    Wine 설치 완료.


    카카오톡 공식홈페이지에서 설치파일을 다운로드 합니다.

    Files를 열어 설치 파일에서 오른쪽 버튼을 눌러, Open With Wine Windows Program Loader를 선택합니다. 항목이 안보이면, Open With Other Application을 선택하면 저 항목이 보입니다.

    설치를 진행합니다. 설치 과정은 윈도우와 동일하게 그냥 쭈욱 진행합니다.

    설치가 완료되고 정상적으로 실행되는 것을 확인할 수 있습니다. 이제 인증을 하고 로그인을 하면 됩니다.


    [O] 실행시 화면이 쪼그맣게 나오는 경우

    터미널에서 $ winecfg 를 입력하여, Wine 설정 창을 실행하고, Graphics 탭에서 System Resolution에서 값을 96에서 적절한 값으로 크게 설정한다. 4K HiDPi 환경에선 200 정도가 적당한듯.

  • NVIDIA Container Toolkit를 설치하면 Docker에서도 Nvidia 관련 툴킷을 사용 가능.

    몇가지 선행 조건이 필요함.

    nvidia-docker를 설치해야 하므로, 먼저 Repository에 대한 GPG Key 등록하고, apt 소스 리스트에 Reposity 등록

    $ distribution=$(. /etc/os-release;echo $ID$VERSION_ID) \
          && curl -fsSL https://nvidia.github.io/libnvidia-container/gpgkey | sudo gpg --dearmor -o /usr/share/keyrings/nvidia-container-toolkit-keyring.gpg \
          && curl -s -L https://nvidia.github.io/libnvidia-container/$distribution/libnvidia-container.list | \
                sed 's#deb https://#deb [signed-by=/usr/share/keyrings/nvidia-container-toolkit-keyring.gpg] https://#g' | \
                sudo tee /etc/apt/sources.list.d/nvidia-container-toolkit.list

    완료되었으면 설치 진행.

    $ sudo apt-get update
    $ sudo apt-get install -y nvidia-docker2

    설치 완료 후, docker 재실행.

    $ sudo systemctl restart docker

    정상적으로 설치되었는지 테스트

    $ sudo docker run --rm --gpus all nvidia/cuda:11.6.2-base-ubuntu20.04 nvidia-smi
    
    Sat Jan 28 13:55:11 2023       
    +-----------------------------------------------------------------------------+
    | NVIDIA-SMI 525.78.01    Driver Version: 525.78.01    CUDA Version: 12.0     |
    |-------------------------------+----------------------+----------------------+
    | GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
    | Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
    |                               |                      |               MIG M. |
    |===============================+======================+======================|
    |   0  NVIDIA GeForce ...  Off  | 00000000:01:00.0  On |                  Off |
    |  0%   38C    P8    20W / 450W |    741MiB / 24564MiB |      0%      Default |
    |                               |                      |                  N/A |
    +-------------------------------+----------------------+----------------------+
                                                                                   
    +-----------------------------------------------------------------------------+
    | Processes:                                                                  |
    |  GPU   GI   CI        PID   Type   Process name                  GPU Memory |
    |        ID   ID                                                   Usage      |
    |=============================================================================|
    +-----------------------------------------------------------------------------+
    

    완료.

  • Ubuntu에서 Docker 설치 방법 정리. 기본적으로 Ubuntu Community에서 제공하는 docker.io가 존재하나, Docker.ce를 설치하는 것을 모두 권장하는 듯. Docker는 64bit 운영체계만 지원함.

    먼저 기존 설치된 docker 관련 패키지들을 모두 제거.

    $ sudo apt-get remove docker docker-engine docker.io containerd runc

    또한 /var/lib/docker 안에, 기존에 설치했던 이미지, 컨테이너 등등의 파일이 존재하므로, 필요가 없다면 이것도 삭제하는 것을 권장함.

    다음으로, 설치에 필요한 패키지 설치

    $ sudo apt-get install ca-certificates curl gnupg lsb-release

    Docker Repository GPG Key 등록

    $ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg

    Docker Repository를 apt 소스 리스트에 등록.

    $ echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null

    설치 시작

    $ sudo apt-get update
    $ sudo apt-get install docker-ce docker-ce-cli containerd.io

    설치한 이후 동작 테스트.

    $ sudo docker run hello-world
    
    Unable to find image 'hello-world:latest' locally
    latest: Pulling from library/hello-world
    2db29710123e: Pull complete 
    Digest: sha256:aa0cc8055b82dc2509bed2e19b275c8f463506616377219d9642221ab53cf9fe
    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를 사용하지 않고 이용하려면, 사용자 계정을 docker 그룹에 추가하면 됨.

    $ sudo groupadd docker
    $ sudo usermod -aG docker $USER

    재부팅 후 사용 가능.

  • Noetic에선 Cartogrphaer의 패키지 버전을 제공하지 않고 있다. 왜인이 이유는 잘 모르겠지만, 일단 Noetic에서 Cartographer를 사용하기 위해선 소스를 직접 빌드하여 사용해야 한다.

    빌드하기 위해서 필요한 툴을 먼저 설치한다.

    $ sudo apt-get install -y python3-wstool python3-rosdep ninja-build stow

    다음으로, 사용자 workspace에 소스를 받는다.

    $ cd ~/catkin_ws/src
    $ mkdir cartographer
    $ cd cartographer
    $ git clone https://github.com/cartographer-project/cartographer.git
    $ git clone https://github.com/cartographer-project/cartographer_ros.git

    패키지 빌드를 위해 필요한 의존 패키지들을 설치한다.

    $ rosdep install --from-paths . --ignore-src -r -y

    다음으로 abseil를 설치한다. 설치 스크립티는 이미 소스에 포함되어 있으므로, 해당 경로로 이동해 스크립트를 실행해주면 된다.

    $ cd catrographer/scripts
    $ ./install_abseil.sh

    마지막으로, cartographer_ros 패키지를 빌드해준다.

    $ cd ~/catkin_ws
    $ catkin build

    이제 사용하면 됨.

  • Ubuntu 22.04를 설치하고 난 이후에 하는 반복적인 설정 작업들.

    [v] Gnome Tweaks, MP3 코덱 등 설치

    $ sudo apt install ubuntu-restricted-extras
    $ sudo apt update
    $ sudo apt install gnome-tweaks

    [v] Gnome Shell 설정 – 독 아이콘 클릭시 최소화 하도록

    $ gsettings set org.gnome.shell.extensions.dash-to-dock click-action 'minimize'

    [v] Gnome Shell Extension Manager 설치 (사용자 테마 설정 가능)\

    $ sudo apt install gnome-shell-extension-manager

    [v] vim-tiny 제거, vim 설치 : 초기 설치시 vim 에디터의 최소버전이 기본 설치됨. (사용 불편)

    $ sudo apt purge vim-tiny
    $ sudo apt install vim

    [v] net-tools, htop 설치 : ifconfig 등 네트웍 관련 명령어 사용

    $ sudo apt install htop net-tools

    [v] 한글 입력기 설치: fcitx5-hangul, 이후 설정에서 입력기를 fcitx5로 선택.

    $ sudo apt install fcitx5 fcitx5-hangul

    [v] CPU의 주파수 정책(?)를 항상 퍼포먼스 모드로… (성능 향상.. 배터리는 암울…)

    $ sudo apt install cpufrequtils
    $ sudo nano /etc/default/cpufrequtils
    
    GOVERNOR="performance"
    MIN_SPEED="2000MHz"
    
    $ sudo systemctl disable ondemand
    $ sudo systemctl restart cpufrequtils

    [v] Nvidia Driver 설치 : https://ahnbk.dev/?p=29

    [v] tmux 설치 : https://ahnbk.dev/?p=40

    [v] Github CLI 설치: github 관련 작업을 CLI 환경에서 가능하도록 (Repository 생성, 로그인 등)

    $ sudo apt install curl
    $ curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | sudo dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg
    $ echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null
    $ sudo apt update
    $ sudo apt install gh

    [v] 폰트 설치

    [v] Visual Studio Code 설치

    $ sudo apt install software-properties-common apt-transport-https wget
    $ wget -q https://packages.microsoft.com/keys/microsoft.asc -O- | sudo apt-key add -
    $ sudo add-apt-repository "deb [arch=amd64] https://packages.microsoft.com/repos/vscode stable main"
    $ sudo apt update
    $ sudo apt install code
  • tmux는 하나의 터미널에서 여러 개의 터미널을 사용할 수 있게 해주는 Multiplexer이다. 또한 detach 기능도 지원하여, screen과 같이 여러 개의 터미널이 실행된 상태에서 백그라운드로 전환할 수 도 있다.

    설치는 그냥 apt를 이용하여 설치한다.

    $ sudo apt install git tmux

    tmux를 사용하는데 플러그인을 사용하기 쉽도록 매니저를 설치한다.

    $ git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm

    이제 tmux의 환경설정을 위한 파일을 수정한다.

    $ vi ~/.tmux.conf
    set -g @plugin 'tmux-plugins/tpm'
    set -g @plugin 'tmux-plugins/tmux-sensible'
    set -g @plugin 'tmux-plugins/tmux-yank'
    
    set -g mouse on
    set -g destroy-unattached on
    setw -g monitor-activity on
    set -g visual-activity on
    set -g default-terminal "screen-256color"
    set -g history-limit 30000
    
    set -g base-index 1
    set -g pane-base-index 1
    
    # Pane splitting.
    bind \\ split-window -h -c "#{pane_current_path}"
    bind - split-window -v -c "#{pane_current_path}"
    bind r source-file ~/.tmux.conf \; display "Reloaded ~/.tmux.conf"
    
    run '~/.tmux/plugins/tpm/tpm'

    실행은 터미널에서 다음과 같이 입력한다.

    $ tmux

    간단한 사용법은 다음과 같다.

    • 가로로 창 분리: ctrl + b + \
    • 세로로 창 분리: ctrl + b + -
    • 창 전환은 마우스로 클릭
    • 새로운 그룹 (윈도우 생성): ctrl + b + c

    끝.

  • Ubuntu 22.04를 설치하면 자동으로 Nvidia 그래픽카드 드라이버가 설치된다. Nvidia에서 직접 제공하는 Repository를 사용하면, 쉽게 최신 버전의 그래픽 카드 드라이버를 설치할 수 있다.

    먼저 현재 설치되어 있는 드라이버를 삭제한다.

    $ sudo apt purge *nvidia*

    다음으로, Nvidia Repository의 키를 등록하고, apt에 Repository를 추가한다.

    $ sudo wget -P /etc/apt/trusted.gpg.d/ https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64/cuda-archive-keyring.gpg
    $ sudo bash -c 'echo "deb https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64 /" >> /etc/apt/sources.list.d/cuda.list'

    이제, apt를 업데이트하고, 드라이버를 설치한다. 이때 cuda를 설치하면 해당 CUDA의 버전에 맞게 안정된 드라이버를 같이 설치해준다.

    $ sudo apt update
    $ sudo apt install cuda

    마지막으로 노트북의 경우, prime-select 기능을 이용해 intel 대신 nvidia 드라이버가 항상 사용할 수 있도록 설정해준다.

    $ sudo prime-select nvidia

    재부팅하면 완료.

  • 블로그를 새로 설치하였습니다. 도메인은 ahnbk.dev 입니다. 며칠전까지는 Ghost를 이용해서 설치하고, 몇번을 포스팅하면서 지켜보았습니다만, WordPress에 비해서 여러가지 불편한 점이 보입니다.

    • 코어, 테마가 하나로 동작합니다. 테마를 수정해도 앱을 빌드하듯 빌드를 해야 하고, 이를 적용하려면, 블로그를 재시작해야 합니다.
    • 따로 글을 포스팅할 수 있는 앱이 없습니다. 여러가지 편집기의 플러그인 형식으로 가능하다곤 하지만, 불편합니다.
    • 에디터가 그다지 훌륭하지 않습니다.
    • 최고의 문제점은 Anonymous로 접속할 경우, 댓글을 달 수가 없습니다. 무조건 가입을 해야 합니다.
    • 컨텐츠를 유료화하긴 쉽게 해놓았고, 이를 이용해 구독자를 모이게 하는 것에는 최적화 되어 있는 듯 합니다. 별로입니다.
    • 카테고리 구조가 아닙니다. 태그로 구분되긴 하지만, 글을 적당히 분류할 수 있는 방법이 쉽지 않습니다.
    • 이쁜 테마가 없는데, 또 맘에 드는 테마를 만들기엔 아주 많은 수고와 시간이 들어갑니다. 이는 워드프레스와 다를 바가 없는데, 오히려 더 힙듭니다.

    이제 새로운 블로그에 새로운 글을 차곡차곡 쌓아볼까합니다.

Join 900+ subscribers

Stay in the loop with everything you need to know.