前提 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: