worldsnow 2020-11-06
Fast-Linux 项目地址:https://gitee.com/uitc/Fast-Linux
介绍
Linux初始化和一些常用环境的搭建是一个虽简单但费时的工作,尤其是你的Linux由于某种不可控的因素宕机了,这意味着你又要从头开始部署一遍环境,有些令人抓狂,因此我有了搭建这个Linux初始化脚本库的想法,不管小白还是大佬,只需一键运行,然后喝杯咖啡,环境便可搭建成功,岂不美滋滋?
由于个人能力有限,只能总结我碰到的环境脚本(我是Java开发,不熟悉python,c/c++等)
由于linux版本众多,开发环境也多种多样,因此这是一个需要大家一起贡献才能越来越强大的仓库,欢迎大家 fork push start!!!
使用教程
git clone https://gitee.com/qiu-qian/Fast-Linux.git
克隆该项目cd Fast-Linux/ubuntu/ubuntu16-04/
chmod 700 start.sh
./start.sh
脚本更新日志
(注:如需提交,请在该日志后追加,说明你增加的脚本路径及环境组合,统一格式,方便管理)
2020/7/26
#设置apt源 echo "deb http://mirrors.aliyun.com/ubuntu/ xenial main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiversec" >/etc/apt/sources.list #更新apt源 apt-get update #允许root用户通过ssh远测登录 sed -i "s/PermitRootLogin prohibit-password/#PermitRootLogin prohibit-password\nPermitRootLogin yes/g" /etc/ssh/sshd_config #重启ssh服务 service ssh restart #向用户变量中追加系统命令,防止重启命令失效 echo 'export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games' >>/etc/profile #新建文件夹,分配资源 mkdir /usr/local/java mkdir /usr/local/maven cp settings.xml /usr/local/maven #安装Java cd /usr/local/java #下载java安装包 curl -o jdk-8u251-linux-x64.tar.gz https://code.aliyun.com/kar/oracle-jdk/raw/3c932f02aa11e79dc39e4a68f5b0483ec1d32abe/jdk-8u251-linux-x64.tar.gz tar -zxvf jdk-8u251-linux-x64.tar.gz rm jdk-8u251-linux-x64.tar.gz #追加java的系统环境变量(所有用户皆可使用) echo 'export JAVA_HOME=/usr/local/java/jdk1.8.0_251' >>/etc/environment echo 'export JRE_HOME=/usr/local/java/jdk1.8.0_251/jre' >>/etc/environment echo 'export CLASSPATH=$CLASSPATH:$JAVA_HOME/lib:$JAVA_HOME/jre/lib' >>/etc/environment echo 'export PATH=$JAVA_HOME/bin:$JAVA_HOME/jre/bin:$PATH:$HOME/bin' >>/etc/environment #追加java的用户环境变量 echo 'export JAVA_HOME=/usr/local/java/jdk1.8.0_251' >>/etc/profile echo 'export JRE_HOME=/usr/local/java/jdk1.8.0_251/jre' >>/etc/profile echo 'export CLASSPATH=$CLASSPATH:$JAVA_HOME/lib:$JAVA_HOME/jre/lib' >>/etc/profile echo 'export PATH=$JAVA_HOME/bin:$JAVA_HOME/jre/bin:$PATH:$HOME/bin' >>/etc/profile #安装maven cd /usr/local/maven #下载maven安装包 curl -o apache-maven-3.6.3-bin.tar.gz https://mirrors.tuna.tsinghua.edu.cn/apache/maven/maven-3/3.6.3/binaries/apache-maven-3.6.3-bin.tar.gz tar -zxvf apache-maven-3.6.3-bin.tar.gz rm apache-maven-3.6.3-bin.tar.gz #追加maven的系统环境变量(所有用户皆可使用) echo 'export M2_HOME=/usr/local/maven/apache-maven-3.6.3' >>/etc/environment echo 'export CLASSPATH=$CLASSPATH:$M2_HOME/lib' >>/etc/environment echo 'export PATH=$PATH:$M2_HOME/bin' >>/etc/environment #追加maven的用户环境变量 echo 'export M2_HOME=/usr/local/maven/apache-maven-3.6.3' >>/etc/profile echo 'export CLASSPATH=$CLASSPATH:$M2_HOME/lib' >>/etc/profile echo 'export PATH=$PATH:$M2_HOME/bin' >>/etc/profile #新建maven仓库 mkdir repository #修改maven的配置文件 # rm apache-maven-3.6.3/conf/settings.xml mv settings.xml apache-maven-3.6.3/conf #重启 reboot
#docker环境搭建脚本 #下载docker curl -fsSL get.docker.com -o get-docker.sh # sh get-docker.sh --mirror Aliyun sh get-docker.sh --mirror AzureChinaCloud #配置镜像加速 echo "{\"registry-mirrors\": [\"https://qy5lms4s.mirror.aliyuncs.com\"]}" >/etc/docker/daemon.json #重启服务 systemctl daemon-reload systemctl restart docker #拉取ubuntu:16.04测试 docker pull ubuntu:16.04 #docker-compose的安装 curl -L https://get.daocloud.io/docker/compose/releases/download/1.25.4/docker-compose-$(uname -s)-$(uname -m) >/usr/local/bin/docker-compose chmod +x /usr/local/bin/docker-compose