Home  >  Q&A  >  body text

ubuntu - 没有root权限的前提下,如何安装Cmake

具体情况是,在我的工作环境中,我的远程工作站是Ubuntu系统,并且我没有root权限。
作为一个普通用户,我在~/.bashrc中,添加了:

PATH=$PATH:~/bin

安装软件时,通常是安在~/bin/目录下,比如自己编译的Vim;一些比较大的“绿色”软件,则是把可执行文件,软连接到这里,比如Eclipse

但是,我不知道如何安装Cmake,及其依赖。我原先的方法,无法奏效。

PHP中文网PHP中文网2738 days ago814

reply all(3)I'll reply

  • 大家讲道理

    大家讲道理2017-04-22 09:01:00

    Linux software can be installed anywhere, as long as it can be found when used. You have set the environment variables, then cmake can be installed to $HOME路径下面. 你去下载cmake的源码, ./configure --help能看到有一个install path, just set this and it will be fine

    reply
    0
  • 阿神

    阿神2017-04-22 09:01:00

    I have never tried to install this kind of low-level application with a non-root account. The following process was obtained from Baidu. You can try it:

    1、进入到cmake解压后的文件夹;因为原来的机器上没有装过cmake,先运行命令  ./bootstrap;
    2、cmake的默认安装路径应该需要root权限;由于没有root权限,所以配置一下安装路径(安装在自己有权限的目录下),运行命令 ./configure --prefix=dir_xxx;
    3、make,编译得到可执行文件;
    4、make install,安装可执行文件到指定目录(dir_xxx);
    5、如果dir_xxx没有在shell的$PATH变量中,那么cd到home目录: cd ~;修改home目录下的.bashrc文件,在其中的$PATH变量中加入dir_xxx目录;这样在shell终端里直接敲cmake就行运行cmake了。

    Step 5: echo 'export PATH=dir_xxx:$PATH' >> ~/.bashrc
    source ~/.bashrc

    Then you should be able to compile the file through cmake.

    reply
    0
  • 阿神

    阿神2017-04-22 09:01:00

    In fact, even without root, if your account is in the sudo user group, that is enough.
    If you no longer have sudo permissions, then give up. Or you can try cross-compiling.

    reply
    0
  • Cancelreply