Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save xenophy/bbb13d841687cf061217eede409e0777 to your computer and use it in GitHub Desktop.
Save xenophy/bbb13d841687cf061217eede409e0777 to your computer and use it in GitHub Desktop.
#
# [ Setup phpenv w composer, rbenv, pyenv for CentOS 8.1 ]
#
# exec as root user.
#
#
# Packages
#
# remi and epel and enable PowerTools.
# and setup "dnf update" automaticly.
#
# Script Languages
#
# php 7.4.5 with Composer
# ruby 2.7.1
# python 3.8.2
#
# :if you want to change the version number, you should change following each language settings.
#
# [Setup Packages]
# add repos
dnf -y update;
dnf -y install http://rpms.famillecollet.com/enterprise/remi-release-8.rpm;
dnf -y install epel-release;
sed -i -e s/enabled=0/enabled=1/g /etc/yum.repos.d/CentOS-PowerTools.repo;
dnf -y install mysql mysql-devel jq zlib-devel gcc-c++ libzip libzip-devel oniguruma oniguruma-devel bzip2 re2c libicu-devel bzip2-devel sqlite-devel gcc libxml2 libxml2-devel libcurl libcurl-devel libpng libpng-devel libmcrypt libmcrypt-devel libtidy libtidy-devel libxslt libxslt-devel openssl-devel bison libjpeg-turbo-devel readline-devel autoconf;
# auto dnf update
dnf install dnf-automatic dnf-utils -y;
cp -a /etc/dnf/automatic.conf{,.org};
sed -i -e 's/^apply_updates = no/apply_updates = yes/' /etc/dnf/automatic.conf;
systemctl enable dnf-automatic.timer;
systemctl start dnf-automatic.timer;
# ----
# [Setup Script Languages]
# phpenv
cd;
git clone https://github.com/CHH/phpenv.git;
cd phpenv/bin;
./phpenv-install.sh;
cat <<EOS >> /root/.bashrc
# phpenv
export PATH="/root/.phpenv/bin:\$PATH"
eval "\$(phpenv init -)"
EOS
source ~/.bashrc;
git clone https://github.com/CHH/php-build.git ~/.phpenv/plugins/php-build;
phpenv install 7.4.5;
phpenv global 7.4.5;
php -v;
# composer install
cd ~;
curl https://getcomposer.org/installer | php;
mv composer.phar /usr/local/bin/composer;
# rbenv
cd;
git clone https://github.com/sstephenson/rbenv.git ~/.rbenv
git clone https://github.com/rbenv/ruby-build.git ~/.rbenv/plugins/ruby-build
cat <<EOS >> /root/.bashrc
# rbenv
export PATH="\$HOME/.rbenv/bin:\$PATH"
eval "\$(rbenv init -)"
EOS
source ~/.bashrc;
rbenv install 2.7.1;
rbenv global 2.7.1;
ruby -v;
# pyenv
cd;
git clone git://github.com/yyuu/pyenv.git ~/.pyenv
cat <<EOS >> /root/.bashrc
# pyenv
export PATH="\$HOME/.pyenv/bin:\$PATH"
eval "\$(pyenv init -)"
EOS
source ~/.bashrc;
pyenv install 2.7.17;
pyenv install 3.8.2;
pyenv global 3.8.2;
python --version;
# ----
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment