728x90

출처

ESP-IDF Extension 설치

[F1] -> New Project 선택

blink_example_main.c

#include <stdio.h>
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "driver/gpio.h"
#include "esp_log.h"

#define LED_PIN 3   // DFR1172 보드 내장 LED 핀 (필요 시 2, 13 등으로 변경)
static const char *TAG = "LED_BLINK";

void app_main(void)
{
    ESP_LOGI(TAG, "ESP32-P4 LED Blink Example Start");

    // GPIO 설정
    gpio_reset_pin(LED_PIN);
    gpio_set_direction(LED_PIN, GPIO_MODE_OUTPUT);

    while (1) {
        gpio_set_level(LED_PIN, 1);  // LED 켜기
        ESP_LOGI(TAG, "LED ON");
        vTaskDelay(pdMS_TO_TICKS(1000));

        gpio_set_level(LED_PIN, 0);  // LED 끄기
        ESP_LOGI(TAG, "LED OFF");
        vTaskDelay(pdMS_TO_TICKS(1000));
    }
}

Build

Flash

728x90
728x90

출처

List Bluetooth Adaptors

pi@raspberrypi:~$ hciconfig
hci0:   Type: Primary  Bus: UART
        BD Address: D8:3A:DD:BA:79:78  ACL MTU: 1021:8  SCO MTU: 64:1
        UP RUNNING 
        RX bytes:3771 acl:0 sco:0 events:398 errors:0
        TX bytes:68389 acl:0 sco:0 commands:398 errors:

Scan for Bluetooth devices

pi@raspberrypi:~$ hcitool scan
Scanning ...
        C4:47:4E:BE:57:FC       n/a
        F8:63:3F:0B:D3:3E       LAPTOP-Q2A61D9E

Scan for BLE devices

pi@raspberrypi:~$ sudo hcitool lescan | grep BBL_SHUTTER
20:6E:F1:47:9D:76 BBL_SHUTTER
20:6E:F1:47:9D:76 BBL_SHUTTER

gatttool을 사용하여 장치에 연결

pi@raspberrypi:~$ sudo gatttool -b 20:6E:F1:47:9D:76 -t random --interactive
[20:6E:F1:47:9D:76][LE]>

라즈베리파이 환경 준비

pi@raspberrypi:~$ sudo apt update
pi@raspberrypi:~$ sudo apt install bluetooth bluez python3-bluez python3-dbus

실행 오류

pi@raspberrypi:~$ python3 RPi_BLE_Shutter_Client.py 
Traceback (most recent call last):
  File "/home/pi/RPi_BLE_Shutter_Client.py", line 2, in 
    from bleak import BleakClient, BleakScanner
ModuleNotFoundError: No module named 'bleak'

bleak 설치 오류

pi@raspberrypi:~$ sudo pip3 install bleak
error: externally-managed-environment
 
× This environment is externally managed
╰─> To install Python packages system-wide, try apt install
    python3-xyz, where xyz is the package you are trying to
    install.
    
    If you wish to install a non-Debian-packaged Python package,
    create a virtual environment using python3 -m venv path/to/venv.
    Then use path/to/venv/bin/python and path/to/venv/bin/pip. Make
    sure you have python3-full installed.
    
    For more information visit http://rptl.io/venv
 
note: If you believe this is a mistake, please contact your Python installation or OS distribution provider. You can override this, at the risk of breaking your Python installation or OS, by passing --break-system-packages.
hint: See PEP 668 for the detailed specification.

pip에 설치 권한 부여

pi@raspberrypi:~$ python -m pip config set global.break-system-packages true
Writing to /home/pi/.config/pip/pip.conf

bleak 설치

pi@raspberrypi:~$ pip3 install bleak
Collecting bleak
  Downloading bleak-1.1.1-py3-none-any.whl.metadata (5.1 kB)
Collecting dbus-fast>=1.83.0 (from bleak)
  Downloading dbus_fast-2.44.5-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl.metadata (10 kB)
Downloading bleak-1.1.1-py3-none-any.whl (136 kB)
Downloading dbus_fast-2.44.5-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl (868 kB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 868.4/868.4 kB 2.7 MB/s eta 0:00:00
Installing collected packages: dbus-fast, bleak
Successfully installed bleak-1.1.1 dbus-fast-2.44.5
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager, possibly rendering your system unusable. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv. Use the --root-user-action option if you know what you are doing and want to suppress this warning.

RPi_BLE_Shutter_Client.py (최종적으로 실패)

import asyncio
from bleak import BleakClient, BleakScanner
from bleak.backends.device import BLEDevice
from bleak.backends.scanner import AdvertisementData

# BLE HID 서비스 및 특성 UUID
# HID Service: 00001812-0000-1000-8000-00805f9b34fb
HID_SERVICE_UUID = "00001812-0000-1000-8000-00805f9b34fb" 
# Report Characteristic: 00002a4d-0000-1000-8000-00805f9b34fb (일반적인 HID Report UUID)
REPORT_CHAR_UUID = "00002a4d-0000-1000-8000-00805f9b34fb" 

# 찾고자 하는 셔터 장치의 이름 (예시: 실제 장치 이름으로 변경 필요)
TARGET_DEVICE_NAME = "BBL_SHUTTER"

def hid_report_handler(characteristic: int, data: bytearray):
    """
    셔터 장치로부터 HID Report를 수신할 때 호출되는 콜백 함수.
    
    셔터 이벤트(볼륨 업/다운)는 보통 6~8바이트 길이의 HID Report로 전송됩니다.
    볼륨 업(셔터) 키는 보통 Report의 두 번째 바이트에 특정 값으로 표시됩니다.
    """
    print(f"[{characteristic}]: Received HID Report: {data.hex()}")
    
    # 셔터 버튼 이벤트 감지 (HID 키보드 보고서 형식의 일반적인 패턴)
    # 볼륨 업(셔터)은 보통 두 번째 바이트(인덱스 1)가 0x80 또는 0x0E 등으로 설정됩니다.
    if len(data) >= 2:
        # 0xE9는 일반적으로 볼륨 업 키를 나타내는 HID Usage ID입니다.
        if data[1] == 0xE9:
            print("🚀 **셔터 버튼 (볼륨 업) 눌림 감지!**")
        elif data[1] == 0x00:
            print("셔터 버튼 떼짐 감지.")
        else:
            # 기타 키 또는 HID 이벤트
            pass


async def scan_and_connect():
    """타겟 장치를 스캔하고 연결을 시도하는 메인 함수"""
    print(f"Scanning for BLE device named '{TARGET_DEVICE_NAME}'...")

    # 스캔을 통해 장치를 찾습니다.
    scanner = BleakScanner()
    # 10초 동안 스캔
    devices = await scanner.discover(timeout=10.0)
    
    target_device = None
    for device in devices:
        if device.name and TARGET_DEVICE_NAME in device.name:
            target_device = device
            break
            
    if not target_device:
        print(f"Error: Could not find device with name '{TARGET_DEVICE_NAME}'.")
        print("Please ensure the device is discoverable and check the name.")
        return

    address = target_device.address
    print(f"Found target device at address: {address}. Connecting...")

    # 연결 시도
    async with BleakClient(address) as client:
        if not client.is_connected:
            print("Failed to connect.")
            return

        print("Connection successful! Discovering services...")
        
        # HID Report Characteristic 찾기
        report_char = None
        
        # 연결된 장치의 모든 서비스를 검색합니다.
        for service in client.services:
            print(f"\n[Service] UUID: {service.uuid} (Handle: {service.handle})")
            # HID 서비스 UUID 확인
            if service.uuid == HID_SERVICE_UUID:
                print(f"Found HID Service: {service.uuid}")
                for char in service.characteristics:
                    # Report Characteristic UUID 확인
                    print(f"uuid = {char.uuid}")
                    if char.uuid == REPORT_CHAR_UUID:
                        report_char = char
                        print(f"Found Report Characteristic: {char.uuid}")
                        break
                if report_char:
                    break

        if not report_char:
            print(f"Error: Could not find Report Characteristic ({REPORT_CHAR_UUID}).")
            return
            
        # Notification 구독 시작 (셔터 이벤트 수신)
        print("---> Notification 구독 시작 (셔터 이벤트 수신)")
        try:
            await client.start_notify(REPORT_CHAR_UUID, hid_report_handler)
            print("Subscribed to Report Characteristic notifications. Waiting for shutter events...")

            # 연결 유지 및 이벤트 수신 대기
            # 사용자가 Ctrl+C를 누를 때까지 무한정 대기
            while client.is_connected:
                await asyncio.sleep(1)

        except Exception as e:
            print(f"An error occurred during notification: {e}")
        finally:
            print("Stopping notifications and disconnecting...")
            await client.stop_notify(REPORT_CHAR_UUID)

if __name__ == "__main__":
    # Bleak는 비동기 함수(async)를 사용하므로 asyncio.run()으로 실행
    try:
        asyncio.run(scan_and_connect())
    except KeyboardInterrupt:
        print("\nClient stopped by user (KeyboardInterrupt).")
    except Exception as e:
        print(f"An unhandled error occurred: {e}")
728x90
728x90

출처

Docker 패키지 다운로드

user01@css:/usr/local$ sudo apt-get reinstall --download-only -y docker-ce docker-ce-cli containerd.io docker-compose-plugin

Docker 패키지 파일 복사

user01@css:~$ cd ~/
user01@css:~$ mkdir docker
user01@css:~$ sudo mv /var/cache/apt/archives/*.deb ~/docker/

Docker 패키지 설치

user01@css:~$ cd docker/
user01@css:~/docker$ ls
bridge-utils_1.7.1-1ubuntu2_amd64.deb                                pigz_2.8-1_amd64.deb
containerd_1.7.24-0ubuntu1~24.04.2_amd64.deb                         python3-compose_1.29.2-6ubuntu1_all.deb
containerd.io_1.7.27-1_amd64.deb                                     python3-docker_5.0.3-1ubuntu1.1_all.deb
docker-buildx-plugin_0.23.0-1~ubuntu.24.04~noble_amd64.deb           python3-dockerpty_0.4.1-5_all.deb
docker-ce_5%3a28.1.1-1~ubuntu.24.04~noble_amd64.deb                  python3-docopt_0.6.2-6_all.deb
docker-ce-cli_5%3a28.1.1-1~ubuntu.24.04~noble_amd64.deb              python3-dotenv_1.0.1-1_all.deb
docker-ce-rootless-extras_5%3a28.1.1-1~ubuntu.24.04~noble_amd64.deb  python3-texttable_1.6.7-1_all.deb
docker-compose_1.29.2-6ubuntu1_all.deb                               python3-websocket_1.7.0-1_all.deb
docker-compose-plugin_2.35.1-1~ubuntu.24.04~noble_amd64.deb          runc_1.1.12-0ubuntu3.1_amd64.deb
docker.io_26.1.3-0ubuntu1~24.04.1_amd64.deb                          slirp4netns_1.2.1-1build2_amd64.deb
libltdl7_2.4.7-7build1_amd64.deb                                     ubuntu-fan_0.12.16_all.deb
libslirp0_4.7.0-1ubuntu3_amd64.deb
user01@css:~/docker$ sudo dpkg -i *.deb

공유할 디렉토리 생성

user01@css:~$ sudo mkdir /usr/local/bluexmas_home
user01@css:~$ sudo mkdir -p /usr/local/bluexmas/resources

공유할 디렉토리 소유자 변경

user01@css:~$ sudo chown user01:user01 -Rf /usr/local/cnssm_home/
user01@css:~$ sudo chown user01:user01 -Rf /usr/local/cnssm/

Docker 이미지 복원

user01@css:~$ sudo docker load -i bluexxmas-ubuntu_v8.1.tar
Loaded image: bluexxmas-ubuntu:v8.1

컨테이너 생성

sudo docker run --add-host=host.docker.internal:host-gateway -it \
-h 0.0.0.0 \
-p 80:80 -p 443:443 -p 8080:8080 \
--name bluexxmas-ubuntu \
--restart always \
-v /usr/local/bluexxmas_home:/usr/local/bluexxmas_home \
-v /usr/local/bluexxmas/resources:/usr/local/bluexxmas/resources \
bluexxmas-ubuntu:v8.1 \
/bin/startservice.sh
user01@css:~$ sudo docker run --add-host=host.docker.internal:host-gateway -it \
> -h 0.0.0.0 \
> -p 80:80 -p 443:443 -p 8080:8080 \
> --name bluexxmas-ubuntu \
> --restart always \
> -v /usr/local/bluexxmas_home:/usr/local/bluexxmas_home \
> -v /usr/local/bluexxmas/resources:/usr/local/bluexxmas/resources \
> bluexxmas-ubuntu:v8.1 \
> /bin/startservice.sh
 * Starting Nginx Server...                                                                                                                                             [ OK ] 
Starting Tomcat
Using CATALINA_BASE:   /usr/local/apache-tomcat-10.1.34
Using CATALINA_HOME:   /usr/local/apache-tomcat-10.1.34
Using CATALINA_TMPDIR: /usr/local/apache-tomcat-10.1.34/temp
Using JRE_HOME:        /usr/lib/jvm/java-17-openjdk-amd64
Using CLASSPATH:       /usr/local/apache-tomcat-10.1.34/bin/bootstrap.jar:/usr/local/apache-tomcat-10.1.34/bin/tomcat-juli.jar
Using CATALINA_OPTS:   
Tomcat started.

Docker 컨테이너 목록 확인

user01@css:~$ sudo docker ps -a
CONTAINER ID   IMAGE               COMMAND                  CREATED          STATUS         PORTS                                                                                                                       NAMES
ec829951584a   cnssm-ubuntu:v8.1   "/bin/startservice.sh"   11 minutes ago   Up 9 minutes   0.0.0.0:80->80/tcp, [::]:80->80/tcp, 0.0.0.0:443->443/tcp, [::]:443->443/tcp, 0.0.0.0:8080->8080/tcp, [::]:8080->8080/tcp   cnssm-ubuntu

Docker 컨테이너 shell 접속

user01@css:~$ sudo docker exec -it ec829951584a /bin/bash

Docker 컨테이너 shell 실행

root@ 0:/# cat /bin/startservice.sh
#!/bin/sh
 
service nginx start
service tomcat start
/bin/bash
 
root@ 0:/# 

 

728x90
728x90

출처

리눅스에서 NAS 마운트 :: 다인엔시스

마운트 전 확인

[bluesanta@localhost ~]$ df -h
Filesystem           Size  Used Avail Use% Mounted on
devtmpfs             4.0M     0  4.0M   0% /dev
tmpfs                 63G     0   63G   0% /dev/shm
tmpfs                 26G   58M   25G   1% /run
efivarfs             128K   38K   86K  31% /sys/firmware/efi/efivars
/dev/mapper/rl-root   70G   24G   47G  34% /
/dev/mapper/rl-home  7.3T   84G  7.2T   2% /home
/dev/nvme0n1p2       960M  603M  358M  63% /boot
/dev/nvme0n1p1       599M  7.1M  592M   2% /boot/efi
tmpfs                 13G   56K   13G   1% /run/user/42
tmpfs                 13G  132K   13G   1% /run/user/1000

NFS 패키지 설치

[bluesanta@localhost ~]$ sudo dnf install -y nfs-utils
[bluesanta@localhost ~]$ sudo dnf install -y samba-client

NAS 정보 확인

[bluesanta@localhost ~]$ smbclient -L //192.168.0.58 -U bluesanta -d 3
lp_load_ex: refreshing parameters
Initialising global parameters
rlimit_max: increasing rlimit_max (1024) to minimum Windows limit (16384)
Processing section "[global]"
added interface enp5s0 ip=192.168.0.202 bcast=192.168.0.255 netmask=255.255.255.0
Client started (version 4.20.2).
Connecting to 192.168.0.58 at port 445
Password for [SAMBA\bluesanta]:
GENSEC backend 'gssapi_spnego' registered
GENSEC backend 'gssapi_krb5' registered
GENSEC backend 'gssapi_krb5_sasl' registered
GENSEC backend 'spnego' registered
GENSEC backend 'schannel' registered
GENSEC backend 'ncalrpc_as_system' registered
GENSEC backend 'sasl-EXTERNAL' registered
GENSEC backend 'ntlmssp' registered
GENSEC backend 'ntlmssp_resume_ccache' registered
GENSEC backend 'http_basic' registered
GENSEC backend 'http_ntlm' registered
GENSEC backend 'http_negotiate' registered
Cannot do GSE to an IP address
Got challenge flags:
Got NTLMSSP neg_flags=0x628a8215
NTLMSSP: Set final flags:
Got NTLMSSP neg_flags=0x62088215
NTLMSSP Sign/Seal - Initialising with flags:
Got NTLMSSP neg_flags=0x62088215
NTLMSSP Sign/Seal - Initialising with flags:
Got NTLMSSP neg_flags=0x62088215
 
        Sharename       Type      Comment
        ---------       ----      -------
        Disk1           Disk      
        Disk3           Disk      
        IPC$            IPC       IPC Service ()
SMB1 disabled -- no workgroup available

NAS 마운트

[bluesanta@localhost ~]$ sudo mkdir /mnt/Disk1
[bluesanta@localhost ~]$ sudo mount -t cifs -o username=bluesanta,password=passwd //192.168.0.58/Disk1 /mnt/Disk1

 

728x90
728x90

출처

키 다운로드

user01@css:~$ sudo apt-get install apt-transport-https curl
user01@css:~$ sudo mkdir -p /etc/apt/keyrings
user01@css:~$ sudo curl -o /etc/apt/keyrings/mariadb-keyring.pgp 'https://mariadb.org/mariadb_release_signing_key.pgp'

mariadb 소스 추가

user01@css:~$ sudo vi /etc/apt/sources.list.d/mariadb.sources
# MariaDB 11.8 repository list - created 2025-04-14 00:00 UTC
# https://mariadb.org/download/
X-Repolib-Name: MariaDB
Types: deb
# deb.mariadb.org is a dynamic mirror if your preferred mirror goes offline. See https://mariadb.org/mirrorbits/ for details.
# URIs: https://deb.mariadb.org/11.rc/ubuntu
URIs: https://tw1.mirror.blendbyte.net/mariadb/repo/11.8/ubuntu
Suites: noble
Components: main main/debug
Signed-By: /etc/apt/keyrings/mariadb-keyring.pgp

mariadb 설치

user01@css:~$ sudo apt-get update
user01@css:~$ sudo apt install mariadb-server

mariadb 서비스 등록 확인

user01@css:~$ sudo systemctl is-enabled mariadb
enabled

mariadb 서비스 실행 상태 확인

user01@css:~$ sudo systemctl status mysql
● mariadb.service - MariaDB 11.8.1 database server
     Loaded: loaded (/usr/lib/systemd/system/mariadb.service; enabled; preset: enabled)
    Drop-In: /etc/systemd/system/mariadb.service.d
             └─migrated-from-my.cnf-settings.conf
     Active: active (running) since Thu 2025-04-24 12:33:14 UTC; 53min ago
       Docs: man:mariadbd(8)
             https://mariadb.com/kb/en/library/systemd/
    Process: 5020 ExecStartPre=/usr/bin/install -m 755 -o mysql -g root -d /var/run/mysqld (code=exited, status=0/SUCCE>
    Process: 5022 ExecStartPre=/bin/sh -c [ ! -e /usr/bin/galera_recovery ] && VAR= ||   VAR=`/usr/bin/galera_recovery`>
    Process: 5106 ExecStartPost=/bin/rm -f /run/mysqld/wsrep-start-position (code=exited, status=0/SUCCESS)
    Process: 5108 ExecStartPost=/etc/mysql/debian-start (code=exited, status=0/SUCCESS)
   Main PID: 5050 (mariadbd)
     Status: "Taking your SQL requests now..."
      Tasks: 9 (limit: 29494)
     Memory: 174.1M (peak: 263.6M)
        CPU: 7.101s
     CGroup: /system.slice/mariadb.service
             └─5050 /usr/sbin/mariadbd
 
Apr 24 12:33:12 css mariadbd[5050]: 2025-04-24 12:33:12 0 [Note] InnoDB: log sequence number 47629; transaction id 14
Apr 24 12:33:12 css mariadbd[5050]: 2025-04-24 12:33:12 0 [Note] Plugin 'FEEDBACK' is disabled.
Apr 24 12:33:12 css mariadbd[5050]: 2025-04-24 12:33:12 0 [Note] InnoDB: Loading buffer pool(s) from /var/lib/mysql/ib_>
Apr 24 12:33:12 css mariadbd[5050]: 2025-04-24 12:33:12 0 [Note] Plugin 'wsrep-provider' is disabled.
Apr 24 12:33:12 css mariadbd[5050]: 2025-04-24 12:33:12 0 [Note] InnoDB: Buffer pool(s) load completed at 250424 12:33:>
Apr 24 12:33:14 css mariadbd[5050]: 2025-04-24 12:33:14 0 [Note] Server socket created on IP: '127.0.0.1'.
Apr 24 12:33:14 css mariadbd[5050]: 2025-04-24 12:33:14 0 [Note] mariadbd: Event Scheduler: Loaded 0 events
Apr 24 12:33:14 css mariadbd[5050]: 2025-04-24 12:33:14 0 [Note] /usr/sbin/mariadbd: ready for connections.
Apr 24 12:33:14 css mariadbd[5050]: Version: '11.8.1-MariaDB-ubu2404'  socket: '/run/mysqld/mysqld.sock'  port: 3306  m>
Apr 24 12:33:14 css systemd[1]: Started mariadb.service - MariaDB 11.8.1 database server.

mariadb root 패스워드 변경

user01@css:~$ sudo /usr/bin/mysqladmin -u root password
/usr/bin/mysqladmin: Deprecated program name. It will be removed in a future release, use '/usr/bin/mariadb-admin' instead
New password: 
Confirm new password: 

mariadb 접속

user01@css:~$ mysql -u root -p
mysql: Deprecated program name. It will be removed in a future release, use '/usr/bin/mariadb' instead
Enter password: 
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 34
Server version: 11.8.1-MariaDB-ubu2404 mariadb.org binary distribution
 
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
 
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
 
MariaDB [(none)]> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| sys                |
+--------------------+
4 rows in set (0.001 sec)
 
MariaDB [(none)]> 

mariadb DB 사용자 생성

user01@css:~$ mysql -u root -p 
mysql: Deprecated program name. It will be removed in a future release, use '/usr/bin/mariadb' instead
Enter password: 
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 35
Server version: 11.8.1-MariaDB-ubu2404 mariadb.org binary distribution
 
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
 
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
 
MariaDB [(none)]> CREATE DATABASE bluexmas_db CHARACTER SET utf8mb4 collate utf8mb4_general_ci;
Query OK, 1 row affected (0.000 sec)
 
MariaDB [(none)]> create user 'user01'@'localhost' identified by 'passwd';
Query OK, 0 rows affected (0.003 sec)
 
MariaDB [(none)]> grant all privileges on *.* to 'user01'@'localhost' with grant option;
Query OK, 0 rows affected (0.008 sec)
 
MariaDB [(none)]> create user 'user01'@'%' identified by 'passwd';
Query OK, 0 rows affected (0.003 sec)
 
MariaDB [(none)]> grant all privileges on bluexmas_db.* to 'user01'@'%' with grant option;
Query OK, 0 rows affected (0.003 sec)
 
MariaDB [(none)]> flush privileges;
Query OK, 0 rows affected (0.001 sec)
 
MariaDB [(none)]> exit
Bye

mariadb 포트 개발

user01@css:~$ sudo ufw status verbose
[sudo] password for user01: 
Status: inactive
user01@css:~$ sudo ufw enable
Command may disrupt existing ssh connections. Proceed with operation (y|n)? y
Firewall is active and enabled on system startup
user01@css:~$ sudo ufw status verbose
Status: active
Logging: on (low)
Default: deny (incoming), allow (outgoing), deny (routed)
New profiles: skip
user01@css:~$ sudo ufw allow 22
Rule added
Rule added (v6)
user01@css:~$ sudo ufw allow 3306
Rule added
Rule added (v6)
user01@css:~$ sudo ufw status verbose
Status: active
Logging: on (low)
Default: deny (incoming), allow (outgoing), deny (routed)
New profiles: skip
 
To                         Action      From
--                         ------      ----
22                         ALLOW IN    Anywhere                  
3306                       ALLOW IN    Anywhere                  
22 (v6)                    ALLOW IN    Anywhere (v6)             
3306 (v6)                  ALLOW IN    Anywhere (v6)             
 
user01@css:~$ 

mariadb 외부 접속 허용

mariadb 포트 확인

mariadb 포트 확인 해보면 127.0.0.1:3306 로컬에서 접속하도록 설정 되어 있는 것을 확인 할 수 있음

user01@css:~$ netstat -nao | grep 3306
tcp        0      0 127.0.0.1:3306          0.0.0.0:*               LISTEN      off (0.00/0/0)

mariadb 환경 변수 수정

user01@css:~$ sudo vi /etc/mysql/mariadb.conf.d/50-server.cnf 

bind-address 주석 처리

[mariadbd]

# bind-address            = 127.0.0.1
# skip-ssl        # (ERROR 2026 (HY000)) 해결

mariadb 서비스 재시작

user01@css:~$ sudo systemctl restart mysql

mariadb 포트 확인

user01@css:~$ netstat -nao | grep 3306
tcp        0      0 0.0.0.0:3306            0.0.0.0:*               LISTEN      off (0.00/0/0)
tcp6       0      0 :::3306                 :::*                    LISTEN      off (0.00/0/0)
728x90
728x90

출처

xrdp 설치

[bluesanta@localhost ~]$ sudo dnf -y install epel-release.noarch
[bluesanta@localhost ~]$ sudo dnf -y install xrdp

xrdp 서비스 등록, 서비스 실행

[bluesanta@localhost ~]$ sudo systemctl enable xrdp
Created symlink /etc/systemd/system/multi-user.target.wants/xrdp.service → /usr/lib/systemd/system/xrdp.service.
[bluesanta@localhost ~]$ sudo systemctl restart xrdp

xrdp 방화벽 개방

[bluesanta@localhost ~]$ sudo firewall-cmd --add-port=3389/tcp --permanent 
success
[bluesanta@localhost ~]$ sudo firewall-cmd --reload
success
[bluesanta@localhost ~]$
728x90
728x90

출처

리눅스 버전 확인

pi@raspberrypi:~$ uname -a
Linux raspberrypi 6.6.20+rpt-rpi-2712 #1 SMP PREEMPT Debian 1:6.6.20-1+rpt1 (2024-03-07) aarch64 GNU/Linux

도커 설치

pi@raspberrypi:~$ curl -sSL https://get.docker.com | sh

도커 버전 확인

pi@raspberrypi:~$ sudo docker version
Client: Docker Engine - Community
 Version:           26.0.0
 API version:       1.45

도커 허브에서 Oracle 데이터베이스용 이미지 다운로드

pi@raspberrypi:~$ sudo docker pull bluexmas/aarch64_oracle_db_19
Using default tag: latest
latest: Pulling from bluexmas/aarch64_oracle_db_19
ea4e27ae0b4c: Pull complete 
60e14e4a36dc: Pull complete 
2459d70df083: Pull complete 
43588f5a3c30: Pull complete 
fd59129c6b98: Pull complete 
f4347f997964: Pull complete 
b1a1518d1ad3: Pull complete 
051a9330efaf: Pull complete 
7145497f1832: Pull complete 
4f4fb700ef54: Pull complete 
Digest: sha256:276c6358c179efab39be868b6a8368df57c29210f0370c2e2cec9017f7b54dc2
Status: Downloaded newer image for bluexmas/aarch64_oracle_db_19:latest
docker.io/bluexmas/aarch64_oracle_db_19:latest

이미지 조회

pi@raspberrypi:~$ sudo docker images
REPOSITORY                      TAG       IMAGE ID       CREATED       SIZE
bluexmas/aarch64_oracle_db_19   latest    73ebf0277483   2 hours ago   5.89GB

환경변수 추가

pi@raspberrypi:~$ vi ~/.profile
CONTAINER_NAME=ORCL
ORADATA=~/oracle-docker/oradata

환경변수 적용

pi@raspberrypi:~$ source ~/.profile

데이터 디렉터리 및 Docker 볼륨 만들기

 for dir in audit data diag reco
  do mkdir -p $ORADATA/${CONTAINER_NAME}/${dir}
     rm -fr $ORADATA/${CONTAINER_NAME}/${dir}/*
     sudo docker volume rm ${CONTAINER_NAME}_${dir} 2>/dev/null
     sudo docker volume create --opt type=none --opt o=bind \
            --opt device=$ORADATA/${CONTAINER_NAME}/${dir} \
            ${CONTAINER_NAME}_${dir}
done
pi@raspberrypi:~$  for dir in audit data diag reco
>   do mkdir -p $ORADATA/${CONTAINER_NAME}/${dir}
>      rm -fr $ORADATA/${CONTAINER_NAME}/${dir}/*
>      sudo docker volume rm ${CONTAINER_NAME}_${dir} 2>/dev/null
>      sudo docker volume create --opt type=none --opt o=bind \
>             --opt device=$ORADATA/${CONTAINER_NAME}/${dir} \
>             ${CONTAINER_NAME}_${dir}
> done
ORCL_audit
ORCL_data
ORCL_diag
ORCL_reco

도커 이미지에서 디렉토리 권한이 없으므로 디렉토리 권한 해제

pi@raspberrypi:~$ cd oracle-docker/oradata/
pi@raspberrypi:~/oracle-docker/oradata$ sudo chmod 777 -Rf ORCL
pi@raspberrypi:~/oracle-docker/oradata$ cd ORCL
pi@raspberrypi:~/oracle-docker/oradata/ORCL$ ls -al
합계 24
drwxrwxrwx 6 pi pi 4096  3월 23일  21:58 .
drwxr-xr-x 3 pi pi 4096  3월 23일  21:58 ..
drwxrwxrwx 2 pi pi 4096  3월 23일  21:58 audit
drwxrwxrwx 2 pi pi 4096  3월 23일  21:58 data
drwxrwxrwx 2 pi pi 4096  3월 23일  21:58 diag
drwxrwxrwx 2 pi pi 4096  3월 23일  21:58 reco

Oracle Docker 이미지 실행

sudo docker run -d \
    --name ${CONTAINER_NAME} \
    --volume ${CONTAINER_NAME}_data:/u02/app/oracle/oradata \
    --volume ${CONTAINER_NAME}_diag:/u01/app/oracle/diag \
    --volume ${CONTAINER_NAME}_audit:/u01/app/oracle/admin \
    --volume ${CONTAINER_NAME}_reco:/u03/app/oracle \
    --volume $ORADATA/scripts:/scripts \
    -e ORACLE_SID=${CONTAINER_NAME} \
    -e ORACLE_PDB=${CONTAINER_NAME}PDB1 \
    -p 8080:8080 \
    -p 1521:1521 \
    bluexmas/aarch64_oracle_db_19
pi@raspberrypi:~$ sudo docker run -d \
>     --name ${CONTAINER_NAME} \
>     --volume ${CONTAINER_NAME}_data:/u02/app/oracle/oradata \
>     --volume ${CONTAINER_NAME}_diag:/u01/app/oracle/diag \
>     --volume ${CONTAINER_NAME}_audit:/u01/app/oracle/admin \
>     --volume ${CONTAINER_NAME}_reco:/u03/app/oracle \
>     --volume $ORADATA/scripts:/scripts \
>     -e ORACLE_SID=${CONTAINER_NAME} \
>     -e ORACLE_PDB=${CONTAINER_NAME}PDB1 \
>     -p 8080:8080 \
>     -p 1521:1521 \
>     bluexmas/aarch64_oracle_db_19
cb12a2d9068bdb4ccf34ab033bfcc5ea9a9222f6d397a783995a1fb9da9393af

도커 실행 로그 확인

pi@raspberrypi:~$ sudo docker logs -f $CONTAINER_NAME
cat: /sys/fs/cgroup/memory.max: No such file or directory
ERROR: There was a problem getting the cgroups memory limit on the system
Exiting...
 
## ----------------------------------------------------------------------------------------------- #
  Oracle password for SYS, SYSTEM and PDBADMIN: muPGi2X9#b6J_7 
## ----------------------------------------------------------------------------------------------- #
 
## ----------------------------------------------------------------------------------------------- #
  runDBCA: Running DBCA for database ORCL at 2024-03-23 12:59:41
## ----------------------------------------------------------------------------------------------- #
 
LSNRCTL for Linux: Version 19.0.0.0.0 - Production on 23-MAR-2024 12:59:41
 
Copyright (c) 1991, 2023, Oracle.  All rights reserved.
 
Starting /u01/app/oracle/product/19.19/dbhome_1/bin/tnslsnr: please wait...
 
TNSLSNR for Linux: Version 19.0.0.0.0 - Production
System parameter file is /u01/app/oracle/product/19.19/dbhome_1/network/admin/listener.ora
Log messages written to /u01/app/oracle/diag/tnslsnr/cb12a2d9068b/listener/alert/log.xml
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1)))
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=0.0.0.0)(PORT=1521)))
 
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 19.0.0.0.0 - Production
Start Date                23-MAR-2024 12:59:41
Uptime                    0 days 0 hr. 0 min. 0 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /u01/app/oracle/product/19.19/dbhome_1/network/admin/listener.ora
Listener Log File         /u01/app/oracle/diag/tnslsnr/cb12a2d9068b/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=0.0.0.0)(PORT=1521)))
Services Summary...
Service "ORCL" has 1 instance(s).
  Instance "ORCL", status UNKNOWN, has 1 handler(s) for this service...
The command completed successfully
 
## ----------------------------------------------------------------------------------------------- #
  runDBCA: Creating container database ORCL and 1 pluggable database(s) with name ORCLPDB1 at 2024-03-23 12:59:41
## ----------------------------------------------------------------------------------------------- #
Prepare for db operation
8% complete
Copying database files
31% complete
Creating and starting Oracle instance
32% complete
36% complete
40% complete
43% complete
46% complete
Completing Database Creation
51% complete
54% complete
Creating Pluggable Databases
58% complete
77% complete
Executing Post Configuration Actions
100% complete
Database creation complete. For details check the logfiles at:
 /u01/app/oracle/cfgtoollogs/dbca/ORCL.
Database Information:
Global Database Name:ORCL
System Identifier(SID):ORCL
Look at the log file "/u01/app/oracle/cfgtoollogs/dbca/ORCL/ORCL.log" for further details.
 
Pluggable database altered.
 
 
Pluggable database altered.
 
 
## ----------------------------------------------------------------------------------------------- #
  runDBCA: DBCA complete at 2024-03-23 13:09:10
## ----------------------------------------------------------------------------------------------- #
 
## ----------------------------------------------------------------------------------------------- #
  Database ORCL with unique name ORCL is open and available. 
## ----------------------------------------------------------------------------------------------- #
 
## ----------------------------------------------------------------------------------------------- #
  Tailing alert_ORCL.log: 
2024-03-23T13:09:09.405148+00:00
ORCLPDB1(3):CREATE SMALLFILE TABLESPACE "USERS" LOGGING  DATAFILE  SIZE 5M AUTOEXTEND ON NEXT  1280K MAXSIZE UNLIMITED  EXTENT MANAGEMENT LOCAL  SEGMENT SPACE MANAGEMENT  AUTO
ORCLPDB1(3):Completed: CREATE SMALLFILE TABLESPACE "USERS" LOGGING  DATAFILE  SIZE 5M AUTOEXTEND ON NEXT  1280K MAXSIZE UNLIMITED  EXTENT MANAGEMENT LOCAL  SEGMENT SPACE MANAGEMENT  AUTO
ORCLPDB1(3):ALTER DATABASE DEFAULT TABLESPACE "USERS"
ORCLPDB1(3):Completed: ALTER DATABASE DEFAULT TABLESPACE "USERS"
2024-03-23T13:09:10.226142+00:00
alter pluggable database all open
Completed: alter pluggable database all open
alter pluggable database all save state
Completed: alter pluggable database all save state

컨테이너 ID 확인

pi@raspberrypi:~$ sudo docker ps 
CONTAINER ID   IMAGE                           COMMAND                   CREATED          STATUS                    PORTS                                                                                            NAMES
cb12a2d9068b   bluexmas/aarch64_oracle_db_19   "/bin/sh -c 'exec $D…"   10 minutes ago   Up 10 minutes (healthy)   0.0.0.0:1521->1521/tcp, :::1521->1521/tcp, 0.0.0.0:8080->8080/tcp, :::8080->8080/tcp, 5500/tcp   ORCL

SQLPlus 접속

pi@raspberrypi:~$ sudo docker exec -it cb12a2d9068b sqlplus
 
SQL*Plus: Release 19.0.0.0.0 - Production on Sat Mar 23 13:11:36 2024
Version 19.19.0.0.0
 
Copyright (c) 1982, 2023, Oracle.  All rights reserved.
 
Enter user-name: SYSTEM
Enter password: 
Last Successful login time: Sat Mar 23 2024 13:05:14 +00:00
 
Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.19.0.0.0
 
SQL> select TABLESPACE_NAME from DBA_TABLESPACES;
 
TABLESPACE_NAME
------------------------------
SYSTEM
SYSAUX
UNDOTBS1
TEMP
USERS
 
SQL> 
728x90
728x90

출처

Delphi로 ARM CPU용 리눅스 프로그램 만들기

TMS에서 제공하는 컴포넌트를 이용해서 Raspberry PI 런타임 모듈을 첨부한 파일을 Orange Pi에서 실행해보았다. Orange Pi 정식 제공하는 OS에서는 실행에 오류가 있었고, Armbian 리눅스에서 정상적으로 실행되는 것을 확인

프로젝트 생성

[File] - [New] - [Other...] 메뉴 선택

[TMS WEB Miletus Application] 메뉴 선택

화면 구성 - 버튼, 에디트박스 추가

버튼 클릭 이벤트 구현

unit Unit1;

interface

uses
  System.SysUtils, System.Classes, JS, Web, WEBLib.Graphics, WEBLib.Controls,
  WEBLib.Forms, WEBLib.Miletus, WEBLib.Dialogs, Vcl.StdCtrls, WEBLib.StdCtrls,
  Vcl.Controls;

type
  TForm1 = class(TMiletusForm)
    WebEdit1: TWebEdit;
    WebButton1: TWebButton;
    procedure WebButton1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.WebButton1Click(Sender: TObject);
begin
  WebEdit1.Text := 'hello world !!!';
end;

initialization
  RegisterClass(TForm1);

end.

Build Configurations - Build-Raspberry-Pi64로 변경

실행

런타임 라이브러리 설치

orangepi@orangepi5:~$ sudo apt install libwebkit2gtk-4.0-dev

TMSWeb\Build-Raspberry-Pi64 폴더의 Project1 파일을 리눅스에 복사하고 실행 모드 적용 후 실행

728x90

+ Recent posts