解决Xshell 在ubuntu中安装Redis的报错问题:pkg-config not found,Failed to fetch , Authentication failure

前提 Xshell已经连接,redis包已经通过Xftp传输到ubuntu里

刚开始一路按尚硅谷redis的命令,

下载redis-6.2.1.tar.gz放/opt目录

解压命令:tar -zxvf redis-6.2.1.tar.gz

解压完成后进入目录:cd redis-6.2.1

在redis-6.2.1目录下再次执行make命令(只是编译好)

跳过make test 继续执行: make install

注意尚硅谷用的是yum,如果用ubuntu是apt

报错1:make后Permission denied

make后发现Permission denied了。

输入 su - 输入我自己用户(cleopatra)的登录密码,显示 su:Authentication failure。

但是我的密码是肯定没错的。

解决方法:
输入 sudo passwd root
显示 Enter new UNIX password:
显示 Retype new UNIX password:
再把刚才的密码输入一遍
然后会显示 passws: password updated successfully
这时候就可以用刚设置的密码进入 root 了(最后一行 现在是root状态了)

引用(平时安装软件和锁屏登录用到的密码是当前用户的密码,而不是权限更高的 root 密码。
所以要先给 root 设置一个独立的密码,然后才可以使用 root 模式)

报错2:pkg-config 包not found

重新make 这次报pkg-config 包not found

ok,那我就去更新一下最新的包的信息,输入

apt-get update

结果一堆Err 和Failed to fetch :

root@cleopatra:/home/cleopatra/opt/redis-7.2.2# apt-get update

Err:1 http://security.ubuntu.com/ubuntu bionic-security InRelease Could not resolve ‘security.ubuntu.com’ Err:2 http://de.archive.ubuntu.com/ubuntu bionic InRelease Could not resolve ‘de.archive.ubuntu.com’ Err:3 http://de.archive.ubuntu.com/ubuntu bionic-updates InRelease Could not resolve ‘de.archive.ubuntu.com’ Err:4 http://de.archive.ubuntu.com/ubuntu bionic-backports InRelease Could not resolve ‘de.archive.ubuntu.com’ Hit:5 https://dl.google.com/linux/chrome/deb stable InRelease Reading package lists... Done W: Failed to fetch http://de.archive.ubuntu.com/ubuntu/dists/bionic/InRelease Could not resolve ‘de.archive.ubuntu.com’ W: Failed to fetch http://de.archive.ubuntu.com/ubuntu/dists/bionic-updates/InRelease Could not resolve ‘de.archive.ubuntu.com’

这里DNS解析失败了,我的服务器尝试连接到仓库,但由于某种原因,它不能解析那些仓库的域名。

解决方法:

1.检查网络连接

输入 ping 8.8.8.8  正常

2.看一下当前DNS仓库在哪,有没有设置

输入:cat /etc/resolv.conf

当前的Dns nameserver 127.0.0.53 是我本地的DNS stub resolver把它改成google的dns

输入

sudo bash -c "echo 'nameserver 8.8.8.8' > /etc/resolv.conf"
sudo bash -c "echo 'nameserver 8.8.4.4' >> /etc/resolv.conf"

 

改完重新apt -get update一下,好了

重新make和make install:

安装成功:)

参考文章:https://blog.csdn.net/weixin_42895478/article/details/114928866

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值