Last active
October 3, 2019 16:36
-
-
Save perfecto25/df358c4597d64f9ed58efcf85fbee274 to your computer and use it in GitHub Desktop.
Install python 3.7 on Centos 7 or Ubuntu 16
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # Installs Python 3.7 on Centos 7 | |
| yum -y install libffi-devel gcc openssl-devel bzip2-devel | |
| cd /usr/src | |
| wget https://www.python.org/ftp/python/3.7.0/Python-3.7.0.tgz | |
| tar xzf Python-3.7.0.tgz | |
| cd Python-3.7.0/ | |
| ./configure --enable-optimizations | |
| make altinstall | |
| rm -f /tmp/Python-3.7.0.tgz | |
| rm -rf /tmp/Python-3.7.0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # Installs Python 3.7 on Ubuntu 16+ | |
| cd /usr/src | |
| sudo apt-get install build-essential checkinstall gcc | |
| sudo apt-get install libreadline-gplv2-dev libncursesw5-dev libssl-dev \ | |
| libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev | |
| sudo wget https://www.python.org/ftp/python/3.7.0/Python-3.7.0.tgz | |
| sudo tar xzf Python-3.7.0.tgz | |
| cd Python-3.7.0 | |
| sudo ./configure --enable-optimizations | |
| sudo make altinstall | |
| rm -rf /usr/src/Python-3.7.0* |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ## Saltstack State - installs Python 3.7.4 + sqlite | |
| {% set version = '3.7.4' %} | |
| {% set pkgs = ['libffi-devel', 'gcc', 'openssl-devel', 'bzip2-devel', 'wget'] %} | |
| {% for pkg in pkgs %} | |
| {{ pkg }}_install: | |
| pkg.installed: | |
| - name: {{ pkg }} | |
| {% endfor %} | |
| ## add SQLite module | |
| sqlite_tar: | |
| archive.extracted: | |
| - name: /opt/sqlite_tmp | |
| - source: https://www.sqlite.org/2019/sqlite-autoconf-3290000.tar.gz | |
| - skip_verify: True | |
| sqlite_make: | |
| cmd.run: | |
| - name: ./configure && make && make install | |
| - cwd: /opt/sqlite_tmp/sqlite-autoconf-3290000 | |
| - unless: test -f /usr/local/bin/sqlite3 | |
| # unarchive in /opt since /tmp is disabled for executables (CIS compliance) | |
| python_tar: | |
| archive.extracted: | |
| - name: /opt/python37tmp | |
| - source: https://www.python.org/ftp/python/{{ version }}/Python-{{ version }}.tgz | |
| - skip_verify: True | |
| configure_and_make: | |
| cmd.run: | |
| - name: ./configure --enable-optimizations && make altinstall | |
| - cwd: /opt/python37tmp/Python-{{ version }} | |
| - unless: test -f /usr/bin/python3.7 | |
| /usr/bin/python3.7: | |
| file.symlink: | |
| - target: /usr/local/bin/python3.7 | |
| remove_python_tmp: | |
| cmd.run: | |
| - name: rm -rf /opt/python37tmp | |
| - onlyif: test -f /opt/python37tmp | |
| remove_sqlite_tmp: | |
| cmd.run: | |
| - name: rm -rf /opt/sqlite_tmp | |
| - onlyif: test -f /opt/sqlite_tmp |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment