0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

【sudo不要】UbuntuにHomebrewをユーザー権限だけでインストールし、Siegeを導入する方法

0
Posted at

概要

  • sudo 権限が無くても Homebrew をホームディレクトリにインストール可能
  • 公式スクリプトではなく git clone 方式を使用
  • brew 経由で siege をインストールし、負荷テストができるようになる

【⚠️注意】42Tokyoのwebserveのテスト用


背景

通常の Homebrew インストールは /home/linuxbrew/.linuxbrew/ への書き込みが必要ですが sudoなし環境では権限不足で失敗します。

そこで今回は、Homebrew公式ドキュメントで紹介されている
代替インストール手順(unsupported method) を使います。


環境

  • Ubuntu 20.04 / 22.04 / WSL可
  • sudo権限なし
  • git / curl が利用可能

手順

1. Homebrew用ディレクトリを作成

mkdir -p $HOME/.homebrew

2. Homebrew本体を git clone

git clone https://github.com/Homebrew/brew $HOME/.homebrew/Homebrew

3. brew コマンドのパスを通す

mkdir -p $HOME/.homebrew/bin
ln -s $HOME/.homebrew/Homebrew/bin/brew $HOME/.homebrew/bin/brew

4. シェルに設定追加

Bash

echo 'export PATH="$HOME/.homebrew/bin:$PATH"' >> ~/.bashrc
echo 'eval "$($HOME/.homebrew/bin/brew shellenv)"' >> ~/.bashrc
source ~/.bashrc

Zsh

echo 'export PATH="$HOME/.homebrew/bin:$PATH"' >> ~/.zshrc
echo 'eval "$($HOME/.homebrew/bin/brew shellenv)"' >> ~/.zshrc
source ~/.zshrc

5. 動作確認

brew --version
brew doctor

Siegeをインストール

brew update
brew install siege

動作確認

siege --version

Siegeで負荷テストしてみる

siege -c 10 -t 30s https://example.com
  • -c 10 … 同時接続10
  • -t 30s … 30秒間負荷テスト

おすすめbrewパッケージ

brew install gcc       # Cコンパイラ
brew install make      # ビルド系
brew install tree      # 階層表示
brew install htop      # リソース監視
brew install valgrind  # メモリ解析

注意

  • Homebrew 側で サポート外 方式(build from sourceが多い)
  • パッケージのビルドに時間がかかる場合がある
  • ストレージをやや消費(数GB)

まとめ

内容 ポイント
sudoなしでbrew導入 $HOME/.homebrew へインストール
brew取得方法 git clone
負荷テストツール brew install siege

参考


最後に

「sudoが使えないLinux環境でもツールを導入したい」
という方の参考になれば嬉しいです!

質問や改善点があればコメントください 🙌

0
0
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
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?