   42  curl -fsSL https://packagecloud.io/timescale/timescaledb/gpgkey | sudo gpg --dearmor -o /usr/share/keyrings/timescaledb-archive-keyring.gpg
   43  sudo apt-get update
   44  curl -fsSL https://packagecloud.io/timescale/timescaledb/gpgkey | sudo gpg --dearmor -o /usr/share/keyrings/timescaledb-archive-keyring.gpg
   45  sudo nano /etc/apt/sources.list.d/timescaledb.list
   46  sudo apt update
   47  sudo rm /etc/apt/sources.list.d/timescaledb.list
   48  sudo nano /etc/apt/sources.list.d/timescaledb.list
   49  curl -fsSL https://packagecloud.io/timescale/timescaledb/gpgkey | sudo gpg --dearmor -o /usr/share/keyrings/timescaledb-archive-keyring.gpg
   50  sudo apt-get update
   51  sudo apt-get install timescaledb-postgresql-16
   52  sudo rm /etc/apt/sources.list.d/timescaledb.list
   53  curl -fsSL https://packagecloud.io/timescale/timescaledb/gpgkey | sudo gpg --dearmor -o /usr/share/keyrings/timescaledb-archive-keyring.gpg
   54  sudo nano /etc/apt/sources.list.d/timescaledb.list
   55  sudo apt-get update
   56  sudo apt-get install timescaledb-postgresql-16
   57  curl -s https://packagecloud.io/install/repositories/timescale/timescaledb/script.deb.sh | sudo bash
   58  sudo pkill -f "script.deb.sh"
   59  sudo rm -f /etc/apt/sources.list.d/timescaledb.list
   60  sudo rm -f /usr/share/keyrings/timescaledb-archive-keyring.gpg
   61  sudo apt-get install timescaledb-2-postgresql-16
   62  sudo pkill -f "script.deb.sh"
   63  sudo rm -f /etc/apt/sources.list.d/timescaledb.list
   64  sudo rm -f /usr/share/keyrings/timescaledb-archive-keyring.gpg
   65  curl -fsSL https://packagecloud.io/timescale/timescaledb/gpgkey | sudo gpg --dearmor -o /usr/share/keyrings/timescaledb-archive-keyring.gpg
   66  echo "deb [signed-by=/usr/share/keyrings/timescaledb-archive-keyring.gpg] https://packagecloud.io/timescale/timescaledb/ubuntu/ noble main" | sudo tee /etc/apt/sources.list.d/timescaledb.list
   67  sudo apt-get update
   68  sudo apt-get install timescaledb-2-postgresql-16
   69  sudo nano /etc/postgresql/16/main/postgresql.conf
   70  sudo systemctl restart postgresql
   71  SHOW shared_preload_libraries;
   72  sudo shutdown now
   73  sudo add-apt-repository ppa:dotnet/backports
   74  sudo apt-get update &&   sudo apt-get install -y aspnetcore-runtime-10.0
   75  resolvectl status
   76  sudo resolvectl dns ens33 8.8.8.8 1.1.1.1
   77  sudo resolvectl domain ens33 "~."
   78  resolvectl status
   79  sudo apt-get update &&   sudo apt-get install -y aspnetcore-runtime-10.0
   80  sudo apt update
   81  sudo nano /etc/netplan/00-installer-config.yaml
   82  sudo netplan apply
   83  sudo chmod 600 /etc/netplan/00-installer-config.yaml
   84  ls -l /etc/netplan/00-installer-config.yaml
   85  sudo netplan apply
   86  resolvectl status
   87  ping -c 3 google.com
   88  apt install postgresql
   89  sudo apt install postgresql
   90  sudo -u postgres PASSWORD 'root'
   91  sudo -u postgres psql
   92  sudo nano /etc/postgresql/15/main/postgresql.conf
   93  postgresql --version
   94  psql -version
   95  sudo -u postgres psql
   96  sudo nano /etc/postgresql/15/main/postgresql.conf
   97  sudo nano /etc/postgresql/16/main/postgresql.conf
   98  sudo nano /etc/postgresql/16/main/pg_hba.conf
   99  sudo systemctl restart postgresql
  100  mkdir -p ~/projects
  101  cd ~/projects
  102  dotnet new console -n DbTest
  103  cd DbTest
  104  dotnet --info
  105  ls /usr/share/dotnet/sdk
  106  which dotnet
  107  dotnet --list-sdks
  108  sudo apt update
  109  sudo apt install -y dotnet-sdk-8.0
  110  dotnet --list-sdks
  111  8.0.xxx
  112  cd ~/projects
  113  dotnet new console -n DbTest
  114  cd DbTest
  115  dotnet add package Npgsql
  116  ssh-keygen -t rsa -b 4096
  117  ssh-copy-id pacer@192.168.0.50
  118  sudo nano /etc/postgresql/16/main/pg_hba.conf
  119  sudo systemctl restrat postgresql
  120  sudo systemctl restart postgresql
  121  ps aux | grep bash
  122  cd DBTest
  123  ls
  124  cd DbTest
  125  ls
  126  cd bin
  127  ls
  128  cd ../
  129  ls
  130  exit
  131  sudo shutdown now
  132  ls
  133  sudo shutdown now
  134  cd DbTest
  135  dotnet add package OPCFoundation.NetStandard.Opc.Ua
  136  dotnet list package
  137  sudo shutdown now
  138  dotnet run
  139  cd DbTest
  140  dotnet run
  141  cd..
  142  cd ../
  143  ls
  144  cd OPCTest
  145  ls
  146  dotnet new console -n OpcUaClient
  147  cd OpcUaClient
  148  dotnet add package OPCFoundation.NetStandard.Opc.Ua
  149  cd ../
  150  cd ~/projects
  151  ls
  152  dotnet new console -n OpcUaClient
  153  cd OpcUaClient
  154  dotnet add package OPCFoundation.NetStandard.Opc.Ua
  155  dotnet run
  156  using System;
  157  using System.Threading.Tasks;
  158  using Opc.Ua;
  159  using Opc.Ua.Client;
  160  using Opc.Ua.Configuration;
  161  class Program
  162  {     static async Task Main()
  163  }
  164  dotnet run
  165  dotnet list package
  166  using System;
  167  using System.Threading.Tasks;
  168  using Opc.Ua;
  169  using Opc.Ua.Client;
  170  using Opc.Ua.Configuration;
  171  class Program
  172  {     static async Task Main()
  173  }
  174  dotnet run
  175  dotnet new console -n OpcUaMinimal
  176  cd OpcUaMinimal
  177  dotnet add package OPCFoundation.NetStandard.Opc.Ua --version 1.5.378.106
  178  cd ../
  179  cd ~/project
  180  ls
  181  cd ~/projects
  182  ls
  183  dotnet new console -n OpcUaMinimal
  184  cd OpcUaMinimal
  185  dotnet add package OPCFoundation.NetStandard.Opc.Ua --version 1.5.378.106
  186  dotnet run
  187  ls
  188  cd OpcUaMinimal
  189  dotnet run
  190  dotnet --list-sdks
  191  dotnet --list-runtimes
  192  dotnet list package
  193  lsb_release -a
  194  uname -a
  195  dotnet run
  196  dotnet list package
  197  dotnet add package OPCFoundation.NetStandard.Opc.Ua --version 1.5.427.112
  198  dpkg -I
  199  apt list --installed
  200  sudo shutdown now
  201  cd OpcUaMinimal
  202  dotnet new globaljson --sdk-version 8.0.123
  203  dotnet --version
  204  cd ~/projects/OpcClientSystem  # 또는 프로젝트 루트
  205  # .NET 8.0 고정
  206  dotnet new globaljson --sdk-version 8.0.123 --force
  207  # 확인
  208  cat global.json
  209  dotnet --version
  210  # 프로젝트 생성 시에도 8.0 사용됨
  211  dotnet new worker -n TestService
  212  cd ~/projects
  213  mkdir OpcConnectionTest
  214  cd OpcConnectionTest
  215  # 콘솔 프로젝트 생성
  216  dotnet new console
  217  # .NET 8.0 고정
  218  dotnet new globaljson --sdk-version 8.0.123 --force
  219  # OPC UA 패키지 설치
  220  dotnet add package OPCFoundation.NetStandard.Opc.Ua
  221  dotnet add package OPCFoundation.NetStandard.Opc.Ua.Client
  222  dotnet run
  223  dotnet clean
  224  dotnet build
  225  dotnet run
  226  dotnet clean
  227  dotnet build
  228  dotnet clean
  229  dotnet build
  230  dotnet clean
  231  dotnet build
  232  git init
  233  git clone windpacer@192.168.0.250
  234  ssl ubuntu@192.168.0.250
  235  ssh ubuntu@192.168.0.250
  236  git --version
  237  git config --global user.name "windpacer"
  238  git config --global user.email "windpacer@hanmocnn.co.kr"
  239  git remote add origin http://192.168.0.250:3000/windpacer/windpacer.git
  240  git add .
  241  git commit -m "OPC DB server Project First Commit"
  242  git push -u origin main
  243  git remote add origin https://192.168.0.250:3000/windpacer/windpacer.git
  244  git push -u origin main
  245  git remote add origin http://192.168.0.250/windpacer/windpacer.git
  246  git remote remove origin
  247  git remote add origin https://192.168.0.250:3000/windpacer/windpacer.git
  248  git add .
  249  git commit -m "OPC DB server Project First Commit"
  250  git push -u origin main
  251  git branch
  252  git branch -M main
  253  git push -u origin main
  254  git remote remove origin
  255  git remote add origin http://192.168.0.250:3000/windpacer/windpacer.git
  256  git branch
  257  git push -u origin main
  258  git remote remove origin
  259  git remote add origin http://192.168.0.250:3000/windpacer/dbserver.git
  260  git checkout -b main
  261  git add .
  262  git commit -m "OPC DB server Project First Commit"
  263  git push -u origin main
  264  ssh ubuntu@192.168.0.250
  265  ls
  266  cd OpcConnectionTest
  267  ls
  268  dotnet run
  269  sudo shutdown now
  270  dotnet run
  271  ls
  272  cd OpcConnectionTest
  273  ls
  274  dotnet run
  275  dotnet clean
  276  dotnet build
  277  dotnet clean
  278  dotnet build
  279  dotnet clean
  280  dotnet build
  281  dotnet clean
  282  dotnet build
  283  dotnet clean
  284  dotnet build
  285  dotnet run
  286  dotnet clean
  287  dotnet build
  288  dotnet clean
  289  dotnet build
  290  dotnet run
  291  cd ../
  292  ls
  293  cd opcCerti
  294  ls
  295  dotnet clean
  296  dotnet build
  297  cd ../
  298  ls
  299  cd ~/project/OpcConnectionTest
  300  ls
  301  cd ~/Projects
  302  ls
  303  cd ../
  304  ls
  305  cd ~/Projects
  306  cd ~/projects/OpcConnectionTest
  307  ls
  308  dotnet clean
  309  dotnet build
  310  dotnet clean
  311  dotnet build
  312  dotnet clean
  313  dotnet build
  314  dotnet run
  315  ls
  316  dotnet clean
  317  dotnet build
  318  dotnet clean
  319  dotnet build
  320  dotnet clean
  321  dotnet build
  322  # 1. 폴더 생성
  323  mkdir -p pki/own/certs pki/own/private pki/trusted/certs pki/rejected/certs
  324  # 2. 개인키와 인증서 생성 (Honeywell 호환을 위해 2048비트 RSA 사용)
  325  openssl req -x509 -newkey rsa:2048 -keyout pki/own/private/OpcTestClient.key -out pki/own/certs/OpcTestClient.der -days 3650 -nodes -outform DER -subj "/CN=OpcTestClient/DC=dbsvr"
  326  ls
  327  cd pki
  328  ls
  329  cd own
  330  ls
  331  cd certs
  332  ls
  333  cd ../
  334  dotnet clean
  335  dotnet build
  336  dotnet run
  337  # dbsvr 터미널에서 실행
  338  openssl req -x509 -newkey rsa:2048 -keyout pki/own/private/OpcTestClient.key -out pki/own/certs/OpcTestClient.der -days 3650 -nodes -outform DER -subj "/CN=OpcTestClient" -addext "subjectAltName = URI:urn:OpcTestClient, IP:192.168.0.20"
  339  # (IP 주소는 현재 dbsvr의 실제 IP로 바꿔주세요)
  340  dotnet clear
  341  dotnet clean
  342  dotnet build
  343  dotnet run
  344  cp pki/own/private/OpcTestClient.key pki/own/OpcTestClient.key
  345  openssl pkcs12 -export -out pki/own/private/OpcTestClient.pfx -inkey pki/own/private/OpcTestClient.key -in pki/own/certs/OpcTestClient.der -passout pass:
  346  ls
  347  cd pki
  348  ls
  349  cd own
  350  ls
  351  cd private
  352  ls
  353  cd ../
  354  dotnet clean
  355  dotnet build
  356  dotnet run
  357  ls
  358  # 1. 파일 경로로 이동
  359  cd ~/projects/OpcConnectionTest/pki/own/certs/
  360  # 2. 라이브러리가 찾기 쉽게 파일명을 SubjectName과 동일하게 복사 (대소문자 주의)
  361  # 만약 SubjectName이 "OpcTestClient"라면:
  362  cp OpcTestClient.der OpcTestClient.der
  363  # 혹시 모르니 소문자로도 하나 복사
  364  cp OpcTestClient.der opctestclient.der
  365  # 3. 개인키도 마찬가지 (private 폴더)
  366  cd ../private/
  367  cp OpcTestClient.key OpcTestClient.key
  368  cp OpcTestClient.key opctestclient.key
  369  # 4. 전체 권한 개방 (읽기 권한 문제 방지)
  370  chmod -R 777 ~/projects/OpcConnectionTest/pki/
  371  cd ../
  372  # dbsvr 터미널에서 실행 (비밀번호 없음)
  373  openssl pkcs12 -export -out ~/projects/OpcConnectionTest/pki/own/certs/OpcTestClient.pfx -inkey ~/projects/OpcConnectionTest/pki/own/private/OpcTestClient.key -in ~/projects/OpcConnectionTest/pki/own/certs/OpcTestClient.der -passout pass:
  374  # 생성된 pfx를 private 폴더에도 복사
  375  cp ~/projects/OpcConnectionTest/pki/own/certs/OpcTestClient.pfx ~/projects/OpcConnectionTest/pki/own/private/
  376  ls -R pki/own
  377  cd pki
  378  ls
  379  cd trusted
  380  ls
  381  cd certs
  382  ls
  383  cd ../
  384  dotnet clean
  385  dotnet build
  386  dotnet clean
  387  dotnet build
  388  dotnet clean
  389  dotnet build
  390  dotnet clean
  391  dotnet build
  392  dotnet clean
  393  dotnet build
  394  dotnet clean
  395  dotnet build
  396  dotnet run
  397  dotnet clean
  398  dotnet build
  399  dotnet run
  400  sudo sh -c 'echo "192.168.0.20  DESKTOP-8VS6SD2" >> /etc/hosts'
  401  dotnet run
  402  sudo shutdown now
  403  ls
  404  cd projects
  405  ls
  406  cd ..
  407  ls
  408  setfont
  409  sudo dpkg-reconfigure console-setup
  410  xrandr
  411  sudo shutdown now
  412  nuget help
  413  dotnet list package
  414  ls
  415  dotnet clean
  416  dotnet build
  417  dotnet run
  418  dotnet clean
  419  dotnet build
  420  dotnet run
  421  # PFX에서 DER 인증서 추출 (OpenSSL)
  422  openssl pkcs12 -in OpcTestClient.pfx -clcerts -nokeys -out cert.pem -passin pass:
  423  openssl x509 -in cert.pem -outform DER -out OpcTestClient.der
  424  # 배치
  425  cp OpcTestClient.der pki/own/certs/
  426  dotnet clean
  427  dotnet build
  428  dotnet run
  429  dotnet clean
  430  dotnet build
  431  dotnet run
  432  dotnet clean
  433  dotnet build
  434  dotnet run
  435  dotnet build
  436  dotnet run
  437  dotnet clean
  438  dotnet build
  439  dotnet clean
  440  dotnet build
  441  dotnet run
  442  sudo dpkg-reconfigure console-setup
  443  ls
  444  cd projects
  445  ls
  446  cls
  447  sudo shutdown now
  448  sudo dpkg-reconfigure console-setup
  449  ls
  450  sudo shutdown now
  451  dotnet run
  452  dotnet clean
  453  dotnet build
  454  dotnet run
  455  dotnet build
  456  dotnet run
  457  dotnet build
  458  dotnet run
  459  dotnet --list-runtimes
  460  dotnet clean
  461  dotnet build
  462  dotnet run
  463  dotnet build
  464  dotnet run
  465  dotnet --list-runtimes
  466  dotnet build
  467  dotnet clean
  468  dontnet build
  469  dotnet build
  470  dotnet clean
  471  dotnet build
  472  dotnet run
  473  dotnet build
  474  dotnet run
  475  dotnet build
  476  dotnet run
  477  dotnet build
  478  dotnet run
  479  dotnet build
  480  dotnet run
  481  dotnet build
  482  dotnet clean
  483  dotnet build
  484  dotnet run
  485  dotnet build
  486  dotnet run
  487  sudo sh -c 'echo "192.168.0.20  DESKTOP-8VS6SD2" >> /etc/hosts'
  488  dotnet run
  489  dotnet build
  490  dotnet run
  491  dotnet build
  492  dotnet run
  493  sudo sh -c 'echo "192.168.0.20  DESKTOP-8VS6SD2" >> /etc/hosts'
  494  dotnet build
  495  dotnet run
  496  dotnet build
  497  dotnet run
  498  dotnet build
  499  dotnet run
  500  date
  501  sudo timedatectl set-timezone Asia/Seoul
  502  date
  503  dotnet run
  504  rm -rf pki/own/certs/OpcTestClient.pfx
  505  rm -rf pki/own/private/OpcTestClient.pfx
  506  dotnet run
  507  ls -l pki/own/certs/OpcTestClient.pfx
  508  dotnet run
  509  openssl req -x509 -newkey rsa:2048 -keyout key.pem -out cert.pem -days 3650 -nodes -subj "/CN=OpcTestClient/DC=dbsvr"
  510  openssl pkcs12 -export -out pki/own/certs/OpcTestClient.pfx -inkey key.pem -in cert.pem -passout pass:
  511  rm key.pem cert.pem
  512  ls -l pki/own/certs/OpcTestClient.pfx
  513  dotnet run
  514  dotnet build
  515  dotnet run
  516  ls
  517  pacer
  518  sudo shutdwon now
  519  sudo shutdown now
  520  dotnet run
  521  dotnet clean
  522  dotnet build
  523  dotnet run
  524  dotnet clean
  525  dotnet build
  526  dotnet run
  527  dotnet build
  528  dotnet run
  529  dotnet build
  530  dotnet run
  531  dotnet build
  532  dotnet run
  533  dotnet clean
  534  dotnet build
  535  dotnet run
  536  dotnet build
  537  dotnet run
  538  dotnet build
  539  dotnet run
  540  hostname
  541  dbsvr
  542  rm -rf pki/own/certs/OpcTestClient.pfx
  543  dotnet run
  544  hostname -I
  545  date
  546  dotnet build
  547  dotnet run
  548  rm -rf pki/own/certs/OpcTestClient.pfx
  549  dotnet build
  550  dotnet run
  551  dotnet build
  552  dotnet run
  553  sudo shutdown now
  554  dotnet run
  555  dotnet build
  556  dotnet run
  557  ping 192.168.0.182
  558  dotnet run
  559  dotnet build
  560  dotnet run
  561  dotnet build
  562  dotnet run
  563  dotnet build
  564  dotnet run
  565  dotnet build
  566  dotnet run
  567  cd ..
  568  git add .
  569  git commit -m "TAG 1 개 읽기 성공!"
  570  git push -u orgin main
  571  git remote -v
  572  git config --list
  573  git push -u orgin main
  574  git branch
  575  git push -u origin main
  576  cd OpcConnectionTest
  577  ls
  578  dotnet run
  579  sudo systemctl status postgresql
  580  psql --version
  581  sudo -u postgres psql
  582  ls
  583  dotnet add package Npgsql
  584  dotnet build
  585  dotnet run
  586  dotnet build
  587  dotnet run
  588  # DB 접속
  589  sudo -u postgres psql -d opcdb
  590  # 테이블 구조 확인
  591  \d opc_history
  592  dotnet run
  593  sudo -u postgres psql -d opcdb -c "SELECT * FROM opc_history ORDER BY id DESC;"
  594  dotnet run
  595  sudo -u postgres psql -d opcdb -c "SELECT * FROM opc_history ORDER BY id DESC;"
  596  dotnet run
  597  sudo -u postgres psql -d opcdb -c "SELECT * FROM opc_history ORDER BY id DESC;"
  598  ls
  599  cd ..
  600  git add .
  601  git commit -m "태그1개읽어서 DB INSERT 5회 성공!"
  602  git push -u origin main
  603  dotnet clean
  604  dotnet build
  605  cd OpcConnectionTest
  606  ls
  607  dotnet clean
  608  dotnet build
  609  dotnet list package --outdated
  610  # 1. 기존에 꼬인 패키지들 최신 안정 버전으로 강제 업데이트
  611  dotnet add package Opc.Ua.Client
  612  dotnet add package Opc.Ua.Core
  613  dotnet add package Opc.Ua.Configuration
  614  # 2. 캐시 정리 및 다시 로드
  615  dotnet restore
  616  dotnet build
  617  dotnet run
  618  dotnet build
  619  dotnet run
  620  dotnet build
  621  dotnet run
  622  cd ..
  623  mkdir OpcPksPlatform
  624  cd OpcPksPlatform
  625  cd ..
  626  # 1. 솔루션 폴더 생성 및 이동
  627  New-Item -ItemType Directory -Name OpcPksPlatform
  628  cd OpcPksPlatform
  629  # 2. 솔루션 파일 생성
  630  dotnet new sln -n OpcPksPlatform
  631  # 3. 프로젝트 생성 (Core, Collector, Web)
  632  dotnet new classlib -n OpcPks.Core             # 공통 라이브러리
  633  dotnet new console -n OpcPks.Collector        # 수집기 (Ubuntu용)
  634  dotnet new mvc -n OpcPks.Web                 # 웹 서버 (엔지니어링 화면)
  635  # 4. 솔루션에 프로젝트 등록
  636  dotnet sln add OpcPks.Core/OpcPks.Core.csproj
  637  dotnet sln add OpcPks.Collector/OpcPks.Collector.csproj
  638  dotnet sln add OpcPks.Web/OpcPks.Web.csproj
  639  # 5. 프로젝트 간 참조(Dependency) 설정
  640  # Collector와 Web이 Core를 참조하게 함
  641  dotnet add OpcPks.Collector/OpcPks.Collector.csproj reference OpcPks.Core/OpcPks.Core.csproj
  642  dotnet add OpcPks.Web/OpcPks.Web.csproj reference OpcPks.Core/OpcPks.Core.csproj
  643  # 6. 필수 NuGet 패키지 추가 (기존 csproj 기반)
  644  # Core: DB 및 공통 모델용
  645  dotnet add OpcPks.Core/OpcPks.Core.csproj package Npgsql
  646  dotnet add OpcPks.Core/OpcPks.Core.csproj package OPCFoundation.NetStandard.Opc.Ua
  647  # Collector: OPC UA 클라이언트용
  648  dotnet add OpcPks.Collector/OpcPks.Collector.csproj package OPCFoundation.NetStandard.Opc.Ua.Client
  649  # 7. 데이터 및 로그 폴더 생성
  650  New-Item -ItemType Directory -Path "data"
  651  New-Item -ItemType Directory -Path "logs"
  652  Write-Host "✅ OpcPksPlatform 솔루션 빌드 완료!" -ForegroundColor Green
  653  dotnet build
  654  ls
  655  cd OpcPks.Core.Data
  656  cd OpcPks.Core
  657  ls
  658  cd OpcPks.Collector
  659  ls
  660  cd OpcPksPlatform
  661  ls
  662  dotnet build
  663  dotnet clean
  664  cd OpcPks.Collector
  665  ls
  666  psql -U pacer -d opcdb
  667  psql -U postgres -d opcdb
  668  sudo -u postgres psql
  669  psql -U pacer -d opcdb
  670  dotnet run
  671  sudo -u postgres psql
  672  dotnet run
  673  sudo -U pacer psql
  674  psql -U pacer -d opcdb
  675  # 1. 웹 프로젝트 폴더로 이동
  676  cd ~/projects/OpcPksPlatform/OpcPks.Web
  677  # 2. 프로젝트 빌드 및 실행
  678  dotnet run
  679  psql -U pacer -d opcdb
  680  cd ..
  681  ls
  682  cd OpcPks.Core
  683  ls
  684  cd Data
  685  ls
  686  cd..
  687  cd ..
  688  ls
  689  cd OpcPks.Collector
  690  ls
  691  dotnet run
  692  cd ..
  693  psql -U pacer -d opcdb
  694  ls
  695  cd OpcPks.Web
  696  dontnet run
  697  dotnet run
  698  cd ..
  699  ls
  700  psql -U pacer -d opcdb
  701  dotnet add package OPCFoundation.NetStandard.Opc.Ua.Client
  702  find . -name "*.csproj"
  703  # 1. 수집기 프로젝트에 설치 (실제 통신 담당)
  704  dotnet add OpcPks.Collector/OpcPks.Collector.csproj package OPCFoundation.NetStandard.Opc.Ua.Client
  705  # 2. 웹 프로젝트에 설치 (UI에서 노드 정보 처리용)
  706  dotnet add OpcPks.Web/OpcPks.Web.csproj package OPCFoundation.NetStandard.Opc.Ua.Client
  707  dotnet build
  708  # Core 프로젝트 폴더로 이동하거나 경로를 지정해서 설치
  709  dotnet add OpcPks.Core/OpcPks.Core.csproj package Npgsql
  710  dotnet build
  711  # Core 프로젝트 버전 조정
  712  dotnet add OpcPks.Core/OpcPks.Core.csproj package Npgsql --version 8.0.4
  713  # Web 프로젝트 버전 조정
  714  dotnet add OpcPks.Web/OpcPks.Web.csproj package Npgsql --version 8.0.4
  715  # Collector 프로젝트 버전 조정
  716  dotnet add OpcPks.Collector/OpcPks.Collector.csproj package Npgsql --version 8.0.4
  717  dotnet build
  718  cd ~/projects/OpcPksPlatform/OpcPks.Web
  719  dotnet run
  720  # 1. 뷰 폴더 생성
  721  mkdir -p ~/projects/OpcPksPlatform/OpcPks.Web/Views/Home
  722  mkdir -p ~/projects/OpcPksPlatform/OpcPks.Web/Views/Engineering
  723  mkdir -p ~/projects/OpcPksPlatform/OpcPks.Web/Views/Shared
  724  # 2. 파일 이동 (선생님의 Index.cshtml을 Engineering 폴더로)
  725  # 만약 파일이 다른 곳에 있다면 Engineering 폴더로 옮깁니다.
  726  mv ~/projects/OpcPksPlatform/OpcPks.Web/Views/Index.cshtml ~/projects/OpcPksPlatform/OpcPks.Web/Views/Engineering/Index.cshtml 2>/dev/null
  727  cd ..
  728  # tree가 설치되어 있지 않다면 설치 (Fedora 기준)
  729  sudo dnf install -y tree
  730  # 프로젝트 구조 출력 (bin, obj, .git 등 불필요한 폴더는 제외하고 출력)
  731  tree -I "bin|obj|.git|.vs"
  732  # tree 설치 후 출력
  733  sudo apt update && sudo apt install -y tree
  734  tree -I "bin|obj|.git|.vs"
  735  # 컨트롤러 파일 이름의 공백 제거
  736  mv "~/projects/OpcPksPlatform/OpcPks.Web/Controllers/Engineering Controller.cs" "~/projects/OpcPksPlatform/OpcPks.Web/Controllers/EngineeringController.cs"
  737  # PostgreSQL 서비스 계정이 폴더를 읽을 수 있도록 권한 부여
  738  sudo chmod 755 /home/pacer/projects/OpcPksPlatform/OpcPks.Core/Data
  739  sudo chmod 644 /home/pacer/projects/OpcPksPlatform/OpcPks.Core/Data/Honeywell_FullMap.csv
  740  cd ~/projects/OpcPksPlatform
  741  dotnet build
  742  cd OpcPks.Web
  743  dotnet run
  744  # 기존 Index.cshtml을 TagExplorer.cshtml로 이름 변경
  745  mv ~/projects/OpcPksPlatform/OpcPks.Web/Views/Engineering/Index.cshtml ~/projects/OpcPksPlatform/OpcPks.Web/Views/Engineering/TagExplorer.cshtml
  746  cd ..
  747  dotnet run
  748  cd ~/projects/OpcPksPlatform/OpcPks.Web
  749  dotnet run
  750  cd ~/projects/OpcPksPlatform
  751  dotnet clean
  752  dotnet build
  753  cd ~/projects/OpcPksPlatform/OpcPks.Web
  754  cd ..
  755  dotnet build
  756  cd ~/projects/OpcPksPlatform/OpcPks.Web
  757  dotnet run
  758  curl -X POST http://localhost:5000/Engineering/RunCrawler
  759  ls
  760  cd OpcPksPlatform
  761  ls
  762  cd OpcPks.Web
  763  curl -X POST http://localhost:5000/Engineering/RunCrawler
  764  fuser -k 5000/tcp
  765  cd ..
  766  dotnet build
  767  cd ~/projects/OpcPksPlatform
  768  find . -maxdepth 3 -not -path '*/.*'
  769  # 1. Core 프로젝트 안에 Services 폴더 생성 (이미 있다면 무시)
  770  mkdir -p ~/projects/OpcPksPlatform/OpcPks.Core/Services
  771  # 2. 최상위에 있던 파일들을 정위치로 이동
  772  mv ~/projects/OpcPksPlatform/Services/HoneywellCrawler.cs ~/projects/OpcPksPlatform/OpcPks.Core/Services/
  773  mv ~/projects/OpcPksPlatform/OpcPks.Core/OpcSessionManager.cs ~/projects/OpcPksPlatform/OpcPks.Core/Services/
  774  # 3. 빈 폴더 삭제
  775  rmdir ~/projects/OpcPksPlatform/Services
  776  cd ~/projects/OpcPksPlatform
  777  dotnet build
  778  # 1. Models 폴더 생성
  779  mkdir -p ~/projects/OpcPksPlatform/OpcPks.Core/Models
  780  # 2. 표준 데이터 모델 파일 생성
  781  cat <<EOF > ~/projects/OpcPksPlatform/OpcPks.Core/Models/TagMaster.cs
  782  namespace OpcPks.Core.Models;
  783  public class TagMaster
  784  {
  785      public string TagName { get; set; } = string.Empty;
  786      public string NodeId { get; set; } = string.Empty;
  787      public string Description { get; set; } = string.Empty;
  788      public string DataType { get; set; } = string.Empty;
  789      public string Level { get; set; } = string.Empty;
  790  }
  791  EOF
  792  cd ~/projects/OpcPksPlatform
  793  tree -L 3 -I "obj|bin|.*"
  794  cd ~/projects/OpcPksPlatform
  795  dotnet build
  796  cat <<EOF > ~/projects/OpcPksPlatform/OpcPks.Core/Models/TagMaster.cs
  797  namespace OpcPks.Core.Models;
  798  public class TagMaster
  799  {
  800      public string TagName { get; set; } = string.Empty;
  801      public string FullNodeId { get; set; } = string.Empty; // NodeId 대신 크롤러가 찾는 이름
  802      public string Description { get; set; } = string.Empty;
  803      public string DataType { get; set; } = string.Empty;
  804      public string NodeClass { get; set; } = string.Empty; // 추가
  805      public int Level { get; set; } // string에서 int로 변경 (크롤러 연산용)
  806  }
  807  EOF
  808  dotnet build
  809  cd ~/projects/OpcPksPlatform
  810  dotnet build
  811  cd ~/projects/OpcPksPlatform
  812  dotnet build
  813  # Ubuntu Server 터미널에서 실행
  814  ping 192.168.0.20 -c 4
  815  cd ~/projects/OpcPksPlatform/OpcPks.Web
  816  dotnet run --urls "http://0.0.0.0:5000"
  817  hostname -I
  818  dotnet run --urls "http://0.0.0.0:5000"
  819  cd ..
  820  dotnet build
  821  ls
  822  cd OpcPks.Web
  823  ls
  824  dotnet build
  825  dotnet run --urls "http://0.0.0.0:5000
  826  dotnet run --urls "http://0.0.0.0:5000"
  827  tree -L 3 -I "obj|bin|.*"
  828  dotnet run
  829  ls
  830  sudo shutdown now
  831  tree -L 3 -I "obj|bin|.*"
  832  cd OpcPks.Web
  833  cd OpcPksPlatform
  834  ls
  835  cd OpcPks.Web
  836  ls
  837  dotnet run
  838  cd ..
  839  dotnet build
  840  cd ..cd \
  841  cd \
  842  cd /
  843  ls
  844  ls -a
  845  mkdir -p .config/OPC Foundation/CertificateStores/MachineDefault/certs/
  846  sudo mkdir -p .config/OPC Foundation/CertificatesStores/MachineDefault/certs
  847  sudo mkdir -p .config/OPC Foundation/CertificatesStores/MachineDefault/private
  848  ls
  849  ls -a
  850  cd .config
  851  ls
  852  cd OPC
  853  ls
  854  cd ..
  855  rmdir OPC
  856  sudo rmdir OPC
  857  ls
  858  sudo mkdir -p "OPC Foundation"
  859  ls
  860  sudo mkdir -p /CertificateStores/MachineDefault/certs/
  861  ls
  862  sudo mkdir -p /CertificateStores/MachineDefault/privates/
  863  ls
  864  cd OPC Foundation
  865  cd "OPC Foundation"
  866  ls
  867  sudo mkdir -p /CertificateStores
  868  cd CertificateStores
  869  ls
  870  sudo mkdir -p CertificateStores/MachineDefault/certs
  871  ls
  872  cd CertificateStores
  873  ls
  874  cd MachineDefault
  875  ls
  876  sudo mkdir -p private
  877  ls
  878  # Data 폴더로 이동 (경로는 실제 환경에 맞춰 확인해 주세요)
  879  mkdir -p ~/projects/OpcPksPlatform/OpcPks.Core/Data/pki
  880  # 이전 프로그램의 pki 폴더 내용을 통째로 복사 (예시 경로입니다)
  881  cp -r ~/이전프로그램폴더/pki/* ~/projects/OpcPksPlatform/OpcPks.Core/Data/pki/
  882  # 권한 부여 (우분투에서 읽고 쓸 수 있게)
  883  chmod -R 755 ~/projects/OpcPksPlatform/OpcPks.Core/Data/pki
  884  chmod -R 755 /home/pacer/projects/OpcPksPlatform/OpcPks.Core/Data/pki
  885  cd /
  886  ls
  887  cd Foundation
  888  ls
  889  sudo rmdir -p Foundation
  890  cd ..
  891  sudo rmdir -p Foundation
  892  ls
  893  cd home
  894  ls
  895  cd pacer
  896  ls
  897  cd projects
  898  ls
  899  cd OpcPksPlatform
  900  ls
  901  dotnet build
  902  ls
  903  cd OpcPks.Web
  904  ls
  905  dotnet run
  906  ls -R /home/pacer/projects/OpcPksPlatform/OpcPks.Core/Data/pki
  907  ls -ahlR /home/pacer/projects/OpcPksPlatform/OpcPks.Core/Data/pki
  908  mv /home/pacer/projects/OpcPksPlatform/OpcPks.Core/Data/pki/own/certs/OpcTestClient.pfx /home/pacer/projects/OpcPksPlatform/OpcPks.Core/Data/pki/own/private/
  909  chmod -R 777 /home/pacer/projects/OpcPksPlatform/OpcPks.Core/Data/pki/own
  910  dotnet run
  911  sudo shutdown now
  912  cd OpcPksPlatform
  913  OpcPks.View
  914  cd OpcPks.Web
  915  ls
  916  dotnet run
  917  cd ..
  918  ls
  919  cd OpcPks.Core
  920  ls
  921  cd Data
  922  ls
  923  cd pki
  924  ls
  925  openssl req -x509 -new -nodes -keyout private.key -sha256 -days 365 -out certificate.crt -config openssl.cnf
  926  cd /
  927  ls
  928  ls -a -r *.key
  929  find . -name *key
  930  sudo find . *.crt
  931  openssl req -x509 -nodes -days 3650 -newkey rsa:2048 -keyout myopc.key -out myopc.crt
  932  sudo openssl req -x509 -nodes -days 3650 -newkey rsa:2048 -keyout 8845hs.key -out 8845hs.crt
  933  ls
  934  sudo cp 8845hs.* Projects\OpcPksPlatform\OpcPks.Core\Data
  935  sudo cp 8845hs.* Projects\OpcPksPlatform\OpcPks.Core\Data\pki\own
  936  cd ~/OpcPksPlatform/OpcPks.Core
  937  cd ~/Projects/OpcPksPlatform/OpcPks.Core/Data/pki/own
  938  ls
  939  cd /
  940  ls
  941  cp 8845hs.* ~/projectOpcPksPlatform/OpcPks.Core/Data/pki/
  942  cp 8845hs.* ~/projectOpcPksPlatform/OpcPks.Core/Data/pki
  943  cp 8845hs.* ~/projects/OpcPksPlatform/OpcPks.Core/Data/pki/
  944  sudo chown -R pacer 8845hs.*
  945  cp 8845hs.* ~/projects/OpcPksPlatform/OpcPks.Core/Data/pki/
  946  ls
  947  cd ~/project/OpcPksPlatform/OpcPks.Core/Data/pki/
  948  cd ~/projects/OpcPksPlatform/OpcPks.Core/Data/pki/
  949  ls
  950  cp 8845hs.crt /own
  951  cd ..
  952  cd OpcPks.Web
  953  ls
  954  dotnet run
  955  sudo reboot now
  956  cd OpcPks.Web
  957  ls
  958  dotnet run
  959  tree -L 3 -I "obj|bin|.*"H
  960  cd ..
  961  dotnet build
  962  cd OpcPks.Web
  963  ls
  964  dotnet run
  965  tree -L 3 -I "obj|bin|.*"H
  966  # pfx 파일을 private 폴더로 이동 (이미 하셨다면 스킵하셔도 됩니다)
  967  mv /home/pacer/projects/OpcPksPlatform/OpcPks.Core/Data/pki/own/certs/OpcTestClient.pfx /home/pacer/projects/OpcPksPlatform/OpcPks.Core/Data/pki/own/private/
  968  # 만약 해당 pfx에 대한 공개 인증서(.der)가 없다면 폴더 권한을 완전히 열어줍니다. 
  969  # 그래야 프로그램이 스스로 .der 파일을 추출해서 own/certs에 저장할 수 있습니다.
  970  chmod -R 777 /home/pacer/projects/OpcPksPlatform/OpcPks.Core/Data/pki/own
  971  dotnet run
  972  cd ..
  973  dotnet build
  974  cd OpcPks.Web
  975  dotnet run
  976  cd ..
  977  dotnet build
  978  cd OpcPks.WEb
  979  cd OpcPks.Web
  980  dotnet run
  981  cd ..
  982  dotnet build
  983  cd OpcPks.Web
  984  dotnet run
  985  dotnet run --urls "http://0.0.0.0:5000
  986  :
  987  dotnet run --urls "http://0.0.0.0:5000"
  988  dotnet run
  989  # 5000번 포트 허용
  990  sudo ufw allow 5000/tcp
  991  # 방화벽 상태 확인 (5000번이 ALLOW로 떠야 함)
  992  sudo ufw status
  993  dotnet run --urls "http://0.0.0.0:5000"
  994  ping 192.168.0.20
  995  nc -zv 192.168.0.20 4840
  996  openssl pkcs12 -in /home/pacer/projects/OpcPksPlatform/OpcPks.Core/Data/pki/own/private/OpcTestClient.pfx -nokeys -info | grep URI
  997  openssl pkcs12 -in /home/pacer/projects/OpcPksPlatform/OpcPks.Core/Data/pki/own/private/OpcTestClient.pfx -nokeys -clcerts | openssl x509 -text -noout | grep -A 1 "Subject Alternative Name"
  998  cd OpcPksPlatform
  999  ls
 1000  dotnet build
 1001  cd OpcPks.Web
 1002  ls
 1003  # 1. 포트 개방
 1004  sudo ufw allow 5000/tcp
 1005  # 2. 모든 인터페이스 바인딩 실행
 1006  dotnet run --urls "http://0.0.0.0:5000"
 1007  sudo nano /etc/hosts
 1008  ip addr
 1009  cd ..
 1010  ls
 1011  dotnet build
 1012  cd OpcPks.Web
 1013  ls
 1014  dotnet run
 1015  cd ..
 1016  dotnet build
 1017  cd OpcPks.Web
 1018  dotnet run
 1019  sudo dotnet run
 1020  nc -zv 192.168.0.20 4840
 1021  telnet 192.168.0.20 4840
 1022  nc -zv -w 5 192.168.0.20 4840
 1023  dotnet run
 1024  cd ..
 1025  dotnet build
 1026  cd OpcPks.Web
 1027  ls
 1028  dotnet run
 1029  head -n 10 /home/pacer/projects/OpcPksPlatform/OpcPks.Core/Data/Honeywell_FullMap.csv
 1030  sudo dotnet run --project OpcPks.Web --urls "http://0.0.0.0:5000"
 1031  cd ..
 1032  sudo dotnet run --project OpcPks.Web --urls "http://0.0.0.0:5000"
 1033  dotnet build
 1034  cd OpcPks.Web
 1035  sudo dotnet run --urls "http://0.0.0.0:5000"
 1036  dotnet list reference
 1037  cd OpcPks.Web
 1038  dotnet run --urls "http://192.168.0.5:5000"
 1039  cd ..
 1040  ls
 1041  history > myhistory.txt
