1.准备工作:下载安装最新版的gcc编译器
注意:Centos6版本以上只能使用gcc8以上版本进行编译
sudo yum install centos-release-scl scl-utils-build;
sudo yum install -y devtoolset-8-toolchain;
# 注意: 执行此命令会自动切换到 root 用户
sudo scl enable devtoolset-8 bash
问题1:Cannot find a valid baseurl for repo: centos-sclo-sclo/x86_64
问题2:Cannot find a valid baseurl for repo: centos-sclo-rh/x86_64
问题3:Could not resolve host: mirrorlist.centos.org; Unknown error
问题4:No package centos-release-scl available
终极解决办法:
1.创建阿里云yum源
1.1 编辑CentOS-Base.repo文件
vim /etc/yum.repos.d/CentOS-Base.repo
1.2 写入内容
# CentOS-Base.repo
#
# The mirror system uses the connecting IP address of the client and the
# update status of each mirror to pick mirrors that are updated to and
# geographically close to the client. You should use this for CentOS updates
# unless you are manually picking other mirrors.
#
# If the mirrorlist= does not work for you, as a fall back you can try the
# remarked out baseurl= line instead.
#
#
[base]
name=CentOS-$releasever - Base - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos/$releasever/os/$basearch/
http://mirrors.aliyuncs.com/centos/$releasever/os/$basearch/
http://mirrors.cloud.aliyuncs.com/centos/$releasever/os/$basearch/
gpgcheck=1
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
#released updates
[updates]
name=CentOS-$releasever - Updates - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos/$releasever/updates/$basearch/
http://mirrors.aliyuncs.com/centos/$releasever/updates/$basearch/
http://mirrors.cloud.aliyuncs.com/centos/$releasever/updates/$basearch/
gpgcheck=1
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos/$releasever/extras/$basearch/
http://mirrors.aliyuncs.com/centos/$releasever/extras/$basearch/
http://mirrors.cloud.aliyuncs.com/centos/$releasever/extras/$basearch/
gpgcheck=1
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos/$releasever/centosplus/$basearch/
http://mirrors.aliyuncs.com/centos/$releasever/centosplus/$basearch/
http://mirrors.cloud.aliyuncs.com/centos/$releasever/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
#contrib - packages by Centos Users
[contrib]
name=CentOS-$releasever - Contrib - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos/$releasever/contrib/$basearch/
http://mirrors.aliyuncs.com/centos/$releasever/contrib/$basearch/
http://mirrors.cloud.aliyuncs.com/centos/$releasever/contrib/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
1.3 编辑CentOS-SCLo-rh.repo文件
vim /etc/yum.repos.d/CentOS-SCLo-rh.repo
1.4 写入内容
[centos-sclo-rh]
name=CentOS-7 - SCLo rh
baseurl=https://mirrors.aliyun.com/centos/7/sclo/x86_64/rh/
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-SCLo
1.5 编辑CentOS-SCLo-scl.repo
vim /etc/yum.repos.d/CentOS-SCLo-scl.repo
1.6 写入内容
# CentOS-SCLo-sclo.repo
#
# Please see http://wiki.centos.org/SpecialInterestGroup/SCLo for more
# information
[centos-sclo-sclo]
name=CentOS-7 - SCLo sclo
# baseurl=http://mirror.centos.org/centos/7/sclo/$basearch/sclo/
baseurl=http://mirrors.aliyun.com/centos/7/sclo/x86_64/sclo/
#mirrorlist=http://mirrorlist.centos.org?arch=$basearch&release=7&repo=sclo-sclo
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-SCLo
#[centos-sclo-rh]
#name=CentOS-7 - SCLo rh
#baseurl=https://mirrors.aliyun.com/centos/7/sclo/x86_64/rh/
#gpgcheck=1
#enabled=1
#gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-SCLo
[centos-sclo-sclo-testing]
name=CentOS-7 - SCLo sclo Testing
baseurl=http://buildlogs.centos.org/centos/7/sclo/$basearch/sclo/
gpgcheck=0
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-SCLo
[centos-sclo-sclo-source]
name=CentOS-7 - SCLo sclo Sources
baseurl=http://vault.centos.org/centos/7/sclo/Source/sclo/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-SCLo
[centos-sclo-sclo-debuginfo]
name=CentOS-7 - SCLo sclo Debuginfo
baseurl=http://debuginfo.centos.org/centos/7/sclo/$basearch/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-SCLo
1.7 yum重建
yum clean all;
yum makecache;
2.测试 gcc版本
gcc --version
2.下载redis-6.0.8.tar.gz,置于 /opt/software 目录下
cd /opt/software;
wget http://download.redis.io/releases/redis-6.0.8.tar.gz
3.解压
tar -zxvf redis-6.0.8.tar.gz -C ../module/
4. 解压完成后进入目录 redis-6.0.8
cd ../module/redis-6.0.8/
5.在redis-6.0.8目录下执行make命令(只是编译好)
make
问题1: Jemalloc/jemalloc.h:没有那个文件
解决办法:
5.1 运行make distclean
make distclean
6. 在redis-6.0.8目录下再次执行make命令(只是编译好)
make
7.执行make install
make install
8.跳转到安装目录:/usr/local/bin
cd /usr/local/bin;
9.备份redis.conf
cp /opt/module/redis-6.0.8/redis.conf ~/my_redis.conf
10.更改配置文件
vim my_redis.conf;
1.将 daemonize no 改为 daemonize yes ,让服务在后台启动
2.注释掉bind 127.0.0.1
3.protected-mode默认为yes,修改为no
11.后台启动redis
redis-server ~/my_redis.conf
12.用客户端访问
redis-cli
127.0.0.1:6379>
13.测试验证
127.0.0.1:6379> ping
PONG
127.0.0.1:6379>
13. 单实例关闭Redis
redis-cli
shutdown
14. 多实例关闭Redis,指定端口关闭
redis-server ~/my_redis.conf
redis-cli -p 6379 shutdown
IDEA连接Redis时需注意:
1)禁用Linux防火墙
[atguigu@hadoop102 ~]$ sudo systemctl stop firewalld
[atguigu@hadoop102 ~]$ sudo systemctl disable firewalld
2)修改redis.conf
注释掉bind 127.0.0.1
protected-mode默认为yes,修改为no