自己的记录
Posted Liuzhaoxuan
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了自己的记录相关的知识,希望对你有一定的参考价值。
服务器初始化及服务部署配置
初始化服务器
#关闭防火墙和selinux
systemctl stop firewalld
systemctl disable firewalld
setenforce 0
sed -i s/SELINUX=enforcing/SELINUX=disabled/g /etc/selinux/config
#配置DNS
echo "nameserver 8.8.8.8" >> /etc/resolv.conf
ping baidu.com
#配置阿里云yum源
cd /etc/yum.repos.d/
mkdir backup
mv CentOS-* backup/
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
yum makecache
yum -y install epel-release
#时间同步
yum -y install chrony
systemctl start chronyd
#磁盘扩容(逻辑卷)
lsblk
vgdisplay
lvdisplay
mkfs.xfs /dev/NAME
vgextend vgNAME /dev/NAME
vgdisplay
lvextend -l +100%free /dev/vgNAME/NAME
lvdisplay
lsblk
df -Th
xfs_growfs /dev/vgNAME/NAME
df -Th
部署服务软件
安装mysql、nginx
#安装mysql-5.7(采用yum安装方式 rpm方式)
#下载rpm包
https://downloads.mysql.com/archives/community/
#将mysql-5.7.34-1.el7.x86_64.rpm-bundle.tar包放到 /home/soft
tar -xvf mysql-5.7.34-1.el7.x86_64.rpm-bundle.tar
yum -y install *.rpm
systemctl status mysqld
systemctl start mysqld
systemctl enable mysqld
#yum安装nginx
yum -y install nginx
systemctl status nginx
systemctl start nginx
systemctl enable nginx
rpm -Uvh http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm
脚本安装jdk
#!/bin/bash
cd /opt
curl -OL http://192.168.173.110:8090/jdk-8u201-linux-x64.tar.gz
tar -xvf jdk-8u201-linux-x64.tar.gz
rm -rf /opt/jdk-8u201-linux-x64.tar.gz
mv jdk1.8.0_201 /usr/local/jdk1.8
ln -sf /usr/local/jdk1.8/bin/* /usr/bin/
# SET JAVA ENV
cd /etc/profile.d/
curl -OL http://192.168.173.110:8090/sajava.sh
source /etc/profile
安装redis
mv redis-4.0.11.tar.gz /home/soft/
tar zxvf redis-4.0.11.tar.gz
make && make install
#完成安装拷贝相对应配置文件
#启动redis
redis-server redis.conf
#如需导入数据用.rdb文件
#查看你数据是否导入成功
redis-cli -a PASSWORD
keys *
安装docker
#安装docker所需依赖
yum install -y yum-utils device-mapper-persistent-data lvm2
#下载docker源
yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
#查看docker版本
yum list docker-ce --showduplicates | sort -r
#下载
yum -y install docker-ce-18.09.9-3.el7 docker-ce-cli-18.09.9-3.el7
systemctl start docker
systemctl status docker
docker version
docker info
#安装docker-compose
curl -L https://get.daocloud.io/docker/compose/releases/download/1.29.1/docker-compose-`uname -s`-`uname -m` > /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose
#如需要docker-compose启动容器
docker-compose up -d
#docker daemon.json文件
"registry-mirrors": [
"http://hub-mirror.c.163.com",
"https://registry.docker-cn.com",
"https://docker.mirrors.ustc.edu.cn"
],
"insecure-registries":[
"192.168.173.110:5000"
]
"registry-mirrors" : [
"https://registry.docker-cn.com",
"https://docker.mirrors.ustc.edu.cn",
"http://hub-mirror.c.163.com"],
"data-root": "/home/docker", #如果需要修改docker工作目录
"insecure-registries": ["192.168.173.110:5000"]
systemctl daemon-reload
systemctl restart docker
以上是关于自己的记录的主要内容,如果未能解决你的问题,请参考以下文章