Skip to content

Instantly share code, notes, and snippets.

@simonkuang
Last active April 28, 2021 06:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save simonkuang/57fdb6b028c3e63d65a5165badb2da78 to your computer and use it in GitHub Desktop.
Save simonkuang/57fdb6b028c3e63d65a5165badb2da78 to your computer and use it in GitHub Desktop.
Init composer environment in container.
yum install -y dnf dnf-core-plugins
dnf install -y https://rpms.remirepo.net/enterprise/remi-release-7.rpm
find /etc/yum.repos.d/ -name "remi*.repo" | xargs sed -i "s/#baseurl/baseurl/g"
find /etc/yum.repos.d/ -name "remi*.repo" | xargs sed -i "s/mirrorlist/#mirrorlist/g"
find /etc/yum.repos.d/ -name "remi*.repo" | xargs sed -i "s@http://rpms.remirepo.net@https://mirrors.tuna.tsinghua.edu.cn/remi@g"
dnf install -y php74-php php74-php-pear php74-php-cli php74-php-pecl-zip unzip \
php74-php-gd php74-php-dba php74-php-dbg php74-php-fpm php74-php-gmp php74-php-pdo \
php74-php-xml php74-php-imap php74-php-json php74-php-devel php74-php-bcmath \
php74-php-pgsql php74-php-sodium php74-php-xhprof php74-php-mysqlnd php74-php-process \
php74-php-mbstring php74-php-pecl-amqp php74-php-pecl-yaml php74-php-pecl-geoip \
php74-php-pecl-xdebug php74-php-pecl-mongodb php74-php-pecl-msgpack php74-php-pecl-memcached \
php74-php-pecl-imagick php74-php-mcrypt php74-php-pecl-swoole4 php74-php-pecl-inotify \
php74-php-intl php74-php-pecl-igbinary php74-php-pecl-lzf php74-php-zstd php74-php-pecl-leveldb \
php74-php-pecl-redis5 php74-php-phpiredis
dnf install -y php73-php php73-php-pear php73-php-cli php73-php-pecl-zip unzip \
php73-php-gd php73-php-dba php73-php-dbg php73-php-fpm php73-php-gmp php73-php-pdo \
php73-php-xml php73-php-imap php73-php-json php73-php-devel php73-php-bcmath \
php73-php-pgsql php73-php-sodium php73-php-xhprof php73-php-mysqlnd php73-php-process \
php73-php-mbstring php73-php-pecl-amqp php73-php-pecl-yaml php73-php-pecl-geoip \
php73-php-pecl-xdebug php73-php-pecl-mongodb php73-php-pecl-msgpack php73-php-pecl-memcached \
php73-php-pecl-imagick php73-php-pecl-mcrypt php73-php-pecl-swoole4 php73-php-pecl-inotify \
php73-php-intl php73-php-pecl-igbinary php73-php-pecl-lzf php73-php-zstd php73-php-pecl-leveldb \
php73-php-pecl-redis5 php73-php-phpiredis
dnf install -y php71-php php71-php-pear php71-php-cli php71-php-pecl-zip unzip \
php71-php-gd php71-php-dba php71-php-dbg php71-php-fpm php71-php-gmp php71-php-pdo \
php71-php-xml php71-php-imap php71-php-json php71-php-devel php71-php-bcmath \
php71-php-pgsql php71-php-sodium php71-php-xhprof php71-php-mysqlnd php71-php-process \
php71-php-mbstring php71-php-pecl-amqp php71-php-pecl-yaml php71-php-pecl-geoip \
php71-php-pecl-xdebug php71-php-pecl-mongodb php71-php-pecl-msgpack php71-php-pecl-memcached \
php71-php-pecl-imagick php71-php-mcrypt php71-php-pecl-swoole4 php71-php-pecl-inotify \
php71-php-intl php71-php-pecl-igbinary php71-php-pecl-lzf php71-php-zstd php71-php-pecl-leveldb \
php71-php-phpiredis php71-php-pecl-redis5
mkdir -p ~/bin
curl -Lo ~/bin/composer.phar https://getcomposer.org/download/2.0.12/composer.phar
chmod +x ~/bin/composer.phar
pushd ~/bin
ln -s composer.phar composer
popd
echo 'export PATH+=:/opt/remi/php71/root/usr/bin:/opt/remi/php71/root/usr/sbin:$HOME/.config/composer/vendor/bin' >> ~/.bashrc
export PATH+=:/opt/remi/php71/root/usr/bin:/opt/remi/php71/root/usr/sbin:$HOME/.config/composer/vendor/bin
echo 'export COMPOSER_ALLOW_SUPERUSER=1' >> ~/.bashrc
export COMPOSER_ALLOW_SUPERUSER=1
composer config -g repo.packagist composer https://mirrors.aliyun.com/composer/
composer global require slince/composer-registry-manager
composer repo:ls
composer repo:use aliyun
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment