centos 7.6 配置IP,防火墙、安装Docker、node、yarn 以及Docker安装mysql和redis

centos 7.6
ip addr
vi /etc/sysconfig/network-scripts/ifcfg-eth0

TYPE=Ethernet
BOOTPROTO=static
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
NAME=eno16777736
UUID=34bbe4fa-f0b9-4ced-828a-f7f7e1094e4a
DEVICE=eno16777736
ONBOOT=yes
PEERDNS=yes
PEERROUTES=yes
IPV6_PEERDNS=yes
IPV6_PEERROUTES=yes
IPADDR=192.168.179.3
NETMASK=255.255.255.0
GATEWAY=192.168.179.2

-- -----------------------------------------------------
安装 wget
yum -y install wget
yum install lrzsz //使用shell上传下载方便
-- -----------------------------------------------------
禁用Selinux, 修改/etc/selinux/config 文件,将SELINUX=enforcing改为SELINUX=disabled,重启机器即可
-- -----------------------------------------------------
安装docker
首先备份yum 源
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
下载阿里云的yum源 根据系统版本安装
CentOS 5
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-5.repo

CentOS 6
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo

CentOS 7
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo

再安装epel 的yum 源 根据系统版本安装
epel(RHEL 7)
wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo

epel(RHEL 6)
wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-6.repo

epel(RHEL 5)
wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-5.repo

然后生成缓存
yum clean all
yum makecache
先安装docker依赖
yum install lxc libcgroup device-mapper-event-libs
然后再安装docker
yum install docker-io

安装完成后查看docker版本
docker -v

将docker 开机自启
chkconfig docker on
service docker start
----------------------------------------------------------------------
防火墙
firewall-cmd --zone=public --list-ports //firewall-cmd --zone=public --query-port=3306/tcp

firewall-cmd --zone=public --add-port=3306/tcp --permanent //关闭 firewall-cmd --zone=public --remove-port=80/tcp --permanent
firewall-cmd --zone=public --add-port=6379/tcp --permanent
firewall-cmd --zone=public --add-port=80/tcp --permanent
firewall-cmd --zone=public --add-port=3307/tcp --permanent
firewall-cmd --zone=public --add-port=3308/tcp --permanent
firewall-cmd --zone=public --add-port=3309/tcp --permanent
firewall-cmd --zone=public --add-port=3310/tcp --permanent
firewall-cmd --zone=public --add-port=3000/tcp --permanent
firewall-cmd --reload
----------------------------------------------------------------------
https://hub.docker.com/_/mysql?tab=tags
docker pull mysql:8.0
docker images
//docker run -it docker.io/mysql:8.0 /bin/bash

docker run --name mysql8 -p 3306:3306 -e MYSQL_ROOT_PASSWORD=11111111 --privileged=true -d docker.io/mysql:8.0
docker update --restart=always mysql8

docker exec -it mysql8 /bin/bash
mysql -u root -p
use mysql;
ALTER USER ‘root‘@‘localhost‘ IDENTIFIED WITH mysql_native_password BY ‘11111111‘;
ALTER USER ‘root‘@‘%‘ IDENTIFIED WITH mysql_native_password BY ‘11111111‘;
flush privileges;
docker restart mysql8
----------------------------------------------------------------------
docker pull redis:5.0
docker run --name redis5 -p 6379:6379 -d --restart=always redis:5.0 redis-server --appendonly yes --requirepass "11111111"
----------------------------------------------------------------------

wget https://nodejs.org/dist/v12.16.1/node-v12.16.1-linux-x64.tar.xz
tar -xvf node-v12.16.1-linux-x64.tar.xz
mkdir /usr/local/nodejs12
mv node-v12.16.1-linux-x64/* /usr/local/nodejs12
ln -s /usr/local/nodejs12/bin/npm /usr/local/bin/
ln -s /usr/local/nodejs12/bin/node /usr/local/bin/
node-v
----------------------------------------------------------------------
安装 yarn
curl --silent --location https://dl.yarnpkg.com/rpm/yarn.repo | sudo tee /etc/yum.repos.d/yarn.repo
sudo yum install yarn
yarn global add pm2
//curl --silent --location https://rpm.nodesource.com/setup_8.x | sudo bash -
----------------------------------------------------------------------
yum -y install httpd*
rpm -qa | grep httpd
/etc/httpd/conf/httpd.conf # 主配置文件
/var/www/html # 默认网站家目录

vi /etc/httpd/conf/httpd.conf

 

 

 

 

 

 

 

 

 

 

 

 

 

 


安装mysql
wget https://cdn.mysql.com//Downloads/MySQL-8.0/mysql-8.0.19-linux-glibc2.12-x86_64.tar.xz
tar -vxf mysql-8.0.19-linux-glibc2.12-x86_64.tar.xz
mkdir /usr/local/mysql8
mv mysql-8.0.19-linux-glibc2.12-x86_64/* /usr/local/mysql8
cd /usr/local/mysql8


//添加 mysql 组
groupadd mysql
//添加 mysql 用户
useradd -r -g mysql mysql

//检查是否安装了 libaio
rpm -qa | grep libaio
//若没有则安装
//版本检查
yum search libaio
//安装
yum -y install libaio

 

cd /usr/local/mysql8

 

 

 

 

centos 7.6 配置IP,防火墙、安装Docker、node、yarn 以及Docker安装mysql和redis

上一篇:JSP+Servlet+JDBC+mysql实现的学生成绩管理系统


下一篇:禁止执行某些讨厌的程序,如tadb.exe