(用以模拟生成环境)
详情参见:传送门
1、添加yum源
#一定注意版本
#curl 下载阿里镜像源
curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
#rpm 安装官方-EPEL源
rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
#更新
yum clean all && yum makecache
yum update && yum upgrade
2、安装yum辅助工具
yum install -y yum-utils device-mapper-persistent-data lvm2
1、安装net-tools:用于执行ifconfig等命令,查看网卡情况
yum install -y net-tools
2、安装vim:编辑文件,能优化vi操作
yum install -y vim
3、安装lrzsz:文件传输工具
yum install -y lrzsz
4、安装wget:文件下载工具
yum install -y wget
5、安装lsof:端口查看工具
yum install -y lsof
6、安装pip:python包管理工具
#默认是python2.7的
yum install -y python-pip
7、安装zip:解压zip包工具
yum install -y zip unzip
yum install -y glibc-devel make ncurses-devel openssl-devel xmlto curl-devel expat-devel gettext-devel zlib-devel perl-ExtUtils-MakeMaker
1、安装gcc:c语言环境
yum install -y gcc
2、安装openjdk:java语言环境
#只安装java,会缺少javac
yum install -y java
yum install -y java-devel
3、安装python3:python语言环境
#centos自带python2.7,只需要python3
yum install -y python34
#安装pip
yum install -y python34-pip
4、安装erlang:支持go语言环境
#源码下载(贼他妈慢,最好用代理加速)
wget http://erlang.org/download/otp_src_21.2.tar.gz
#进入解压
cd otp_src_21.2 && tar -zxvf otp_src_21.2.tar.gz
#编译
./configure --prefix=/usr/local/erlang --enable-hipe --enable-threads --enable-smp-support --enable-kernel-poll --without-javac
make && make install
#添加环境
echo "export PATH:$PATH:/usr/local/erlang/bin"
#测试
erl
5、安装nodejs:支持JavaScript语言
#下载源码
wget https://npm.taobao.org/mirrors/node/v10.14.2/node-v10.14.2-linux-x64.tar.gz
#解压
tar -zxvf node-v10.14.2-linux-x64.tar.gz
#指定环境
echo "export PATH=$PATH:/usr/local/nodejs/bin"
#检测
node --version
6、安装perl:支持perl语言
wget https://www.cpan.org/src/5.0/perl-5.28.1.tar.gz
tar -xzf perl-5.28.1.tar.gz
cd perl-5.28.1
./Configure -des -Dprefix=$HOME/localperl
make && make install
#临时关闭
systemctl stop firewalld
#禁止开机启动
systemctl disable firewalld
#关闭selinux安全策略
vim /etc/selinux/config
#设置
SELINUX=disable
#添加
firewall-cmd --zone=public --add-port=80/tcp --permanent
#重新载入
firewall-cmd --reload
#查看
firewall-cmd --zone= public --query-port=80/tcp
#删除
firewall-cmd --zone= public --remove-port=80/tcp --permanent
#修改hosts文件
vim /etc/hosts
#插入目标映射
xxIP xxName
#生成rsa密钥
ssh-keygen -t rsa
#将ssh 添加到认证文件
ssh-copy-id -i xxName
#下载安装包
wget http://mirrors.shu.edu.cn/apache/maven/maven-3/3.6.0/binaries/apache-maven-3.6.0-bin.tar.gz
#解压
tar -zxvf apache-maven-3.6.0-bin.tar.gz
#添加环境变量
echo "export PATH=$PATH:/usr/local/maven/bin"
#测试
mvn --version
#傻瓜式
yum install -y maven
#下载源码
wget https://mirrors.edge.kernel.org/pub/software/scm/git/git-2.19.2.tar.gz
#编译源码
tar -zxvf git-2.19.2.tar.gz
cd git-2.19.2
./configure --prefix=/usr/local/git
make && make install
#添加环境变量
echo "export PATH=$PATH:/usr/local/git/bin"
#检查版本
git --version
#傻瓜式
yum install -y git
#下载官方源
wget -i -c http://dev.mysql.com/get/mysql80-community-release-el7-1.noarch.rpm
#安装源
yum -y install mysql80-community-release-el7-1.noarch.rpm
#安装mysql
yum -y install mysql-community-server
#检查版本
mysql --version
#傻瓜式
yum install -y mysql
wget http://download.redis.io/releases/redis-5.0.3.tar.gz
tar xzf redis-5.0.3.tar.gz
cd redis-5.0.3
make
#添加环境
echo "export PATH=$PATH:/usr/local/redis/src"
#测试
redis-cli --version
#前面安装的erlang如果版本不对或者太慢,可以采用下面方式安装
vim /etc/yum.repos.d/rabbitmq-erlang.repo
#插入
[rabbitmq-erlang]
name=rabbitmq-erlang
baseurl=https://dl.bintray.com/rabbitmq/rpm/erlang/20/el/7
gpgcheck=1
gpgkey=https://dl.bintray.com/rabbitmq/Keys/rabbitmq-release-signing-key.asc
repo_gpgcheck=0
enabled=1
#更新
yum clean all && yum makecache
#下载源码
wget https://dl.bintray.com/rabbitmq/rpm/rabbitmq-server/v3.7.x/el/7/noarch/rabbitmq-server-3.7.9-1.el7.noarch.rpm
#安装
yum install rabbitmq-server-3.7.4-1.el7.noarch.rpm
#启动RabbitMQ服务
#service rabbitmq-server start
#状态查看
rabbitmqctl status
启用插件
#rabbitmq-plugins enable rabbitmq_management
重启服务
#service rabbitmq-server restart
添加帐号:name 密码:passwd
#rabbitmqctl add_user name passwd
赋予其administrator角色
#rabbitmqctl set_user_tags name administrator
设置权限
#rabbitmqctl set_permissions -p / name ".*" ".*" ".*"
#编写yum软件源
vim /etc/yum.repos.d/elk.repo
#插入
[elk]
name=elk
baseurl=https://mirrors.tuna.tsinghua.edu.cn/elasticstack/yum/elastic-6.x/
enable=1
gpgcheck=0
#安装
yum install elasticsearch logstash kibana filebeat -y
#添加head插件
cd /usr/share/elasticsearch/plugins
git clone git://github.com/mobz/elasticsearch-head.git
cd elasticsearch-head
npm install
#添加docker源
yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
#安装
yum install -y docker-ce
#检测
docker --version
#先覆盖下载源
#添加环境变量
echo "MAVEN_HOME=/usr/local/maven
GIT_HOME=/usr/local/git
ERLANG_HOME=/usr/local/erlang
REDIS_HOME=/usr/local/redis
NODE_HOME=/usr/local/nodejs
export PATH=\$PATH:\$GIT_HOME/bin:\$MAVEN_HOME/bin:\$ERLANG_HOME/bin:\$REDIS_HOME/src:\$NODE_HOME/bin
" >> /etc/profile
source /etc/profile
#进入软件安装目录
cd /usr/local/
#手动更改默认软件源
yum clean all && yum makecache
#下载yum辅助工具
yum install -y yum-utils device-mapper-persistent-data lvm2
#安装基础工具
yum install -y net-tools
yum install -y vim
yum install -y lrzsz
yum install -y wget
yum install -y lsof
yum install -y zip unzip
#安装编译工具
yum install -y glibc-devel make ncurses-devel openssl-devel xmlto
#安装语言环境
yum install -y gcc
yum install -y java
yum install -y java-devel
yum install -y python34
yum install -y python34-pip
wget https://npm.taobao.org/mirrors/node/v10.14.2/node-v10.14.2-linux-x64.tar.gz
tar -zxvf node-v10.14.2-linux-x64.tar.gz
mv node-v10.14.2-linux-x64 nodejs
wget https://www.cpan.org/src/5.0/perl-5.28.1.tar.gz
tar -xzf perl-5.28.1.tar.gz
cd perl-5.28.1
./Configure -des -Dprefix=/usr/local/perl
make && make install
cd /usr/local
#关闭防火墙
systemctl stop firewalld
systemctl disable firewalld
#配置ssh
#echo "192.168.10.xx linuxx" >> /etc/hosts
#ssh-keygen -t rsa
#ssh-copy-id -i linuxx
#安装Maven
wget https://archive.apache.org/dist/maven/maven-3/3.6.1/binaries/apache-maven-3.6.1-bin.tar.gz
tar -zxvf apache-maven-3.6.1-bin.tar.gz
mv apache-maven-3.6.1 maven
#安装git
wget https://mirrors.edge.kernel.org/pub/software/scm/git/git-2.19.2.tar.gz
#编译源码
tar -zxvf git-2.19.2.tar.gz
cd git-2.19.2
./configure --prefix=/usr/local/git
make && make install
cd /usr/local
#安装mysql
yum -y install mysql-community-server
#安装redis
wget http://download.redis.io/releases/redis-5.0.3.tar.gz
tar xzf redis-5.0.3.tar.gz
mv redis-5.0.3 redis
cd redis
make
cd /usr/local
#安装rabbitmq
#下载源码
wget https://dl.bintray.com/rabbitmq/rpm/rabbitmq-server/v3.7.x/el/7/noarch/rabbitmq-server-3.7.9-1.el7.noarch.rpm
#安装
yum install rabbitmq-server-3.7.4-1.el7.noarch.rpm
#启动RabbitMQ服务
service rabbitmq-server start
#启用插件
rabbitmq-plugins enable rabbitmq_management
#重启服务
service rabbitmq-server restart
#添加帐号:name 密码:passwd
rabbitmqctl add_user admin 123456
#赋予其administrator角色
rabbitmqctl set_user_tags admin administrator
#设置权限
rabbitmqctl set_permissions -p / admin ".*" ".*" ".*"
#安装ELK
yum install elasticsearch logstash kibana filebeat -y
#添加head插件
cd /usr/share/elasticsearch/plugins
git clone git://github.com/mobz/elasticsearch-head.git
cd elasticsearch-head
npm install
cd /usr/local
#安装docker
yum install -y docker-ce
#最后更新yum
yum update && yum upgrade