IT 관련/Linux

cargo 이용해서 빌드하는 법 (온라인망 -> 폐쇄망)

상어 우두머리 2025. 10. 20. 09:05
728x90

tar 파일 압축해제

[root@ ~]# tar -zxvf pgcat-pgcat-0.2.5.tar.gz

 

cargo install

[root@~ yum.repos.d]# yum install cargo
Updating Subscription Management repositories.
Unable to read consumer identity

This system is not registered with an entitlement server. You can use

Repository epel-modular is listed more than once in the configuration
Repository epel-modular-debuginfo is listed more than once in the conf
Repository epel-modular-source is listed more than once in the configu
Last metadata expiration check: 0:00:27 ago on Thu 16 Oct 2025 04:10:4
Dependencies resolved.
======================================================================
 Package                Architecture  Version
======================================================================
Installing:
 cargo                  x86_64        1.84.1-2.module_el8.10.0+3993+ad
Installing dependencies:
 llvm-libs              x86_64        19.1.7-2.module_el8.10.0+3990+33
 rust                   x86_64        1.84.1-2.module_el8.10.0+3993+ad
 rust-std-static        x86_64        1.84.1-2.module_el8.10.0+3993+ad
Enabling module streams:
 llvm-toolset                         rhel8
 rust-toolset                         rhel8

Transaction Summary
======================================================================
Install  4 Packages

Total download size: 108 M
Installed size: 381 M
Is this ok [y/N]: y
Downloading Packages:
(1/4): llvm-libs-19.1.7-2.module_el8.10.0+3990+33d0d926.x86_64.rpm
(2/4): cargo-1.84.1-2.module_el8.10.0+3993+adf09561.x86_64.rpm
(3/4): rust-1.84.1-2.module_el8.10.0+3993+adf09561.x86_64.rpm
(4/4): rust-std-static-1.84.1-2.module_el8.10.0+3993+adf09561.x86_64.r
----------------------------------------------------------------------
Total
AlmaLinux 8 - AppStream
Importing GPG key 0xC21AD6EA:
 Userid     : "AlmaLinux <packager@almalinux.org>"
 Fingerprint: E53C F5EF 91CE B0AD 1812 ECB8 51D6 647E C21A D6EA
 From       : https://repo.almalinux.org/almalinux/RPM-GPG-KEY-AlmaLin
Is this ok [y/N]: y
Key imported successfully
Importing GPG key 0xCED7258B:
 Userid     : "AlmaLinux OS 8 <packager@almalinux.org>"
 Fingerprint: BC5E DDCA DF50 2C07 7F15 8288 2AE8 1E8A CED7 258B
 From       : https://repo.almalinux.org/almalinux/RPM-GPG-KEY-AlmaLin
Is this ok [y/N]: y
Key imported successfully
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :
  Installing       : llvm-libs-19.1.7-2.module_el8.10.0+3990+33d0d926.
  Installing       : rust-std-static-1.84.1-2.module_el8.10.0+3993+adf
  Installing       : rust-1.84.1-2.module_el8.10.0+3993+adf09561.x86_6
  Installing       : cargo-1.84.1-2.module_el8.10.0+3993+adf09561.x86_
  Running scriptlet: cargo-1.84.1-2.module_el8.10.0+3993+adf09561.x86_
  Verifying        : cargo-1.84.1-2.module_el8.10.0+3993+adf09561.x86_
  Verifying        : llvm-libs-19.1.7-2.module_el8.10.0+3990+33d0d926.
  Verifying        : rust-1.84.1-2.module_el8.10.0+3993+adf09561.x86_6
  Verifying        : rust-std-static-1.84.1-2.module_el8.10.0+3993+adf
Installed products updated.

Installed:
  cargo-1.84.1-2.module_el8.10.0+3993+adf09561.x86_64  llvm-libs-19.1.
  rust-1.84.1-2.module_el8.10.0+3993+adf09561.x86_64   rust-std-static

Complete!

 

 

온라인 환경에서 필요한 파일 다운로드

[root@~ pgcat-pgcat-0.2.5]# cargo vendor --versioned-dirs --locked

 

그럼 vendor 라는 디렉토리에 파일이 모아짐

[root@~ pgcat-pgcat-0.2.5]# cd vendor/
[root@~ vendor]# ll
total 100

빌드된 폴더 압축

[root@~ tmp]# tar -zcvf pgcat-pgcat-0.2.5_test.tar.gz pgcat-pgcat-0.2.5

 

압축된 파일을 폐쇄망으로 옮겨서 사용

728x90