본문 바로가기
IoT 디바이스 활용/Raspberry Pi

Raspberry Pi - 라즈베리파이 시작하기 - Raspbian, NOOBS, VNC, Putty, Samba

by cooluk 2020. 10. 16.

라즈베리파이 설치 1 (Image 설치)

https://www.raspberrypi.org/downloads/

image-20200923094813972


라즈비안 OS 이미지 다운로드

  • 크기 2.5G

image-20200923095742961


Win32 Disk Imager 설치

image-20200923095839346


라즈비언 이미지 SDCard 심기

  • 10분 정도 소요

image-20200923095928058


파티션 구성

  • 부팅 및 시스템 설정 파티션(256 MB)
  • 주 파티션(6.59 GB)
  • 미할당 영역(7.99 GB)
    • 확장 필요

image-20200923100013299


SSH 활성화하기

  • boot 파티션에 ssh 파일 생성
    • 확장명 무, 내용 무

WiFi 접속설정 파일 만들기

  • boot 파티션에 wpa_supplicant.conf 작성
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
network={
    ssid="네트워크이름"
    psk="네트워크비번"
}

부팅 후 우측 상단 와이파이 아이콘에 마우스 올리면 IP 주소 확인 가능


개행문자 조정

  • CRLF -> LF

image-20200923100337477


부팅

  • 최초 부팅 약간 시간 걸림

    • 자동 파티션 확장

    • 화면에 아무것도 안 나와도 기다림.

      내 IP: 192.168.0.10

      cmd > ssh pi@192.168.0.10

      password : raspberry



라즈베리파이 설치 2 (NOOBS 설치)

https://www.raspberrypi.org/downloads/

image-20200923105044448


NOOBS 다운로드

image-20200923105115029


microSD 카드 준비

  • micro SD카드 Fat32 포맷
  • NOOBS_v3_4_0 파일 압축해제
  • 파일/디렉토리를 micro SD카드에 복사

image-20200923134028209


장치 연결

  • HDMI, 키보드, 마우스 연결
  • SD카드 장착
  • HDMI 연결 시 반드시 어댑터로 전원공급
    • USB로 전원공급 시 전류 부족으로 그래픽 환경 지원 못함
    • 무한 재부팅 발생

최초 부팅시 설치할 OS 선택

  • Rasbian (선택)
  • LibreELEC
  • INSTALL 메뉴 실행


라즈베리파이 초기화

image-20200923134404281


image-20200923134419165


image-20200923134512092


image-20200923134524630


무선 마우스 반응 속도

  • sudo nano /boot/cmdline.txt
  • 라인 끝에 다음 추가
    • usbhid.mousepoll=0
      재부팅

시스템 업데이트

  • $ sudo apt update
  • $ sudo apt upgrade
  • 주 1회 간격으로 실행 권장

5인치 터치 LCD

  • 터치 드라이버 설치(micro USB 연결 시 불필요)
    • $ git clone https://github.com/goodtft/LCD-show.git
    • $ cd LCD-show/
    • $ chmod +x LCD5-show
    • $ sudo ./LCD5-show

가상 키패드 설치

  • $ sudo apt install florence -y
  • $ sudo apt install at-spi2-core -y
  • 메뉴 > Universal Access > Florence Virtual Keyboard

image-20200923153529555



원격 접속 환경 설정 - Headless 환경 -


원격 접속을 위한 VNC와 Putty (Headless 환경)

설정

  • Preference->Raspverry Pi Configuration

    image-20200923153838118


텍스트 모드 원격 접속

image-20200923160505357

image-20200923160513095

image-20200923160528771


그래픽 모드 원격 접속

  • 라즈베리파이 VNC 접속 허용
    • 기본 설정 > Raspberry Pi Configuration > Interfaces > VNC Enable

image-20200923160608819

image-20200923160742934

  • VNC Viewer
    • File > New Connection…

image-20200923161620045

image-20200923162006039

image-20200923162017218



한글 입력기 및 locale 설정

한글 폰트 설치하기(fonts-unfonts-core)

  • $ sudo apt-get install fonts-unfonts-core

한글 입력기 설치

  • $ sudo apt-get install nabi im-config
  • $ sudo reboot

한글 입력기 설정

  • 메뉴 > Preference(설정) > Input Method(입력기) > OK

image-20200923170743400


한글 입력기 설정

image-20200923170758773

image-20200923170812592


재기동

image-20200923170824171


locale 설정

image-20200923170917726


한글 전환키 재설정

image-20200923171017378



Samba 설치 - 윈도우즈에서 폴더 공유 -

삼바(Samba)

  • 리눅스(UNIX-like)와 윈도우간에 파일 및 프린터를 공유 지원 패키지
  • 컴퓨터 간 파일 공유등의 서비스 구현
  • SMB/CIFS 프로토콜 사용
  • 리눅스 서버를 타운영체제와 파일을 공유할 수 있는 파일서버로도 사용

삼바 설치

  • $ sudo apt install samba samba-common-bin

사용자 추가

  • 시스템 사용자 id와 삼바 사용자 id 다름
  • smbpasswd로 삼바를 사용할 id를 추가
    • 이 id를 사용하여, 다른 컴퓨터에서 라즈베리파이로 삼바 접속
pi@raspberrypi:~ $ sudo smbpasswd -a pi
New SMB password:
Retype new SMB password:
Added user pi.
pi@raspberrypi:~ $

삼바 구성 정보 설정

  • pi@raspberrypi:~ $ sudo nano /etc/samba/smb.conf
[pi]
    comment = pi shared folder
    path = /home/pi
    valid users = pi
    browseable = yes
    guest ok = no
    read only = no
    create mask = 0777

Ctrl + o 저장


samba 재시작

  • pi@raspberrypi:~ $ sudo service smbd restart

image-20200923205201992

mypi -> 192.168.10


로그인

  • samba에 등록한 사용자 id/password 이용

image-20200923205317530

네트워크 드라이브 연결

image-20200923205403730

image-20200923205411708

image-20200923205730342



Python3 설정

라즈베리파이의 파이썬

  • /usr/bin에 기본 명령 존재
  • python : python2에 대한 심벌릭 링크
  • pip : pip2의 복사본

  • python3를 디폴트로 만들기

    $ cd /usr/bin
    $ sudo ln -sf arm-linux-gnueabihf-python3.7-config python3.7-config
    $ sudo ln -sf python3.7-config python3-config
    $ sudo ln -sf python3-config python-config

image-20200924091442901


해상도/듀얼 모드 복원

  • config.txt > 공유폴더에 복사

  • $ cd ~
    $ sudo su

    # cat config.txt > /boot/config.txt

# For more options and information see
# http://rpf.io/configtxt
# Some settings may impact device functionality. See link above for details

# uncomment if you get no picture on HDMI for a default "safe" mode
#hdmi_safe=1

# uncomment this if your display has a black border of unused pixels visible
# and your display can output without overscan
#disable_overscan=1

# uncomment the following to adjust overscan. Use positive numbers if console
# goes off screen, and negative if there is too much border
#overscan_left=16
#overscan_right=16
#overscan_top=16
#overscan_bottom=16

# uncomment to force a console size. By default it will be display's size minus
# overscan.
#framebuffer_width=1280
#framebuffer_height=720

# uncomment if hdmi display is not detected and composite is being output
#hdmi_force_hotplug=1

# uncomment to force a specific HDMI mode (this will force VGA)
#hdmi_group=1
#hdmi_mode=1

# uncomment to force a HDMI mode rather than DVI. This can make audio work in
# DMT (computer monitor) modes
#hdmi_drive=2

# uncomment to increase signal to HDMI, if you have interference, blanking, or
# no display
#config_hdmi_boost=4

# uncomment for composite PAL
#sdtv_mode=2

#uncomment to overclock the arm. 700 MHz is the default.
#arm_freq=800

# Uncomment some or all of these to enable the optional hardware interfaces
#dtparam=i2c_arm=on
#dtparam=i2s=on
#dtparam=spi=on

# Uncomment this to enable the lirc-rpi module
#dtoverlay=lirc-rpi

# Additional overlays and parameters are documented /boot/overlays/README

# Enable audio (loads snd_bcm2835)
dtparam=audio=on

[pi4]
# Enable DRM VC4 V3D driver on top of the dispmanx display stack
dtoverlay=vc4-fkms-v3d
max_framebuffers=2

[all]
#dtoverlay=vc4-fkms-v3d

# NOOBS Auto-generated Settings:
hdmi_force_hotplug=1
  • 설정 > 기본 설정 > Main Menu Editor > 기본 설정> Display Settings
    Display Settings : HDMI 연결 시 해상도 변경 가능
    Screen Configuration : 듀얼모니터 설정

Ctrl + Alt + T : 터미널

댓글