homebrew安装和解决brew安装速度慢的问题
homebrew安装
ruby -e “$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)”
解决brew安装速度慢的问题(替换homebrew镜像源)
1.替换brew.git:
cd $(brew --repo)
git remote set-url origin https://mirrors.aliyun.com/homebrew/brew.git
2.替换homebrew-core.git:
cd $(brew --repo)/Library/Taps/homebrew/homebrew-core
git remote set-url origin https://mirrors.aliyun.com/homebrew/homebrew-core.git
3.终端输入命令:
echo $SHELL 看输出结果是/bin/zsh还是/bin/bash
- /bin/zsh替换homebrew-bottles:
echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.aliyun.com/homebrew/homebrew-bottles' >> ~/.zshrc
source ~/.zshrc
- /bin/bash替换homebrew-bottles:
echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.ustc.edu.cn/homebrew-bottles' >> ~/.bash_profile
source ~/.bash_profile
4.恢复homebrew国内镜像源配置
- 重置brew.git
cd $(brew --repo)
git remote set-url origin https://github.com/Homebrew/brew.git
- 重置homebrew-core.git
cd $(brew --repo)/Library/Taps/homebrew/homebrew-core
git remote set-url origin https://github.com/Homebrew/homebrew-core.git
- 重置homebrew-bottles
将刚添加到~/.bash_profile文件的语句注释掉即可
解决brew安装包一直卡在Updating Homebrew
运行命令brew install node,结果界面一直卡在Updating Homebrew上,有两种解决办法
方法一:关闭brew每次执行命令时的自动更新(推荐)
vim ~/.bash_profile
# 新增一行
export HOMEBREW_NO_AUTO_UPDATE=true
方法二(懒人方法):
出现Updating Homebrew的时候ctrl+c一下就行
pip下载库超时Connection to files.pythonhosted.org timed out问题解决(换源)
1、国内镜像大全
阿里云 http://mirrors.aliyun.com/pypi/simple/
中国科技大学 https://pypi.mirrors.ustc.edu.cn/simple/
豆瓣(douban) http://pypi.douban.com/simple/
清华大学 https://pypi.tuna.tsinghua.edu.cn/simple/
中国科学技术大学 http://pypi.mirrors.ustc.edu.cn/simple/
2、换源命令
临时:pip命令+ -i +镜像地址。例如 pip install numpy -i https://mirrors.aliyun.com/pypi/simple/
永久:在更新到最新版本pip后,pip config set global.index-url+国内镜像地址,例如
pip config set global.index-url https://mirrors.aliyun.com/pypi/simple/
ubuntu编译安装php7
https://www.php.net/downloads.php
下载php7源码解压
下载 https://github.com/kkos/oniguruma 源码编译安装或者不使用mbstring的正则功能,即在“--enable-mbstring”后再添加“--disable-mbregex”参数。这样的配置将不再需要oniguruma库
./configure \
--prefix=/usr/local/php7 \
--exec-prefix=/usr/local/php7 \
--bindir=/usr/local/php7/bin \
--sbindir=/usr/local/php7/sbin \
--includedir=/usr/local/php7/include \
--libdir=/usr/local/php7/lib/php \
--mandir=/usr/local/php7/php/man \
--with-zip \
--enable-pdo \
--enable-inline-optimization \
--enable-shared \
--enable-xml \
--enable-bcmath \
--enable-shmop \
--enable-sysvsem \
--enable-mbregex \
--enable-mbstring \
--enable-ftp \
--enable-pcntl \
--enable-sockets \
--enable-fileinfo \
--enable-filter \
--enable-soap \
--enable-session \
--enable-opcache \
--enable-fpm \
--disable-debug \
--disable-rpath \
--with-config-file-path=/usr/local/php7/etc \
--with-mysql-sock=/var/run/mysql/mysql.sock \
--with-mhash \
--with-openssl \
--with-mysqli=mysqlnd \
--with-pdo-mysql=mysqlnd \
--enable-gd \
--with-iconv \
--with-zlib \
--with-xmlrpc \
--with-gettext \
--with-curl \
--with-fpm-user=php \
--with-fpm-group=php \
--with-pear=/usr/local/php7/bin
sudo make && make install
将/usr/local/php7加入环境变量
增加php-fpm命令:
sudo cp sapi/fpm/init.d.php-fpm /usr/local/php7/bin/php-fpm
sudo chmod +x /usr/local/php7/bin/php-fpm
初始化 PHP 和 PHP-FPM 的配置
sudo cp php.ini-production /usr/local/php7/etc/php.ini
sudo cp /usr/local/php7/etc/php-fpm.conf.default /usr/local/php7/etc/php-fpm.conf
将PHP-FPM加入系统服务
cp sapi/fpm/php-fpm.service /etc/systemd/system/
chmod +x /etc/systemd/system/php-fpm.service
设置开机自启以及开启服务:
systemctl enable php-fpm.service
systemctl start php-fpm.service