CentOS 环境搭建

LNMP

利用 lnmp.org 集成包进行快速搭建

1
2
3
4
5
6
7
8
9
10
11
$ yum -y install wget
$ wget -c http://soft.vpser.net/lnmp/lnmp1.6.tar.gz
$ tar zxf lnmp1.6.tar.gz
$ cd lnmp1.6
$ sed -i "s/PHP_Modules_Options=''/PHP_Modules_Options='redis'/" lnmp.conf
$ sed -i "s/Enable_PHP_Fileinfo='n'/Enable_PHP_Fileinfo='y'/" lnmp.conf
$ ./install.sh lnmp
$ composer config -g repo.packagist composer https://repo.huaweicloud.com/repository/php/
$ sed -i "s/,proc_open,proc_get_status//g" /usr/local/php/etc/php.ini
$ sed -i 's/date.timezone = PRC/date.timezone = Asia/Shanghai/g' /usr/local/php/etc/php.ini
$ lnmp restart

无人值守命令生成:https://lnmp.org/auto.html
更多使用方法:https://github.com/licess/lnmp

Python3

1
2
3
4
5
6
7
8
$ yum -y install zlib*
$ wget https://repo.huaweicloud.com/python/3.6.6/Python-3.6.6.tgz
$ tar zxf Python-3.6.6.tgz
$ cd Python-3.6.6
$ ./configure --prefix=/usr/local/python3
$ make
$ make install
$ ln -s /usr/local/python3/bin/python3 /usr/bin/python3

测试

1
2
3
4
5
6
7
8
# 查看版本
$ python3 -v

# 升级pip
$ pip3 install --upgrade pip

# 安装依赖
$ pip3 install requests

Node

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
$ yum -y install git
$ git clone https://github.com/nvm-sh/nvm.git .nvm
$ cd .nvm
$ git checkout v0.35.1
$ source nvm.sh
$ export NVM_NODEJS_ORG_MIRROR=https://repo.huaweicloud.com/nodejs/
$ nvm install node
$ npm config set registry https://repo.huaweicloud.com/repository/npm/
$ npm cache clean -f
$ npm config set disturl https://repo.huaweicloud.com/nodejs
$ npm config set sass_binary_site https://repo.huaweicloud.com/node-sass
$ npm config set phantomjs_cdnurl https://repo.huaweicloud.com/phantomjs
$ npm config set chromedriver_cdnurl https://repo.huaweicloud.com/chromedriver
$ npm config set operadriver_cdnurl https://repo.huaweicloud.com/operadriver
$ npm config set electron_mirror https://repo.huaweicloud.com/electron/
$ npm config set python_mirror https://repo.huaweicloud.com/python
往上