python3.6.4源码安装
该脚本适合centos6和ubuntu用,关于debian可以根据脚本中的范例自己添加
微笑哥与你每天进步一点点
#!/bin/bash
#
#Check system
check_sys(){
local checkType=$1
local value=$2
local release=''
local systemPackage=''
if [[ -f /etc/redhat-release ]]; then
release="centos"
systemPackage="yum"
elif cat /etc/issue | grep -Eqi "debian"; then
release="debian"
systemPackage="apt"
elif cat /etc/issue | grep -Eqi "ubuntu"; then
release="ubuntu"
systemPackage="apt"
elif cat /etc/issue | grep -Eqi "centos|red hat|redhat"; then
release="centos"
systemPackage="yum"
elif cat /proc/version | grep -Eqi "debian"; then
release="debian"
systemPackage="apt"
elif cat /proc/version | grep -Eqi "ubuntu"; then
release="ubuntu"
systemPackage="apt"
elif cat /proc/version | grep -Eqi "centos|red hat|redhat"; then
release="centos"
systemPackage="yum"
fi
if [[ ${checkType} == "sysRelease" ]]; then
if [ "$value" == "$release" ]; then
return 0
else
return 1
fi
elif [[ ${checkType} == "packageManager" ]]; then
if [ "$value" == "$systemPackage" ]; then
return 0
else
return 1
fi
fi
}
# Get version
getversion(){
if [[ -s /etc/redhat-release ]]; then
grep -oE "[0-9.]+" /etc/redhat-release
else
grep -oE "[0-9.]+" /etc/issue
fi
}
pre_install(){
if check_sys packageManager yum || check_sys packageManager apt; then
# Not support CentOS 5
if centosversion 5; then
echo -e "$[{red}Error${plain}] Not supported CentOS 5, please change to CentOS 6+/Debian 7+/Ubuntu 12+ and try again."
exit 1
fi
else
echo -e "[${red}Error${plain}] Your OS is not supported. please change OS to CentOS/Debian/Ubuntu and try again."
exit 1
fi
}
local_IP=`curl -s ident.me`
if check_sys packageManager yum; then
echo ""
echo ""
echo "=======安装前请把yum源配好,(ctrl + c停止)======="
echo "您的系统是:`cat /etc/centos-release`"
echo "您的内核是:`uname -r`"
echo "您的外网publicIP是:$local_IP"
#centos的设置倒计时
kk=5
echo "时间同步中,请稍候....."
service ntpd start >/dev/null
echo $? >/dev/null
if [ $? -ne 0 ];then
yum -y install ntpd && service ntpd start >/dev/null
fi
ntpdate time.nist.gov >/dev/null
hwclock --systohc >/dev/null
hwclock -w >/dev/null
while [ $kk -gt 0 ];do
echo -n $kk
sleep 1
kk=$(($kk - 1))
echo -ne "\r \r"
done
fi
#系统判断
if check_sys packageManager apt; then
echo ""
echo ""
echo "=======安装前请把yum源配好,(ctrl + c停止)======="
echo "您的系统是:`cat /etc/issue`"
echo "您的内核是:`uname -r`"
echo "您的外网publicIP是:$local_IP"
#ubuntu的设置倒计时
if check_sys packageManager apt; then
echo ""
echo ""
echo "=======安装前请把yum源配好,(ctrl + c停止)======="
echo "您的系统是:`cat /etc/issue`"
echo "您的内核是:`uname -r`"
echo "您的外网publicIP是:$local_IP"
kk=5
echo "时间同步中,请稍候....."
service ntp start >/dev/null
echo $? >/dev/null
if [ $? -ne 0 ];then
sudo apt install ntp || service ntp restart >/dev/null
fi
sudo hwclock --systohc >/dev/null
sudo hwclock -w >/dev/null
while [ $kk -gt 0 ];do
echo -n $kk
sleep 1
kk=$(($kk - 1))
echo -ne "\r \r"
done
fi
#按任意键开始设置
get_char()
{
SAVEDSTTY=`stty -g`
stty -echo
stty raw
dd if=/dev/tty bs=1 count=1 2> /dev/null
stty -raw
stty echo
stty $SAVEDSTTY
}
sleep 3
echo "时间同步完毕,按任意键继续...."
char=`get_char`
#系统确定后的执行命令
if check_sys packageManager yum;then
yum install -y wget readline-devel gcc*
elif check_sys packageManager apt; then
sudo apt-get -y update
sudo apt-get -y install wget lrzsz gcc make \
libbz2-dev libsqlite3-dev python3-dev libxml2-dev libffi-dev libssl-dev zlib1g-dev
fi
if [ ! -d /opop ];then
mkdir /opop
fi
cd /opop/
wget https://www.python.org/ftp/python/3.6.4/Python-3.6.4.tgz
tar -zxvf Python-3.6.4.tgz || tar -xf Python-3.6.4.tgz ./
cd Python-3.6.4
./configure --prefix=/usr/local/python3
make && make install
ln -sv /usr/local/python3/bin/python3.6 /usr/bin/
echo -e "\t\t#####################"
echo -e "\t\t# 输入exit()可退出 #"
echo -e "\t\t#####################"
python3.6
python3.6.4源码安装的更多相关文章
- linux中的源码安装
前两天自己在笔记本上装了CentOs版本的虚拟机,接着要装Python3,是源码安装的挺费劲,个人总结了一些源码安装的经验,今天在这里给大家分享一下. 1. 首先准备环境,安装必要的编译工具gcc g ...
- CentOS6.5源码安装python3.5.2
前提: 1.实现自动补全需要安装模块 readline-devel (yum install -y readline-devel) 2.实现支持SSL协议需安装模块 openssl-devel (yu ...
- centos7源码安装Python3的前提条件
centos7源码安装Python3的前提条件: # yum -y install openssl-devel bzip2-devel expat-devel gdbm-devel readline- ...
- CentOS7 下源码安装 python3
CentOS 7 下源码安装 python3 在CentOS7下,默认安装的是python2.7:为满足项目要求,安装python3 的方法如下: 1. 首先安装python3.6可能使用的依 ...
- [Dynamic Language] Python3.7 源码安装 ModuleNotFoundError: No module named '_ctypes' 解决记录
Python3.7 源码安装 ModuleNotFoundError: No module named '_ctypes' 解决记录 源码安装时报错 File "/home/abeenser ...
- 源码安装Python3
源码安装Python3 一.安装Python3需要的依赖包 [root@localhost ~]# yum install -y gcc make wget openssl openssl-devel ...
- centos 服务器装与python34源码安装
http://www.111cn.net/sys/CentOS/63645.htm 1.CentOS安装Python的依赖包(不安装依赖包,会导致python安装不完整) yum groupinsta ...
- 源码安装python +NGINX 的坎坷路 +uwsgi安装 部署django 的CRM项目
一.Nginx安装(基于ubuntu17.10 版本) 首先我们是基于源码安装,主要有如下步骤 1.安装依赖包 1.安装gcc g++的依赖库 sudo apt-get install build-e ...
- CentOS6源码安装vim8
CentOS6源码安装vim8 vim8相比vim7多了很多功能. 不过需要源码来进行安装. 移除旧版本的vim yum remove vim 安装依赖库 sudo yum install -y ru ...
随机推荐
- APP(通信)接口定义
- link标签链接CSS和@import加载的区别
link:基本语法 <link rel="stylesheet" href="路径"> @import 基本语法 <style> @im ...
- switch和if语句
if :基本语法: 1.单分支语句 : if(条件){代码块}else{代码块} 2.多分支语句 :if(条件){代码块} else if(条件){代码块}else{代码块} * 不要忘记添加else ...
- 【代码笔记】Web-ionic tab(选项卡)
一,效果图. 二,代码. <!DOCTYPE html> <html> <head> <meta charset="utf-8"> ...
- CSS盒模型的介绍
CSS盒模型的概念与分类 CSS盒模型就是一个盒子,封装周围的HTML元素,它包括内容content.边框border.内边距padding.外边距margin. CSS盒模型分为标准模型和 ...
- [LTR] RankLib.jar 包介绍
一.介绍 RankLib.jar 是一个学习排名(Learning to rank)算法的库,目前已经实现了如下几种算法: MART RankNet RankBoost AdaRank Coordin ...
- [20171107]dbms_shared_pool.pin补充.txt
[20171107]dbms_shared_pool.pin补充.txt --//上午的测试,做一些补充,主要还是一些理解问题. 1.环境:SCOTT@book> @ &r/ver1 P ...
- JMeter—前置处理器(九)
参考<全栈性能测试修炼宝典JMeter实战>第六章 JMeter 元件详解中第四节前置处理器前置处理器用来处理请求前的一些准备工作,比如参数设置.环境变变量设置等 一.BeanShell ...
- C#基础(数据类型运算符)
---恢复内容开始--- 1.类 修饰符 class 类名 基类或接口 { } 2.命名规范 成员变量前加_ 首字符小写,后面单词首字母大写(Camel规则) 接口首字母为I 方法的命名使用动词 所有 ...
- Node.js中文乱码解决方法