mount

[root@host-192-0-11-183 isorepo]# more /etc/yum.repos.d/dvd.repo       //查看/etc/yum.repos.d/dvd.repo
/etc/yum.repos.d/dvd.repo: No such file or directory                                //发现没有这个文件
[root@host-192-0-11-183 isorepo]# touch /etc/yum.repos.d/dvd.repo      //使用touch命令创建这个文件dvd.repo
[root@host-192-0-11-183 isorepo]# vi /etc/yum.repos.d/dvd.repo            //用vi命令编辑该文件
[root@host-192-0-11-183 isorepo]#                                                                                                                                    [c7-media]                                                                                                                                                                                                      name=CGSL-$releasever - Media                                                                                                                                                                                                   baseurl=file:///isorepo/tmp                                                                                                                                                                                                     gpgcheck=0                                                                                                                                                                                                  enabled=1                                                                                                                                                                                                   gpgkey=file:///isorepo/tmp/RPM-GPG-KEY-CGSL-V5
[root@host-192-0-11-183 isorepo]#
[root@host-192-0-11-183 isorepo]#
[root@host-192-0-11-183 isorepo]#
[root@host-192-0-11-183 isorepo]# mount -o loop CGS-Linux-MAIN.V5.04.F1-x86_64.dvd.iso ./tmp        挂载点./tmp  
mount: mount point ./tmp does not exist                                                                                                                         挂载点不存在
[root@host-192-0-11-183 isorepo]# mkdir ./tmp                                                                                                           创建目录./tmp
[root@host-192-0-11-183 isorepo]# mount -o loop CGS-Linux-MAIN.V5.04.F1-x86_64.dvd.iso ./tmp      
mount: /dev/loop2 is write-protected, mounting read-only
[root@host-192-0-11-183 isorepo]# yum install git                                                                                                       安装git命令
Loaded plugins: fastestmirror
Repository c7-media is listed more than once in the configuration
file:///mnt/cdrom/repodata/repomd.xml: [Errno 14] curl#37 - "Couldn't open file /mnt/cdrom/repodata/repomd.xml"
Trying other mirror.
Loading mirror speeds from cached hostfile
Resolving Dependencies
--> Running transaction check
---> Package git.x86_64 0:1.8.3.1-12.el7_4 will be installed
--> Processing Dependency: perl-Git = 1.8.3.1-12.el7_4 for package: git-1.8.3.1-12.el7_4.x86_64
--> Processing Dependency: rsync for package: git-1.8.3.1-12.el7_4.x86_64
--> Processing Dependency: perl(Term::ReadKey) for package: git-1.8.3.1-12.el7_4.x86_64
--> Processing Dependency: perl(Git) for package: git-1.8.3.1-12.el7_4.x86_64
--> Processing Dependency: perl(Error) for package: git-1.8.3.1-12.el7_4.x86_64
--> Processing Dependency: libgnome-keyring.so.0()(64bit) for package: git-1.8.3.1-12.el7_4.x86_64
--> Running transaction check
---> Package libgnome-keyring.x86_64 0:3.12.0-1.el7 will be installed
---> Package perl-Error.noarch 1:0.17020-2.el7 will be installed
---> Package perl-Git.noarch 0:1.8.3.1-12.el7_4 will be installed
---> Package perl-TermReadKey.x86_64 0:2.30-20.el7 will be installed
---> Package rsync.x86_64 0:3.0.9-18.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

======================================================================================================
 Package                     Arch              Version                      Repository           Size
======================================================================================================
Installing:
 git                         x86_64            1.8.3.1-12.el7_4             c7-media            4.4 M
Installing for dependencies:
 libgnome-keyring            x86_64            3.12.0-1.el7                 c7-media            108 k
 perl-Error                  noarch            1:0.17020-2.el7              c7-media             31 k
 perl-Git                    noarch            1.8.3.1-12.el7_4             c7-media             52 k
 perl-TermReadKey            x86_64            2.30-20.el7                  c7-media             30 k
 rsync                       x86_64            3.0.9-18.el7                 c7-media            358 k

Transaction Summary
======================================================================================================
Install  1 Package (+5 Dependent packages)

Total download size: 5.0 M
Installed size: 23 M
Is this ok [y/d/N]: y
Downloading packages:


Error downloading packages:
  rsync-3.0.9-18.el7.x86_64: [Errno 256] No more mirrors to try.
  libgnome-keyring-3.12.0-1.el7.x86_64: [Errno 256] No more mirrors to try.
  perl-Git-1.8.3.1-12.el7_4.noarch: [Errno 256] No more mirrors to try.
  git-1.8.3.1-12.el7_4.x86_64: [Errno 256] No more mirrors to try.
  1:perl-Error-0.17020-2.el7.noarch: [Errno 256] No more mirrors to try.
  perl-TermReadKey-2.30-20.el7.x86_64: [Errno 256] No more mirrors to try.

[root@host-192-0-11-183 isorepo]# cd /etc/yum.repos.d/                                                                            进入目录/etc/yum.repos.d/
CGSL-Media.repo  dvd.repo         zte.repo
[root@host-192-0-11-183 isorepo]# cd /etc/yum.repos.d/
[root@host-192-0-11-183 yum.repos.d]# ll
total 12
-rw-r--r--. 1 root root 553 Mar 13 08:40 CGSL-Media.repo
-rw-r--r--. 1 root root 137 Jul  2 22:15 dvd.repo
-rw-r--r--. 1 root root 502 Mar 23 03:38 zte.repo
[root@host-192-0-11-183 yum.repos.d]# more zte.repo                                                                                  发现里面有三个文件,但是其中只有dvd.repo是我们创建的,现在查看zte.repo文件
# CGSL-Media.repo
#
# This repo is used to mount the default locations for a CDROM / DVD on
#  CGSL V4.  You can use this repo and yum to install items directly off the
#  DVD ISO that we release.
#
# To use this repo, put in your DVD and use it with the other repos too:
#  yum --enablerepo=c7-media [command]
#
# or for ONLY the media repo, do this:
#
#  yum --disablerepo=\* --enablerepo=c6-media [command]

[zterepo]
name=zterepo
baseurl=http://10.43.177.198/repo/yum/tecs/
gpgcheck=0
enabled=1
[root@host-192-0-11-183 yum.repos.d]# ^C
[root@host-192-0-11-183 yum.repos.d]#
[root@host-192-0-11-183 yum.repos.d]#
[root@host-192-0-11-183 yum.repos.d]#
[root@host-192-0-11-183 yum.repos.d]# ll
total 12
-rw-r--r--. 1 root root 553 Mar 13 08:40 CGSL-Media.repo
-rw-r--r--. 1 root root 137 Jul  2 22:15 dvd.repo
-rw-r--r--. 1 root root 502 Mar 23 03:38 zte.repo
[root@host-192-0-11-183 yum.repos.d]# mv zte.repo
mv: missing destination file operand after ‘zte.repo’
Try 'mv --help' for more information.
[root@host-192-0-11-183 yum.repos.d]# mv zte.repo zte.repo.bak                                                      使用mv命令给文件或文件夹重新命名,将zte.repo重新命名为zte.repo.bak
[root@host-192-0-11-183 yum.repos.d]# mv CGSL-Media.repo.bak                                                    
mv: missing destination file operand after ‘CGSL-Media.repo.bak’
Try 'mv --help' for more information.
[root@host-192-0-11-183 yum.repos.d]#
[root@host-192-0-11-183 yum.repos.d]#
[root@host-192-0-11-183 yum.repos.d]#
[root@host-192-0-11-183 yum.repos.d]# mv CGSL-Media.repo CGSL-Media.repo.bak                    使命mv命令给文件或文件夹重新命名,将CGSL-Media.repo重新命名为CGSL-Media.repo.bak
[root@host-192-0-11-183 yum.repos.d]#
[root@host-192-0-11-183 yum.repos.d]#
[root@host-192-0-11-183 yum.repos.d]#
[root@host-192-0-11-183 yum.repos.d]#
[root@host-192-0-11-183 yum.repos.d]#
[root@host-192-0-11-183 yum.repos.d]#
[root@host-192-0-11-183 yum.repos.d]#
[root@host-192-0-11-183 yum.repos.d]# yum install git                                                                               这样只能从本地寻找安装包并安装,也就是dvd.repo文件中寻找安装源





[root@host-192-0-11-183 V6]# git clone ssh://[email protected]:29418/zxv6pf/v6/code/tulip && git config --global url."ssh://[email protected]".pushInsteadOf ssh://[email protected] && scp -p -P 29418 [email protected]:hooks/commit-msg tulip/.git/hooks/
Cloning into 'tulip'...
ssh: Could not resolve hostname gerritro.zte.com.cn: Name or service not known                                                报错的原因是无法解析域名
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
[root@host-192-0-11-183 V6]# more /etc/resolv.conf                                                                                                   more命令跟cat一样,查看文件/etc/resolv.conf
; generated by /usr/sbin/dhclient-script
search openstacklocal
nameserver 192.0.11.107
nameserver 192.0.11.108
[root@host-192-0-11-183 V6]# vi /etc/resolv.conf                                                                                                       发现没有配虚拟机内网的DNS服务器,所以无法解析域名。添加nameserver 10.41.132.9


[root@host-192-0-11-183 V6]# git clone ssh://[email protected]:29418/zxv6pf/v6/code/tulip && git config --global url."ssh://[email protected]".pushInsteadOf ssh:/                                                                              /[email protected] && scp -p -P 29418 [email protected]:hooks/commit-ms                                                                              g tulip/.git/hooks/
Cloning into 'tulip'...
The authenticity of host '[gerritro.zte.com.cn]:29418 ([10.41.103.17]:29418)' can't be established.               意思是没有把本地生成的publickey添加到Gerrit上,此时本地还没有生成sshkey
RSA key fingerprint is SHA256:oEryy4r4kadgHC3fEOypCXrNeDvQAIRAVHGCQAFoB80.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '[gerritro.zte.com.cn]:29418,[10.41.103.17]:29418' (RSA) to the list of known hosts.
[email protected]: Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
[root@host-192-0-11-183 V6]# find ~/.ssh
/root/.ssh
/root/.ssh/known_hosts
[root@host-192-0-11-183 V6]# cd root
-bash: cd: root: No such file or directory
[root@host-192-0-11-183 V6]# cd /root
[root@host-192-0-11-183 ~]# ll
total 4
-rw-------. 1 root root 1295 Mar 13 08:21 anaconda-ks.cfg
[root@host-192-0-11-183 ~]# ssh-keygen -t rsa -C"[email protected]"                                                                   生成sshkey密钥对
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /root/.ssh/id_rsa.
Your public key has been saved in /root/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:JmxKylqE/QUPiVo5etzZMFbLMx8bsD5SDxgZKk6pY8A [email protected]
The key's randomart image is:
+---[RSA 2048]----+
|    ooo          |
|. .+.* +         |
|oE* O O o        |
|=O + % * +       |
|*o= = X S        |
|.= + = +         |
|  + o            |
| o               |
|.                |
+----[SHA256]-----+
[root@host-192-0-11-183 ~]# cat /root/.ssh/id_rsa.pub
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC7P45FVV5v7eUO258jhA6qVPTZt4Wt7zcgrMu5e+0u5tR9fGn5E2QMPwbkekvCmBuHa/Y6NwMYLH617uWEmO2YobWE30agcgc8+zykfqmheI+pTmn0hAbeWRQsXGD9eH8X2OcnP0AoP8+TFQKRUINdDo6c9Qd9+d+cQ7dwj/qnW1gHqhQl/i1uV5MhRwLp8zFCEYhU79rOaGXdpkIJUTlrfOySkid6U6ly9LLdnX9OKzp9JiJ9iYvHnleednd0UeJaUs68uSDR4YDCt1Tua68Ym7l4oBH9N0X2daJu+3hPPvyRA/x5boyqRkTtpT39gjhJWXAHdvWbpwE6zZd25HNR [email protected]
[root@host-192-0-11-183 ~]# git clone ssh://[email protected]:29418/zxv6pf/v6/code/tulip && git config --global url."ssh://[email protected]".pushInsteadOf ssh://[email protected] && scp -p -P 29418 [email protected]:hooks/commit-msg tulip/.git/hooks/
Cloning into 'tulip'...
[email protected]: Permission denied (publickey).                                                                                           //把本地生成的publickey添加到Gerrit上,还是不行,竟然是因为Gerrit上的key太多,删除所有以前的只留刚生成的,再试就可以了竟然。应该使用ssh-agent bash  ssh-add
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
[root@host-192-0-11-183 ~]# git clone ssh://[email protected]:29418/zxv6pf/v6/code/tulip && git config --global url."ssh://[email protected]".pushInsteadOf ssh://[email protected] && scp -p -P 29418 [email protected]:hooks/commit-msg tulip/.git/hooks/
Cloning into 'tulip'...
remote: Counting objects: 5499, done
remote: Finding sources: 100% (5499/5499)
remote: Total 5499 (delta 2218), reused 5162 (delta 2218)
Receiving objects: 100% (5499/5499), 17.59 MiB | 9.42 MiB/s, done.
Resolving deltas: 100% (2218/2218), done.
The authenticity of host '[gerrit.zte.com.cn]:29418 ([10.41.103.20]:29418)' can't be established.
RSA key fingerprint is SHA256:oEryy4r4kadgHC3fEOypCXrNeDvQAIRAVHGCQAFoB80.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '[gerrit.zte.com.cn]:29418,[10.41.103.20]:29418' (RSA) to the list of known hosts.
commit-msg                                                                                                                             100% 4693   180.2KB/s   00:00
[root@host-192-0-11-183 ~]#
[root@host-192-0-11-183 ~]#
[root@host-192-0-11-183 ~]#
[root@host-192-0-11-183 ~]#
[root@host-192-0-11-183 ~]#

[root@host-192-0-11-183 tulip]# yum install ntpdate                                                                                                           //安装时间同步工具ntpdate
Loaded plugins: fastestmirror
file:///isorepo/tmp/repodata/repomd.xml: [Errno 14] curl#37 - "Couldn't open file /isorepo/tmp/repodata/repomd.xml"
Trying other mirror.
Loading mirror speeds from cached hostfile
Resolving Dependencies
--> Running transaction check
---> Package ntpdate.x86_64 0:4.2.6p5-25.el7.centos.2 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

============================================================================================================================================
 Package                      Arch                        Version                                       Repository                     Size
============================================================================================================================================
Installing:
 ntpdate                      x86_64                      4.2.6p5-25.el7.centos.2                       c7-media                       84 k

Transaction Summary
============================================================================================================================================
Install  1 Package

Total download size: 84 k
Installed size: 121 k
Is this ok [y/d/N]: y
Downloading packages:


Error downloading packages:
  ntpdate-4.2.6p5-25.el7.centos.2.x86_64: [Errno 256] No more mirrors to try.

[root@host-192-0-11-183 tulip]# yum install ntp-date
Loaded plugins: fastestmirror
file:///isorepo/tmp/repodata/repomd.xml: [Errno 14] curl#37 - "Couldn't open file /isorepo/tmp/repodata/repomd.xml"
Trying other mirror.
Loading mirror speeds from cached hostfile
No package ntp-date available.
Error: Nothing to do
[root@host-192-0-11-183 tulip]#
[root@host-192-0-11-183 tulip]#
[root@host-192-0-11-183 tulip]#
[root@host-192-0-11-183 tulip]# cd /isorep                                                                                                                                                  
isorepo/ isorepp/
[root@host-192-0-11-183 tulip]# cd /isorep
isorepo/ isorepp/
[root@host-192-0-11-183 tulip]# cd /isorepo                                                                                                                              进入 /isorepo文件夹
[root@host-192-0-11-183 isorepo]# ll
total 2572288
-rw-r--r--. 1 root root 2634022912 Jul  2 22:04 CGS-Linux-MAIN.V5.04.F1-x86_64.dvd.iso
drwxr-xr-x. 2 root root          6 Jul  2 22:16 tmp
[root@host-192-0-11-183 isorepo]# mount -o loop CGS-Linux-MAIN.V5.04.F1-x86_64.dvd.iso ./tmp/                    重启虚拟机之后iso需要重新挂载,才能打开目录结构,可以理解成需要重新解压
mount: /dev/loop2 is write-protected, mounting read-only
[root@host-192-0-11-183 isorepo]# yum install ntpdate                                                                                                          再次安装ntpdate时间同步工具,发现成功安装了。
Loaded plugins: fastestmirror
c7-media                                                                                                             | 3.6 kB  00:00:00
Loading mirror speeds from cached hostfile
Resolving Dependencies
--> Running transaction check
---> Package ntpdate.x86_64 0:4.2.6p5-25.el7.centos.2 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

============================================================================================================================================
 Package                      Arch                        Version                                       Repository                     Size
============================================================================================================================================
Installing:
 ntpdate                      x86_64                      4.2.6p5-25.el7.centos.2                       c7-media                       84 k

Transaction Summary
============================================================================================================================================
Install  1 Package

Total download size: 84 k
Installed size: 121 k
Is this ok [y/d/N]: y
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : ntpdate-4.2.6p5-25.el7.centos.2.x86_64                                                                                   1/1
  Verifying  : ntpdate-4.2.6p5-25.el7.centos.2.x86_64                                                                                   1/1

Installed:
  ntpdate.x86_64 0:4.2.6p5-25.el7.centos.2

Complete!
[root@host-192-0-11-183 isorepo]# ntpdate 10.30.1.105
 3 Jul 05:16:55 ntpdate[1770]: adjust time server 10.30.1.105 offset 0.156463 sec
[root@host-192-0-11-183 isorepo]#


你可能感兴趣的:(mount)