2
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

オフライン環境にパッケージをインストールする

Posted at

オフライン環境にパッケージをインストールする

今後もやることがあるかもしれないのでメモ

0.概要

オフライン環境にパッケージをインストールしたい。

インターネットに繋がるオンライン環境があることが前提で、以下の手順を実施。

  1. オンライン環境でパッケージをダウンロード
  2. オフライン環境にパッケージを転送
  3. パッケージをインストール

1. オンライン環境でパッケージをダウンロード

yum installで --downloadonly オプションを指定。

--downloaddir オプションを指定すればダウンロード先を指定できるのだが、ここで指定し忘れたのでめんどくさいことに。。。

$ sudo yum install -y https://s3.amazonaws.com/ec2-downloads-windows/SSMAgent/latest/linux_amd64/amazon-ssm-agent.rpm --downloadonly
Loaded plugins: fastestmirror
amazon-ssm-agent.rpm                                                                                                                  |  31 MB  00:00:10
Examining /var/tmp/yum-root-oPlmKR/amazon-ssm-agent.rpm: amazon-ssm-agent-2.3.772.0-1.x86_64
Marking /var/tmp/yum-root-oPlmKR/amazon-ssm-agent.rpm to be installed
Resolving Dependencies
--> Running transaction check
---> Package amazon-ssm-agent.x86_64 0:2.3.772.0-1 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

=============================================================================================================================================================
 Package                                  Arch                           Version                             Repository                                 Size
=============================================================================================================================================================
Installing:
 amazon-ssm-agent                         x86_64                         2.3.772.0-1                         /amazon-ssm-agent                         120 M

Transaction Summary
=============================================================================================================================================================
Install  1 Package

Total size: 120 M
Installed size: 120 M
Background downloading packages, then exiting:
exiting because "Download Only" specified

/var/tmp/yum-root-oPlmKR というよくわからないところにだうんろーどされてしまったので、これをhomeに持ってくる。

ついでに所有者も変えておく

# cp amazon-ssm-agent.rpm /home/centos/
# chown centos /home/centos/amazon-ssm-agent.rpm

2. オフライン環境にパッケージを転送

scpコマンドで転送。

-i オプションで転送先にログインする鍵ファイルを指定。

$ scp -i ./.ssh/xxx.pem amazon-ssm-agent.rpm xx.xx.xx.xx(転送先のIP):~

3. パッケージをインストール

いつも通り yumでインストール

sudo つけ忘れて一度怒られた。。。

$ sudo yum install amazon-ssm-agent.rpm
Loaded plugins: fastestmirror
Examining amazon-ssm-agent.rpm: amazon-ssm-agent-2.3.772.0-1.x86_64
Marking amazon-ssm-agent.rpm to be installed
Resolving Dependencies
--> Running transaction check
---> Package amazon-ssm-agent.x86_64 0:2.3.772.0-1 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

=============================================================================================================================================================
 Package                                  Arch                           Version                             Repository                                 Size
=============================================================================================================================================================
Installing:
 amazon-ssm-agent                         x86_64                         2.3.772.0-1                         /amazon-ssm-agent                         120 M

Transaction Summary
=============================================================================================================================================================
Install  1 Package

Total size: 120 M
Installed size: 120 M
Is this ok [y/d/N]: y
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : amazon-ssm-agent-2.3.772.0-1.x86_64                                                                                                       1/1
Created symlink from /etc/systemd/system/multi-user.target.wants/amazon-ssm-agent.service to /etc/systemd/system/amazon-ssm-agent.service.
  Verifying  : amazon-ssm-agent-2.3.772.0-1.x86_64                                                                                                       1/1

Installed:
  amazon-ssm-agent.x86_64 0:2.3.772.0-1

Complete!

以上でインストールできた。

2
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?