docker
install
echo "# 添加国内yum 源"
wget -O /etc/yum.repos.d/docker-ce.repo https://download.docker.com/linux/centos/docker-ce.repo
sudo sed -i 's+download.docker.com+mirrors.tuna.tsinghua.edu.cn/docker-ce+' /etc/yum.repos.d/docker-ce.repo
echo "# 更新 yum 软件源缓存"
sudo yum makecache fast
echo "# 安装"
sudo yum install docker-ce-18.06.3.ce-3.el7 -y
mkdir -p /etc/docker
echo "#设置docker配置"
cat <<EOF | sudo tee /etc/docker/daemon.json
{
"exec-opts": ["native.cgroupdriver=systemd"],
"registry-mirrors": ["https://u9nigs6v.mirror.aliyuncs.com","https://docker.mirrors.ustc.edu.cn"],
"log-driver": "json-file",
"log-opts": {
"max-size": "100m"
},
"storage-driver": "overlay2",
"storage-opts": [
"overlay2.override_kernel_check=true"
]
}
EOF
echo "#启动 Docker CE"
sudo systemctl enable docker & systemctl start docker & systemctl status docker
echo "#测试 Docker 是否安装正确"
docker info
start
sudo systemctl start docker
nginx
install
yum install nginx -y
remove
yum remove nginx
start
nginx
redis
install
# 安装gcc环境 如果没有安装gcc会出现错误(此时需要删除文件夹重新解压)
yum install gcc-c++ -y
# 将redis-5.0.5.tar.gz下载到/home
cd /home
wget http://download.redis.io/releases/redis-5.0.5.tar.gz
tar xzf redis-5.0.5.tar.gz
cd redis-5.0.5
# 编译
make
# 安装到/usr/local/redis目录下
make PREFIX=/usr/local/redis install
# 拷贝配置文件
cp redis.conf /usr/local/redis/
start
direct
/usr/local/redis/bin/redis-server
back
# 设置daemonize为yes
vim /usr/local/redis/redis.conf
# redis-server根据redis.conf文件启动redis
cd /usr/local/redis/
./bin/redis-server ./redis.conf
# 启动后查看redis默认端口号为6379
ps -ef | grep -i redis
# 关闭redis
./bin/redis-cli shutdown