How to install VIM on Linux when I don't have root permissions?

20,186

Solution 1

make install DESTDIR=~/.local, then make a symlink in ~/bin to ~/.local/bin/vim.

Solution 2

I often install things with ./configure --prefix=$HOME/.local && make && make install where I'm not root. That's the way to proceed.

This works with most software. Vim is in no way different here.

Note that in vim case, I actually configure with the following options (as well) --disable-perlinterp --enable-rubyinterp --enable-multibyte --enable-pythoninterp --with-features=huge as I like my version of Vim to be quite complete.

Solution 3

  1. Create local user path:

    mkdir -p ~/usr/local
    
  2. Downloaded latest version of ncurses from here: http://ftp.gnu.org/pub/gnu/ncurses/

  3. Install ncurses:

    cd <path_to_ncurses_downloaded_folder>
    tar -xzvf <ncurses>.tar.gz
    cd <ncurses_extracted_folder>
    ./configure --prefix=$HOME/usr/local
    make
    make install
    
  4. Clone vim-repo with

    git clone https://github.com/vim/vim.git
    
  5. Install vim with:

    cd vim/src
    LDFLAGS=-L$HOME/usr/local/lib ./configure --prefix=$HOME/usr/local
    make
    make install
    
  6. Set PATH with

    export PATH=$PATH:$HOME/usr/local/bin
    
Share:
20,186

Related videos on Youtube

SpawnST
Author by

SpawnST

Updated on September 17, 2022

Comments

  • SpawnST
    SpawnST over 1 year

    I've got some troubles when I try to install Vim on Linux while I don't have a root account. The error information is shown below:

    errorinfo

    How can I solve this? Can I install it in another directory other than /usr/local/bin/vim?

  • SpawnST
    SpawnST almost 14 years
    Do I need to create a fold named .local or it's just a normal name?
  • Ignacio Vazquez-Abrams
    Ignacio Vazquez-Abrams almost 14 years
    It is safest to create the destination directory yourself.
  • SpawnST
    SpawnST almost 14 years
    I got a vim diretory like /home/apache/.local/usr/local/share/vim/vim72 after finish the two steps.Anything wrong?
  • Ignacio Vazquez-Abrams
    Ignacio Vazquez-Abrams almost 14 years
    You'll need to pass a different --prefix option to configure as well then.
  • SpawnST
    SpawnST almost 14 years
    it would be greatly appreciated if you can write all steps down in the answer.
  • akira
    akira almost 14 years
    ./configure --prefix=~/.local && make install
  • Renato Prado
    Renato Prado about 4 years
    After this step, I add my ~/local/bin to the PATH: export PATH="/home/youruser/.local/bin:$PATH"
  • axolotl
    axolotl almost 3 years
    ./configure --prefix=$HOME/.local --enable-multibyte --enable-pythoninterp --with-features=huge --enable-python3interp --enable-fail-if-missing I omitted the parts about PERL and Ruby (as I don't have Ruby on the target machine)
  • axolotl
    axolotl almost 3 years
    this answer doesn't really work well with the standard convention of .local/bin and .local/share; instead making vim create its own hierarchy beyond that: .local/usr/loca/bin and so on. I would follow the answer by @luc-hermitte