2

I am trying to install Glog 0.3.4 https://github.com/google/glog/releases on my machine even though I don't have sudo access. I ran the following commands:

./configure --prefix=/usr/local
make
make install

which results in the following error

$ make install
make[1]: Entering directory `/glog-0.3.4'
/bin/mkdir -p '/usr/local/lib'
/bin/bash ./libtool   --mode=install /usr/bin/install -c   libglog.la 
'/usr/local/lib'
libtool: install: /usr/bin/install -c .libs/libglog.so.0.0.0 
/usr/local/lib/libglog.so.0.0.0
/usr/bin/install: cannot create regular file 
'/usr/local/lib/libglog.so.0.0.0': Permission denied
make[1]: *** [install-libLTLIBRARIES] Error 1

How to overcome this error and finalize my installation? I don't have any sudo access to the machine. Thank you!

Crista23
  • 3,203
  • 9
  • 47
  • 60

1 Answers1

1

/usr/local is usually owned by root so without sudo you won't be able to write in it. Why not install it into your home directory instead?

Edit:

After talking about it I've realized I forgot about $HOME/.local/bin. This directory, if it exists is already likely in your PATH. So instead of installing to /usr/local/ you can use $HOME/.local/. Just make sure the executable ends up either in $HOME/.local/bin/ or symlinked there.

Original answer:

mkdir $HOME/.glog_install
./configure --prefix=$HOME/.glog_install
make
make install

Then you can just add the executable to your path: PATH=$PATH:~/.glog_install/path/to/bin

In fact if you plan to install multiple programs into your home directory, you may want to keep things a bit more organized. In this case I would create a single directory for all my user installed binaries in my home directory and symlink the installed binaries into it. Then you just have to add the one directory to your path. So:

#make bin directory in home
mkdir $HOME/bin

#add ~/bin to PATH
PATH=$PATH:$HOME/bin

#install first program somewhere in home
mkdir $HOME/.program_1_files
./configure --prefix=$HOME/.program_1_files
make
make install

#link program 1 executables to ~/bin
ln -s ~/.program_1_files/path/to/executable ~/bin/program1

mkdir $HOME/.program_2_files
#...same steps as above

After that running program1 on the command line would invoke the program (for your user.)

Community
  • 1
  • 1
DaveLak
  • 796
  • 9
  • 19