免sudo安装Ollama

To install Ollama without using sudo, you can follow these steps to set it up in your user space. This approach allows you to avoid requiring administrative privileges, making it suitable for shared environments or systems where you do not have root access.

Installation Steps

  1. Download the Ollama Binary
    Use curl to download the Ollama binary directly to your home directory or a preferred location where you have write access:

    curl -L https://ollama.com/download/ollama-linux-amd64.tgz -o ollama-linux-amd64.tgz
    
  2. Create a Local Directory
    Create a directory in your home folder to store the Ollama files. This example uses ~/.local, but you can choose any directory where you have write permissions:

    mkdir -p ~/.local
    
  3. Extract the Downloaded File
    Extract the downloaded .tgz file into the local directory:

    tar -C ~/.local -xzf ollama-linux-amd64.tgz
    
  4. Update Your PATH
    To run Ollama from anywhere in your terminal, add the local binary directory to your PATH. You can do this by adding the following line to your shell configuration file (like ~/.bashrc or ~/.bash_profile):

    export PATH="$HOME/.local:$PATH"
    

    After editing the file, make sure to source it to apply the changes:

    source ~/.bashrc  # or source ~/.bash_profile
    
  5. Run Ollama
    Now you should be able to run Ollama directly from the command line:

    ollama serve &
    
  6. Verify Installation
    Check if Ollama is running correctly by executing:

    ollama --version
    

Additional Notes

  • If you encounter any issues with running models, ensure that your environment variables are set correctly, particularly LD_LIBRARY_PATH, if required by any dependencies.
  • For users interested in package management without root access, consider using tools like Nix, which allow for easy installation and management of packages in user space without needing sudo privileges[1][2].

By following these steps, you can successfully install and run Ollama on your Linux machine without needing administrative rights.

Citations:
[1] https://github.com/ollama/ollama/issues/7421
[2] https://hostkey.com/documentation/technical/gpu/ollama/
[3] https://github.com/ollama/ollama/issues/2111
[4] https://www.hostinger.com/tutorials/how-to-install-ollama
[5] https://itsfoss.com/ollama-setup-linux/

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值