OS 换源脚本
Centos7
#!/bin/bash
cd /etc/yum.repos.d/
mkdir repo_bak
mv *.repo repo_bak/
curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo
yum clean all
yum makecache
yum install -y epel-release.noarch
yum clean all
yum makecache
yum repolist all
基础环境
Git 安装脚本
#!/bin/bash
yum remove git -y
yum install curl-devel expat-devel gettext-devel openssl-devel zlib-deve gcc-c++ perl-ExtUtils-MakeMaker -y
yum remove git -y
cd /usr/src
wget https://www.kernel.org/pub/software/scm/git/git-2.7.3.tar.gz --no-check-certificate
tar -zxvf git-2.7.3.tar.gz
cd git-2.7.3
make configure
./configure --prefix=/usr/git
make profix=/usr/git
make install
echo '#GIT_HOME' >> /etc/profile
echo 'GIT_HOME=/usr/git' >> /etc/profile
echo 'PATH=$PATH:$GIT_HOME/bin' >> /etc/profile
source /etc/profile
git --version
中间件脚本
MySQL 安装脚本
#!/bin/bash
# MySQL依赖net-tools net-tools is needed by mysql-community-server-5.7.26-1.el7.x86_64
yum install -y net-tools
rpm -e --nodeps mariadb-libs
cd /opt/
wget -c http://dev.mysql.com/get/mysql-5.7.26-1.el7.x86_64.rpm-bundle.tar
yum install libaio
tar -xvf mysql-5.7.26-1.el7.x86_64.rpm-bundle.tar
rpm -ivh mysql-community-common-5.7.26-1.el7.x86_64.rpm
rpm -ivh mysql-community-libs-5.7.26-1.el7.x86_64.rpm
rpm -ivh mysql-community-client-5.7.26-1.el7.x86_64.rpm
rpm -ivh mysql-community-server-5.7.26-1.el7.x86_64.rpm --force --nodeps
rpm -ivh mysql-community-libs-compat-5.7.26-1.el7.x86_64.rpm
# 获取mysql初始化密码
systemctl start mysqld.service
grep "password" /var/log/mysqld.log > /opt/MySQLPassWord
firewall-cmd --zone=public --add-port=3306/tcp --permanent
firewall-cmd --reload
Nginx 安装脚本
#!/bin/bash
yum install -y gcc pcre pcre-devel zlib zlib-devel openssl openssl-devel
wget http://nginx.org/download/nginx-1.16.1.tar.gz -p /opt/software
tar -zxvf /opt/software/nginx-1.16.1.tar.gz -C /data
cd /data/nginx-1.16.1
./configure --prefix=/usr/local/nginx \
--sbin-path=/usr/local/nginx/sbin/nginx \
--modules-path=/usr/local/nginx/modules \
--conf-path=/usr/local/nginx/conf/nginx.conf \
--error-log-path=/usr/local/nginx/logs/error.log \
--http-log-path=/usr/local/nginx/logs/access.log \
--pid-path=/usr/local/nginx/logs/nginx.pid \
--lock-path=/usr/local/nginx/logs/nginx.lock \
--with-http_gzip_static_module \
--with-http_ssl_module
make & make install
cd -