CentOS6.x环境通过yum命令在线安装或重装zookeeper-server

Posted raodi

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了CentOS6.x环境通过yum命令在线安装或重装zookeeper-server相关的知识,希望对你有一定的参考价值。



 

一、环境描述:

            在CentOS6.x系统环境下,使用yum命令的形式安装zookeeper-server,由于我这里是重新安装zookeeper-server,所以在正式开始之前我需要将原本的zookeeper服务进行卸载。这里使用的是yum在线方式,所以我就不搭建本地的yum源库,也正因为如此要求实验的CentOS6.x系统能够连接到外网。

技术图片

 

 

二、卸载zookeeper-server

      1、首先使用yum list installed命令查看本地安装的服务列表,并找到需要卸载的部件名称,如下图:

[email protected]:/home/yang]#yum list installed

技术图片

    2、使用yum remove 命令对zookeeper.x86_64进行卸载。注意,在使用yum remove命令时,命令后面所带的字段名称即为需要卸载的东西。

[email protected]:/home/yang]#yum remove zookeeper.x86_64

   当提示内容如下时,可直接yes即可。当出现Complete!时表示已经卸载成功了,不过还是建议使用yum list installed命令进行查看。

 

技术图片    技术图片

 

三、使用yum安装zookeeper-server

    使用yum安装zookeeper-server的命令真的很简单。

[email protected]:/home/yang]#yum install zookeeper-server

    于是乎,直接运行了这个命令,结果却让我大吃一惊。下面的错误对于你来说是不是很熟悉呢?

Loaded plugins: fastestmirror, refresh-packagekit, security
Loading mirror speeds from cached hostfile
 * base: ftp.sjtu.edu.cn
 * extras: ftp.ksu.edu.tw
 * updates: ftp.ksu.edu.tw
http://ftp.sjtu.edu.cn/centos/6.10/os/x86_64/repodata/repomd.xml: [Errno 14] PYCURL ERROR 6 - "Couldn‘t resolve host ‘ftp.sjtu.edu.cn‘"
Trying other mirror.
http://ftp.stu.edu.tw/Linux/CentOS/6.10/os/x86_64/repodata/repomd.xml: [Errno 14] PYCURL ERROR 6 - "Couldn‘t resolve host ‘ftp.stu.edu.tw‘"
Trying other mirror.
http://ftp.yzu.edu.tw/Linux/CentOS/6.10/os/x86_64/repodata/repomd.xml: [Errno 14] PYCURL ERROR 6 - "Couldn‘t resolve host ‘ftp.yzu.edu.tw‘"
Trying other mirror.
http://mirrors.aliyun.com/centos/6.10/os/x86_64/repodata/repomd.xml: [Errno 14] PYCURL ERROR 6 - "Couldn‘t resolve host ‘mirrors.aliyun.com‘"
Trying other mirror.
http://mirrors.huaweicloud.com/repository/centos/6.10/os/x86_64/repodata/repomd.xml: [Errno 14] PYCURL ERROR 6 - "Couldn‘t resolve host ‘mirrors.huaweicloud.com‘"
Trying other mirror.
http://mirrors.neusoft.edu.cn/centos/6.10/os/x86_64/repodata/repomd.xml: [Errno 14] PYCURL ERROR 6 - "Couldn‘t resolve host ‘mirrors.neusoft.edu.cn‘"
Trying other mirror.
http://mirrors.njupt.edu.cn/centos/6.10/os/x86_64/repodata/repomd.xml: [Errno 14] PYCURL ERROR 6 - "Couldn‘t resolve host ‘mirrors.njupt.edu.cn‘"
Trying other mirror.
http://mirrors.shu.edu.cn/centos/6.10/os/x86_64/repodata/repomd.xml: [Errno 14] PYCURL ERROR 6 - "Couldn‘t resolve host ‘mirrors.shu.edu.cn‘"
Trying other mirror.
http://mirrors.sohu.com/centos/6.10/os/x86_64/repodata/repomd.xml: [Errno 14] PYCURL ERROR 6 - "Couldn‘t resolve host ‘mirrors.sohu.com‘"
Trying other mirror.
http://mirrors.tuna.tsinghua.edu.cn/centos/6.10/os/x86_64/repodata/repomd.xml: [Errno 14] PYCURL ERROR 6 - "Couldn‘t resolve host ‘mirrors.tuna.tsinghua.edu.cn‘"
Trying other mirror.
https://archive.cloudera.com/cdh5/redhat/5/x86_64/cdh/5/repodata/repomd.xml: [Errno 14] PYCURL ERROR 6 - "Couldn‘t resolve host ‘archive.cloudera.com‘"
Trying other mirror.
http://ftp.ksu.edu.tw/pub/CentOS/6.10/extras/x86_64/repodata/repomd.xml: [Errno 14] PYCURL ERROR 6 - "Couldn‘t resolve host ‘ftp.ksu.edu.tw‘"
Trying other mirror.
http://ftp.sjtu.edu.cn/centos/6.10/extras/x86_64/repodata/repomd.xml: [Errno 14] PYCURL ERROR 6 - "Couldn‘t resolve host ‘ftp.sjtu.edu.cn‘"
Trying other mirror.
http://mirror.lzu.edu.cn/centos/6.10/extras/x86_64/repodata/repomd.xml: [Errno 14] PYCURL ERROR 6 - "Couldn‘t resolve host ‘mirror.lzu.edu.cn‘"
Trying other mirror.
http://mirrors.aliyun.com/centos/6.10/extras/x86_64/repodata/repomd.xml: [Errno 14] PYCURL ERROR 6 - "Couldn‘t resolve host ‘mirrors.aliyun.com‘"
Trying other mirror.
http://mirrors.huaweicloud.com/repository/centos/6.10/extras/x86_64/repodata/repomd.xml: [Errno 14] PYCURL ERROR 6 - "Couldn‘t resolve host ‘mirrors.huaweicloud.com‘"
Trying other mirror.
http://mirrors.neusoft.edu.cn/centos/6.10/extras/x86_64/repodata/repomd.xml: [Errno 14] PYCURL ERROR 6 - "Couldn‘t resolve host ‘mirrors.neusoft.edu.cn‘"
Trying other mirror.
http://mirrors.njupt.edu.cn/centos/6.10/extras/x86_64/repodata/repomd.xml: [Errno 14] PYCURL ERROR 6 - "Couldn‘t resolve host ‘mirrors.njupt.edu.cn‘"
Trying other mirror.
http://mirrors.shu.edu.cn/centos/6.10/extras/x86_64/repodata/repomd.xml: [Errno 14] PYCURL ERROR 6 - "Couldn‘t resolve host ‘mirrors.shu.edu.cn‘"
Trying other mirror.
http://mirrors.sohu.com/centos/6.10/extras/x86_64/repodata/repomd.xml: [Errno 14] PYCURL ERROR 6 - "Couldn‘t resolve host ‘mirrors.sohu.com‘"
Trying other mirror.
http://mirrors.tuna.tsinghua.edu.cn/centos/6.10/extras/x86_64/repodata/repomd.xml: [Errno 14] PYCURL ERROR 6 - "Couldn‘t resolve host ‘mirrors.tuna.tsinghua.edu.cn‘"
Trying other mirror.
http://ftp.ksu.edu.tw/pub/CentOS/6.10/updates/x86_64/repodata/repomd.xml: [Errno 14] PYCURL ERROR 6 - "Couldn‘t resolve host ‘ftp.ksu.edu.tw‘"
Trying other mirror.
http://ftp.sjtu.edu.cn/centos/6.10/updates/x86_64/repodata/repomd.xml: [Errno 14] PYCURL ERROR 6 - "Couldn‘t resolve host ‘ftp.sjtu.edu.cn‘"
Trying other mirror.
http://ftp.stu.edu.tw/Linux/CentOS/6.10/updates/x86_64/repodata/repomd.xml: [Errno 14] PYCURL ERROR 6 - "Couldn‘t resolve host ‘ftp.stu.edu.tw‘"
Trying other mirror.
http://mirrors.aliyun.com/centos/6.10/updates/x86_64/repodata/repomd.xml: [Errno 14] PYCURL ERROR 6 - "Couldn‘t resolve host ‘mirrors.aliyun.com‘"
Trying other mirror.
http://mirrors.huaweicloud.com/repository/centos/6.10/updates/x86_64/repodata/repomd.xml: [Errno 14] PYCURL ERROR 6 - "Couldn‘t resolve host ‘mirrors.huaweicloud.com‘"
Trying other mirror.
http://mirrors.neusoft.edu.cn/centos/6.10/updates/x86_64/repodata/repomd.xml: [Errno 14] PYCURL ERROR 6 - "Couldn‘t resolve host ‘mirrors.neusoft.edu.cn‘"
Trying other mirror.
http://mirrors.njupt.edu.cn/centos/6.10/updates/x86_64/repodata/repomd.xml: [Errno 14] PYCURL ERROR 6 - "Couldn‘t resolve host ‘mirrors.njupt.edu.cn‘"
Trying other mirror.
http://mirrors.shu.edu.cn/centos/6.10/updates/x86_64/repodata/repomd.xml: [Errno 14] PYCURL ERROR 6 - "Couldn‘t resolve host ‘mirrors.shu.edu.cn‘"
Trying other mirror.
http://mirrors.sohu.com/centos/6.10/updates/x86_64/repodata/repomd.xml: [Errno 14] PYCURL ERROR 6 - "Couldn‘t resolve host ‘mirrors.sohu.com‘"
Trying other mirror.
http://mirrors.tuna.tsinghua.edu.cn/centos/6.10/updates/x86_64/repodata/repomd.xml: [Errno 14] PYCURL ERROR 6 - "Couldn‘t resolve host ‘mirrors.tuna.tsinghua.edu.cn‘"
Trying other mirror.
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package zookeeper-server.x86_64 0:3.4.5+cdh5.15.0+144-1.cdh5.15.0.p0.52.el5 will be installed
http://ftp.sjtu.edu.cn/centos/6.10/os/x86_64/repodata/5f7694d9c6c4a41dee56f51a965c3426ae2f685d6a9fb99d2e5a255c7bec0864-filelists.sqlite.bz2: [Errno 14] PYCURL ERROR 6 - "Couldn‘t resolve host ‘ftp.sjtu.edu.cn‘"
Trying other mirror.
http://ftp.stu.edu.tw/Linux/CentOS/6.10/os/x86_64/repodata/5f7694d9c6c4a41dee56f51a965c3426ae2f685d6a9fb99d2e5a255c7bec0864-filelists.sqlite.bz2: [Errno 14] PYCURL ERROR 6 - "Couldn‘t resolve host ‘ftp.stu.edu.tw‘"
Trying other mirror.
http://ftp.yzu.edu.tw/Linux/CentOS/6.10/os/x86_64/repodata/5f7694d9c6c4a41dee56f51a965c3426ae2f685d6a9fb99d2e5a255c7bec0864-filelists.sqlite.bz2: [Errno 14] PYCURL ERROR 6 - "Couldn‘t resolve host ‘ftp.yzu.edu.tw‘"
Trying other mirror.
http://mirrors.aliyun.com/centos/6.10/os/x86_64/repodata/5f7694d9c6c4a41dee56f51a965c3426ae2f685d6a9fb99d2e5a255c7bec0864-filelists.sqlite.bz2: [Errno 14] PYCURL ERROR 6 - "Couldn‘t resolve host ‘mirrors.aliyun.com‘"
Trying other mirror.
http://mirrors.huaweicloud.com/repository/centos/6.10/os/x86_64/repodata/5f7694d9c6c4a41dee56f51a965c3426ae2f685d6a9fb99d2e5a255c7bec0864-filelists.sqlite.bz2: [Errno 14] PYCURL ERROR 6 - "Couldn‘t resolve host ‘mirrors.huaweicloud.com‘"
Trying other mirror.
http://mirrors.neusoft.edu.cn/centos/6.10/os/x86_64/repodata/5f7694d9c6c4a41dee56f51a965c3426ae2f685d6a9fb99d2e5a255c7bec0864-filelists.sqlite.bz2: [Errno 14] PYCURL ERROR 6 - "Couldn‘t resolve host ‘mirrors.neusoft.edu.cn‘"
Trying other mirror.
http://mirrors.njupt.edu.cn/centos/6.10/os/x86_64/repodata/5f7694d9c6c4a41dee56f51a965c3426ae2f685d6a9fb99d2e5a255c7bec0864-filelists.sqlite.bz2: [Errno 14] PYCURL ERROR 6 - "Couldn‘t resolve host ‘mirrors.njupt.edu.cn‘"
Trying other mirror.
http://mirrors.shu.edu.cn/centos/6.10/os/x86_64/repodata/5f7694d9c6c4a41dee56f51a965c3426ae2f685d6a9fb99d2e5a255c7bec0864-filelists.sqlite.bz2: [Errno 14] PYCURL ERROR 6 - "Couldn‘t resolve host ‘mirrors.shu.edu.cn‘"
Trying other mirror.
http://mirrors.sohu.com/centos/6.10/os/x86_64/repodata/5f7694d9c6c4a41dee56f51a965c3426ae2f685d6a9fb99d2e5a255c7bec0864-filelists.sqlite.bz2: [Errno 14] PYCURL ERROR 6 - "Couldn‘t resolve host ‘mirrors.sohu.com‘"
Trying other mirror.
http://mirrors.tuna.tsinghua.edu.cn/centos/6.10/os/x86_64/repodata/5f7694d9c6c4a41dee56f51a965c3426ae2f685d6a9fb99d2e5a255c7bec0864-filelists.sqlite.bz2: [Errno 14] PYCURL ERROR 6 - "Couldn‘t resolve host ‘mirrors.tuna.tsinghua.edu.cn‘"
Trying other mirror.
Error: failure: repodata/5f7694d9c6c4a41dee56f51a965c3426ae2f685d6a9fb99d2e5a255c7bec0864-filelists.sqlite.bz2 from base: [Errno 256] No more mirrors to try.
 You could try using --skip-broken to work around the problem
 You could try running: rpm -Va --nofiles –nodigest

 

       这里就不兜圈子了,直接上解决的方法!我这里为了尽可能少的打shell字符,我直接进入/etc/yum.repos.d目录中。可以看到,我这里/etc/yum.repos.d目录下面,有几个文件。CentOS-Base.repo是我们要更新的,至于其它的先不用管。

[email protected]:/home/yang]#cd /etc/yum.repos.d

技术图片

 

       不过要说明的是,我这里由于是重新安装,所以我打算连cloudera-cdh5.repo文件也更新一下,也就是先删除再重新下载。如果是初次安装zookeeper-server的话,cloudera-cdh5.repo文件应该是没有的。

技术图片

 

      为了在使用yum命令时网速能更快些,我们需要将在线的yum源指定到国内的mirrors.163.com服务器上。在进行CentOS-Base.repo文件更新时,需要将CentOS-Base.repo文件,备份成以.backup为后缀的备份文件,以免我们更新的新文件用不了。

[email protected]:/etc/yum.repos.d]#mv CentOS-Base.repo CentOS-Base.repo.backup
[email protected]:/etc/yum.repos.d]#wget http://mirrors.163.com/.help/CentOS6-Base-163.repo
[email protected]:/etc/yum.repos.d]#mv CentOS6-Base-163.repo CentOS-Base.repo

技术图片

 

       到此为止,我想再次尝试使用yum命令,对zookeeper-server进行安装。可不幸运的是,还是报出了如下的错误,但相对于前者而言,似乎错误明显改观了许多。

Loaded plugins: fastestmirror, refresh-packagekit, security
Loading mirror speeds from cached hostfile
https://archive.cloudera.com/cdh5/redhat/6/x86_64/cdh/5/repodata/repomd.xml: [Errno 14] Peer cert cannot be verified or peer cert invalid
Trying other mirror.
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package zookeeper-server.x86_64 0:3.4.5+cdh5.15.0+144-1.cdh5.15.0.p0.52.el5 will be installed
base/filelists_db                                        | 6.4 MB     00:04     
https://archive.cloudera.com/cdh5/redhat/6/x86_64/cdh/5/repodata/filelists.xml.gz: [Errno 14] Peer cert cannot be verified or peer cert invalid
Trying other mirror.
Error: failure: repodata/filelists.xml.gz from cloudera-cdh5: [Errno 256] No more mirrors to try.
 You could try using --skip-broken to work around the problem
 You could try running: rpm -Va --nofiles –nodigest

 

       由于它是Peer cert cannot be verified or peer cert invalid类型的错误,所以我们要修改一下/etc/yum.conf文件的配置内容。可直接编辑该文件

[email protected]:/etc/yum.repos.d]#vi /etc/yum.conf

   在文件中,添加如下内容:

sslverify=false

技术图片

 

最后,需要将一些部件进行更新一下:

[email protected]:/etc/yum.repos.d]#yum check-update

技术图片

 

 

最后的最后,我们可以正式对zookeeper-server进行下载安装了:

[email protected]:/etc/yum.repos.d]#yum install zookeeper-server

技术图片   

当提示Is this ok [y/N]: 时,直接输入y即可。

技术图片

 

       此时,如果你的网速不是很好的话,建议你先去小卖部逛两圈,顺便路过奶茶店记得帮小编带一杯不加糖的绿茶,虽然我也喝不到,不过随便了。

     好了,经过漫长的等待之后,当提示以下内容时,恭喜你已经通过yum命令完成了zookeeper-server的安装。

技术图片

 

       最后,小编还想再啰嗦一点的就是,通过这种方式部署集群的话,效率显然并不是很高!现在,你或许以为自己已经真正的部署了zookeeper-server而沾沾自喜,其实并不然。我们只是将zookeeper-server安装到了我们的机器上,还没有对其进行初始化和集群分配,也就是说并没有对它进行部署和使用。

      值得啰嗦的是,zookeeper集群的搭建必须是奇数个机器哦,还有的就是最低要求也要3台服务器~

 

以上是关于CentOS6.x环境通过yum命令在线安装或重装zookeeper-server的主要内容,如果未能解决你的问题,请参考以下文章

ubuntu删除或重装损坏的程序

centos6.x下yum安装heartbeat

CentOS 6.x/7.x上安装git

centos小版本更新

centos小版本更新

Centos6.x系统下安装telnet命令及使用