我正在尝试创建一个 shell 脚本来为我安装一系列的东西。 iMod 就是其中之一。我找到了 iMod 的自安装 shell 脚本,并在 bash 控制台上运行了以下命令:
export IMOD_VERSION=4.11.12
export CUDA_VERSION=10.1
wget https://bio3d.colorado.edu/imod/AMD64-RHEL5/imod_${IMOD_VERSION}_RHEL7-64_CUDA${CUDA_VERSION}.sh
sudo sh imod_${IMOD_VERSION}_RHEL7-64_CUDA${CUDA_VERSION}.sh
笔记
重新启动设备并断开连接并重新连接后问题仍然存在(通过 SSH,启动新终端)
安装输出
$ export IMOD_VERSION=4.11.12
$ export CUDA_VERSION=10.1
$ wget https://bio3d.colorado.edu/imod/AMD64-RHEL5/imod_${IMOD_VERSION}_RHEL7-64_CUDA${CUDA_VERSION}.sh
--2022-02-02 03:16:12-- https://bio3d.colorado.edu/imod/AMD64-RHEL5/imod_4.11.12_RHEL7-64_CUDA10.1.sh
Resolving bio3d.colorado.edu (bio3d.colorado.edu)... 128.138.72.88
Connecting to bio3d.colorado.edu (bio3d.colorado.edu)|128.138.72.88|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 205325213 (196M) [application/x-sh]
Saving to: ‘imod_4.11.12_RHEL7-64_CUDA10.1.sh.1’
100%[===================================================================================================================>] 205,325,213 5.60MB/s in 38s
2022-02-02 03:16:51 (5.21 MB/s) - ‘imod_4.11.12_RHEL7-64_CUDA10.1.sh.1’ saved [205325213/205325213]
$ sudo sh imod_4.11.12_RHEL7-64_CUDA10.1.sh
This script will install IMOD in /usr/local and rename
any previous version, or remove another copy of this version.
It will copy IMOD-linux.csh and IMOD-linux.sh to /etc/profile.d
You can add the option -h to see a full list of options
Enter Y if you want to proceed: y
Extracting imod_4.11.12_RHEL7-64_CUDA10.1.tar.gz ...
Extracting installIMOD
Checking system and package types
Saving the Plugins directory in the existing installation
Removing link to previous version but leaving previous version
Removing an existing copy of the same version...
Unpacking IMOD in /usr/local ...
Linking imod_4.11.12 to IMOD
Restoring the Plugins directory
Copying startup scripts to /etc/profile.d: IMOD-linux.csh IMOD-linux.sh
SELinux is enabled - Trying to change security context of libraries.
The installation of IMOD 4.11.12 is complete.
You may need to start a new terminal window for changes to take effect
If there are version-specific IMOD startup commands in individual user
startup files (.cshrc, .bashrc, .bash_profile) they should be changed
or removed.
Cleaning up imod_4.11.12_RHEL7-64_CUDA10.1.tar.gz, installIMOD, and IMODtempDir
答案1
我花了一些时间尝试重现您的问题。
库存 CentOS 7.9 最小。
然后:
export IMOD_VERSION=4.11.12
export CUDA_VERSION=10.1
wget https://bio3d.colorado.edu/imod/AMD64-RHEL5/imod_${IMOD_VERSION}_RHEL7-64_CUDA${CUDA_VERSION}.sh
sudo sh imod_${IMOD_VERSION}_RHEL7-64_CUDA${CUDA_VERSION}.sh
输出:
This script will install IMOD in /usr/local and rename
any previous version, or remove another copy of this version.
It will copy IMOD-linux.csh and IMOD-linux.sh to /etc/profile.d
You can add the option -h to see a full list of options
Enter Y if you want to proceed: Y
Extracting imod_4.11.12_RHEL7-64_CUDA10.1.tar.gz ...
Extracting installIMOD
Checking system and package types
Unpacking IMOD in /usr/local ...
Linking imod_4.11.12 to IMOD
Copying startup scripts to /etc/profile.d: IMOD-linux.csh IMOD-linux.sh
SELinux is enabled - Trying to change security context of libraries.
The installation of IMOD 4.11.12 is complete.
You may need to start a new terminal window for changes to take effect
If there are version-specific IMOD startup commands in individual user
startup files (.cshrc, .bashrc, .bash_profile) they should be changed
or removed.
Cleaning up imod_4.11.12_RHEL7-64_CUDA10.1.tar.gz, installIMOD, and IMODtempDir
安装脚本似乎在以下位置安装了软件/usr/local/IMOD
:
[test@centos7test ~]$ ll /usr/local/
total 0
<...>
lrwxrwxrwx. 1 root root 12 Feb 3 10:31 IMOD -> imod_4.11.12
drwxr-xr-x. 13 1095 111 286 Nov 19 12:32 imod_4.11.12
<...>
现在,注销并登录 shell 非常重要,因为它需要获取安装在的以下代码段/etc/profile.d/IMOD-linux.sh
:
<...>
export IMOD_DIR=${IMOD_DIR:=/usr/local/IMOD}
# Put the IMOD programs on the path
#
if ! echo ${PATH} | grep -q "$IMOD_DIR/bin" ; then
export PATH=$IMOD_DIR/bin:$PATH
fi
<...>
这反映在您当前的$PATH
环境变量中:
[test@centos7test ~]# echo $PATH
/usr/local/IMOD/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin
我现在能够成功找到并运行imod
和imodhelp
二进制文件:
[test@centos7test local]# whereis imod imodhelp
imod: /usr/local/imod_4.11.12/bin/imod
imodhelp: /usr/local/imod_4.11.12/bin/imodhelp
如果由于某种原因你的机器没有拾取下面的文件,/etc/profile.d/IMOD-linux.sh
你可以像这样强制运行它:
[test@centos7test ~]# source /etc/profile.d/IMOD-linux.sh