mkdir-p/opt/servers: No such file or directory
时间: 2024-05-12 07:14:18 浏览: 70
这个错误提示意味着你试图在 `/opt/servers` 目录下创建文件夹,但该目录并不存在。你需要先创建这个目录,然后再尝试创建子目录。你可以通过以下命令来创建 `/opt/servers` 目录:
```
sudo mkdir -p /opt/servers
```
这将使用超级用户权限创建 `/opt/servers` 目录及其所有父级目录(如果它们不存在)。
相关问题
为什么会这样[user_mongo@nosql01 replicaset]$ cd /opt [user_mongo@nosql01 opt]$ ll total 0 drwxr-xr-x. 3 root root 25 Mar 16 17:08 servers drwxr-xr-x. 2 root root 51 Mar 16 17:10 software [user_mongo@nosql01 opt]$ tar -zxvf /opt/software/mongodb-linux-x86_64-rhel70-4.4.12.tgz -C /opt/servers/mongodb_demo/replicaset/ mongodb-linux-x86_64-rhel70-4.4.12/LICENSE-Community.txt tar: mongodb-linux-x86_64-rhel70-4.4.12: Cannot mkdir: Permission denied tar: mongodb-linux-x86_64-rhel70-4.4.12/LICENSE-Community.txt: Cannot open: No such file or directory mongodb-linux-x86_64-rhel70-4.4.12/MPL-2 tar: mongodb-linux-x86_64-rhel70-4.4.12: Cannot mkdir: Permission denied tar: mongodb-linux-x86_64-rhel70-4.4.12/MPL-2: Cannot open: No such file or directory mongodb-linux-x86_64-rhel70-4.4.12/README tar: mongodb-linux-x86_64-rhel70-4.4.12: Cannot mkdir: Permission denied tar: mongodb-linux-x86_64-rhel70-4.4.12/README: Cannot open: No such file or directory mongodb-linux-x86_64-rhel70-4.4.12/THIRD-PARTY-NOTICES tar: mongodb-linux-x86_64-rhel70-4.4.12: Cannot mkdir: Permission denied tar: mongodb-linux-x86_64-rhel70-4.4.12/THIRD-PARTY-NOTICES: Cannot open: No such file or directory mongodb-linux-x86_64-rhel70-4.4.12/bin/install_compass tar: mongodb-linux-x86_64-rhel70-4.4.12: Cannot mkdir: Permission denied tar: mongodb-linux-x86_64-rhel70-4.4.12/bin/install_compass: Cannot open: No such file or directory mongodb-linux-x86_64-rhel70-4.4.12/bin/mongo tar: mongodb-linux-x86_64-rhel70-4.4.12: Cannot mkdir: Permission denied tar: mongodb-linux-x86_64-rhel70-4.4.12/bin/mongo: Cannot open: No such file or directory mongodb-linux-x86_64-rhel70-4.4.12/bin/mongod tar: mongodb-linux-x86_64-rhel70-4.4.12: Cannot mkdir: Permission denied tar: mongodb-linux-x86_64-rhel70-4.4.12/bin/mongod: Cannot open: No such file or directory mongodb-linux-x86_64-rhel70-4.4.12/bin/mongos tar: mongodb-linux-x86_64-rhel70-4.4.12: Cannot mkdir: Permission denied tar: mongodb-linux-x86_64-rhel70-4.4.12/bin/mongos: Cannot open: No such file or directory tar: Exiting with failure status due to previous errors [user_mongo@nosql01 opt]$ tar -zcvf /opt/software/mongodb-linux-x86_64-rhel70-4.4.12.tgz -C /opt/servers/mongodb_demo/replicaset/ tar: Cowardly refusing to create an empty archive Try `tar --help' or `tar --usage' for more information.
根据你提供的信息,出现这种情况可能是因为你没有足够的权限在目标文件夹中创建文件。可以尝试以下解决方法:
1.使用sudo命令运行tar命令,以管理员权限运行。例如:sudo tar -zxvf /opt/software/mongodb-linux-x86_64-rhel70-4.4.12.tgz -C /opt/servers/mongodb_demo/replicaset/
2.检查目标文件夹/opt/servers/mongodb_demo/replicaset/的权限是否正确,可以使用ls -l命令查看。如果权限不足,可以使用chmod命令更改目标文件夹的权限。例如:sudo chmod 755 /opt/servers/mongodb_demo/replicaset/
希望以上解决方法能够帮助到你。
mkdir: cannot create directory ‘/opt/sks/vp1’: No such file or directory
This error message suggests that the directory '/opt/sks/vp1' does not exist on your system. To create this directory, you can use the following command:
```
sudo mkdir -p /opt/sks/vp1
```
This will create the directory '/opt/sks/vp1' along with any necessary parent directories that may be missing. The 'sudo' command is used to gain administrative privileges, which may be required to create directories in certain locations on the system.
阅读全文