定时下载任务脚本
https://blog.csdn.net/woaizxy123/article/details/88660759
docker安装
- 更新yum源:
yum -y upgrade
,yum -y update
- 下载repo镜像:
wget https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo -O /etc/yum.repos.d/docker-ce.repo
- 安装repo镜像:
yum -y install docker-ce-18.06.1.ce-3.el7
- 启动:
systemctl enable docker && systemctl start docker
- 部署daocloud监控脚本
- 拉取nginx镜像:
dao pull nginx
- 开启nginx容器:
docker run -it -p 80:80 nginx bin/bash
- 查看nginx在哪:
which nginx
- 开启nginx:
./nginx
- 在浏览器可以访问了
docker中mysql安装
- 基于centos7做mysql镜像
- 拉取镜像:
dao pull centos:7
- 起服务:
docker run -it --name mysql5.7 -p 3306:3306 centos:7 bin/bash
- yum安装wget:
yum -y install wget
- 切换到用户家目录:
cd ~
- wget下载rpm包:
wget http://repo.mysql.com/mysql57-community-release-el7-8.noarch.rpm
- rpm安装mysql:
rpm -ivh mysql57-community-release-el7-8.noarch.rpm
- 安装:
yum -y install mysql-server
- 制作镜像:docker commit 容器id 别名
- 进docker里无法使用systemctl问题:
docker run -it --name mysql5.7 --privileged=true -p 3306:3306 mysql5.7 /usr/sbin/init
- 相当于初始化一下 /usr/sbin/init
- 再次连接必须通过:
docker exec -it 容器id bin/bash
进入才能交互式的操作 - 进去之后启动mysql服务就可以了
- 获取默认密码或免密码登录:
vim /etc/my.cnf
skip-grant-tables
use mysql
update mysql.user set authentication_string=password('yourpassword') where user='root' ;
flush privileges;
- 注释掉
skip-grant-tables
后重启数据库 - 配置可以远程登录:
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'yourpassword' WITH GRANT OPTION;
- 测试连接:
telnet ip port
- 放通云服务器安全组:ALL 、 TCP:3306
- 一般数据要挂在到外面,因为容器是有声明周期的,如果挂了就gg了
- https://cloud.tencent.com/developer/article/1531789
- 打包镜像:docker commit 容器id 别名
- 提交到镜像仓库:docker push
- 打标签:docker tag
- 写dockerfile加add项目也可以,或者在里面通过git拉项目下来部署在docker里
- docker本质也是一个进程需要一些工具来守护进程,项目暂时不用k8s,因为团队能力有限,即使部署后出错难以排查
制作redis容器
- 基于centos7:
docker run -it --name redis5.0 --privileged=true -p 6379:6379 centos:7 /usr/sbin/init
docker exec -it 容器id bash
yum -y install wget
yum install net-tools
yum -y install gcc automake autoconf libtool make
wget http://download.redis.io/releases/redis-5.0.4.tar.gz
tar -zxvf redis-5.0.4.tar.gz
cd redis-5.0.4
make && make install
cd src
vi redis.conf
./redis-server
- 将daemonize no修改为daemonize yes
- 配置允许所有ip都可以访问redis,将bind 127.0.0.1注释掉
- 并且将protected-mode 改为no
- 配置访问密码:requirepass yourpassword
- https://blog.csdn.net/NathanniuBee/article/details/83274960:redis
Centos7安装Python
- 安装一些依赖环境
yum install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gcc make
- 添加epel扩展源
yum -y install epel-release
- 安装pip
yum install python-pip
yum install libffi-devel -y
- wget下载python源码包
wget https://www.python.org/ftp/python/3.7.5/Python-3.7.5.tgz
tar -zxvf Python-3.7.5.tgz
./configure -prefix=期望安装的位置
make && make install
Centos7安装Go环境
- wget下载源码包
wget https://dl.google.com/go/go1.13.1.linux-amd64.tar.gz
tar -zxvf go1.13.1.linux-amd64.tar.gz
- 配置环境变量
export GOROOT=/usr/local/go
export GOPATH=$HOME/桌面/go_project
export PATH=$GOPATH/bin:$GOROOT/bin:$PATH
go env -w GOPROXY=https://goproxy.cn