make命令后报错

make命令后报错

问题描述:

make命令后报错,redis安装失败

相关代码:

[root@localhost ~]# cd /user/local
bash: cd: /user/local: 没有那个文件或目录
[root@localhost ~]# cd user/local
[root@localhost local]# ll
总用量 0
[root@localhost local]# mkdir redis
[root@localhost local]# ll
总用量 0
drwxr-xr-x. 2 root root 6 8月  13 15:56 redis
[root@localhost local]# cd redis
[root@localhost redis]# 
[root@localhost redis]# 
[root@localhost redis]# yum install gcc
已加载插件:fastestmirror, langpacks
Loading mirror speeds from cached hostfile
Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=os&infra=stock error was
14: curl#6 - "Could not resolve host: mirrorlist.centos.org; 未知的错误"


 One of the configured repositories failed (未知),
 and yum doesn't have enough cached data to continue. At this point the only
 safe thing yum can do is fail. There are a few ways to work "fix" this:

     1. Contact the upstream for the repository and get them to fix the problem.

     2. Reconfigure the baseurl/etc. for the repository, to point to a working
        upstream. This is most often useful if you are using a newer
        distribution release than is supported by the repository (and the
        packages for the previous distribution release still work).

     3. Run the command with the repository temporarily disabled
            yum --disablerepo=<repoid> ...

     4. Disable the repository permanently, so yum won't use it by default. Yum
        will then just ignore the repository until you permanently enable it
        again or use --enablerepo for temporary usage:

            yum-config-manager --disable <repoid>
        or
            subscription-manager repos --disable=<repoid>

     5. Configure the failing repository to be skipped, if it is unavailable.
        Note that yum will try to contact the repo. when it runs most commands,
        so will have to try and fail each time (and thus. yum will be be much
        slower). If it is a very temporary problem though, this is often a nice
        compromise:

            yum-config-manager --save --setopt=<repoid>.skip_if_unavailable=true

Cannot find a valid baseurl for repo: base/7/x86_64
[root@localhost redis]# wget http://download.redis.io/releases/redis-5.0.2.tar.gz
--2024-08-13 16:04:59--  http://download.redis.io/releases/redis-5.0.2.tar.gz
正在解析主机 download.redis.io (download.redis.io)... 45.60.121.1
正在连接 download.redis.io (download.redis.io)|45.60.121.1|:80... 已连接。
已发出 HTTP 请求,正在等待回应... 200 OK
长度:1952989 (1.9M) [application/octet-stream]
正在保存至: “redis-5.0.2.tar.gz”

100%[======================================>] 1,952,989    481KB/s 用时 4.4s   

2024-08-13 16:05:06 (434 KB/s) - 已保存 “redis-5.0.2.tar.gz” [1952989/1952989])

[root@localhost redis]# ll
总用量 1908
-rw-r--r--. 1 root root 1952989 6月  27 2020 redis-5.0.2.tar.gz
[root@localhost redis]# tar xzf redis-5.0.2.tar.gz
[root@localhost redis]# ll
总用量 1912
drwxrwxr-x. 6 root root    4096 11月 22 2018 redis-5.0.2
-rw-r--r--. 1 root root 1952989 6月  27 2020 redis-5.0.2.tar.gz
[root@localhost redis]# cd redis-5.0.2
[root@localhost redis-5.0.2]# cd redis-5.0.2
bash: cd: redis-5.0.2: 没有那个文件或目录
[root@localhost redis-5.0.2]# ll
总用量 236
-rw-rw-r--.  1 root root 85327 11月 22 2018 00-RELEASENOTES
-rw-rw-r--.  1 root root    53 11月 22 2018 BUGS
-rw-rw-r--.  1 root root  1894 11月 22 2018 CONTRIBUTING
-rw-rw-r--.  1 root root  1487 11月 22 2018 COPYING
drwxrwxr-x.  6 root root   124 11月 22 2018 deps
-rw-rw-r--.  1 root root    11 11月 22 2018 INSTALL
-rw-rw-r--.  1 root root   151 11月 22 2018 Makefile
-rw-rw-r--.  1 root root  4223 11月 22 2018 MANIFESTO
-rw-rw-r--.  1 root root 20555 11月 22 2018 README.md
-rw-rw-r--.  1 root root 62155 11月 22 2018 redis.conf
-rwxrwxr-x.  1 root root   275 11月 22 2018 runtest
-rwxrwxr-x.  1 root root   280 11月 22 2018 runtest-cluster
-rwxrwxr-x.  1 root root   281 11月 22 2018 runtest-sentinel
-rw-rw-r--.  1 root root  9710 11月 22 2018 sentinel.conf
drwxrwxr-x.  3 root root  4096 11月 22 2018 src
drwxrwxr-x. 10 root root   167 11月 22 2018 tests
drwxrwxr-x.  8 root root  4096 11月 22 2018 utils
[root@localhost redis-5.0.2]# make
cd src && make all
make[1]: 进入目录“/root/user/local/redis/redis-5.0.2/src”
    CC Makefile.dep
make[1]: 离开目录“/root/user/local/redis/redis-5.0.2/src”
make[1]: 进入目录“/root/user/local/redis/redis-5.0.2/src”
rm -rf redis-server redis-sentinel redis-cli redis-benchmark redis-check-rdb redis-check-aof *.o *.gcda *.gcno *.gcov redis.info lcov-html Makefile.dep dict-benchmark
(cd ../deps && make distclean)
make[2]: 进入目录“/root/user/local/redis/redis-5.0.2/deps”
(cd hiredis && make clean) > /dev/null || true
(cd linenoise && make clean) > /dev/null || true
(cd lua && make clean) > /dev/null || true
(cd jemalloc && [ -f Makefile ] && make distclean) > /dev/null || true
(rm -f .make-*)
make[2]: 离开目录“/root/user/local/redis/redis-5.0.2/deps”
(rm -f .make-*)
echo STD=-std=c99 -pedantic -DREDIS_STATIC='' >> .make-settings
echo WARN=-Wall -W -Wno-missing-field-initializers >> .make-settings
echo OPT=-O2 >> .make-settings
echo MALLOC=jemalloc >> .make-settings
echo CFLAGS= >> .make-settings
echo LDFLAGS= >> .make-settings
echo REDIS_CFLAGS= >> .make-settings
echo REDIS_LDFLAGS= >> .make-settings
echo PREV_FINAL_CFLAGS=-std=c99 -pedantic -DREDIS_STATIC='' -Wall -W -Wno-missing-field-initializers -O2 -g -ggdb   -I../deps/hiredis -I../deps/linenoise -I../deps/lua/src -DUSE_JEMALLOC -I../deps/jemalloc/include >> .make-settings
echo PREV_FINAL_LDFLAGS=  -g -ggdb -rdynamic >> .make-settings
(cd ../deps && make hiredis linenoise lua jemalloc)
make[2]: 进入目录“/root/user/local/redis/redis-5.0.2/deps”
(cd hiredis && make clean) > /dev/null || true
(cd linenoise && make clean) > /dev/null || true
(cd lua && make clean) > /dev/null || true
(cd jemalloc && [ -f Makefile ] && make distclean) > /dev/null || true
(rm -f .make-*)
(echo "" > .make-cflags)
(echo "" > .make-ldflags)
MAKE hiredis
cd hiredis && make static
make[3]: 进入目录“/root/user/local/redis/redis-5.0.2/deps/hiredis”
gcc -std=c99 -pedantic -c -O3 -fPIC  -Wall -W -Wstrict-prototypes -Wwrite-strings -g -ggdb  net.c
make[3]: gcc:命令未找到
make[3]: *** [net.o] 错误 127
make[3]: 离开目录“/root/user/local/redis/redis-5.0.2/deps/hiredis”
make[2]: *** [hiredis] 错误 2
make[2]: 离开目录“/root/user/local/redis/redis-5.0.2/deps”
make[1]: [persist-settings] 错误 2 (忽略)
    CC adlist.o
/bin/sh: cc: 未找到命令
make[1]: *** [adlist.o] 错误 127
make[1]: 离开目录“/root/user/local/redis/redis-5.0.2/src”
make: *** [all] 错误 2
[root@localhost redis-5.0.2]# 

正在回答 回答被采纳积分+1

登陆购买课程后可参与讨论,去登陆

1回答
好帮手慕小蓝 2024-08-13 17:17:22

同学你好,从报错信息看,很可能是因为缺少编译工具GCC,可以使用下面的命令安装一下,然后再重新执行make命令试一下。

yum install gcc

祝学习愉快~

  • 提问者 慕桂英5534918 #1

    老师,上面已经用了这个命令,还是报错

    2024-08-13 17:20:39
  • 好帮手慕小蓝 回复 提问者 慕桂英5534918 #2

    同学你好,建议同学使用命令“gcc --version”查看一下是否安装成功了,如果安装成功了,那么报错应该和之前是不一样的,建议同学先看一下报错信息,如果不能找到问题原因,可以将新的报错信息提供到问答区。

    祝学习愉快~


    2024-08-13 17:56:46
问题已解决,确定采纳
还有疑问,暂不采纳

恭喜解决一个难题,获得1积分~

来为老师/同学的回答评分吧

0 星
Java工程师 2024版
  • 参与学习       2020    人
  • 提交作业       1249    份
  • 解答问题       1202    个

2024重磅革新,超百小时内容豪华升级,加速提升高级技能与高薪就业竞争力 课程紧贴企业最新人才需求,历经7年持续迭代,帮助万名学子入行转行 从零起点到高阶实战,学习路径稳健顺滑,成就从小白到工程师高薪

了解课程
请稍等 ...
意见反馈 帮助中心 APP下载
官方微信

在线咨询

领取优惠

免费试听

领取大纲

扫描二维码,添加
你的专属老师