How to install VIM on Linux when I don't have root permissions?
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
-
Create local user path:
mkdir -p ~/usr/local
Downloaded latest version of
ncurses
from here: http://ftp.gnu.org/pub/gnu/ncurses/-
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
-
Clone
vim-repo
withgit clone https://github.com/vim/vim.git
-
Install vim with:
cd vim/src LDFLAGS=-L$HOME/usr/local/lib ./configure --prefix=$HOME/usr/local make make install
-
Set PATH with
export PATH=$PATH:$HOME/usr/local/bin
Related videos on Youtube
SpawnST
Updated on September 17, 2022Comments
-
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:
How can I solve this? Can I install it in another directory other than
/usr/local/bin/vim
? -
SpawnST almost 14 yearsDo I need to create a fold named
.local
or it's just a normal name? -
Ignacio Vazquez-Abrams almost 14 yearsIt is safest to create the destination directory yourself.
-
SpawnST almost 14 yearsI got a vim diretory like
/home/apache/.local/usr/local/share/vim/vim72
after finish the two steps.Anything wrong? -
Ignacio Vazquez-Abrams almost 14 yearsYou'll need to pass a different
--prefix
option toconfigure
as well then. -
SpawnST almost 14 yearsit would be greatly appreciated if you can write all steps down in the answer.
-
akira almost 14 years./configure --prefix=~/.local && make install
-
Renato Prado about 4 yearsAfter this step, I add my ~/local/bin to the PATH: export PATH="/home/youruser/.local/bin:$PATH"
-
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 almost 3 yearsthis 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